smart object creation - image factory override
parent
838ae9e3af
commit
4d828ee849
|
@ -20,6 +20,10 @@ GameLib.Color = function (
|
|||
apiColor = {};
|
||||
}
|
||||
|
||||
if (apiColor instanceof GameLib.Color) {
|
||||
return apiColor;
|
||||
}
|
||||
|
||||
GameLib.API.Color.call(
|
||||
this,
|
||||
apiColor.r,
|
||||
|
|
|
@ -529,51 +529,51 @@ GameLib.D3.API.Material.FromObjectMaterial = function(objectMaterial) {
|
|||
var apiSpecularMap = null;
|
||||
|
||||
if (objectMaterial.alphaMap) {
|
||||
apiAlphaMap = objectMaterial.alphaMap;
|
||||
apiAlphaMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.alphaMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.aoMap) {
|
||||
apiAoMap = objectMaterial.aoMap;
|
||||
apiAoMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.aoMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.bumpMap) {
|
||||
apiBumpMap = objectMaterial.bumpMap;
|
||||
apiBumpMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.bumpMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.diffuseMap) {
|
||||
apiDiffuseMap = objectMaterial.diffuseMap;
|
||||
apiDiffuseMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.diffuseMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.displacementMap) {
|
||||
apiDisplacementMap = objectMaterial.displacementMap;
|
||||
apiDisplacementMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.displacementMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.emissiveMap) {
|
||||
apiEmissiveMap = objectMaterial.emissiveMap;
|
||||
apiEmissiveMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.emissiveMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.environmentMap) {
|
||||
apiEnvironmentMap = objectMaterial.environmentMap;
|
||||
apiEnvironmentMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.environmentMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.lightMap) {
|
||||
apiLightMap = objectMaterial.lightMap;
|
||||
apiLightMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.lightMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.metalnessMap) {
|
||||
apiMetalnessMap = objectMaterial.metalnessMap;
|
||||
apiMetalnessMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.metalnessMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.normalMap) {
|
||||
apiNormalMap = objectMaterial.normalMap;
|
||||
apiNormalMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.normalMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.roughnessMap) {
|
||||
apiRoughnessMap = objectMaterial.roughnessMap;
|
||||
apiRoughnessMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.roughnessMap);
|
||||
}
|
||||
|
||||
if (objectMaterial.specularMap) {
|
||||
apiSpecularMap = objectMaterial.specularMap;
|
||||
apiSpecularMap = GameLib.D3.API.Texture.FromObjectTexture(objectMaterial.specularMap);
|
||||
}
|
||||
|
||||
return new GameLib.D3.API.Material(
|
||||
|
|
|
@ -106,9 +106,10 @@ GameLib.D3.API.Scene.prototype.constructor = GameLib.D3.API.Scene;
|
|||
/**
|
||||
* Returns an API scene from an Object scene
|
||||
* @param objectScene
|
||||
* @param imageFactory GameLib.D3.ImageFactory
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
|
||||
GameLib.D3.API.Scene.FromObjectScene = function(objectScene, imageFactory) {
|
||||
|
||||
var apiImageFactory = null;
|
||||
var apiMeshes = [];
|
||||
|
@ -120,7 +121,12 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
|
|||
var apiQuaternion = new GameLib.API.Quaternion();
|
||||
var apiScale = new GameLib.API.Vector3(1,1,1);
|
||||
|
||||
if (objectScene.imageFactory) {
|
||||
/**
|
||||
* Passed in ImageFactory overrides API image factory
|
||||
*/
|
||||
if (imageFactory) {
|
||||
apiImageFactory = imageFactory;
|
||||
} else if (objectScene.imageFactory) {
|
||||
apiImageFactory = GameLib.D3.API.ImageFactory.FromObjectImageFactory(objectScene.imageFactory);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,6 +167,9 @@ GameLib.D3.API.Texture = function(
|
|||
this.encoding = encoding;
|
||||
};
|
||||
|
||||
GameLib.D3.API.Texture.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Texture.prototype.constructor = GameLib.D3.API.Texture;
|
||||
|
||||
/**
|
||||
* Creates an API texture from Object data
|
||||
* @param objectTexture
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.BoneWeight = function (
|
|||
apiBoneWeight = {};
|
||||
}
|
||||
|
||||
if (apiBoneWeight instanceof GameLib.D3.BoneWeight) {
|
||||
return apiBoneWeight;
|
||||
}
|
||||
|
||||
GameLib.D3.API.BoneWeight.call(
|
||||
this,
|
||||
apiBoneWeight.boneIndex,
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.Bone = function (
|
|||
apiBone = {};
|
||||
}
|
||||
|
||||
if (apiBone instanceof GameLib.D3.Bone) {
|
||||
return apiBone;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Bone.call(
|
||||
this,
|
||||
apiBone.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Camera = function(
|
|||
apiCamera = {};
|
||||
}
|
||||
|
||||
if (apiCamera instanceof GameLib.D3.Camera) {
|
||||
return apiCamera;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Camera.call(
|
||||
this,
|
||||
apiCamera.id,
|
||||
|
|
|
@ -13,9 +13,13 @@ GameLib.D3.Composer = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiComposer)) {
|
||||
apiComposer = {};
|
||||
apiComposer = {};
|
||||
}
|
||||
|
||||
if (apiComposer instanceof GameLib.D3.Composer) {
|
||||
return apiComposer;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Composer.call(
|
||||
this,
|
||||
apiComposer.id,
|
||||
|
|
|
@ -11,6 +11,10 @@ GameLib.D3.CustomCode = function(
|
|||
apiCustomCode = {};
|
||||
}
|
||||
|
||||
if (apiCustomCode instanceof GameLib.D3.CustomCode) {
|
||||
return apiCustomCode;
|
||||
}
|
||||
|
||||
GameLib.D3.API.CustomCode.call(
|
||||
this,
|
||||
apiCustomCode.id,
|
||||
|
|
|
@ -22,6 +22,10 @@ GameLib.D3.Editor = function(
|
|||
apiEditor = {};
|
||||
}
|
||||
|
||||
if (apiEditor instanceof GameLib.D3.Editor) {
|
||||
return apiEditor;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Editor.call(
|
||||
this,
|
||||
apiEditor.id,
|
||||
|
@ -471,3 +475,24 @@ GameLib.D3.Editor.prototype.setSize = function(width, height) {
|
|||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a scene to the Editor
|
||||
* @param scene GameLib.D3.API.Scene
|
||||
*/
|
||||
GameLib.D3.Editor.prototype.addScene = function(scene) {
|
||||
|
||||
if (scene instanceof GameLib.D3.Scene) {
|
||||
this.scenes.push(scene);
|
||||
this.buildIdToObject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (scene instanceof GameLib.D3.API.Scene) {
|
||||
scene = new GameLib.D3.Scene(this.graphics, scene);
|
||||
this.scenes.push(scene);
|
||||
this.buildIdToObject();
|
||||
}
|
||||
|
||||
throw new Error('Unhandled scene type : ' + scene);
|
||||
};
|
|
@ -15,6 +15,10 @@ GameLib.D3.Follow = function (
|
|||
apiFollow = {};
|
||||
}
|
||||
|
||||
if (apiFollow instanceof GameLib.D3.Follow) {
|
||||
return apiFollow;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Follow.call(
|
||||
this,
|
||||
apiFollow.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Game = function (
|
|||
apiGame = {};
|
||||
}
|
||||
|
||||
if (apiGame instanceof GameLib.D3.Game) {
|
||||
return apiGame;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Game.call(
|
||||
this,
|
||||
apiGame.id,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* The image factory takes care that we only make requests for Image URLs which we have not already started downloading
|
||||
* @param graphics GameLib.D3.Graphics
|
||||
* @param apiImageFactory GameLib.D3.API.ImageFactory
|
||||
* @param graphics
|
||||
* @param apiImageFactory
|
||||
* @param progressCallback
|
||||
* @returns {Function}
|
||||
* @returns {GameLib.D3.ImageFactory}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.ImageFactory = function (
|
||||
|
@ -18,6 +18,10 @@ GameLib.D3.ImageFactory = function (
|
|||
apiImageFactory = {};
|
||||
}
|
||||
|
||||
if (apiImageFactory instanceof GameLib.D3.ImageFactory) {
|
||||
return apiImageFactory;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(progressCallback)) {
|
||||
progressCallback = null;
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ GameLib.D3.Image = function(
|
|||
|
||||
this.filename = filename;
|
||||
|
||||
if (typeof size == 'undefined') {
|
||||
if (GameLib.Utils.UndefinedOrNull(size)) {
|
||||
size = 0;
|
||||
}
|
||||
this.size = size;
|
||||
|
||||
if (typeof contentType == 'undefined') {
|
||||
if (GameLib.Utils.UndefinedOrNull(contentType)) {
|
||||
|
||||
contentType = 'application/octet-stream';
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ GameLib.D3.Input.Drive = function (
|
|||
apiInputDrive = {};
|
||||
}
|
||||
|
||||
if (apiInputDrive instanceof GameLib.D3.Drive) {
|
||||
return apiInputDrive;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Input.Drive.call(
|
||||
this,
|
||||
apiInputDrive.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Input.Editor = function (
|
|||
apiInputEditor = {};
|
||||
}
|
||||
|
||||
if (apiInputEditor instanceof GameLib.D3.Input.Editor) {
|
||||
return apiInputEditor;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Input.Editor.call(
|
||||
this,
|
||||
apiInputEditor.id,
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.Light = function Light(
|
|||
apiLight = {};
|
||||
}
|
||||
|
||||
if (apiLight instanceof GameLib.D3.Light) {
|
||||
return apiLight;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Light.call(
|
||||
this,
|
||||
apiLight.id,
|
||||
|
@ -96,8 +100,8 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
|
|||
if (!instance) {
|
||||
|
||||
if (
|
||||
this.lightType == GameLib.D3.Light.LIGHT_TYPE_AMBIENT ||
|
||||
this.lightType == 'AmbientLight'
|
||||
this.lightType === GameLib.D3.Light.LIGHT_TYPE_AMBIENT ||
|
||||
this.lightType === 'AmbientLight'
|
||||
) {
|
||||
instance = new THREE.AmbientLight(
|
||||
this.color.instance,
|
||||
|
@ -106,8 +110,8 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
|
|||
}
|
||||
|
||||
if (
|
||||
this.lightType == GameLib.D3.Light.LIGHT_TYPE_DIRECTIONAL ||
|
||||
this.lightType == 'DirectionalLight'
|
||||
this.lightType === GameLib.D3.Light.LIGHT_TYPE_DIRECTIONAL ||
|
||||
this.lightType === 'DirectionalLight'
|
||||
) {
|
||||
instance = new THREE.DirectionalLight(
|
||||
this.color.instance,
|
||||
|
@ -116,8 +120,8 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
|
|||
}
|
||||
|
||||
if (
|
||||
this.lightType == GameLib.D3.Light.LIGHT_TYPE_POINT ||
|
||||
this.lightType == 'PointLight'
|
||||
this.lightType === GameLib.D3.Light.LIGHT_TYPE_POINT ||
|
||||
this.lightType === 'PointLight'
|
||||
) {
|
||||
instance = new THREE.PointLight(
|
||||
this.color.instance,
|
||||
|
@ -128,8 +132,8 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
|
|||
}
|
||||
|
||||
if (
|
||||
this.lightType == GameLib.D3.Light.LIGHT_TYPE_SPOT ||
|
||||
this.lightType == 'SpotLight'
|
||||
this.lightType === GameLib.D3.Light.LIGHT_TYPE_SPOT ||
|
||||
this.lightType === 'SpotLight'
|
||||
) {
|
||||
instance = new THREE.SpotLight(
|
||||
this.color.instance,
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.LookAt = function (
|
|||
apiLookAt = {};
|
||||
}
|
||||
|
||||
if (apiLookAt instanceof GameLib.D3.LookAt) {
|
||||
return apiLookAt;
|
||||
}
|
||||
|
||||
GameLib.D3.API.LookAt.call(
|
||||
this,
|
||||
apiLookAt.id,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @constructor
|
||||
* @returns {GameLib.D3.Material | GameLib.D3.API.Material}
|
||||
*/
|
||||
GameLib.D3.Material = function Material(
|
||||
GameLib.D3.Material = function(
|
||||
graphics,
|
||||
apiMaterial,
|
||||
imageFactory
|
||||
|
@ -20,6 +20,10 @@ GameLib.D3.Material = function Material(
|
|||
apiMaterial = {};
|
||||
}
|
||||
|
||||
if (apiMaterial instanceof GameLib.D3.Material) {
|
||||
return apiMaterial;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
||||
console.warn('Cannot create a Material fully without specifying an ImageFactory');
|
||||
imageFactory = null;
|
||||
|
|
|
@ -19,6 +19,10 @@ GameLib.D3.Mesh = function (
|
|||
apiMesh = {};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(computeNormals)) {
|
||||
computeNormals = true;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Pass = function (
|
|||
apiPass = {};
|
||||
}
|
||||
|
||||
if (apiPass instanceof GameLib.D3.Pass) {
|
||||
return apiPass;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Pass.call(
|
||||
this,
|
||||
apiPass.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.PathFollowing = function (
|
|||
apiPathFollowing = {};
|
||||
}
|
||||
|
||||
if (apiPathFollowing instanceof GameLib.D3.PathFollowing) {
|
||||
return apiPathFollowing;
|
||||
}
|
||||
|
||||
GameLib.D3.API.PathFollowing.call(
|
||||
this,
|
||||
apiPathFollowing.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Raycaster = function(
|
|||
apiRaycaster = {};
|
||||
}
|
||||
|
||||
if (apiRaycaster instanceof GameLib.D3.Raycaster) {
|
||||
return apiRaycaster;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Raycaster.call(
|
||||
this,
|
||||
apiRaycaster.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.RenderTarget = function (
|
|||
apiRenderTarget = {};
|
||||
}
|
||||
|
||||
if (apiRenderTarget instanceof GameLib.D3.RenderTarget) {
|
||||
return apiRenderTarget;
|
||||
}
|
||||
|
||||
GameLib.D3.API.RenderTarget.call(
|
||||
this,
|
||||
apiRenderTarget.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.D3.Renderer = function (
|
|||
apiRenderer = {};
|
||||
}
|
||||
|
||||
if (apiRenderer instanceof GameLib.D3.Renderer) {
|
||||
return apiRenderer;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Renderer.call(
|
||||
this,
|
||||
apiRenderer.id,
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* created
|
||||
* @param graphics
|
||||
* @param apiScene GameLib.D3.API.Scene
|
||||
* @param imageFactory
|
||||
* @param computeNormals
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -19,6 +18,10 @@ GameLib.D3.Scene = function (
|
|||
apiScene = {};
|
||||
}
|
||||
|
||||
if (apiScene instanceof GameLib.D3.Scene) {
|
||||
return apiScene;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(computeNormals)) {
|
||||
computeNormals = true;
|
||||
}
|
||||
|
@ -253,15 +256,17 @@ GameLib.D3.Scene.prototype.toApiScene = function() {
|
|||
* @param graphics GameLib.D3.Graphics
|
||||
* @param objectScene Object
|
||||
* @param computeNormals boolean to indicate whether or not to recalculate normals
|
||||
* @param imageFactory GameLib.D3.ImageFactory
|
||||
* @returns {GameLib.D3.Scene}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Scene.FromObjectScene = function(
|
||||
graphics,
|
||||
objectScene,
|
||||
computeNormals
|
||||
computeNormals,
|
||||
imageFactory
|
||||
) {
|
||||
var apiScene = GameLib.D3.API.Scene.FromObjectScene(objectScene);
|
||||
var apiScene = GameLib.D3.API.Scene.FromObjectScene(objectScene, imageFactory);
|
||||
|
||||
return new GameLib.D3.Scene(
|
||||
graphics,
|
||||
|
@ -276,18 +281,21 @@ GameLib.D3.Scene.FromObjectScene = function(
|
|||
* @param objectScene Object (as it comes from the API)
|
||||
* @param computeNormals
|
||||
* @param onLoaded
|
||||
* @param imageFactory GameLib.D3.ImageFactory
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Scene.LoadScene = function(
|
||||
graphics,
|
||||
objectScene,
|
||||
computeNormals,
|
||||
onLoaded
|
||||
onLoaded,
|
||||
imageFactory
|
||||
) {
|
||||
var scene = GameLib.D3.Scene.FromObjectScene(
|
||||
graphics,
|
||||
objectScene,
|
||||
computeNormals
|
||||
computeNormals,
|
||||
imageFactory
|
||||
);
|
||||
|
||||
onLoaded(scene);
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.Skeleton = function Skeleton(
|
|||
apiSkeleton = {};
|
||||
}
|
||||
|
||||
if (apiSkeleton instanceof GameLib.D3.Skeleton) {
|
||||
return apiSkeleton;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Skeleton.call(
|
||||
this,
|
||||
apiSkeleton.id,
|
||||
|
|
|
@ -15,6 +15,10 @@ GameLib.D3.Spline = function (
|
|||
apiSpline = {};
|
||||
}
|
||||
|
||||
if (apiSpline instanceof GameLib.D3.Spline) {
|
||||
return apiSpline;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Spline.call(
|
||||
this,
|
||||
apiSpline.id,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @param imageFactory GameLib.D3.ImageFactory
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Texture = function Texture(
|
||||
GameLib.D3.Texture = function(
|
||||
graphics,
|
||||
apiTexture,
|
||||
imageFactory
|
||||
|
@ -18,6 +18,10 @@ GameLib.D3.Texture = function Texture(
|
|||
apiTexture = {};
|
||||
}
|
||||
|
||||
if (apiTexture instanceof GameLib.D3.Texture) {
|
||||
return apiTexture;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
|
||||
console.warn('Cannot create a Texture without specifying an ImageFactory');
|
||||
imageFactory = null;
|
||||
|
|
|
@ -15,7 +15,11 @@ GameLib.D3.Vertex = function Vertex(
|
|||
apiVertex = {};
|
||||
}
|
||||
|
||||
GameLib.D3.API.Vertex.call(
|
||||
if (apiVertex instanceof GameLib.D3.Vertex) {
|
||||
return apiVertex;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Vertex.call(
|
||||
this,
|
||||
apiVertex.position,
|
||||
apiVertex.boneWeights
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* Viewport Runtime
|
||||
* @param graphics GameLib.D3.Graphics
|
||||
* @param apiViewport GameLib.D3.API.Viewport
|
||||
* @param imageFactory GameLib.D3.ImageFactory
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Viewport = function (
|
||||
|
@ -17,6 +16,10 @@ GameLib.D3.Viewport = function (
|
|||
apiViewport = {};
|
||||
}
|
||||
|
||||
if (apiViewport instanceof GameLib.D3.Viewport) {
|
||||
return apiViewport;
|
||||
}
|
||||
|
||||
GameLib.D3.API.Viewport.call(
|
||||
this,
|
||||
apiViewport.id,
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
*/
|
||||
GameLib.DomElement = function (apiDomElement) {
|
||||
|
||||
if (apiDomElement instanceof GameLib.DomElement) {
|
||||
return apiDomElement;
|
||||
}
|
||||
|
||||
GameLib.API.DomElement.call(
|
||||
this,
|
||||
apiDomElement.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.EntityManager = function(
|
|||
apiEntityManager = {};
|
||||
}
|
||||
|
||||
if (apiEntityManager instanceof GameLib.EntityManager) {
|
||||
return apiEntityManager;
|
||||
}
|
||||
|
||||
GameLib.API.EntityManager.call(
|
||||
this,
|
||||
apiEntityManager.id,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.Entity = function (
|
|||
apiEntity = {};
|
||||
}
|
||||
|
||||
if (apiEntity instanceof GameLib.Entity) {
|
||||
return apiEntity;
|
||||
}
|
||||
|
||||
GameLib.API.Entity.call(
|
||||
this,
|
||||
apiEntity.id,
|
||||
|
|
|
@ -20,6 +20,10 @@ GameLib.Matrix4 = function(
|
|||
apiMatrix4 = {};
|
||||
}
|
||||
|
||||
if (apiMatrix4 instanceof GameLib.Matrix4) {
|
||||
return apiMatrix4;
|
||||
}
|
||||
|
||||
GameLib.API.Matrix4.call(
|
||||
this,
|
||||
apiMatrix4.rows[0],
|
||||
|
|
|
@ -13,6 +13,10 @@ GameLib.Mouse = function (graphics, apiMouse) {
|
|||
apiMouse = {};
|
||||
}
|
||||
|
||||
if (apiMouse instanceof GameLib.Mouse) {
|
||||
return apiMouse;
|
||||
}
|
||||
|
||||
GameLib.API.Mouse.call(
|
||||
this,
|
||||
apiMouse.id,
|
||||
|
|
|
@ -19,6 +19,10 @@ GameLib.Quaternion = function (
|
|||
apiQuaternion = {};
|
||||
}
|
||||
|
||||
if (apiQuaternion instanceof GameLib.Quaternion) {
|
||||
return apiQuaternion;
|
||||
}
|
||||
|
||||
GameLib.API.Quaternion.call(
|
||||
this,
|
||||
apiQuaternion.x,
|
||||
|
|
|
@ -16,6 +16,10 @@ GameLib.System = function(
|
|||
apiSystem = {};
|
||||
}
|
||||
|
||||
if (apiSystem instanceof GameLib.System) {
|
||||
return apiSystem;
|
||||
}
|
||||
|
||||
GameLib.API.System.call(
|
||||
this,
|
||||
apiSystem.id,
|
||||
|
|
|
@ -19,6 +19,10 @@ GameLib.Vector2 = function (
|
|||
apiVector2 = {};
|
||||
}
|
||||
|
||||
if (apiVector2 instanceof GameLib.Vector2) {
|
||||
return apiVector2;
|
||||
}
|
||||
|
||||
GameLib.API.Vector2.call(
|
||||
this,
|
||||
apiVector2.x,
|
||||
|
|
|
@ -19,6 +19,10 @@ GameLib.Vector3 = function (
|
|||
apiVector3 = {};
|
||||
}
|
||||
|
||||
if (apiVector3 instanceof GameLib.Vector3) {
|
||||
return apiVector3;
|
||||
}
|
||||
|
||||
GameLib.API.Vector3.call(
|
||||
this,
|
||||
apiVector3.x,
|
||||
|
|
|
@ -20,7 +20,11 @@ GameLib.Vector4 = function (
|
|||
apiVector4 = {};
|
||||
}
|
||||
|
||||
GameLib.API.Vector4.call(
|
||||
if (apiVector4 instanceof GameLib.Vector4) {
|
||||
return apiVector4;
|
||||
}
|
||||
|
||||
GameLib.API.Vector4.call(
|
||||
this,
|
||||
apiVector4.x,
|
||||
apiVector4.y,
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = GameLib;
|
||||
}
|
Loading…
Reference in New Issue