fixes
parent
49eafef601
commit
68a8eef4bb
|
@ -57,13 +57,24 @@ GameLib.Component.prototype.getDependencies = function() {
|
||||||
var dependencies = [];
|
var dependencies = [];
|
||||||
|
|
||||||
for (var property in this.linkedObjects) {
|
for (var property in this.linkedObjects) {
|
||||||
|
//TODO array linked objects
|
||||||
if (this.linkedObjects.hasOwnProperty(property)){
|
if (this.linkedObjects.hasOwnProperty(property)){
|
||||||
if (
|
if (this.hasOwnProperty(property)) {
|
||||||
this.hasOwnProperty(property) &&
|
|
||||||
typeof this[property] === 'string'
|
if (typeof this[property] === 'string') {
|
||||||
) {
|
dependencies.push(this[property]);
|
||||||
dependencies.push(this[property]);
|
}
|
||||||
|
|
||||||
|
if (this[property] instanceof Array) {
|
||||||
|
this[property].map(function(arrayProperty){
|
||||||
|
if (typeof arrayProperty === 'string') {
|
||||||
|
dependencies.push(arrayProperty);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +99,7 @@ GameLib.Component.COMPONENT_COMPOSER = 0xb;
|
||||||
GameLib.Component.COMPONENT_RENDER_TARGET = 0xc;
|
GameLib.Component.COMPONENT_RENDER_TARGET = 0xc;
|
||||||
GameLib.Component.COMPONENT_PASS = 0xd;
|
GameLib.Component.COMPONENT_PASS = 0xd;
|
||||||
GameLib.Component.COMPONENT_SCENE = 0xe;
|
GameLib.Component.COMPONENT_SCENE = 0xe;
|
||||||
GameLib.Component.COMPONENT_GAME = 0xf;
|
GameLib.Component.COMPONENT_RAYCASTER = 0xf;
|
||||||
GameLib.Component.COMPONENT_INPUT_EDITOR = 0x10;
|
GameLib.Component.COMPONENT_INPUT_EDITOR = 0x10;
|
||||||
GameLib.Component.COMPONENT_EDITOR = 0x11;
|
GameLib.Component.COMPONENT_EDITOR = 0x11;
|
||||||
GameLib.Component.COMPONENT_VIEWPORT = 0x12;
|
GameLib.Component.COMPONENT_VIEWPORT = 0x12;
|
||||||
|
@ -129,7 +140,7 @@ GameLib.Component.GetComponentName = function(number) {
|
||||||
case 0xc : return 'GameLib.D3.RenderTarget';
|
case 0xc : return 'GameLib.D3.RenderTarget';
|
||||||
case 0xd : return 'GameLib.D3.Pass';
|
case 0xd : return 'GameLib.D3.Pass';
|
||||||
case 0xe : return 'GameLib.D3.Scene';
|
case 0xe : return 'GameLib.D3.Scene';
|
||||||
case 0xf : return 'GameLib.D3.Game';
|
case 0xf : return 'GameLib.D3.Raycaster';
|
||||||
case 0x10 : return 'GameLib.D3.InputEditor';
|
case 0x10 : return 'GameLib.D3.InputEditor';
|
||||||
case 0x11 : return 'GameLib.D3.Editor';
|
case 0x11 : return 'GameLib.D3.Editor';
|
||||||
case 0x12 : return 'GameLib.D3.Viewport';
|
case 0x12 : return 'GameLib.D3.Viewport';
|
||||||
|
|
|
@ -16,14 +16,6 @@ GameLib.D3.API.Image = function(
|
||||||
size,
|
size,
|
||||||
parentEntity
|
parentEntity
|
||||||
) {
|
) {
|
||||||
|
|
||||||
GameLib.Component.call(
|
|
||||||
this,
|
|
||||||
GameLib.Component.COMPONENT_IMAGE,
|
|
||||||
null,
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||||
id = GameLib.Utils.RandomId();
|
id = GameLib.Utils.RandomId();
|
||||||
}
|
}
|
||||||
|
@ -57,10 +49,15 @@ GameLib.D3.API.Image = function(
|
||||||
}
|
}
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(size)) {
|
if (GameLib.Utils.UndefinedOrNull(size)) {
|
||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||||
|
parentEntity = null;
|
||||||
|
}
|
||||||
|
this.parentEntity = parentEntity;
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Image.prototype = Object.create(GameLib.Component.prototype);
|
GameLib.D3.API.Image.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
|
|
@ -34,6 +34,9 @@ GameLib.D3.API.Raycaster = function(
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Raycaster.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
GameLib.D3.API.Raycaster.prototype.constructor = GameLib.D3.API.Raycaster;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an API raycaster from an Object raycaster
|
* Returns an API raycaster from an Object raycaster
|
||||||
* @param objectRaycaster
|
* @param objectRaycaster
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* @param name
|
* @param name
|
||||||
* @param object
|
* @param object
|
||||||
* @param helperType
|
* @param helperType
|
||||||
|
* @param parentEntity
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Helper = function(
|
GameLib.D3.Helper = function(
|
||||||
|
@ -12,16 +13,12 @@ GameLib.D3.Helper = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
object,
|
object,
|
||||||
helperType
|
helperType,
|
||||||
|
parentEntity
|
||||||
) {
|
) {
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
GameLib.Component.call(
|
|
||||||
this,
|
|
||||||
GameLib.Component.COMPONENT_HELPER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||||
id = GameLib.Utils.RandomId();
|
id = GameLib.Utils.RandomId();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +66,15 @@ GameLib.D3.Helper = function(
|
||||||
}
|
}
|
||||||
this.helperType = helperType;
|
this.helperType = helperType;
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||||
|
parentEntity = null;
|
||||||
|
}
|
||||||
|
this.parentEntity = parentEntity;
|
||||||
|
|
||||||
|
GameLib.Component.call(
|
||||||
|
this,
|
||||||
|
GameLib.Component.COMPONENT_HELPER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Helper.prototype = Object.create(GameLib.Component.prototype);
|
GameLib.D3.Helper.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
@ -98,12 +103,12 @@ GameLib.D3.Helper.prototype.createInstance = function(update) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var instance = null;
|
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
instance = this.instance;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var instance = null;
|
||||||
|
|
||||||
if (this.helperType === GameLib.D3.Helper.HELPER_TYPE_EDGES) {
|
if (this.helperType === GameLib.D3.Helper.HELPER_TYPE_EDGES) {
|
||||||
instance = new THREE.EdgesHelper(this.object.instance, 0x00FF00);
|
instance = new THREE.EdgesHelper(this.object.instance, 0x00FF00);
|
||||||
}
|
}
|
||||||
|
@ -135,5 +140,5 @@ GameLib.D3.Helper.prototype.createInstance = function(update) {
|
||||||
* Updates the instance with the current state
|
* Updates the instance with the current state
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Helper.prototype.updateInstance = function() {
|
GameLib.D3.Helper.prototype.updateInstance = function() {
|
||||||
this.instance = this.createInstance(true);
|
this.createInstance(true);
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,10 @@ GameLib.D3.Image = function(
|
||||||
apiImage.parentEntity
|
apiImage.parentEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
GameLib.Component.call(
|
||||||
|
this,
|
||||||
|
GameLib.Component.COMPONENT_IMAGE
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Image.prototype = Object.create(GameLib.D3.API.Image.prototype);
|
GameLib.D3.Image.prototype = Object.create(GameLib.D3.API.Image.prototype);
|
||||||
|
|
|
@ -239,8 +239,6 @@ GameLib.D3.Material = function(
|
||||||
'specularMap' : GameLib.D3.Texture
|
'specularMap' : GameLib.D3.Texture
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.updateTextures();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Material.prototype = Object.create(GameLib.D3.API.Material.prototype);
|
GameLib.D3.Material.prototype = Object.create(GameLib.D3.API.Material.prototype);
|
||||||
|
@ -919,6 +917,10 @@ GameLib.D3.Material.prototype.createInstance = function(update) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.instance = instance;
|
||||||
|
|
||||||
|
this.updateTextures();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,10 @@ GameLib.D3.Raycaster = function(
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
GameLib.Component.call(
|
||||||
|
this,
|
||||||
|
GameLib.Component.COMPONENT_RAYCASTER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Raycaster.prototype = Object.create(GameLib.D3.API.Raycaster.prototype);
|
GameLib.D3.Raycaster.prototype = Object.create(GameLib.D3.API.Raycaster.prototype);
|
||||||
|
|
|
@ -325,9 +325,14 @@ GameLib.D3.Scene.prototype.addObject = function(object) {
|
||||||
|
|
||||||
object.parentScene = this;
|
object.parentScene = this;
|
||||||
|
|
||||||
this.instance.add(object.instance);
|
if (this.instance) {
|
||||||
|
this.instance.add(object.instance);
|
||||||
|
}
|
||||||
|
|
||||||
this.buildIdToObject();
|
|
||||||
|
// this.instance.add(object.instance);
|
||||||
|
//
|
||||||
|
// this.buildIdToObject();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -353,11 +358,13 @@ GameLib.D3.Scene.prototype.removeObject = function(object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instance.remove(object.instance);
|
if (this.instance) {
|
||||||
|
this.instance.remove(object.instance);
|
||||||
|
}
|
||||||
|
|
||||||
if (object.parentScene === this) {
|
if (object.parentScene === this) {
|
||||||
object.parentScene = null;
|
object.parentScene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buildIdToObject();
|
// this.buildIdToObject();
|
||||||
};
|
};
|
Loading…
Reference in New Issue