migration start
parent
d0ac06f2b6
commit
56d40d33b6
|
@ -44,9 +44,6 @@ GameLib.API.System = function (
|
||||||
this.entityManager = entityManager;
|
this.entityManager = entityManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.API.System.prototype = Object.create(GameLib.Component.prototype);
|
|
||||||
GameLib.API.System.prototype.constructor = GameLib.API.System;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object to GameLib.D3.API.System
|
* Object to GameLib.D3.API.System
|
||||||
* @param objectComponent
|
* @param objectComponent
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* @param gameType
|
* @param gameType
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
* @param baseUrl
|
||||||
|
* @param path
|
||||||
* @param scenes
|
* @param scenes
|
||||||
* @param cameras
|
* @param cameras
|
||||||
* @param renderers
|
* @param renderers
|
||||||
|
@ -13,14 +15,14 @@
|
||||||
* @param viewports
|
* @param viewports
|
||||||
* @param entityManager
|
* @param entityManager
|
||||||
* @param mouse
|
* @param mouse
|
||||||
* @param activeCameraIndex
|
|
||||||
* @param activeRendererIndex
|
|
||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Game = function(
|
GameLib.D3.API.Game = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
baseUrl,
|
||||||
|
path,
|
||||||
gameType,
|
gameType,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -45,7 +47,7 @@ GameLib.D3.API.Game = function(
|
||||||
'systems' : [GameLib.D3.System],
|
'systems' : [GameLib.D3.System],
|
||||||
'viewports' : [GameLib.D3.Viewport],
|
'viewports' : [GameLib.D3.Viewport],
|
||||||
'entityManager' : GameLib.EntityManager,
|
'entityManager' : GameLib.EntityManager,
|
||||||
'mouse' : GameLib.D3.Mouse
|
'mouse' : GameLib.Mouse
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
@ -61,6 +63,17 @@ GameLib.D3.API.Game = function(
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(baseUrl)) {
|
||||||
|
baseUrl = '';
|
||||||
|
console.warn('The base URL required for downloading images is not set - textured meshes will not render properly');
|
||||||
|
}
|
||||||
|
this.baseUrl = baseUrl;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(path)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
this.path = path;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(gameType)) {
|
if (GameLib.Utils.UndefinedOrNull(gameType)) {
|
||||||
gameType = GameLib.D3.Game.GAME_TYPE_VR_PONG;
|
gameType = GameLib.D3.Game.GAME_TYPE_VR_PONG;
|
||||||
}
|
}
|
||||||
|
@ -196,6 +209,8 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
|
||||||
return new GameLib.D3.API.Game(
|
return new GameLib.D3.API.Game(
|
||||||
objectGame.id,
|
objectGame.id,
|
||||||
objectGame.name,
|
objectGame.name,
|
||||||
|
objectGame.baseUrl,
|
||||||
|
objectGame.path,
|
||||||
objectGame.gameType,
|
objectGame.gameType,
|
||||||
objectGame.width,
|
objectGame.width,
|
||||||
objectGame.height,
|
objectGame.height,
|
||||||
|
|
|
@ -2,32 +2,24 @@
|
||||||
* Raw Scene API object - should always correspond with the Scene Schema
|
* Raw Scene API object - should always correspond with the Scene Schema
|
||||||
* @param id String
|
* @param id String
|
||||||
* @param name String
|
* @param name String
|
||||||
* @param baseUrl String
|
|
||||||
* @param path String
|
|
||||||
* @param meshes [GameLib.D3.API.Mesh]
|
* @param meshes [GameLib.D3.API.Mesh]
|
||||||
* @param position GameLib.API.Vector3
|
* @param position GameLib.API.Vector3
|
||||||
* @param quaternion GameLib.API.Quaternion
|
* @param quaternion GameLib.API.Quaternion
|
||||||
* @param scale GameLib.API.Vector3
|
* @param scale GameLib.API.Vector3
|
||||||
* @param parentGameId
|
* @param parentGameId
|
||||||
* @param lights [GameLib.D3.API.Light]
|
* @param lights [GameLib.D3.API.Light]
|
||||||
* @param materials [GameLib.D3.API.Material]
|
|
||||||
* @param textures [GameLib.D3.API.Texture]
|
|
||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Scene = function(
|
GameLib.D3.API.Scene = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
baseUrl,
|
|
||||||
path,
|
|
||||||
meshes,
|
meshes,
|
||||||
position,
|
position,
|
||||||
quaternion,
|
quaternion,
|
||||||
scale,
|
scale,
|
||||||
parentGameId,
|
parentGameId,
|
||||||
lights,
|
lights,
|
||||||
materials,
|
|
||||||
textures,
|
|
||||||
parentEntity
|
parentEntity
|
||||||
) {
|
) {
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
|
@ -35,9 +27,7 @@ GameLib.D3.API.Scene = function(
|
||||||
GameLib.Component.COMPONENT_SCENE,
|
GameLib.Component.COMPONENT_SCENE,
|
||||||
{
|
{
|
||||||
'meshes' : [GameLib.D3.Mesh],
|
'meshes' : [GameLib.D3.Mesh],
|
||||||
'lights' : [GameLib.D3.Light],
|
'lights' : [GameLib.D3.Light]
|
||||||
'textures' : [GameLib.D3.Texture],
|
|
||||||
'materials' : [GameLib.D3.Material]
|
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
@ -53,17 +43,6 @@ GameLib.D3.API.Scene = function(
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(baseUrl)) {
|
|
||||||
baseUrl = '';
|
|
||||||
console.warn('The base URL required for downloading images is not set - textured meshes will not render properly');
|
|
||||||
}
|
|
||||||
this.baseUrl = baseUrl;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(path)) {
|
|
||||||
path = null;
|
|
||||||
}
|
|
||||||
this.path = path;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(meshes)) {
|
if (GameLib.Utils.UndefinedOrNull(meshes)) {
|
||||||
meshes = [];
|
meshes = [];
|
||||||
}
|
}
|
||||||
|
@ -94,18 +73,9 @@ GameLib.D3.API.Scene = function(
|
||||||
}
|
}
|
||||||
this.lights = lights;
|
this.lights = lights;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(materials)) {
|
|
||||||
materials = [];
|
|
||||||
}
|
|
||||||
this.materials = materials;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(textures)) {
|
|
||||||
textures = [];
|
|
||||||
}
|
|
||||||
this.textures = textures;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Scene.prototype = Object.create(GameLib.Scene.prototype);
|
GameLib.D3.API.Scene.prototype = Object.create(GameLib.Component.prototype);
|
||||||
GameLib.D3.API.Scene.prototype.constructor = GameLib.D3.API.Scene;
|
GameLib.D3.API.Scene.prototype.constructor = GameLib.D3.API.Scene;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,8 +87,6 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
|
||||||
|
|
||||||
var apiMeshes = [];
|
var apiMeshes = [];
|
||||||
var apiLights = [];
|
var apiLights = [];
|
||||||
var apiMaterials = [];
|
|
||||||
var apiTextures = [];
|
|
||||||
|
|
||||||
var apiPosition = new GameLib.API.Vector3();
|
var apiPosition = new GameLib.API.Vector3();
|
||||||
var apiQuaternion = new GameLib.API.Quaternion();
|
var apiQuaternion = new GameLib.API.Quaternion();
|
||||||
|
@ -140,22 +108,6 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectScene.textures) {
|
|
||||||
apiTextures = objectScene.textures.map(
|
|
||||||
function(objectTexture) {
|
|
||||||
return GameLib.D3.API.Texture.FromObjectTexture(objectTexture);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectScene.materials) {
|
|
||||||
apiMaterials = objectScene.materials.map(
|
|
||||||
function(objectMaterial) {
|
|
||||||
return GameLib.D3.API.Material.FromObjectMaterial(objectMaterial);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectScene.position) {
|
if (objectScene.position) {
|
||||||
apiPosition = GameLib.API.Vector3.FromObjectVector(objectScene.position);
|
apiPosition = GameLib.API.Vector3.FromObjectVector(objectScene.position);
|
||||||
}
|
}
|
||||||
|
@ -171,16 +123,12 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
|
||||||
return new GameLib.D3.API.Scene(
|
return new GameLib.D3.API.Scene(
|
||||||
objectScene.id,
|
objectScene.id,
|
||||||
objectScene.name,
|
objectScene.name,
|
||||||
objectScene.baseUrl,
|
|
||||||
objectScene.path,
|
|
||||||
apiMeshes,
|
apiMeshes,
|
||||||
apiPosition,
|
apiPosition,
|
||||||
apiQuaternion,
|
apiQuaternion,
|
||||||
apiScale,
|
apiScale,
|
||||||
objectScene.parentGameId,
|
objectScene.parentGameId,
|
||||||
apiLights,
|
apiLights,
|
||||||
apiMaterials,
|
|
||||||
apiTextures,
|
|
||||||
objectScene.parentEntity
|
objectScene.parentEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,6 @@ GameLib.D3.Coder = function Coder(
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Coder.prototype = Object.create(GameLib.D3.API.Coder.prototype);
|
|
||||||
GameLib.D3.Coder.prototype.constructor = GameLib.D3.Coder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.Coder Types
|
* GameLib.D3.Coder Types
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
* Game Runtime
|
* Game Runtime
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param apiGame GameLib.D3.API.Game
|
* @param apiGame GameLib.D3.API.Game
|
||||||
|
* @param imageFactory
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Game = function (
|
GameLib.D3.Game = function (
|
||||||
graphics,
|
graphics,
|
||||||
apiGame
|
apiGame,
|
||||||
|
imageFactory
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
|
@ -20,6 +22,8 @@ GameLib.D3.Game = function (
|
||||||
this,
|
this,
|
||||||
apiGame.id,
|
apiGame.id,
|
||||||
apiGame.name,
|
apiGame.name,
|
||||||
|
apiGame.baseUrl,
|
||||||
|
apiGame.path,
|
||||||
apiGame.gameType,
|
apiGame.gameType,
|
||||||
apiGame.width,
|
apiGame.width,
|
||||||
apiGame.height,
|
apiGame.height,
|
||||||
|
@ -34,6 +38,14 @@ GameLib.D3.Game = function (
|
||||||
apiGame.parentEntity
|
apiGame.parentEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
||||||
|
imageFactory = GameLib.D3.ImageFactory(
|
||||||
|
this.graphics,
|
||||||
|
this.baseUrl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.imageFactory = imageFactory;
|
||||||
|
|
||||||
this.scenes = this.scenes.map(
|
this.scenes = this.scenes.map(
|
||||||
function(apiScene) {
|
function(apiScene) {
|
||||||
|
|
||||||
|
@ -130,39 +142,7 @@ GameLib.D3.Game = function (
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.idToObject = {};
|
this.buildIdToObject();
|
||||||
|
|
||||||
if (this.entityManager instanceof GameLib.API.EntityManager) {
|
|
||||||
|
|
||||||
this.entityManager = new GameLib.EntityManager(
|
|
||||||
this.graphics,
|
|
||||||
this.entityManager
|
|
||||||
);
|
|
||||||
|
|
||||||
this.entityManager.entities.map(
|
|
||||||
function (entity) {
|
|
||||||
this.idToObject[entity.id] = entity;
|
|
||||||
entity.components.map(
|
|
||||||
function(component) {
|
|
||||||
if (component instanceof GameLib.Component) {
|
|
||||||
this.idToObject[component.id] = component;
|
|
||||||
} else {
|
|
||||||
console.warn('Component not of type Component');
|
|
||||||
throw new Error('Component not of type Component');
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
)
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.entityManager.linkObjects(this.idToObject);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
console.warn('EntityManager not of type API.EntityManager');
|
|
||||||
throw new Error('EntityManager not of type API.EntityManager');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.scenes = {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Game.prototype = Object.create(GameLib.D3.API.Game.prototype);
|
GameLib.D3.Game.prototype = Object.create(GameLib.D3.API.Game.prototype);
|
||||||
|
@ -216,6 +196,55 @@ GameLib.D3.Game.prototype.updateInstance = function() {
|
||||||
this.instance = this.createInstance(true);
|
this.instance = this.createInstance(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Game.prototype.buildIdToObject = function() {
|
||||||
|
|
||||||
|
this.idToObject = {};
|
||||||
|
|
||||||
|
if (this.entityManager instanceof GameLib.API.EntityManager) {
|
||||||
|
|
||||||
|
this.entityManager = new GameLib.EntityManager(
|
||||||
|
this.graphics,
|
||||||
|
this.entityManager
|
||||||
|
);
|
||||||
|
|
||||||
|
this.entityManager.entities.map(
|
||||||
|
function (entity) {
|
||||||
|
this.idToObject[entity.id] = entity;
|
||||||
|
entity.components.map(
|
||||||
|
function(component) {
|
||||||
|
if (component instanceof GameLib.Component) {
|
||||||
|
this.idToObject[component.id] = component;
|
||||||
|
} else {
|
||||||
|
console.warn('Component not of type Component');
|
||||||
|
throw new Error('Component not of type Component');
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.entityManager.linkObjects(this.idToObject);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.warn('EntityManager not of type API.EntityManager');
|
||||||
|
throw new Error('EntityManager not of type API.EntityManager');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.scenes.map(
|
||||||
|
function(scene) {
|
||||||
|
|
||||||
|
var idToObject = scene.idToObject;
|
||||||
|
|
||||||
|
for (var property in idToObject) {
|
||||||
|
if (idToObject.hasOwnProperty(property)) {
|
||||||
|
this.idToObject[property] = idToObject[property];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a GameLib.D3.Game to a new GameLib.D3.API.Game
|
* Converts a GameLib.D3.Game to a new GameLib.D3.API.Game
|
||||||
* @returns {GameLib.D3.API.Game}
|
* @returns {GameLib.D3.API.Game}
|
||||||
|
@ -329,6 +358,8 @@ GameLib.D3.Game.prototype.toApiGame = function() {
|
||||||
return new GameLib.D3.API.Game(
|
return new GameLib.D3.API.Game(
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
|
this.baseUrl,
|
||||||
|
this.path,
|
||||||
this.gameType,
|
this.gameType,
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
|
|
|
@ -28,9 +28,6 @@ GameLib.D3.Graphics = function Graphics(
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Graphics.prototype = Object.create(GameLib.D3.API.Graphics.prototype);
|
|
||||||
GameLib.D3.Graphics.prototype.constructor = GameLib.D3.Graphics;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.Graphics Types
|
* GameLib.D3.Graphics Types
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
|
|
@ -63,6 +63,10 @@ GameLib.D3.Input.Editor = function (
|
||||||
this.graphics
|
this.graphics
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.mouse = new GameLib.Mouse(
|
||||||
|
this.graphics
|
||||||
|
);
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -372,12 +376,12 @@ GameLib.D3.Input.Editor.prototype.onMouseMove = function(event) {
|
||||||
|
|
||||||
var clientX = event.clientX - this.widthOffset;
|
var clientX = event.clientX - this.widthOffset;
|
||||||
|
|
||||||
this.scene.mouse.x = ((clientX / (window.innerWidth - this.widthOffset))) * 2 - 1;
|
this.mouse.x = ((clientX / (window.innerWidth - this.widthOffset))) * 2 - 1;
|
||||||
this.scene.mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
this.mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||||
|
|
||||||
this.scene.raycaster.instance.setFromCamera(
|
this.raycaster.instance.setFromCamera(
|
||||||
this.scene.mouse,
|
this.mouse,
|
||||||
this.scene.cameras[this.scene.activeCameraIndex].instance
|
this.cameras[this.scene.activeCameraIndex].instance
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.meshMoveMode) {
|
if (this.meshMoveMode) {
|
||||||
|
@ -398,6 +402,35 @@ GameLib.D3.Input.Editor.prototype.onMouseMove = function(event) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves selected objects along an axis
|
||||||
|
* @param alongAxis
|
||||||
|
* @param units
|
||||||
|
*/
|
||||||
|
GameLib.D3.Input.Editor.prototype.moveSelectedObjects = function(alongAxis, units) {
|
||||||
|
|
||||||
|
for (var s = 0; s < this.editor.selectedObjects.length; s++) {
|
||||||
|
|
||||||
|
var object = this.editor.selectedObjects[s].object;
|
||||||
|
|
||||||
|
if (object.position) {
|
||||||
|
if (alongAxis == 'x') {
|
||||||
|
object.position.x += units;
|
||||||
|
}
|
||||||
|
if (alongAxis == 'y') {
|
||||||
|
object.position.y += units;
|
||||||
|
}
|
||||||
|
if (alongAxis == 'z') {
|
||||||
|
object.position.z += units;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (object.updateInstance) {
|
||||||
|
object.updateInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent Context Menu creation
|
* Prevent Context Menu creation
|
||||||
* @param event
|
* @param event
|
||||||
|
|
|
@ -117,123 +117,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,
|
|
||||||
'alphaMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'aoMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'bumpMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'map',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'displacementMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'emissiveMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'envMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'lightMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'metalnessMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'normalMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'roughnessMap',
|
|
||||||
imageFactory
|
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,
|
|
||||||
'specularMap',
|
|
||||||
imageFactory
|
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();
|
||||||
|
@ -512,61 +548,85 @@ GameLib.D3.Material.prototype.createInstance = function(update) {
|
||||||
if (property == 'alphaMap') {
|
if (property == 'alphaMap') {
|
||||||
if (this.alphaMap) {
|
if (this.alphaMap) {
|
||||||
instance.alphaMap = this.alphaMap.instance;
|
instance.alphaMap = this.alphaMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.alphaMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'aoMap') {
|
else if (property == 'aoMap') {
|
||||||
if (this.aoMap) {
|
if (this.aoMap) {
|
||||||
instance.aoMap = this.aoMap.instance;
|
instance.aoMap = this.aoMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.aoMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'bumpMap') {
|
else if (property == 'bumpMap') {
|
||||||
if (this.bumpMap) {
|
if (this.bumpMap) {
|
||||||
instance.bumpMap = this.bumpMap.instance;
|
instance.bumpMap = this.bumpMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.bumpMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'map') {
|
else if (property == 'map') {
|
||||||
if (this.diffuseMap) {
|
if (this.diffuseMap) {
|
||||||
instance.map = this.diffuseMap.instance;
|
instance.map = this.diffuseMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.map = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'displacementMap') {
|
else if (property == 'displacementMap') {
|
||||||
if (this.displacementMap) {
|
if (this.displacementMap) {
|
||||||
instance.displacementMap = this.displacementMap.instance;
|
instance.displacementMap = this.displacementMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.displacementMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'emissiveMap') {
|
else if (property == 'emissiveMap') {
|
||||||
if (this.emissiveMap) {
|
if (this.emissiveMap) {
|
||||||
instance.emissiveMap = this.emissiveMap.instance;
|
instance.emissiveMap = this.emissiveMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.emissiveMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'envMap') {
|
else if (property == 'envMap') {
|
||||||
if (this.environmentMap) {
|
if (this.environmentMap) {
|
||||||
instance.envMap = this.environmentMap.instance;
|
instance.envMap = this.environmentMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.envMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'lightMap') {
|
else if (property == 'lightMap') {
|
||||||
if (this.lightMap) {
|
if (this.lightMap) {
|
||||||
instance.lightMap = this.lightMap.instance;
|
instance.lightMap = this.lightMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.lightMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'metalnessMap') {
|
else if (property == 'metalnessMap') {
|
||||||
if (this.metalnessMap) {
|
if (this.metalnessMap) {
|
||||||
instance.metalnessMap = this.metalnessMap.instance;
|
instance.metalnessMap = this.metalnessMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.metalnessMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'normalMap') {
|
else if (property == 'normalMap') {
|
||||||
if (this.normalMap) {
|
if (this.normalMap) {
|
||||||
instance.normalMap = this.normalMap.instance;
|
instance.normalMap = this.normalMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.normalMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'roughnessMap') {
|
else if (property == 'roughnessMap') {
|
||||||
if (this.roughnessMap) {
|
if (this.roughnessMap) {
|
||||||
instance.roughnessMap = this.roughnessMap.instance;
|
instance.roughnessMap = this.roughnessMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.roughnessMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'specularMap') {
|
else if (property == 'specularMap') {
|
||||||
if (this.specularMap) {
|
if (this.specularMap) {
|
||||||
instance.specularMap = this.specularMap.instance;
|
instance.specularMap = this.specularMap.instance;
|
||||||
|
} else {
|
||||||
|
instance.specularMap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (property == 'size') {
|
else if (property == 'size') {
|
||||||
|
|
|
@ -25,8 +25,8 @@ GameLib.D3.Mesh = function (
|
||||||
this.computeNormals = computeNormals;
|
this.computeNormals = computeNormals;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
||||||
console.warn('Cannot create a mesh without specifying an ImageFactory');
|
console.warn('Cannot create a Mesh without specifying an ImageFactory');
|
||||||
throw new Error('Cannot create a mesh without specifying an ImageFactory');
|
throw new Error('Cannot create a Mesh without specifying an ImageFactory');
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.D3.API.Mesh.call(
|
GameLib.D3.API.Mesh.call(
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
* created
|
* created
|
||||||
* @param graphics
|
* @param graphics
|
||||||
* @param apiScene GameLib.D3.API.Scene
|
* @param apiScene GameLib.D3.API.Scene
|
||||||
* @param imageFactory
|
|
||||||
* @param computeNormals
|
* @param computeNormals
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Scene = function Scene(
|
GameLib.D3.Scene = function (
|
||||||
graphics,
|
graphics,
|
||||||
apiScene,
|
apiScene,
|
||||||
imageFactory,
|
imageFactory,
|
||||||
|
@ -20,14 +19,6 @@ GameLib.D3.Scene = function Scene(
|
||||||
apiScene = {};
|
apiScene = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
|
||||||
imageFactory = GameLib.D3.ImageFactory(
|
|
||||||
this.graphics,
|
|
||||||
this.baseUrl
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.imageFactory = imageFactory;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(computeNormals)) {
|
if (GameLib.Utils.UndefinedOrNull(computeNormals)) {
|
||||||
computeNormals = true;
|
computeNormals = true;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +28,6 @@ GameLib.D3.Scene = function Scene(
|
||||||
this,
|
this,
|
||||||
apiScene.id,
|
apiScene.id,
|
||||||
apiScene.name,
|
apiScene.name,
|
||||||
apiScene.baseUrl,
|
|
||||||
apiScene.path,
|
|
||||||
apiScene.meshes,
|
apiScene.meshes,
|
||||||
apiScene.position,
|
apiScene.position,
|
||||||
apiScene.quaternion,
|
apiScene.quaternion,
|
||||||
|
@ -50,6 +39,12 @@ GameLib.D3.Scene = function Scene(
|
||||||
apiScene.parentEntity
|
apiScene.parentEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
||||||
|
console.warn('Cannot create a Scene without specifying an ImageFactory');
|
||||||
|
throw new Error('Cannot create a Scene without specifying an ImageFactory');
|
||||||
|
}
|
||||||
|
this.imageFactory = imageFactory;
|
||||||
|
|
||||||
this.idToObject = {};
|
this.idToObject = {};
|
||||||
|
|
||||||
this.meshes = this.meshes.map(
|
this.meshes = this.meshes.map(
|
||||||
|
@ -59,7 +54,7 @@ GameLib.D3.Scene = function Scene(
|
||||||
this.graphics,
|
this.graphics,
|
||||||
apiMesh,
|
apiMesh,
|
||||||
this.computeNormals,
|
this.computeNormals,
|
||||||
imageFactory
|
this.imageFactory
|
||||||
);
|
);
|
||||||
|
|
||||||
this.idToObject[mesh.id] = mesh;
|
this.idToObject[mesh.id] = mesh;
|
||||||
|
@ -75,6 +70,21 @@ GameLib.D3.Scene = function Scene(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mesh.materials.map(
|
||||||
|
function(material) {
|
||||||
|
this.idToObject[material.id] = material;
|
||||||
|
|
||||||
|
for (var property in material) {
|
||||||
|
if (material.hasOwnProperty(property)) {
|
||||||
|
if (material[property] instanceof GameLib.D3.Texture) {
|
||||||
|
this.idToObject[material[property].id] = material[property];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
@ -117,45 +127,6 @@ GameLib.D3.Scene = function Scene(
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.materials = this.materials.map(
|
|
||||||
function(apiMaterial) {
|
|
||||||
if (apiMaterial instanceof GameLib.D3.API.Material) {
|
|
||||||
var material = new GameLib.D3.Material(
|
|
||||||
this.graphics,
|
|
||||||
apiMaterial,
|
|
||||||
this.imageFactory
|
|
||||||
);
|
|
||||||
|
|
||||||
this.idToObject[material.id] = material;
|
|
||||||
|
|
||||||
return material;
|
|
||||||
} else {
|
|
||||||
console.warn('apiMaterial not an instance of API.Material');
|
|
||||||
throw new Error('apiMaterial not an instance of API.Material');
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
this.textures = this.textures.map(
|
|
||||||
function(apiTexture) {
|
|
||||||
if (apiTexture instanceof GameLib.D3.API.Texture) {
|
|
||||||
var texture = new GameLib.D3.Texture(
|
|
||||||
this.graphics,
|
|
||||||
apiTexture,
|
|
||||||
this.imageFactory
|
|
||||||
);
|
|
||||||
|
|
||||||
this.idToObject[texture.id] = texture;
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
} else {
|
|
||||||
console.warn('apiTexture not an instance of API.Texture');
|
|
||||||
throw new Error('apiTexture not an instance of API.Texture');
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.idToObject[this.id] = this;
|
this.idToObject[this.id] = this;
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
|
@ -209,31 +180,15 @@ GameLib.D3.Scene.prototype.toApiScene = function() {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
var apiMaterials = this.materials.map(
|
|
||||||
function(material) {
|
|
||||||
return material.toApiShape();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
var apiTextures = this.textures.map(
|
|
||||||
function(texture) {
|
|
||||||
return texture.toApiTexture();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return new GameLib.D3.API.Scene(
|
return new GameLib.D3.API.Scene(
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
this.baseUrl,
|
|
||||||
this.path,
|
|
||||||
apiMeshes,
|
apiMeshes,
|
||||||
this.position.toApiVector(),
|
this.position.toApiVector(),
|
||||||
this.quaternion.toApiQuaternion(),
|
this.quaternion.toApiQuaternion(),
|
||||||
this.scale.toApiVector(),
|
this.scale.toApiVector(),
|
||||||
this.parentGameId,
|
this.parentGameId,
|
||||||
apiLights,
|
apiLights,
|
||||||
apiMaterials,
|
|
||||||
apiTextures,
|
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -270,18 +225,21 @@ GameLib.D3.Scene.FromObjectScene = function(
|
||||||
* @param objectScene Object (as it comes from the API)
|
* @param objectScene Object (as it comes from the API)
|
||||||
* @param computeNormals
|
* @param computeNormals
|
||||||
* @param onLoaded
|
* @param onLoaded
|
||||||
|
* @param imageFactory GameLib.D3.ImageFactory
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Scene.LoadScene = function(
|
GameLib.D3.Scene.LoadScene = function(
|
||||||
graphics,
|
graphics,
|
||||||
objectScene,
|
objectScene,
|
||||||
computeNormals,
|
computeNormals,
|
||||||
onLoaded
|
onLoaded,
|
||||||
|
imageFactory
|
||||||
) {
|
) {
|
||||||
var scene = GameLib.D3.Scene.FromObjectScene(
|
var scene = GameLib.D3.Scene.FromObjectScene(
|
||||||
graphics,
|
graphics,
|
||||||
objectScene,
|
objectScene,
|
||||||
computeNormals
|
computeNormals,
|
||||||
|
imageFactory
|
||||||
);
|
);
|
||||||
|
|
||||||
onLoaded(scene);
|
onLoaded(scene);
|
||||||
|
@ -293,12 +251,14 @@ GameLib.D3.Scene.LoadScene = function(
|
||||||
* @param partialSceneObject Object {path: '', name: ''}
|
* @param partialSceneObject Object {path: '', name: ''}
|
||||||
* @param apiUrl
|
* @param apiUrl
|
||||||
* @param onLoaded
|
* @param onLoaded
|
||||||
|
* @param imageFactory GameLib.D3.ImageFactory
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Scene.LoadSceneFromApi = function(
|
GameLib.D3.Scene.LoadSceneFromApi = function(
|
||||||
graphics,
|
graphics,
|
||||||
partialSceneObject,
|
partialSceneObject,
|
||||||
apiUrl,
|
apiUrl,
|
||||||
onLoaded
|
onLoaded,
|
||||||
|
imageFactory
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,7 +297,8 @@ GameLib.D3.Scene.LoadSceneFromApi = function(
|
||||||
graphics,
|
graphics,
|
||||||
objectScene,
|
objectScene,
|
||||||
true,
|
true,
|
||||||
onLoaded
|
onLoaded,
|
||||||
|
imageFactory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ GameLib.Vector2 = function (
|
||||||
apiVector2 = {};
|
apiVector2 = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.Vector2.call(
|
GameLib.API.Vector2.call(
|
||||||
this,
|
this,
|
||||||
apiVector2.x,
|
apiVector2.x,
|
||||||
apiVector2.y
|
apiVector2.y
|
||||||
|
|
|
@ -19,7 +19,7 @@ GameLib.Vector3 = function (
|
||||||
apiVector3 = {};
|
apiVector3 = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.Vector3.call(
|
GameLib.API.Vector3.call(
|
||||||
this,
|
this,
|
||||||
apiVector3.x,
|
apiVector3.x,
|
||||||
apiVector3.y,
|
apiVector3.y,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
GameLib.API.System.prototype = Object.create(GameLib.Component.prototype);
|
||||||
|
GameLib.API.System.prototype.constructor = GameLib.API.System;
|
||||||
|
|
||||||
if (typeof module !== 'undefined') {
|
if (typeof module !== 'undefined') {
|
||||||
module.exports = GameLib;
|
module.exports = GameLib;
|
||||||
}
|
}
|
Loading…
Reference in New Issue