comp / ent refactor

beta.r3js.org
Theunis J. Botha 2016-11-29 11:26:16 +01:00
parent 50a3abf1ae
commit daf6624854
3 changed files with 20 additions and 18 deletions

View File

@ -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];
// }

View File

@ -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;

View File

@ -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() {