sort objects

beta.r3js.org
-=yb4f310 2017-11-03 11:55:20 +01:00
parent 4e82b8dd53
commit e2a1aebc1e
3 changed files with 14 additions and 1 deletions

View File

@ -150,7 +150,7 @@ GameLib.API.Vector3.prototype.multiply = function (object, cross) {
cross = false;
}
if (typeof object == 'number') {
if (typeof object === 'number') {
if (cross) {
this.x *= object;

View File

@ -38,6 +38,7 @@ GameLib.D3.API.Renderer = function (
bufferCamera,
renderTarget,
defaultScene,
sortObjects,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
@ -129,6 +130,11 @@ GameLib.D3.API.Renderer = function (
}
this.defaultScene = defaultScene;
if (GameLib.Utils.UndefinedOrNull(sortObjects)) {
sortObjects = true;
}
this.sortObjects = sortObjects;
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
@ -163,6 +169,7 @@ GameLib.D3.API.Renderer.FromObject = function(objectComponent) {
objectComponent.bufferCamera,
objectComponent.renderTarget,
objectComponent.defaultScene,
objectComponent.sortObjects,
objectComponent.parentEntity
);
};

View File

@ -39,6 +39,7 @@ GameLib.D3.Renderer = function (
apiRenderer.bufferCamera,
apiRenderer.renderTarget,
apiRenderer.defaultScene,
apiRenderer.sortObjects,
apiRenderer.parentEntity
);
@ -199,6 +200,8 @@ GameLib.D3.Renderer.prototype.createInstance = function() {
this.instance.autoClear = this.autoClear;
this.instance.preserveDrawingBuffer = this.preserveDrawingBuffer;
this.instance.sortObjects = this.sortObjects;
GameLib.Component.prototype.createInstance.call(this);
};
@ -253,6 +256,8 @@ GameLib.D3.Renderer.prototype.updateInstance = function() {
} else {
this.instance.clippingPlanes = [];
}
this.instance.sortObjects = this.sortObjects;
};
/**
@ -287,6 +292,7 @@ GameLib.D3.Renderer.prototype.toApiObject = function() {
GameLib.Utils.IdOrNull(this.bufferCamera),
GameLib.Utils.IdOrNull(this.renderTarget),
GameLib.Utils.IdOrNull(this.defaultScene),
this.sortObjects,
GameLib.Utils.IdOrNull(this.parentEntity)
);