loading first components from db

beta.r3js.org
Theunis J. Botha 2017-06-14 14:21:57 +02:00
parent d174999cf9
commit e4ec592a0b
65 changed files with 240 additions and 226 deletions

View File

@ -26,43 +26,43 @@ GameLib.API.Component.prototype.constructor = GameLib.API.Component;
* @returns {GameLib.API.Component} * @returns {GameLib.API.Component}
* @constructor * @constructor
*/ */
GameLib.API.Component.FromObjectComponent = function(objectComponent) { GameLib.API.Component.FromObject = function(objectComponent) {
if (objectComponent instanceof Object) { if (objectComponent instanceof Object) {
if (objectComponent.componentType == GameLib.Component.COMPONENT_PATH_FOLLOWING) { if (objectComponent.componentType == GameLib.Component.COMPONENT_PATH_FOLLOWING) {
return GameLib.D3.API.PathFollowing.FromObjectComponent(objectComponent); return GameLib.D3.API.PathFollowing.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_RENDERER) { if (objectComponent.componentType === GameLib.Component.COMPONENT_RENDERER) {
return GameLib.D3.API.Renderer.FromObjectComponent(objectComponent); return GameLib.D3.API.Renderer.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_COMPOSER) { if (objectComponent.componentType === GameLib.Component.COMPONENT_COMPOSER) {
return GameLib.D3.API.Composer.FromObjectComponent(objectComponent); return GameLib.D3.API.Composer.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_PASS) { if (objectComponent.componentType === GameLib.Component.COMPONENT_PASS) {
return GameLib.D3.API.Pass.FromObjectComponent(objectComponent); return GameLib.D3.API.Pass.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_LOOK_AT) { if (objectComponent.componentType === GameLib.Component.COMPONENT_LOOK_AT) {
return GameLib.D3.API.LookAt.FromObjectComponent(objectComponent); return GameLib.D3.API.LookAt.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_FOLLOW) { if (objectComponent.componentType === GameLib.Component.COMPONENT_FOLLOW) {
return GameLib.D3.API.Follow.FromObjectComponent(objectComponent); return GameLib.D3.API.Follow.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_RENDER_TARGET) { if (objectComponent.componentType === GameLib.Component.COMPONENT_RENDER_TARGET) {
return GameLib.D3.API.RenderTarget.FromObjectComponent(objectComponent); return GameLib.D3.API.RenderTarget.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_SPLINE) { if (objectComponent.componentType === GameLib.Component.COMPONENT_SPLINE) {
return GameLib.D3.API.Spline.FromObjectComponent(objectComponent); return GameLib.D3.API.Spline.FromObject(objectComponent);
} }
if (objectComponent.componentType === GameLib.Component.COMPONENT_INPUT_DRIVE) { if (objectComponent.componentType === GameLib.Component.COMPONENT_INPUT_DRIVE) {
return GameLib.D3.API.Input.Drive.FromObjectComponent(objectComponent); return GameLib.D3.API.Input.Drive.FromObject(objectComponent);
} }
console.warn('No API Component was associated with this Object'); console.warn('No API Component was associated with this Object');

View File

@ -81,37 +81,37 @@ GameLib.Component.COMPONENT_IMAGE = 0x1f;
*/ */
GameLib.Component.GetComponentName = function(number) { GameLib.Component.GetComponentName = function(number) {
switch(number) { switch(number) {
case 0x1 : return 'PathFollowing'; case 0x1 : return 'GameLib.D3.PathFollowing';
case 0x2 : return 'Material'; case 0x2 : return 'GameLib.D3.Material';
case 0x3 : return 'Renderer'; case 0x3 : return 'GameLib.D3.Renderer';
case 0x4 : return 'LookAt'; case 0x4 : return 'GameLib.D3.LookAt';
case 0x5 : return 'Camera'; case 0x5 : return 'GameLib.D3.Camera';
case 0x6 : return 'Follow'; case 0x6 : return 'GameLib.D3.Follow';
case 0x7 : return 'Mesh'; case 0x7 : return 'GameLib.D3.Mesh';
case 0x8 : return 'Spline'; case 0x8 : return 'GameLib.D3.Spline';
case 0x9 : return 'Light'; case 0x9 : return 'GameLib.D3.Light';
case 0xa : return 'InputDrive'; case 0xa : return 'GameLib.D3.InputDrive';
case 0xb : return 'Composer'; case 0xb : return 'GameLib.D3.Composer';
case 0xc : return 'RenderTarget'; case 0xc : return 'GameLib.D3.RenderTarget';
case 0xd : return 'Pass'; case 0xd : return 'GameLib.D3.Pass';
case 0xe : return 'Scene'; case 0xe : return 'GameLib.D3.Scene';
case 0xf : return 'Game'; case 0xf : return 'GameLib.D3.Game';
case 0x10 : return 'InputEditor'; case 0x10 : return 'GameLib.D3.InputEditor';
case 0x11 : return 'Editor'; case 0x11 : return 'GameLib.D3.Editor';
case 0x12 : return 'Viewport'; case 0x12 : return 'GameLib.D3.Viewport';
case 0x13 : return 'System'; case 0x13 : return 'GameLib.System';
case 0x14 : return 'Graphics'; case 0x14 : return 'GameLib.D3.Graphics';
case 0x15 : return 'Helper'; case 0x15 : return 'GameLib.D3.Helper';
case 0x16 : return 'CustomCode'; case 0x16 : return 'GameLib.D3.CustomCode';
case 0x17 : return 'Mouse'; case 0x17 : return 'GameLib.Mouse';
case 0x18 : return 'Skeleton'; case 0x18 : return 'GameLib.D3.Skeleton';
case 0x19 : return 'Texture'; case 0x19 : return 'GameLib.D3.Texture';
case 0x1a : return 'EntityManager'; case 0x1a : return 'GameLib.EntityManager';
case 0x1b : return 'DomElement'; case 0x1b : return 'GameLib.DomElement';
case 0x1c : return 'ImageFactory'; case 0x1c : return 'GameLib.D3.ImageFactory';
case 0x1d : return 'Stats'; case 0x1d : return 'GameLib.D3.Stats';
case 0x1e : return 'GUI'; case 0x1e : return 'GameLib.GUI';
case 0x1f : return 'Image'; case 0x1f : return 'GameLib.D3.Image';
break; break;
} }
}; };

View File

@ -35,7 +35,7 @@ GameLib.API.Color = function (r, g, b, a) {
* @param objectColor * @param objectColor
* @constructor * @constructor
*/ */
GameLib.API.Color.FromObjectColor = function(objectColor) { GameLib.API.Color.FromObject = function(objectColor) {
return new GameLib.API.Color( return new GameLib.API.Color(
objectColor.r, objectColor.r,

View File

@ -49,7 +49,7 @@ GameLib.API.DomElement.prototype.constructor = GameLib.API.DomElement;
* @param objectDomElement * @param objectDomElement
* @constructor * @constructor
*/ */
GameLib.API.DomElement.FromObjectDomElement = function (objectDomElement) { GameLib.API.DomElement.FromObject = function (objectDomElement) {
return new GameLib.API.DomElement( return new GameLib.API.DomElement(
objectDomElement.id, objectDomElement.id,
objectDomElement.name, objectDomElement.name,

View File

@ -51,17 +51,17 @@ GameLib.API.EntityManager.prototype.constructor = GameLib.API.EntityManager;
* @param objectEntityManager * @param objectEntityManager
* @constructor * @constructor
*/ */
GameLib.API.EntityManager.FromObjectEntityManager = function(objectEntityManager) { GameLib.API.EntityManager.FromObject = function(objectEntityManager) {
var apiEntities = objectEntityManager.entities.map( var apiEntities = objectEntityManager.entities.map(
function (objectEntity) { function (objectEntity) {
return GameLib.API.Entity.FromObjectEntity(objectEntity); return GameLib.API.Entity.FromObject(objectEntity);
} }
); );
// var apiSystems = objectEntityManager.systems.map( // var apiSystems = objectEntityManager.systems.map(
// function (objectSystem) { // function (objectSystem) {
// return GameLib.API.System.FromObjectComponent(objectSystem); // return GameLib.API.System.FromObject(objectSystem);
// } // }
// ); // );

View File

@ -60,11 +60,11 @@ GameLib.API.Entity.prototype.constructor = GameLib.API.Entity;
* @param objectEntity * @param objectEntity
* @constructor * @constructor
*/ */
GameLib.API.Entity.FromObjectEntity = function(objectEntity) { GameLib.API.Entity.FromObject = function(objectEntity) {
var apiComponents = objectEntity.components.map( var apiComponents = objectEntity.components.map(
function (objectComponent) { function (objectComponent) {
return GameLib.API.Component.FromObjectComponent(objectComponent); return GameLib.API.Component.FromObject(objectComponent);
} }
); );

View File

@ -61,21 +61,21 @@ GameLib.API.Matrix4 = function ApiMatrix4(
* @param objectMatrix * @param objectMatrix
* @constructor * @constructor
*/ */
GameLib.API.Matrix4.FromObjectMatrix = function(objectMatrix) { GameLib.API.Matrix4.FromObject = function(objectMatrix) {
if (objectMatrix.rows) { if (objectMatrix.rows) {
return new GameLib.API.Matrix4( return new GameLib.API.Matrix4(
GameLib.API.Vector4.FromObjectVector(objectMatrix.rows[0]), GameLib.API.Vector4.FromObject(objectMatrix.rows[0]),
GameLib.API.Vector4.FromObjectVector(objectMatrix.rows[1]), GameLib.API.Vector4.FromObject(objectMatrix.rows[1]),
GameLib.API.Vector4.FromObjectVector(objectMatrix.rows[2]), GameLib.API.Vector4.FromObject(objectMatrix.rows[2]),
GameLib.API.Vector4.FromObjectVector(objectMatrix.rows[3]) GameLib.API.Vector4.FromObject(objectMatrix.rows[3])
); );
} else if (objectMatrix instanceof Array) { } else if (objectMatrix instanceof Array) {
return new GameLib.API.Matrix4( return new GameLib.API.Matrix4(
GameLib.API.Vector4.FromObjectVector(objectMatrix[0]), GameLib.API.Vector4.FromObject(objectMatrix[0]),
GameLib.API.Vector4.FromObjectVector(objectMatrix[1]), GameLib.API.Vector4.FromObject(objectMatrix[1]),
GameLib.API.Vector4.FromObjectVector(objectMatrix[2]), GameLib.API.Vector4.FromObject(objectMatrix[2]),
GameLib.API.Vector4.FromObjectVector(objectMatrix[3]) GameLib.API.Vector4.FromObject(objectMatrix[3])
); );
} else { } else {
console.warn('Unsupported object matrix type - whats your DB version?'); console.warn('Unsupported object matrix type - whats your DB version?');

View File

@ -57,7 +57,7 @@ GameLib.API.Mouse.prototype.constructor = GameLib.API.Mouse;
* @param objectMouse * @param objectMouse
* @constructor * @constructor
*/ */
GameLib.API.Mouse.FromObjectMouse = function (objectMouse) { GameLib.API.Mouse.FromObject = function (objectMouse) {
return new GameLib.API.Mouse( return new GameLib.API.Mouse(
objectMouse.id, objectMouse.id,
objectMouse.name, objectMouse.name,

View File

@ -218,12 +218,12 @@ GameLib.API.Quaternion.prototype.slerp = function (quaternion, t) {
* @param objectQuaternion * @param objectQuaternion
* @constructor * @constructor
*/ */
GameLib.API.Quaternion.FromObjectQuaternion = function (objectQuaternion) { GameLib.API.Quaternion.FromObject = function (objectQuaternion) {
var apiAxis = null; var apiAxis = null;
if (objectQuaternion.axis) { if (objectQuaternion.axis) {
apiAxis = GameLib.API.Vector3.FromObjectVector(objectQuaternion.axis); apiAxis = GameLib.API.Vector3.FromObject(objectQuaternion.axis);
} }
return new GameLib.API.Quaternion( return new GameLib.API.Quaternion(

View File

@ -53,7 +53,7 @@ GameLib.API.System.prototype.constructor = GameLib.API.System;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.API.System.FromObjectComponent = function(objectComponent) { GameLib.API.System.FromObject = function(objectComponent) {
return new GameLib.API.System( return new GameLib.API.System(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -24,7 +24,7 @@ GameLib.API.Vector2.prototype.copy = function () {
* @param objectVector * @param objectVector
* @constructor * @constructor
*/ */
GameLib.API.Vector2.FromObjectVector = function (objectVector) { GameLib.API.Vector2.FromObject = function (objectVector) {
return new GameLib.API.Vector2( return new GameLib.API.Vector2(
objectVector.x, objectVector.x,
objectVector.y objectVector.y

View File

@ -258,7 +258,7 @@ GameLib.API.Vector3.prototype.angleTo = function (v) {
* @param objectVector * @param objectVector
* @constructor * @constructor
*/ */
GameLib.API.Vector3.FromObjectVector = function (objectVector) { GameLib.API.Vector3.FromObject = function (objectVector) {
return new GameLib.API.Vector3( return new GameLib.API.Vector3(
objectVector.x, objectVector.x,
objectVector.y, objectVector.y,

View File

@ -26,7 +26,7 @@ GameLib.API.Vector4 = function (x, y, z, w) {
* @param objectVector * @param objectVector
* @constructor * @constructor
*/ */
GameLib.API.Vector4.FromObjectVector = function (objectVector) { GameLib.API.Vector4.FromObject = function (objectVector) {
return new GameLib.API.Vector4( return new GameLib.API.Vector4(
objectVector.x, objectVector.x,
objectVector.y, objectVector.y,

View File

@ -18,7 +18,7 @@ GameLib.D3.API.BoneWeight = function (
* @returns {GameLib.D3.API.BoneWeight} * @returns {GameLib.D3.API.BoneWeight}
* @constructor * @constructor
*/ */
GameLib.D3.API.BoneWeight.FromObjectBoneWeight = function(objectBoneWeight) { GameLib.D3.API.BoneWeight.FromObject = function(objectBoneWeight) {
return new GameLib.D3.API.BoneWeight( return new GameLib.D3.API.BoneWeight(
objectBoneWeight.boneIndex, objectBoneWeight.boneIndex,
objectBoneWeight.weight objectBoneWeight.weight

View File

@ -67,15 +67,15 @@ GameLib.D3.API.Bone = function (
* @param objectBone * @param objectBone
* @constructor * @constructor
*/ */
GameLib.D3.API.Bone.FromObjectBone = function(objectBone) { GameLib.D3.API.Bone.FromObject = function(objectBone) {
return new GameLib.D3.API.Bone( return new GameLib.D3.API.Bone(
objectBone.id, objectBone.id,
objectBone.name, objectBone.name,
objectBone.childBoneIds, objectBone.childBoneIds,
objectBone.parentBoneIds, objectBone.parentBoneIds,
GameLib.API.Vector3.FromObjectVector(objectBone.position), GameLib.API.Vector3.FromObject(objectBone.position),
GameLib.API.Quaternion.FromObjectQuaternion(objectBone.quaternion), GameLib.API.Quaternion.FromObject(objectBone.quaternion),
GameLib.API.Vector3.FromObjectVector(objectBone.scale), GameLib.API.Vector3.FromObject(objectBone.scale),
GameLib.API.Vector3.FromObjectVector(objectBone.up) GameLib.API.Vector3.FromObject(objectBone.up)
); );
}; };

View File

@ -156,7 +156,7 @@ GameLib.D3.API.Camera.prototype.constructor = GameLib.D3.API.Camera;
* @param objectCamera * @param objectCamera
* @constructor * @constructor
*/ */
GameLib.D3.API.Camera.FromObjectCamera = function(objectCamera) { GameLib.D3.API.Camera.FromObject = function(objectCamera) {
return new GameLib.D3.API.Camera( return new GameLib.D3.API.Camera(
objectCamera.id, objectCamera.id,
@ -166,15 +166,15 @@ GameLib.D3.API.Camera.FromObjectCamera = function(objectCamera) {
objectCamera.aspect, objectCamera.aspect,
objectCamera.near, objectCamera.near,
objectCamera.far, objectCamera.far,
GameLib.API.Vector3.FromObjectVector(objectCamera.position), GameLib.API.Vector3.FromObject(objectCamera.position),
GameLib.API.Vector3.FromObjectVector(objectCamera.lookAt), GameLib.API.Vector3.FromObject(objectCamera.lookAt),
objectCamera.minX, objectCamera.minX,
objectCamera.maxX, objectCamera.maxX,
objectCamera.minY, objectCamera.minY,
objectCamera.maxY, objectCamera.maxY,
objectCamera.minZ, objectCamera.minZ,
objectCamera.maxZ, objectCamera.maxZ,
GameLib.API.Quaternion.FromObjectQuaternion(objectCamera.quaternion), GameLib.API.Quaternion.FromObject(objectCamera.quaternion),
objectCamera.parentEntity, objectCamera.parentEntity,
objectCamera.eyeSeparation, objectCamera.eyeSeparation,
objectCamera.focalLength objectCamera.focalLength

View File

@ -62,7 +62,7 @@ GameLib.D3.API.Composer.prototype.constructor = GameLib.D3.API.Composer;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.Composer.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Composer.FromObject = function(objectComponent) {
return new GameLib.D3.API.Composer( return new GameLib.D3.API.Composer(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -61,7 +61,7 @@ GameLib.D3.API.CustomCode.prototype.constructor = GameLib.D3.API.CustomCode;
* @returns {GameLib.D3.API.CustomCode} * @returns {GameLib.D3.API.CustomCode}
* @constructor * @constructor
*/ */
GameLib.D3.API.CustomCode.FromObjectComponent = function(objectComponent) { GameLib.D3.API.CustomCode.FromObject = function(objectComponent) {
return new GameLib.D3.API.CustomCode( return new GameLib.D3.API.CustomCode(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -84,13 +84,13 @@ GameLib.D3.API.Follow.prototype.constructor = GameLib.D3.API.Follow;
* @returns {GameLib.D3.API.Follow} * @returns {GameLib.D3.API.Follow}
* @constructor * @constructor
*/ */
GameLib.D3.API.Follow.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Follow.FromObject = function(objectComponent) {
return new GameLib.D3.API.Follow( return new GameLib.D3.API.Follow(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,
objectComponent.currentComponent, objectComponent.currentComponent,
objectComponent.targetComponent, objectComponent.targetComponent,
GameLib.API.Vector3.FromObjectVector(objectComponent.targetPositionOffset), GameLib.API.Vector3.FromObject(objectComponent.targetPositionOffset),
objectComponent.minDistance, objectComponent.minDistance,
objectComponent.moveSpeed, objectComponent.moveSpeed,
objectComponent.parentEntity objectComponent.parentEntity

View File

@ -44,7 +44,7 @@ GameLib.D3.API.ImageFactory.prototype.constructor = GameLib.D3.API.ImageFactory;
* @param objectImageFactory * @param objectImageFactory
* @constructor * @constructor
*/ */
GameLib.D3.API.ImageFactory.FromObjectImageFactory = function(objectImageFactory) { GameLib.D3.API.ImageFactory.FromObject = function(objectImageFactory) {
return new GameLib.D3.API.ImageFactory( return new GameLib.D3.API.ImageFactory(
objectImageFactory.id, objectImageFactory.id,
objectImageFactory.name, objectImageFactory.name,

View File

@ -114,7 +114,7 @@ GameLib.D3.API.Input.Drive.prototype.constructor = GameLib.D3.API.Input.Drive;
* @returns {GameLib.D3.API.Input.Drive} * @returns {GameLib.D3.API.Input.Drive}
* @constructor * @constructor
*/ */
GameLib.D3.API.Input.Drive.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Input.Drive.FromObject = function(objectComponent) {
return new GameLib.D3.API.Input.Drive( return new GameLib.D3.API.Input.Drive(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -54,7 +54,7 @@ GameLib.D3.API.Input.Editor.prototype.constructor = GameLib.D3.API.Input.Editor;
* @returns {GameLib.D3.API.Input.Editor} * @returns {GameLib.D3.API.Input.Editor}
* @constructor * @constructor
*/ */
GameLib.D3.API.Input.Editor.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Input.Editor.FromObject = function(objectComponent) {
return new GameLib.D3.API.Input.Editor( return new GameLib.D3.API.Input.Editor(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -136,18 +136,18 @@ GameLib.D3.API.Light.prototype.constructor = GameLib.D3.API.Light;
* @param objectLight * @param objectLight
* @constructor * @constructor
*/ */
GameLib.D3.API.Light.FromObjectLight = function(objectLight) { GameLib.D3.API.Light.FromObject = function(objectLight) {
return new GameLib.D3.API.Light( return new GameLib.D3.API.Light(
objectLight.id, objectLight.id,
objectLight.lightType, objectLight.lightType,
objectLight.name, objectLight.name,
GameLib.API.Color.FromObjectColor(objectLight.color), GameLib.API.Color.FromObject(objectLight.color),
objectLight.intensity, objectLight.intensity,
GameLib.API.Vector3.FromObjectVector(objectLight.position), GameLib.API.Vector3.FromObject(objectLight.position),
GameLib.API.Vector3.FromObjectVector(objectLight.targetPosition), GameLib.API.Vector3.FromObject(objectLight.targetPosition),
GameLib.API.Quaternion.FromObjectQuaternion(objectLight.quaternion), GameLib.API.Quaternion.FromObject(objectLight.quaternion),
GameLib.API.Vector3.FromObjectVector(objectLight.rotation), GameLib.API.Vector3.FromObject(objectLight.rotation),
GameLib.API.Vector3.FromObjectVector(objectLight.scale), GameLib.API.Vector3.FromObject(objectLight.scale),
objectLight.distance, objectLight.distance,
objectLight.decay, objectLight.decay,
objectLight.power, objectLight.power,

View File

@ -77,13 +77,13 @@ GameLib.D3.API.LookAt.prototype.constructor = GameLib.D3.API.LookAt;
* @returns {GameLib.D3.API.LookAt} * @returns {GameLib.D3.API.LookAt}
* @constructor * @constructor
*/ */
GameLib.D3.API.LookAt.FromObjectComponent = function(objectComponent) { GameLib.D3.API.LookAt.FromObject = function(objectComponent) {
return new GameLib.D3.API.LookAt( return new GameLib.D3.API.LookAt(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,
objectComponent.currentComponent, objectComponent.currentComponent,
objectComponent.targetComponent, objectComponent.targetComponent,
GameLib.API.Vector3.FromObjectVector(objectComponent.targetPositionOffset), GameLib.API.Vector3.FromObject(objectComponent.targetPositionOffset),
objectComponent.rotationSpeed, objectComponent.rotationSpeed,
objectComponent.parentEntity objectComponent.parentEntity
); );

View File

@ -515,7 +515,7 @@ GameLib.D3.API.Material.prototype.constructor = GameLib.D3.API.Material;
* @param objectMaterial * @param objectMaterial
* @constructor * @constructor
*/ */
GameLib.D3.API.Material.FromObjectMaterial = function(objectMaterial) { GameLib.D3.API.Material.FromObject = function(objectMaterial) {
var apiAlphaMap = null; var apiAlphaMap = null;
var apiAoMap = null; var apiAoMap = null;
@ -585,11 +585,11 @@ GameLib.D3.API.Material.FromObjectMaterial = function(objectMaterial) {
objectMaterial.opacity, objectMaterial.opacity,
objectMaterial.side, objectMaterial.side,
objectMaterial.transparent, objectMaterial.transparent,
GameLib.API.Color.FromObjectColor(objectMaterial.specular), GameLib.API.Color.FromObject(objectMaterial.specular),
objectMaterial.lightMapIntensity, objectMaterial.lightMapIntensity,
objectMaterial.aoMapIntensity, objectMaterial.aoMapIntensity,
GameLib.API.Color.FromObjectColor(objectMaterial.color), GameLib.API.Color.FromObject(objectMaterial.color),
GameLib.API.Color.FromObjectColor(objectMaterial.emissive), GameLib.API.Color.FromObject(objectMaterial.emissive),
objectMaterial.emissiveIntensity, objectMaterial.emissiveIntensity,
objectMaterial.combine, objectMaterial.combine,
objectMaterial.shininess, objectMaterial.shininess,

View File

@ -174,12 +174,12 @@ GameLib.D3.API.Mesh.prototype.constructor = GameLib.D3.API.Mesh;
* @param objectMesh * @param objectMesh
* @constructor * @constructor
*/ */
GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){ GameLib.D3.API.Mesh.FromObject = function (objectMesh){
var apiSkeleton = null; var apiSkeleton = null;
if (objectMesh.skeleton) { if (objectMesh.skeleton) {
apiSkeleton = GameLib.D3.API.Skeleton.FromObjectSkeleton(objectMesh.skeleton); apiSkeleton = GameLib.D3.API.Skeleton.FromObject(objectMesh.skeleton);
} }
var apiMaterials = []; var apiMaterials = [];
@ -190,7 +190,7 @@ GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){
* From blender we only get Ids to materials (strings) * From blender we only get Ids to materials (strings)
*/ */
if (objectMaterial instanceof Object) { if (objectMaterial instanceof Object) {
return GameLib.D3.API.Material.FromObjectMaterial(objectMaterial); return GameLib.D3.API.Material.FromObject(objectMaterial);
} else { } else {
return objectMaterial return objectMaterial
} }
@ -202,49 +202,49 @@ GameLib.D3.API.Mesh.FromObjectMesh = function (objectMesh){
if (objectMesh.vertices) { if (objectMesh.vertices) {
apiVertices = objectMesh.vertices.map( apiVertices = objectMesh.vertices.map(
function (objectVertex) { function (objectVertex) {
return GameLib.D3.API.Vertex.FromObjectVertex(objectVertex); return GameLib.D3.API.Vertex.FromObject(objectVertex);
} }
) )
} }
var apiPosition = new GameLib.API.Vector3(); var apiPosition = new GameLib.API.Vector3();
if (objectMesh.position) { if (objectMesh.position) {
apiPosition = GameLib.API.Vector3.FromObjectVector(objectMesh.position); apiPosition = GameLib.API.Vector3.FromObject(objectMesh.position);
} }
var apiQuaternion = new GameLib.API.Quaternion(); var apiQuaternion = new GameLib.API.Quaternion();
if (objectMesh.quaternion) { if (objectMesh.quaternion) {
apiQuaternion = GameLib.API.Quaternion.FromObjectQuaternion(objectMesh.quaternion); apiQuaternion = GameLib.API.Quaternion.FromObject(objectMesh.quaternion);
} }
var apiScale = new GameLib.API.Vector3(1,1,1); var apiScale = new GameLib.API.Vector3(1,1,1);
if (objectMesh.scale) { if (objectMesh.scale) {
apiScale = GameLib.API.Vector3.FromObjectVector(objectMesh.scale); apiScale = GameLib.API.Vector3.FromObject(objectMesh.scale);
} }
var apiLocalPosition = new GameLib.API.Vector3(); var apiLocalPosition = new GameLib.API.Vector3();
if (objectMesh.localPosition) { if (objectMesh.localPosition) {
apiLocalPosition = GameLib.API.Vector3.FromObjectVector(objectMesh.localPosition); apiLocalPosition = GameLib.API.Vector3.FromObject(objectMesh.localPosition);
} }
var apiLocalRotation = new GameLib.API.Vector3(); var apiLocalRotation = new GameLib.API.Vector3();
if (objectMesh.localRotation) { if (objectMesh.localRotation) {
apiLocalRotation = GameLib.API.Vector3.FromObjectVector(objectMesh.localRotation); apiLocalRotation = GameLib.API.Vector3.FromObject(objectMesh.localRotation);
} }
var apiLocalScale = new GameLib.API.Vector3(1,1,1); var apiLocalScale = new GameLib.API.Vector3(1,1,1);
if (objectMesh.localScale) { if (objectMesh.localScale) {
apiLocalScale = GameLib.API.Vector3.FromObjectVector(objectMesh.localScale); apiLocalScale = GameLib.API.Vector3.FromObject(objectMesh.localScale);
} }
var apiUp = new GameLib.API.Vector3(0,1,0); var apiUp = new GameLib.API.Vector3(0,1,0);
if (objectMesh.up) { if (objectMesh.up) {
apiUp = GameLib.API.Vector3.FromObjectVector(objectMesh.up); apiUp = GameLib.API.Vector3.FromObject(objectMesh.up);
} }
var apiModelMatrix = new GameLib.API.Matrix4(); var apiModelMatrix = new GameLib.API.Matrix4();
if (objectMesh.modelMatrix) { if (objectMesh.modelMatrix) {
apiModelMatrix = GameLib.API.Matrix4.FromObjectMatrix(objectMesh.modelMatrix); apiModelMatrix = GameLib.API.Matrix4.FromObject(objectMesh.modelMatrix);
} }
return new GameLib.D3.API.Mesh( return new GameLib.D3.API.Mesh(

View File

@ -78,7 +78,7 @@ GameLib.D3.API.Pass.prototype.constructor = GameLib.D3.API.Pass;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.Pass.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Pass.FromObject = function(objectComponent) {
return new GameLib.D3.API.Pass( return new GameLib.D3.API.Pass(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -174,12 +174,12 @@ GameLib.D3.API.PathFollowing.prototype.constructor = GameLib.D3.API.PathFollowin
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.PathFollowing.FromObjectComponent = function(objectComponent) { GameLib.D3.API.PathFollowing.FromObject = function(objectComponent) {
var apiRaycaster = null; var apiRaycaster = null;
if (objectComponent.raycaster) { if (objectComponent.raycaster) {
apiRaycaster = GameLib.D3.API.Raycaster.FromObjectRaycaster(objectComponent.raycaster); apiRaycaster = GameLib.D3.API.Raycaster.FromObject(objectComponent.raycaster);
} }
return new GameLib.D3.API.PathFollowing( return new GameLib.D3.API.PathFollowing(
@ -190,20 +190,20 @@ GameLib.D3.API.PathFollowing.FromObjectComponent = function(objectComponent) {
objectComponent.raytraceMesh, objectComponent.raytraceMesh,
objectComponent.accelleration, objectComponent.accelleration,
objectComponent.maxSpeed, objectComponent.maxSpeed,
GameLib.API.Vector3.FromObjectVector(objectComponent.baseOffset), GameLib.API.Vector3.FromObject(objectComponent.baseOffset),
GameLib.API.Vector3.FromObjectVector(objectComponent.maxOffset), GameLib.API.Vector3.FromObject(objectComponent.maxOffset),
objectComponent.steeringSpeed, objectComponent.steeringSpeed,
GameLib.API.Vector3.FromObjectVector(objectComponent.targetOffset), GameLib.API.Vector3.FromObject(objectComponent.targetOffset),
GameLib.API.Vector3.FromObjectVector(objectComponent.currentOffset), GameLib.API.Vector3.FromObject(objectComponent.currentOffset),
objectComponent.currentPathValue, objectComponent.currentPathValue,
objectComponent.currentSpeed, objectComponent.currentSpeed,
objectComponent.direction, objectComponent.direction,
apiRaycaster, apiRaycaster,
GameLib.API.Vector3.FromObjectVector(objectComponent.currentPosition), GameLib.API.Vector3.FromObject(objectComponent.currentPosition),
GameLib.API.Vector3.FromObjectVector(objectComponent.futurePosition), GameLib.API.Vector3.FromObject(objectComponent.futurePosition),
GameLib.API.Vector3.FromObjectVector(objectComponent.up), GameLib.API.Vector3.FromObject(objectComponent.up),
GameLib.API.Matrix4.FromObjectMatrix(objectComponent.rotationMatrix), GameLib.API.Matrix4.FromObject(objectComponent.rotationMatrix),
GameLib.API.Quaternion.FromObjectQuaternion(objectComponent.rotationVector), GameLib.API.Quaternion.FromObject(objectComponent.rotationVector),
objectComponent.parentEntity objectComponent.parentEntity
); );
}; };

View File

@ -39,11 +39,11 @@ GameLib.D3.API.Raycaster = function(
* @param objectRaycaster * @param objectRaycaster
* @constructor * @constructor
*/ */
GameLib.D3.API.Raycaster.FromObjectRaycaster = function(objectRaycaster) { GameLib.D3.API.Raycaster.FromObject = function(objectRaycaster) {
return new GameLib.D3.API.Raycaster( return new GameLib.D3.API.Raycaster(
objectRaycaster.id, objectRaycaster.id,
objectRaycaster.name, objectRaycaster.name,
GameLib.API.Vector3.FromObjectVector(objectRaycaster.position), GameLib.API.Vector3.FromObject(objectRaycaster.position),
GameLib.API.Vector3.FromObjectVector(objectRaycaster.direction) GameLib.API.Vector3.FromObject(objectRaycaster.direction)
); );
}; };

View File

@ -89,7 +89,7 @@ GameLib.D3.API.RenderTarget.prototype.constructor = GameLib.D3.API.RenderTarget;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.RenderTarget.FromObjectComponent = function(objectComponent) { GameLib.D3.API.RenderTarget.FromObject = function(objectComponent) {
return new GameLib.D3.API.RenderTarget( return new GameLib.D3.API.RenderTarget(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -88,7 +88,7 @@ GameLib.D3.API.Renderer.prototype.constructor = GameLib.D3.API.Renderer;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.Renderer.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Renderer.FromObject = function(objectComponent) {
return new GameLib.D3.API.Renderer( return new GameLib.D3.API.Renderer(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,

View File

@ -114,7 +114,7 @@ GameLib.D3.API.Scene.prototype.constructor = GameLib.D3.API.Scene;
* @param objectScene * @param objectScene
* @constructor * @constructor
*/ */
GameLib.D3.API.Scene.FromObjectScene = function(objectScene) { GameLib.D3.API.Scene.FromObject = function(objectScene) {
var apiMeshes = []; var apiMeshes = [];
var apiLights = []; var apiLights = [];
@ -131,7 +131,7 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
if (objectScene.meshes) { if (objectScene.meshes) {
apiMeshes = objectScene.meshes.map( apiMeshes = objectScene.meshes.map(
function(objectMesh) { function(objectMesh) {
return GameLib.D3.API.Mesh.FromObjectMesh(objectMesh); return GameLib.D3.API.Mesh.FromObject(objectMesh);
} }
) )
} }
@ -139,7 +139,7 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
if (objectScene.lights) { if (objectScene.lights) {
apiLights = objectScene.lights.map( apiLights = objectScene.lights.map(
function(objectLight) { function(objectLight) {
return GameLib.D3.API.Light.FromObjectLight(objectLight); return GameLib.D3.API.Light.FromObject(objectLight);
} }
) )
} }
@ -147,7 +147,7 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
if (objectScene.textures) { if (objectScene.textures) {
apiTextures = objectScene.textures.map( apiTextures = objectScene.textures.map(
function(objectTexture) { function(objectTexture) {
return GameLib.D3.API.Texture.FromObjectTexture(objectTexture) return GameLib.D3.API.Texture.FromObject(objectTexture)
} }
) )
} }
@ -155,7 +155,7 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
if (objectScene.materials) { if (objectScene.materials) {
apiMaterials = objectScene.materials.map( apiMaterials = objectScene.materials.map(
function(objectMaterial) { function(objectMaterial) {
return GameLib.D3.API.Material.FromObjectMaterial(objectMaterial) return GameLib.D3.API.Material.FromObject(objectMaterial)
} }
) )
} }
@ -169,15 +169,15 @@ GameLib.D3.API.Scene.FromObjectScene = function(objectScene) {
} }
if (objectScene.position) { if (objectScene.position) {
apiPosition = GameLib.API.Vector3.FromObjectVector(objectScene.position); apiPosition = GameLib.API.Vector3.FromObject(objectScene.position);
} }
if (objectScene.quaternion) { if (objectScene.quaternion) {
apiQuaternion = GameLib.API.Quaternion.FromObjectQuaternion(objectScene.quaternion); apiQuaternion = GameLib.API.Quaternion.FromObject(objectScene.quaternion);
} }
if (objectScene.scale) { if (objectScene.scale) {
apiScale = GameLib.API.Vector3.FromObjectVector(objectScene.scale); apiScale = GameLib.API.Vector3.FromObject(objectScene.scale);
} }
if (objectScene.activeCamera) { if (objectScene.activeCamera) {

View File

@ -101,18 +101,18 @@ GameLib.D3.API.Skeleton.prototype.constructor = GameLib.D3.API.Skeleton;
* @param objectSkeleton * @param objectSkeleton
* @constructor * @constructor
*/ */
GameLib.D3.API.Skeleton.FromObjectSkeleton = function(objectSkeleton) { GameLib.D3.API.Skeleton.FromObject = function(objectSkeleton) {
return new GameLib.D3.API.Skeleton( return new GameLib.D3.API.Skeleton(
objectSkeleton.id, objectSkeleton.id,
objectSkeleton.name, objectSkeleton.name,
objectSkeleton.bones.map( objectSkeleton.bones.map(
function (objectBone) { function (objectBone) {
return GameLib.D3.API.Bone.FromObjectBone(objectBone); return GameLib.D3.API.Bone.FromObject(objectBone);
} }
), ),
objectSkeleton.boneInverses.map( objectSkeleton.boneInverses.map(
function (boneInverse) { function (boneInverse) {
return GameLib.D3.API.Matrix4.FromObjectMatrix(boneInverse); return GameLib.D3.API.Matrix4.FromObject(boneInverse);
} }
), ),
objectSkeleton.useVertexTexture, objectSkeleton.useVertexTexture,
@ -120,7 +120,7 @@ GameLib.D3.API.Skeleton.FromObjectSkeleton = function(objectSkeleton) {
objectSkeleton.boneTextureHeight, objectSkeleton.boneTextureHeight,
objectSkeleton.boneMatrices.map( objectSkeleton.boneMatrices.map(
function (boneMatrix) { function (boneMatrix) {
return GameLib.D3.API.Matrix4.FromObjectMatrix(boneMatrix); return GameLib.D3.API.Matrix4.FromObject(boneMatrix);
} }
), ),
objectSkeleton.boneTexture, objectSkeleton.boneTexture,

View File

@ -43,13 +43,13 @@ GameLib.D3.API.Spline.prototype.constructor = GameLib.D3.API.Spline;
* @param objectComponent * @param objectComponent
* @constructor * @constructor
*/ */
GameLib.D3.API.Spline.FromObjectComponent = function(objectComponent) { GameLib.D3.API.Spline.FromObject = function(objectComponent) {
return new GameLib.D3.API.Spline( return new GameLib.D3.API.Spline(
objectComponent.id, objectComponent.id,
objectComponent.name, objectComponent.name,
objectComponent.vertices.map( objectComponent.vertices.map(
function (objectVertex) { function (objectVertex) {
return GameLib.API.Vector3.FromObjectVector(objectVertex); return GameLib.API.Vector3.FromObject(objectVertex);
} }
), ),
objectComponent.parentEntity objectComponent.parentEntity

View File

@ -178,7 +178,7 @@ GameLib.D3.API.Texture.prototype.constructor = GameLib.D3.API.Texture;
* @param objectTexture * @param objectTexture
* @constructor * @constructor
*/ */
GameLib.D3.API.Texture.FromObjectTexture = function(objectTexture) { GameLib.D3.API.Texture.FromObject = function(objectTexture) {
return new GameLib.D3.API.Texture( return new GameLib.D3.API.Texture(
objectTexture.id, objectTexture.id,
objectTexture.textureType, objectTexture.textureType,
@ -186,7 +186,7 @@ GameLib.D3.API.Texture.FromObjectTexture = function(objectTexture) {
objectTexture.image, objectTexture.image,
objectTexture.wrapS, objectTexture.wrapS,
objectTexture.wrapT, objectTexture.wrapT,
GameLib.API.Vector2.FromObjectVector(objectTexture.repeat), GameLib.API.Vector2.FromObject(objectTexture.repeat),
objectTexture.data, objectTexture.data,
objectTexture.format, objectTexture.format,
objectTexture.mapping, objectTexture.mapping,
@ -194,7 +194,7 @@ GameLib.D3.API.Texture.FromObjectTexture = function(objectTexture) {
objectTexture.minFilter, objectTexture.minFilter,
objectTexture.textureType, objectTexture.textureType,
objectTexture.anisotropy, objectTexture.anisotropy,
GameLib.API.Vector2.FromObjectVector(objectTexture.offset), GameLib.API.Vector2.FromObject(objectTexture.offset),
objectTexture.generateMipmaps, objectTexture.generateMipmaps,
objectTexture.flipY, objectTexture.flipY,
objectTexture.mipmaps, objectTexture.mipmaps,

View File

@ -25,12 +25,12 @@ GameLib.D3.API.Vertex = function(
* @param objectVertex * @param objectVertex
* @constructor * @constructor
*/ */
GameLib.D3.API.Vertex.FromObjectVertex = function(objectVertex) { GameLib.D3.API.Vertex.FromObject = function(objectVertex) {
return new GameLib.D3.API.Vertex( return new GameLib.D3.API.Vertex(
GameLib.API.Vector3.FromObjectVector(objectVertex.position), GameLib.API.Vector3.FromObject(objectVertex.position),
objectVertex.boneWeights.map( objectVertex.boneWeights.map(
function(boneWeight) { function(boneWeight) {
return GameLib.D3.API.BoneWeight.FromObjectBoneWeight(boneWeight); return GameLib.D3.API.BoneWeight.FromObject(boneWeight);
} }
) )
); );

View File

@ -73,7 +73,7 @@ GameLib.D3.API.Viewport.prototype.constructor = GameLib.D3.API.Viewport;
* @param objectViewport * @param objectViewport
* @constructor * @constructor
*/ */
GameLib.D3.API.Viewport.FromObjectComponent = function(objectViewport) { GameLib.D3.API.Viewport.FromObject = function(objectViewport) {
return new GameLib.D3.API.Viewport( return new GameLib.D3.API.Viewport(
objectViewport.id, objectViewport.id,
objectViewport.name, objectViewport.name,

View File

@ -50,11 +50,11 @@ GameLib.D3.BoneWeight.prototype.toApiObject = function() {
* @returns {GameLib.D3.BoneWeight} * @returns {GameLib.D3.BoneWeight}
* @constructor * @constructor
*/ */
GameLib.D3.BoneWeight.FromObjectBoneWeight = function( GameLib.D3.BoneWeight.FromObject = function(
graphics, graphics,
objectBoneWeight objectBoneWeight
) { ) {
var apiBoneWeight = GameLib.D3.API.BoneWeight.FromObjectBoneWeight(objectBoneWeight); var apiBoneWeight = GameLib.D3.API.BoneWeight.FromObject(objectBoneWeight);
var boneWeight = new GameLib.D3.BoneWeight( var boneWeight = new GameLib.D3.BoneWeight(
graphics, graphics,

View File

@ -132,11 +132,11 @@ GameLib.D3.Bone.prototype.toApiObject = function() {
* @returns {GameLib.D3.Bone} * @returns {GameLib.D3.Bone}
* @constructor * @constructor
*/ */
GameLib.D3.Bone.FromObjectBone = function( GameLib.D3.Bone.FromObject = function(
graphics, graphics,
objectBone objectBone
) { ) {
var apiBone = GameLib.D3.API.Bone.FromObjectBone(objectBone); var apiBone = GameLib.D3.API.Bone.FromObject(objectBone);
var bone = GameLib.D3.Bone( var bone = GameLib.D3.Bone(
graphics, graphics,

View File

@ -225,9 +225,9 @@ GameLib.D3.Camera.prototype.toApiObject = function() {
* @returns {GameLib.D3.Camera} * @returns {GameLib.D3.Camera}
* @constructor * @constructor
*/ */
GameLib.D3.Camera.FromObjectCamera = function(graphics, objectCamera) { GameLib.D3.Camera.FromObject = function(graphics, objectCamera) {
var apiCamera = GameLib.D3.API.Camera.FromObjectCamera(objectCamera); var apiCamera = GameLib.D3.API.Camera.FromObject(objectCamera);
return new GameLib.D3.Camera( return new GameLib.D3.Camera(
graphics, graphics,

View File

@ -138,9 +138,9 @@ GameLib.D3.Composer.prototype.toApiObject = function() {
* @returns {GameLib.D3.Composer} * @returns {GameLib.D3.Composer}
* @constructor * @constructor
*/ */
GameLib.D3.Composer.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Composer.FromObject = function(graphics, objectComponent) {
var apiComposer = GameLib.D3.API.Composer.FromObjectComponent(objectComponent); var apiComposer = GameLib.D3.API.Composer.FromObject(objectComponent);
return new GameLib.D3.Composer( return new GameLib.D3.Composer(
graphics, graphics,

View File

@ -88,9 +88,9 @@ GameLib.D3.CustomCode.prototype.toApiObject = function() {
* @returns {GameLib.D3.CustomCode} * @returns {GameLib.D3.CustomCode}
* @constructor * @constructor
*/ */
GameLib.D3.CustomCode.FromObjectCustomCode = function(objectCustomCode) { GameLib.D3.CustomCode.FromObject = function(objectCustomCode) {
var apiCustomCode = GameLib.D3.API.CustomCode.FromObjectCustomCode(objectCustomCode); var apiCustomCode = GameLib.D3.API.CustomCode.FromObject(objectCustomCode);
return new GameLib.D3.CustomCode( return new GameLib.D3.CustomCode(
apiCustomCode apiCustomCode

View File

@ -84,9 +84,9 @@ GameLib.D3.Follow.prototype.toApiObject = function() {
return apiFollow; return apiFollow;
}; };
GameLib.D3.Follow.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Follow.FromObject = function(graphics, objectComponent) {
var apiFollow = GameLib.D3.API.Follow.FromObjectComponent(objectComponent); var apiFollow = GameLib.D3.API.Follow.FromObject(objectComponent);
return new GameLib.D3.Follow( return new GameLib.D3.Follow(
graphics, graphics,

View File

@ -140,11 +140,11 @@ GameLib.D3.ImageFactory.prototype.toApiObject = function() {
* @param objectImageFactory GameLib.D3.API.ImageFactory * @param objectImageFactory GameLib.D3.API.ImageFactory
* @returns {GameLib.D3.ImageFactory} * @returns {GameLib.D3.ImageFactory}
*/ */
GameLib.D3.ImageFactory.FromObjectImageFactory = function(graphics, objectImageFactory) { GameLib.D3.ImageFactory.FromObject = function(graphics, objectImageFactory) {
return new GameLib.D3.ImageFactory( return new GameLib.D3.ImageFactory(
graphics, graphics,
GameLib.D3.API.ImageFactory.FromObjectImageFactory(objectImageFactory) GameLib.D3.API.ImageFactory.FromObject(objectImageFactory)
); );
}; };

View File

@ -125,9 +125,9 @@ GameLib.D3.Input.Drive.prototype.toApiObject = function() {
return apiInputDrive; return apiInputDrive;
}; };
GameLib.D3.Input.Drive.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Input.Drive.FromObject = function(graphics, objectComponent) {
var apiInputDrive = GameLib.D3.API.Input.Drive.FromObjectComponent(objectComponent); var apiInputDrive = GameLib.D3.API.Input.Drive.FromObject(objectComponent);
return new GameLib.D3.Input.Drive( return new GameLib.D3.Input.Drive(
graphics, graphics,

View File

@ -107,9 +107,9 @@ GameLib.D3.Input.Editor.prototype.toApiObject = function() {
return apiInputEditor; return apiInputEditor;
}; };
GameLib.D3.Input.Editor.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Input.Editor.FromObject = function(graphics, objectComponent) {
var apiInputEditor = GameLib.D3.API.Input.Editor.FromObjectComponent(objectComponent); var apiInputEditor = GameLib.D3.API.Input.Editor.FromObject(objectComponent);
return new GameLib.D3.Input.Editor( return new GameLib.D3.Input.Editor(
graphics, graphics,
@ -270,7 +270,7 @@ GameLib.D3.Input.Editor.prototype.onMouseDown = function(entity, entityManager)
return function(event) { return function(event) {
if (event.button === 2) { if (event.button === 0 || event.button === 2) {
if (this.controlLeft) { if (this.controlLeft) {
return; return;

View File

@ -304,11 +304,11 @@ GameLib.D3.Light.prototype.toApiObject = function() {
* @param objectLight GameLib.D3.API.Light * @param objectLight GameLib.D3.API.Light
* @returns {GameLib.D3.Light} * @returns {GameLib.D3.Light}
*/ */
GameLib.D3.Light.FromObjectLight = function(graphics, objectLight) { GameLib.D3.Light.FromObject = function(graphics, objectLight) {
return new GameLib.D3.Light( return new GameLib.D3.Light(
graphics, graphics,
GameLib.D3.API.Light.FromObjectLight(objectLight) GameLib.D3.API.Light.FromObject(objectLight)
); );
}; };

View File

@ -81,9 +81,9 @@ GameLib.D3.LookAt.prototype.toApiObject = function() {
return apiLookAt; return apiLookAt;
}; };
GameLib.D3.LookAt.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.LookAt.FromObject = function(graphics, objectComponent) {
var apiLookAt = GameLib.D3.API.LookAt.FromObjectComponent(objectComponent); var apiLookAt = GameLib.D3.API.LookAt.FromObject(objectComponent);
return new GameLib.D3.LookAt( return new GameLib.D3.LookAt(
graphics, graphics,

View File

@ -1096,11 +1096,11 @@ GameLib.D3.Material.prototype.toApiObject = function(save) {
* @param objectMaterial Object * @param objectMaterial Object
* @constructor * @constructor
*/ */
GameLib.D3.Material.FromObjectMaterial = function(graphics, objectMaterial) { GameLib.D3.Material.FromObject = function(graphics, objectMaterial) {
var gameLibMaterial = new GameLib.D3.Material( var gameLibMaterial = new GameLib.D3.Material(
graphics, graphics,
GameLib.D3.API.Material.FromObjectMaterial(objectMaterial) GameLib.D3.API.Material.FromObject(objectMaterial)
); );
return gameLibMaterial; return gameLibMaterial;

View File

@ -536,9 +536,9 @@ GameLib.D3.Mesh.prototype.toApiObject = function(save) {
* @param objectMesh {Object} * @param objectMesh {Object}
* @constructor * @constructor
*/ */
GameLib.D3.Mesh.FromObjectMesh = function(graphics, objectMesh) { GameLib.D3.Mesh.FromObject = function(graphics, objectMesh) {
var apiMesh = GameLib.D3.API.Mesh.FromObjectMesh(objectMesh); var apiMesh = GameLib.D3.API.Mesh.FromObject(objectMesh);
return new GameLib.D3.Mesh( return new GameLib.D3.Mesh(
graphics, graphics,

View File

@ -77,9 +77,9 @@ GameLib.D3.Mesh.Sphere.prototype.toApiObject = function() {
* @param imageFactory GameLib.D3.ImageFactory * @param imageFactory GameLib.D3.ImageFactory
* @constructor * @constructor
*/ */
GameLib.D3.Mesh.Sphere.FromObjectMesh = function(graphics, objectMesh, computeNormals, imageFactory) { GameLib.D3.Mesh.Sphere.FromObject = function(graphics, objectMesh, computeNormals, imageFactory) {
var apiMesh = GameLib.D3.API.Mesh.FromObjectMesh(objectMesh); var apiMesh = GameLib.D3.API.Mesh.FromObject(objectMesh);
return new GameLib.D3.Mesh.Sphere( return new GameLib.D3.Mesh.Sphere(
graphics, graphics,

View File

@ -123,9 +123,9 @@ GameLib.D3.Pass.prototype.toApiObject = function() {
* @returns {GameLib.D3.Pass} * @returns {GameLib.D3.Pass}
* @constructor * @constructor
*/ */
GameLib.D3.Pass.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Pass.FromObject = function(graphics, objectComponent) {
var apiPass = GameLib.D3.API.Pass.FromObjectComponent(objectComponent); var apiPass = GameLib.D3.API.Pass.FromObject(objectComponent);
return new GameLib.D3.Pass( return new GameLib.D3.Pass(
graphics, graphics,

View File

@ -152,9 +152,9 @@ GameLib.D3.PathFollowing.prototype.toApiObject = function() {
* @returns {GameLib.D3.PathFollowing} * @returns {GameLib.D3.PathFollowing}
* @constructor * @constructor
*/ */
GameLib.D3.PathFollowing.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.PathFollowing.FromObject = function(graphics, objectComponent) {
var apiPathFollowing = GameLib.D3.API.PathFollowing.FromObjectComponent(objectComponent); var apiPathFollowing = GameLib.D3.API.PathFollowing.FromObject(objectComponent);
return new GameLib.D3.PathFollowing( return new GameLib.D3.PathFollowing(
graphics, graphics,

View File

@ -81,9 +81,9 @@ GameLib.D3.Raycaster.prototype.toApiObject = function() {
) )
}; };
GameLib.D3.Raycaster.FromObjectRaycaster = function(graphics, parentObject, objectRaycaster) { GameLib.D3.Raycaster.FromObject = function(graphics, parentObject, objectRaycaster) {
var apiRaycaster = GameLib.D3.API.Raycaster.FromObjectRaycaster(objectRaycaster); var apiRaycaster = GameLib.D3.API.Raycaster.FromObject(objectRaycaster);
var raycaster = new GameLib.D3.Raycaster( var raycaster = new GameLib.D3.Raycaster(
graphics, graphics,

View File

@ -124,9 +124,9 @@ GameLib.D3.RenderTarget.prototype.toApiObject = function() {
* @returns {GameLib.D3.RenderTarget} * @returns {GameLib.D3.RenderTarget}
* @constructor * @constructor
*/ */
GameLib.D3.RenderTarget.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.RenderTarget.FromObject = function(graphics, objectComponent) {
var apiRenderTarget = GameLib.D3.API.RenderTarget.FromObjectComponent(objectComponent); var apiRenderTarget = GameLib.D3.API.RenderTarget.FromObject(objectComponent);
return new GameLib.D3.RenderTarget( return new GameLib.D3.RenderTarget(
graphics, graphics,

View File

@ -122,9 +122,9 @@ GameLib.D3.Renderer.prototype.toApiObject = function() {
* @returns {GameLib.D3.Renderer} * @returns {GameLib.D3.Renderer}
* @constructor * @constructor
*/ */
GameLib.D3.Renderer.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Renderer.FromObject = function(graphics, objectComponent) {
var apiRenderer = GameLib.D3.API.Renderer.FromObjectComponent(objectComponent); var apiRenderer = GameLib.D3.API.Renderer.FromObject(objectComponent);
return new GameLib.D3.Renderer( return new GameLib.D3.Renderer(
graphics, graphics,

View File

@ -266,11 +266,11 @@ GameLib.D3.Scene.prototype.toApiObject = function(save) {
* @returns {GameLib.D3.Scene} * @returns {GameLib.D3.Scene}
* @constructor * @constructor
*/ */
GameLib.D3.Scene.FromObjectScene = function( GameLib.D3.Scene.FromObject = function(
graphics, graphics,
objectScene objectScene
) { ) {
var apiScene = GameLib.D3.API.Scene.FromObjectScene(objectScene); var apiScene = GameLib.D3.API.Scene.FromObject(objectScene);
return new GameLib.D3.Scene( return new GameLib.D3.Scene(
graphics, graphics,

View File

@ -213,7 +213,7 @@ GameLib.D3.Skeleton.prototype.toApiObject = function() {
* @returns {GameLib.D3.Skeleton} * @returns {GameLib.D3.Skeleton}
* @constructor * @constructor
*/ */
GameLib.D3.Skeleton.FromObjectSkeleton = function( GameLib.D3.Skeleton.FromObject = function(
graphics, graphics,
objectSkeleton objectSkeleton
) { ) {
@ -222,7 +222,7 @@ GameLib.D3.Skeleton.FromObjectSkeleton = function(
return null; return null;
} }
var apiSkeleton = GameLib.D3.API.Skeleton.FromObjectSkeleton(objectSkeleton); var apiSkeleton = GameLib.D3.API.Skeleton.FromObject(objectSkeleton);
var skeleton = new GameLib.D3.Skeleton( var skeleton = new GameLib.D3.Skeleton(
graphics, graphics,

View File

@ -95,11 +95,11 @@ GameLib.D3.Spline.prototype.toApiObject = function() {
* @returns {GameLib.D3.Spline} * @returns {GameLib.D3.Spline}
* @constructor * @constructor
*/ */
GameLib.D3.Spline.FromObjectComponent = function( GameLib.D3.Spline.FromObject = function(
graphics, graphics,
objectComponent objectComponent
) { ) {
var apiSpline = GameLib.D3.API.Spline.FromObjectComponent(objectComponent); var apiSpline = GameLib.D3.API.Spline.FromObject(objectComponent);
return new GameLib.D3.Spline( return new GameLib.D3.Spline(
graphics, graphics,

View File

@ -391,11 +391,11 @@ GameLib.D3.Texture.prototype.toApiObject = function(save) {
* @param objectTexture Object * @param objectTexture Object
* @constructor * @constructor
*/ */
GameLib.D3.Texture.FromObjectTexture = function( GameLib.D3.Texture.FromObject = function(
graphics, graphics,
objectTexture objectTexture
) { ) {
var apiTexture = GameLib.D3.API.Texture.FromObjectTexture(objectTexture); var apiTexture = GameLib.D3.API.Texture.FromObject(objectTexture);
return new GameLib.D3.Texture( return new GameLib.D3.Texture(
graphics, graphics,

View File

@ -66,11 +66,11 @@ GameLib.D3.Vertex.prototype.toApiObject = function() {
* @returns {GameLib.D3.Vertex} * @returns {GameLib.D3.Vertex}
* @constructor * @constructor
*/ */
GameLib.D3.Vertex.FromObjectVertex = function( GameLib.D3.Vertex.FromObject = function(
graphics, graphics,
objectVertex objectVertex
) { ) {
var apiVertex = GameLib.D3.API.Vertex.FromObjectVertex(objectVertex); var apiVertex = GameLib.D3.API.Vertex.FromObject(objectVertex);
return new GameLib.D3.Vertex( return new GameLib.D3.Vertex(
graphics, graphics,

View File

@ -94,9 +94,9 @@ GameLib.D3.Viewport.prototype.toApiObject = function() {
* @returns {GameLib.D3.Viewport} * @returns {GameLib.D3.Viewport}
* @constructor * @constructor
*/ */
GameLib.D3.Viewport.FromObjectComponent = function(graphics, objectComponent) { GameLib.D3.Viewport.FromObject = function(graphics, objectComponent) {
var apiViewport = GameLib.D3.API.Viewport.FromObjectComponent(objectComponent); var apiViewport = GameLib.D3.API.Viewport.FromObject(objectComponent);
return new GameLib.D3.Viewport( return new GameLib.D3.Viewport(
graphics, graphics,

View File

@ -303,9 +303,9 @@ GameLib.EntityManager.prototype.toApiObject = function() {
* @param objectEntityManager Object * @param objectEntityManager Object
* @constructor * @constructor
*/ */
GameLib.EntityManager.FromObjectEntityManager = function(graphics, objectEntityManager) { GameLib.EntityManager.FromObject = function(graphics, objectEntityManager) {
var apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectEntityManager); var apiEntityManager = GameLib.API.EntityManager.FromObject(objectEntityManager);
var entityManager = new GameLib.EntityManager( var entityManager = new GameLib.EntityManager(
graphics, graphics,
@ -331,14 +331,19 @@ GameLib.EntityManager.prototype.onParentSceneChange = function(data) {
*/ */
var helper = this.findHelperByObject(data.object); var helper = this.findHelperByObject(data.object);
if (helper) { if (helper) {
data.originalScene.instance.remove(helper.instance);
if (data.originalScene && data.originalScene.instance) {
data.originalScene.instance.remove(helper.instance);
}
data.newScene.instance.add(helper.instance); data.newScene.instance.add(helper.instance);
} }
/** /**
* We remove the mesh from the old scene and add it to the new scene * We remove the mesh from the old scene and add it to the new scene
*/ */
data.originalScene.removeObject(data.object); if (data.originalScene && data.originalScene.removeObject) {
data.originalScene.removeObject(data.object);
}
data.newScene.addObject(data.object); data.newScene.addObject(data.object);
/** /**
@ -355,33 +360,42 @@ GameLib.EntityManager.prototype.onParentSceneChange = function(data) {
newEntity = data.newScene.parentEntity; newEntity = data.newScene.parentEntity;
} }
if (originalEntity && newEntity) { var gui = null;
/** if (originalEntity) {
* We also transfer the helper (as a component) to the new entity
*/
if (helper) {
originalEntity.removeComponent(helper);
newEntity.addComponent(helper);
}
originalEntity.removeComponent(data.object); if (originalEntity.removeComponent) {
newEntity.addComponent(data.object); if (helper) {
originalEntity.removeComponent(helper);
}
originalEntity.removeComponent(data.object);
}
/** if (originalEntity.getFirstComponent) {
* Now also remove the object from the GUI gui = originalEntity.getFirstComponent(GameLib.GUI);
*/ if (gui) {
var gui = originalEntity.getFirstComponent(GameLib.GUI); gui.removeObject(data.object);
if (gui) { gui.build(this);
gui.removeObject(data.object); }
gui.build(this); }
}
gui = newEntity.getFirstComponent(GameLib.GUI); if (newEntity) {
if (gui) {
gui.addObject(data.object); if (newEntity.addComponent) {
gui.build(this); if (helper) {
} newEntity.addComponent(helper);
} }
newEntity.addComponent(data.object);
}
if (newEntity.getFirstComponent) {
gui = newEntity.getFirstComponent(GameLib.GUI);
if (gui) {
gui.addObject(data.object);
gui.build(this);
}
}
} }
} }

View File

@ -228,9 +228,9 @@ GameLib.Entity.prototype.toApiObject = function() {
* @param objectEntity Object * @param objectEntity Object
* @constructor * @constructor
*/ */
GameLib.Entity.FromObjectEntity = function(graphics, objectEntity) { GameLib.Entity.FromObject = function(graphics, objectEntity) {
var apiEntity = GameLib.API.Entity.FromObjectEntity(objectEntity); var apiEntity = GameLib.API.Entity.FromObject(objectEntity);
return new GameLib.Entity( return new GameLib.Entity(
graphics, graphics,

View File

@ -167,9 +167,9 @@ GameLib.Matrix4.prototype.toApiObject = function () {
* @returns {GameLib.Matrix4} * @returns {GameLib.Matrix4}
* @constructor * @constructor
*/ */
GameLib.Matrix4.FromObjectMatrix = function(graphics, objectMatrix, parentObject) { GameLib.Matrix4.FromObject = function(graphics, objectMatrix, parentObject) {
var apiMatrix = new GameLib.API.Matrix4.FromObjectMatrix(objectMatrix); var apiMatrix = new GameLib.API.Matrix4.FromObject(objectMatrix);
return new GameLib.Matrix4( return new GameLib.Matrix4(
graphics, graphics,