diff --git a/src/game-lib-entity.js b/src/game-lib-entity.js index d1b3b2d..3509642 100644 --- a/src/game-lib-entity.js +++ b/src/game-lib-entity.js @@ -132,9 +132,9 @@ GameLib.D3.Entity.prototype.register = function( parentScene ) { // this.parentScene = parentScene; - - // if (this.id != null && parentScene.meshIdToMesh[this.id]) { - // parentScene.instance.add(parentScene.meshIdToMesh[this.id]); + // + // if (this.mesh && this.mesh.id != null && parentScene.meshIdToMesh[this.mesh.id]) { + // parentScene.instance.add(parentScene.meshIdToMesh[this.mesh.id]); // this.mesh = parentScene.meshIdToMesh[this.id]; // } diff --git a/src/game-lib-scene.js b/src/game-lib-scene.js index 1c93159..9274614 100644 --- a/src/game-lib-scene.js +++ b/src/game-lib-scene.js @@ -97,58 +97,58 @@ GameLib.D3.Scene.API = function( name = 'unnamed'; } this.name = name; - - if (typeof meshes == 'undefined') { + + if (GameLib.D3.Utils.UndefinedOrNull(meshes)) { meshes = []; } this.meshes = meshes; - if (typeof quaternion == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(quaternion)) { quaternion = new GameLib.D3.Vector4(); } this.quaternion = quaternion; - if (typeof position == 'undefined') { - position = new GameLib.D3.Vector3(0,0,0); + if (GameLib.D3.Utils.UndefinedOrNull(position)) { + position = new GameLib.D3.Vector3(); } this.position = position; - if (typeof rotation == 'undefined') { - rotation = new GameLib.D3.Vector3(0,0,0); + if (GameLib.D3.Utils.UndefinedOrNull(rotation)) { + rotation = new GameLib.D3.Vector3(); } this.rotation = rotation; - if (typeof scale == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(scale)) { scale = new GameLib.D3.Vector3(1,1,1); } this.scale = scale; - if (typeof parentSceneId == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(parentSceneId)) { parentSceneId = null; } this.parentSceneId = parentSceneId; - if (typeof lights == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(lights)) { lights = []; } this.lights = lights; - if (typeof worlds == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(worlds)) { worlds = []; } this.worlds = worlds; - if (typeof entities == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(entities)) { entities = []; } this.entities = entities; - if (typeof components == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(components)) { components = []; } this.components = components; - if (typeof shapes == 'undefined') { + if (GameLib.D3.Utils.UndefinedOrNull(shapes)) { shapes = []; } this.shapes = shapes; diff --git a/src/game-lib-vector-3.js b/src/game-lib-vector-3.js index 40399d5..1fa1fa1 100644 --- a/src/game-lib-vector-3.js +++ b/src/game-lib-vector-3.js @@ -19,6 +19,8 @@ GameLib.D3.Vector3.Runtime = function RuntimeVector3(graphics, parentObject, api } } + GameLib.D3.Utils.Extend(GameLib.D3.Vector3.Runtime, GameLib.D3.Vector3); + this.apiVector = apiVector; this.graphics = graphics; @@ -33,7 +35,7 @@ GameLib.D3.Vector3.Runtime = function RuntimeVector3(graphics, parentObject, api }; GameLib.D3.Vector3.Runtime.prototype.createInstance = function() { - return this.graphics.instance.Vector3(this.x, this.y, this.z); + return new this.graphics.instance.Vector3(this.x, this.y, this.z); }; GameLib.D3.Vector3.Runtime.prototype.updateInstance = function() {