materials and textures stuff needs updates

beta.r3js.org
Theunis J. Botha 2017-01-31 11:38:47 +01:00
parent 6e3270508e
commit 4071abc0c6
9 changed files with 337 additions and 171 deletions

View File

@ -202,16 +202,18 @@ GameLib.API.Quaternion.prototype.slerp = function (quaternion, t) {
* @constructor * @constructor
*/ */
GameLib.API.Quaternion.FromObjectQuaternion = function (objectQuaternion) { GameLib.API.Quaternion.FromObjectQuaternion = function (objectQuaternion) {
var apiAxis = null;
if (objectQuaternion.axis) {
apiAxis = GameLib.API.Vector3.FromObjectVector(objectQuaternion.axis);
}
return new GameLib.API.Quaternion( return new GameLib.API.Quaternion(
objectQuaternion.x, objectQuaternion.x,
objectQuaternion.y, objectQuaternion.y,
objectQuaternion.z, objectQuaternion.z,
objectQuaternion.w, objectQuaternion.w,
new GameLib.API.Vector3( apiAxis,
objectQuaternion.axis.x,
objectQuaternion.axis.y,
objectQuaternion.axis.z
),
objectQuaternion.angle objectQuaternion.angle
) )
}; };

View File

@ -528,51 +528,51 @@ GameLib.D3.API.Material.FromObjectMaterial = function(objectMaterial) {
var apiSpecularMap = null; var apiSpecularMap = null;
if (objectMaterial.alphaMap) { if (objectMaterial.alphaMap) {
apiAlphaMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.alphaMap); apiAlphaMap = objectMaterial.alphaMap;
} }
if (objectMaterial.aoMap) { if (objectMaterial.aoMap) {
apiAoMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.aoMap); apiAoMap = objectMaterial.aoMap;
} }
if (objectMaterial.bumpMap) { if (objectMaterial.bumpMap) {
apiBumpMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.bumpMap); apiBumpMap = objectMaterial.bumpMap;
} }
if (objectMaterial.diffuseMap) { if (objectMaterial.diffuseMap) {
apiDiffuseMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.diffuseMap); apiDiffuseMap = objectMaterial.diffuseMap;
} }
if (objectMaterial.displacementMap) { if (objectMaterial.displacementMap) {
apiDisplacementMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.displacementMap); apiDisplacementMap = objectMaterial.displacementMap;
} }
if (objectMaterial.emissiveMap) { if (objectMaterial.emissiveMap) {
apiEmissiveMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.emissiveMap); apiEmissiveMap = objectMaterial.emissiveMap;
} }
if (objectMaterial.environmentMap) { if (objectMaterial.environmentMap) {
apiEnvironmentMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.environmentMap); apiEnvironmentMap = objectMaterial.environmentMap;
} }
if (objectMaterial.lightMap) { if (objectMaterial.lightMap) {
apiLightMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.lightMap); apiLightMap = objectMaterial.lightMap;
} }
if (objectMaterial.metalnessMap) { if (objectMaterial.metalnessMap) {
apiMetalnessMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.metalnessMap); apiMetalnessMap = objectMaterial.metalnessMap;
} }
if (objectMaterial.normalMap) { if (objectMaterial.normalMap) {
apiNormalMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.normalMap); apiNormalMap = objectMaterial.normalMap;
} }
if (objectMaterial.roughnessMap) { if (objectMaterial.roughnessMap) {
apiRoughnessMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.roughnessMap); apiRoughnessMap = objectMaterial.roughnessMap;
} }
if (objectMaterial.specularMap) { if (objectMaterial.specularMap) {
apiSpecularMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.specularMap); apiSpecularMap = objectMaterial.specularMap;
} }
return new GameLib.D3.API.Material( return new GameLib.D3.API.Material(

View File

@ -53,7 +53,8 @@ GameLib.D3.API.Mesh = function(
GameLib.Component.COMPONENT_MESH, GameLib.Component.COMPONENT_MESH,
{ {
'parentMesh' : GameLib.D3.Mesh, 'parentMesh' : GameLib.D3.Mesh,
'parentScene' : GameLib.D3.Scene 'parentScene' : GameLib.D3.Scene,
'materials' : [GameLib.D3.Material]
}, },
null, null,
parentEntity parentEntity
@ -176,11 +177,51 @@ GameLib.D3.API.Mesh.prototype.constructor = GameLib.D3.API.Mesh;
GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){ GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){
var apiSkeleton = null; var apiSkeleton = null;
var apiPosition = null;
var apiQuaternion = null;
var apiScale = null;
var apiLocalPosition = null;
var apiLocalRotation = null;
var apiLocalScale = null;
var apiUp = null;
var apiModelMatrix = null;
if (objectMesh.skeleton) { if (objectMesh.skeleton) {
apiSkeleton = GameLib.D3.API.Skeleton.FromObjectSkeleton(objectMesh.skeleton); apiSkeleton = GameLib.D3.API.Skeleton.FromObjectSkeleton(objectMesh.skeleton);
} }
if (objectMesh.position) {
apiPosition = GameLib.API.Vector3.FromObjectVector(objectMesh.position);
}
if (objectMesh.quaternion) {
apiQuaternion = GameLib.API.Quaternion.FromObjectQuaternion(objectMesh.quaternion);
}
if (objectMesh.scale) {
apiScale = GameLib.API.Vector3.FromObjectVector(objectMesh.scale);
}
if (objectMesh.localPosition) {
apiLocalPosition = GameLib.API.Vector3.FromObjectVector(objectMesh.localPosition);
}
if (objectMesh.localRotation) {
apiLocalRotation = GameLib.API.Vector3.FromObjectVector(objectMesh.localRotation);
}
if (objectMesh.localScale) {
apiLocalScale = GameLib.API.Vector3.FromObjectVector(objectMesh.localScale);
}
if (objectMesh.up) {
apiUp = GameLib.API.Vector3.FromObjectVector(objectMesh.up);
}
if (objectMesh.modelMatrix) {
apiModelMatrix = GameLib.API.Matrix4.FromObjectMatrix(objectMesh.modelMatrix);
}
return new GameLib.D3.API.Mesh( return new GameLib.D3.API.Mesh(
objectMesh.id, objectMesh.id,
objectMesh.meshType, objectMesh.meshType,
@ -192,24 +233,20 @@ GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){
), ),
objectMesh.faces, objectMesh.faces,
objectMesh.faceVertexUvs, objectMesh.faceVertexUvs,
objectMesh.materials.map( objectMesh.materials,
function (objectMaterial) {
return GameLib.D3.API.Material.FromObjectMaterial(objectMaterial);
}
),
objectMesh.parentMesh, objectMesh.parentMesh,
objectMesh.parentScene, objectMesh.parentScene,
apiSkeleton, apiSkeleton,
objectMesh.skinIndices, objectMesh.skinIndices,
objectMesh.skinWeights, objectMesh.skinWeights,
GameLib.API.Vector3.FromObjectVector(objectMesh.position), apiPosition,
GameLib.API.Quaternion.FromObjectQuaternion(objectMesh.quaternion), apiQuaternion,
GameLib.API.Vector3.FromObjectVector(objectMesh.scale), apiScale,
GameLib.API.Vector3.FromObjectVector(objectMesh.localPosition), apiLocalPosition,
GameLib.API.Vector3.FromObjectVector(objectMesh.localRotation), apiLocalRotation,
GameLib.API.Vector3.FromObjectVector(objectMesh.localScale), apiLocalScale,
GameLib.API.Vector3.FromObjectVector(objectMesh.up), apiUp,
GameLib.API.Matrix4.FromObjectMatrix(objectMesh.modelMatrix), apiModelMatrix,
objectMesh.parentEntity, objectMesh.parentEntity,
objectMesh.renderOrder objectMesh.renderOrder
); );

View File

@ -32,7 +32,8 @@ GameLib.D3.API.Scene = function(
shapes, shapes,
cameras, cameras,
activeCameraIndex, activeCameraIndex,
textures textures,
materials
) { ) {
if (GameLib.Utils.UndefinedOrNull(id)) { if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId(); id = GameLib.Utils.RandomId();
@ -108,6 +109,11 @@ GameLib.D3.API.Scene = function(
textures = []; textures = [];
} }
this.textures = textures; this.textures = textures;
if (GameLib.Utils.UndefinedOrNull(materials)) {
materials = [];
}
this.materials = materials;
}; };
/** /**
@ -118,8 +124,15 @@ GameLib.D3.API.Scene = function(
GameLib.D3.API.Scene.FromObjectScene = function(objectScene) { GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
var apiEntityManager = null; var apiEntityManager = null;
var apiPosition = null;
var apiQuaternion = null;
var apiScale = null;
var apiTextures = null; var apiTextures = [];
var apiMaterials = [];
var apiMeshes = [];
var apiLights = [];
var apiCameras = [];
if (objectScene.entityManager) { if (objectScene.entityManager) {
apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectScene.entityManager); apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectScene.entityManager);
@ -133,34 +146,67 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
) )
} }
if (objectScene.materials) {
apiMaterials = objectScene.materials.map(
function(objectMaterial) {
return GameLib.D3.API.Material.FromObjectMaterial(objectMaterial)
}
)
}
if (objectScene.meshes) {
apiMeshes = objectScene.meshes.map(
function(objectMesh) {
return GameLib.D3.API.Mesh.FromObjectMesh(objectMesh);
}
)
}
if (objectScene.lights) {
apiLights = objectScene.lights.map(
function(objectLight) {
return GameLib.D3.API.Light.FromObjectLight(objectLight);
}
)
}
if (objectScene.cameras) {
apiCameras = objectScene.cameras.map(
function(objectCamera) {
return GameLib.D3.API.Camera.FromObjectCamera(objectCamera);
}
)
}
if (objectScene.position) {
apiPosition = GameLib.API.Vector3.FromObjectVector(objectScene.position);
}
if (objectScene.quaternion) {
apiQuaternion = GameLib.API.Quaternion.FromObjectQuaternion(objectScene.quaternion);
}
if (objectScene.scale) {
apiScale = GameLib.API.Vector3.FromObjectVector(objectScene.scale);
}
return new GameLib.D3.API.Scene( return new GameLib.D3.API.Scene(
objectScene.id, objectScene.id,
objectScene.path, objectScene.path,
objectScene.name, objectScene.name,
objectScene.meshes.map( apiMeshes,
function (objectMesh) { apiPosition,
return GameLib.D3.API.Mesh.FromObjectMesh(objectMesh) apiQuaternion,
} apiScale,
),
GameLib.API.Vector3.FromObjectVector(objectScene.position),
GameLib.API.Quaternion.FromObjectQuaternion(objectScene.quaternion),
GameLib.API.Vector3.FromObjectVector(objectScene.scale),
objectScene.parentSceneId, objectScene.parentSceneId,
objectScene.lights.map( apiLights,
function (objectLight) {
return GameLib.D3.API.Light.FromObjectLight(objectLight)
}
),
[], //TODO : implement worlds here [], //TODO : implement worlds here
apiEntityManager, apiEntityManager,
[], //TODO : implement shapes here [], //TODO : implement shapes here
objectScene.cameras.map( apiCameras,
function (objectCamera) {
return GameLib.D3.API.Camera.FromObjectCamera(objectCamera);
}
),
objectScene.activeCameraIndex, objectScene.activeCameraIndex,
apiTextures apiTextures,
apiMaterials
); );
}; };

View File

@ -83,6 +83,7 @@ GameLib.D3.Light.LIGHT_TYPE_SPOT = 0x4;
*/ */
GameLib.D3.Light.prototype.createInstance = function(update) { GameLib.D3.Light.prototype.createInstance = function(update) {
var instance = null; var instance = null;
if (update) { if (update) {
@ -91,22 +92,31 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
if (!instance) { if (!instance) {
if (this.lightType == GameLib.D3.Light.LIGHT_TYPE_AMBIENT) { if (
instance = new this.graphics.instance.AmbientLight( this.lightType == GameLib.D3.Light.LIGHT_TYPE_AMBIENT ||
this.lightType == 'AmbientLight'
) {
instance = new THREE.AmbientLight(
this.color.instance, this.color.instance,
this.intensity this.intensity
); );
} }
if (this.lightType == GameLib.D3.Light.LIGHT_TYPE_DIRECTIONAL) { if (
instance = new this.graphics.instance.DirectionalLight( this.lightType == GameLib.D3.Light.LIGHT_TYPE_DIRECTIONAL ||
this.lightType == 'DirectionalLight'
) {
instance = new THREE.DirectionalLight(
this.color.instance, this.color.instance,
this.intensity this.intensity
); );
} }
if (this.lightType == GameLib.D3.Light.LIGHT_TYPE_POINT) { if (
instance = new this.graphics.instance.PointLight( this.lightType == GameLib.D3.Light.LIGHT_TYPE_POINT ||
this.lightType == 'PointLight'
) {
instance = new THREE.PointLight(
this.color.instance, this.color.instance,
this.intensity this.intensity
); );
@ -114,8 +124,11 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
instance.decay = this.decay; instance.decay = this.decay;
} }
if (this.lightType == GameLib.D3.Light.LIGHT_TYPE_SPOT ) { if (
instance = new this.graphics.instance.SpotLight( this.lightType == GameLib.D3.Light.LIGHT_TYPE_SPOT ||
this.lightType == 'SpotLight'
) {
instance = new THREE.SpotLight(
this.color.instance, this.color.instance,
this.intensity this.intensity
); );

View File

@ -108,123 +108,159 @@ GameLib.D3.Material = function Material(
); );
if (this.alphaMap) { if (this.alphaMap) {
if (this.alphaMap instanceof GameLib.D3.API.Texture) {
this.alphaMap = new GameLib.D3.Texture( this.alphaMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.alphaMap, this.alphaMap,
this, this.imageFactory
'alphaMap',
imageFactory
); );
} else {
console.warn('this.alphaMap is not an instance of API.Texture');
// throw new Error('this.alphaMap is not an instance of API.Texture');
}
} }
if (this.aoMap) { if (this.aoMap) {
if (this.aoMap instanceof GameLib.D3.API.Texture) {
this.aoMap = new GameLib.D3.Texture( this.aoMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.aoMap, this.aoMap,
this, this.imageFactory
'aoMap',
imageFactory
); );
} else {
console.warn('this.aoMap is not an instance of API.Texture');
// throw new Error('this.aoMap is not an instance of API.Texture');
}
} }
if (this.bumpMap) { if (this.bumpMap) {
if (this.bumpMap instanceof GameLib.D3.API.Texture) {
this.bumpMap = new GameLib.D3.Texture( this.bumpMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.bumpMap, this.bumpMap,
this, this.imageFactory
'bumpMap',
imageFactory
); );
} else {
console.warn('this.bumpMap is not an instance of API.Texture');
// throw new Error('this.bumpMap is not an instance of API.Texture');
}
} }
if (this.diffuseMap) { if (this.diffuseMap) {
if (this.diffuseMap instanceof GameLib.D3.API.Texture) {
this.diffuseMap = new GameLib.D3.Texture( this.diffuseMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.diffuseMap, this.diffuseMap,
this, this.imageFactory
'map',
imageFactory
); );
} else {
console.warn('this.diffuseMap is not an instance of API.Texture');
// throw new Error('this.diffuseMap is not an instance of API.Texture');
}
} }
if (this.displacementMap) { if (this.displacementMap) {
if (this.displacementMap instanceof GameLib.D3.API.Texture) {
this.displacementMap = new GameLib.D3.Texture( this.displacementMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.displacementMap, this.displacementMap,
this, this.imageFactory
'displacementMap',
imageFactory
); );
} else {
console.warn('this.displacementMap is not an instance of API.Texture');
// throw new Error('this.displacementMap is not an instance of API.Texture');
}
} }
if (this.emissiveMap) { if (this.emissiveMap) {
if (this.emissiveMap instanceof GameLib.D3.API.Texture) {
this.emissiveMap = new GameLib.D3.Texture( this.emissiveMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.emissiveMap, this.emissiveMap,
this, this.imageFactory
'emissiveMap',
imageFactory
); );
} else {
console.warn('this.emissiveMap is not an instance of API.Texture');
// throw new Error('this.emissiveMap is not an instance of API.Texture');
}
} }
if (this.environmentMap) { if (this.environmentMap) {
if (this.environmentMap instanceof GameLib.D3.API.Texture) {
this.environmentMap = new GameLib.D3.Texture( this.environmentMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.environmentMap, this.environmentMap,
this, this.imageFactory
'envMap',
imageFactory
); );
} else {
console.warn('this.environmentMap is not an instance of API.Texture');
// throw new Error('this.environmentMap is not an instance of API.Texture');
}
} }
if (this.lightMap) { if (this.lightMap) {
if (this.lightMap instanceof GameLib.D3.API.Texture) {
this.lightMap = new GameLib.D3.Texture( this.lightMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.lightMap, this.lightMap,
this, this.imageFactory
'lightMap',
imageFactory
); );
} else {
console.warn('this.lightMap is not an instance of API.Texture');
// throw new Error('this.lightMap is not an instance of API.Texture');
}
} }
if (this.metalnessMap) { if (this.metalnessMap) {
if (this.metalnessMap instanceof GameLib.D3.API.Texture) {
this.metalnessMap = new GameLib.D3.Texture( this.metalnessMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.metalnessMap, this.metalnessMap,
this, this.imageFactory
'metalnessMap',
imageFactory
); );
} else {
console.warn('this.metalnessMap is not an instance of API.Texture');
// throw new Error('this.metalnessMap is not an instance of API.Texture');
}
} }
if (this.normalMap) { if (this.normalMap) {
if (this.normalMap instanceof GameLib.D3.API.Texture) {
this.normalMap = new GameLib.D3.Texture( this.normalMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.normalMap, this.normalMap,
this, this.imageFactory
'normalMap',
imageFactory
); );
} else {
console.warn('this.normalMap is not an instance of API.Texture');
// throw new Error('this.normalMap is not an instance of API.Texture');
}
} }
if (this.roughnessMap) { if (this.roughnessMap) {
if (this.roughnessMap instanceof GameLib.D3.API.Texture) {
this.roughnessMap = new GameLib.D3.Texture( this.roughnessMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.roughnessMap, this.roughnessMap,
this, this.imageFactory
'roughnessMap',
imageFactory
); );
} else {
console.warn('this.roughnessMap is not an instance of API.Texture');
// throw new Error('this.roughnessMap is not an instance of API.Texture');
}
} }
if (this.specularMap) { if (this.specularMap) {
if (this.specularMap instanceof GameLib.D3.API.Texture) {
this.specularMap = new GameLib.D3.Texture( this.specularMap = new GameLib.D3.Texture(
this.graphics, this.graphics,
this.specularMap, this.specularMap,
this, this.imageFactory
'specularMap',
imageFactory
); );
} else {
console.warn('this.specularMap is not an instance of API.Texture');
// throw new Error('this.specularMap is not an instance of API.Texture');
}
} }
this.instance = this.createInstance(); this.instance = this.createInstance();

View File

@ -41,15 +41,15 @@ GameLib.D3.Mesh = function (
apiMesh.renderOrder apiMesh.renderOrder
); );
this.materials = this.materials.map( // this.materials = this.materials.map(
function (apiMaterial) { // function (apiMaterial) {
return new GameLib.D3.Material( // return new GameLib.D3.Material(
this.graphics, // this.graphics,
apiMaterial, // apiMaterial,
imageFactory // imageFactory
) // )
}.bind(this) // }.bind(this)
); // );
if (this.skeleton) { if (this.skeleton) {
this.skeleton = new GameLib.D3.Skeleton( this.skeleton = new GameLib.D3.Skeleton(
@ -426,7 +426,7 @@ GameLib.D3.Mesh.prototype.toApiMesh = function() {
), ),
this.faces, this.faces,
this.faceVertexUvs, this.faceVertexUvs,
this.materials.map(function(material){return material.toApiMaterial()}), this.materials.map(function(material){return material.id}),
GameLib.Utils.IdOrNull(this.parentMesh), GameLib.Utils.IdOrNull(this.parentMesh),
GameLib.Utils.IdOrNull(this.parentScene), GameLib.Utils.IdOrNull(this.parentScene),
apiSkeleton, apiSkeleton,

View File

@ -36,7 +36,8 @@ GameLib.D3.Scene = function Scene(
apiScene.shapes, apiScene.shapes,
apiScene.cameras, apiScene.cameras,
apiScene.activeCameraIndex, apiScene.activeCameraIndex,
apiScene.textures apiScene.textures,
apiScene.materials
); );
this.meshes = this.meshes.map( this.meshes = this.meshes.map(
@ -87,6 +88,16 @@ GameLib.D3.Scene = function Scene(
}.bind(this) }.bind(this)
); );
this.materials = this.materials.map(
function(apiMaterial) {
return new GameLib.D3.Material(
this.graphics,
apiMaterial,
this.imageFactory
)
}.bind(this)
);
this.position = new GameLib.Vector3( this.position = new GameLib.Vector3(
graphics, graphics,
this, this,
@ -113,14 +124,15 @@ GameLib.D3.Scene = function Scene(
"cameras", "cameras",
"meshes", "meshes",
"lights", "lights",
"textures" "textures",
"materials"
]; ];
this.idToObject = {}; this.idToObject = {};
this.idToObject[this.id] = this; this.idToObject[this.id] = this;
var material = null; // var material = null;
for (var p = 0; p < this.interestingProperties.length; p++) { for (var p = 0; p < this.interestingProperties.length; p++) {
property = this.interestingProperties[p]; property = this.interestingProperties[p];
@ -144,14 +156,8 @@ GameLib.D3.Scene = function Scene(
} }
if (this.meshes[m].materials[0]) { if (this.meshes[m].materials[0]) {
this.meshes[m].materials[0] = this.idToObject[this.meshes[m].materials[0]];
material = this.meshes[m].materials[0]; this.meshes[m].materials[0].diffuseMap = this.idToObject[this.meshes[m].materials[0].diffuseMap];
for (var property in material) {
if (material.hasOwnProperty(property) && material[property] instanceof GameLib.D3.Texture) {
this.idToObject[material[property].id] = material[property];
}
}
} }
} }

View File

@ -10,6 +10,32 @@ GameLib.Utils.Extend = function(
} }
}; };
/**
* Returns id of object with the name if it exists in the array, otherwise null
* @param name
* @param array
* @returns {*}
* @constructor
*/
GameLib.Utils.ObjectIdWithNameInArray = function(name, array) {
return array.reduce(
function(result, object) {
if (result) {
return result;
}
if (name == object.name) {
return object.id;
}
return null;
},
null
);
};
// GameLib.Utils.ObjectFactory = function() { // GameLib.Utils.ObjectFactory = function() {
// //
// var promiseList = {}; // var promiseList = {};