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; cross = false;
} }
if (typeof object == 'number') { if (typeof object === 'number') {
if (cross) { if (cross) {
this.x *= object; this.x *= object;

View File

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

View File

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