sockets runtime, component construction

beta.r3js.org
-=yb4f310 2017-12-02 11:49:27 +01:00
parent df490baa34
commit ececa4428a
82 changed files with 3006 additions and 1543 deletions

28
build/game-lib-min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,7 @@ GameLib.Event.STOP_VISUALIZE = 0x3d;
GameLib.Event.FETCH_COMPONENT_TYPES = 0x3e;
GameLib.Event.FETCH_COMPONENTS = 0x3f;
GameLib.Event.GET_API_URL = 0x40;
GameLib.Event.GET_PHYSICS_IMPLEMENTATION = 0x41;
GameLib.Event.GET_RUNTIME = 0x41;
GameLib.Event.PARENT_WORLD_CHANGE = 0x42;
GameLib.Event.ANIMATE = 0x43;
GameLib.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
@ -92,9 +92,9 @@ GameLib.Event.TOUCH_END = 0x4a;
GameLib.Event.TOUCH_MOVE = 0x4b;
GameLib.Event.TOUCH_CANCEL = 0x4c;
GameLib.Event.GET_REMOTE_API_URL = 0x4d;
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION = 0x4e;
//GameLib.Event.GET_GRAPHICS_RUNTIME = 0x4e;
GameLib.Event.DELAYED_INSTANCE_ENCOUNTERED = 0x4f;
GameLib.Event.GET_CODER_IMPLEMENTATION = 0x50;
//GameLib.Event.GET_CODER_IMPLEMENTATION = 0x50;
GameLib.Event.ANIMATION_MESH_ADDED = 0x51;
GameLib.Event.ANIMATION_MESH_REMOVED = 0x52;
GameLib.Event.GET_SCENE = 0x53;
@ -199,7 +199,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x3e : return 'fetch_component_types';
case 0x3f : return 'fetch_components';
case 0x40 : return 'get_api_url';
case 0x41 : return 'get_physics_implementation';
case 0x41 : return 'get_runtime';
case 0x42 : return 'parent_world_change';
case 0x43 : return 'animate';
case 0x44 : return 'animation_compile_success';
@ -212,9 +212,9 @@ GameLib.Event.GetEventName = function(number) {
case 0x4b : return 'touch_move';
case 0x4c : return 'touch_cancel';
case 0x4d : return 'get_remote_api_url';
case 0x4e : return 'get_graphics_implementation';
case 0x4e : return 'unused';//'get_graphics_implementation';
case 0x4f : return 'delayed_instance_encountered';
case 0x50 : return 'get_coder_implementation';
case 0x50 : return 'unused';//'get_coder_implementation';
case 0x51 : return 'animation_mesh_added';
case 0x52 : return 'animation_mesh_removed';
case 0x53 : return 'get_scene';

View File

@ -212,23 +212,23 @@ GameLib.Component.prototype.toString = function() {
return this.id;
};
GameLib.Component.COMPONENT_PATH_FOLLOWING = 0x1;
//GameLib.Component.COMPONENT_PATH_FOLLOWING = 0x1;
GameLib.Component.COMPONENT_MATERIAL = 0x2;
GameLib.Component.COMPONENT_RENDERER = 0x3;
GameLib.Component.COMPONENT_LOOK_AT = 0x4;
//GameLib.Component.COMPONENT_LOOK_AT = 0x4;
GameLib.Component.COMPONENT_CAMERA = 0x5;
GameLib.Component.COMPONENT_FOLLOW = 0x6;
//GameLib.Component.COMPONENT_FOLLOW = 0x6;
GameLib.Component.COMPONENT_MESH = 0x7;
GameLib.Component.COMPONENT_SPLINE = 0x8;
GameLib.Component.COMPONENT_LIGHT = 0x9;
GameLib.Component.COMPONENT_INPUT_DRIVE = 0xa;
//GameLib.Component.COMPONENT_INPUT_DRIVE = 0xa;
GameLib.Component.COMPONENT_COMPOSER = 0xb;
GameLib.Component.COMPONENT_RENDER_TARGET = 0xc;
GameLib.Component.COMPONENT_PASS = 0xd;
GameLib.Component.COMPONENT_SCENE = 0xe;
GameLib.Component.COMPONENT_RAYCASTER = 0xf;
GameLib.Component.COMPONENT_INPUT_EDITOR = 0x10;
GameLib.Component.COMPONENT_EDITOR = 0x11;
//GameLib.Component.COMPONENT_INPUT_EDITOR = 0x10;
//GameLib.Component.COMPONENT_EDITOR = 0x11;
GameLib.Component.COMPONENT_VIEWPORT = 0x12;
GameLib.Component.COMPONENT_SYSTEM = 0x13;
GameLib.Component.COMPONENT_GRAPHICS = 0x14;
@ -239,7 +239,7 @@ GameLib.Component.COMPONENT_SKELETON = 0x18;
GameLib.Component.COMPONENT_TEXTURE = 0x19;
GameLib.Component.COMPONENT_ENTITY_MANAGER = 0x1a;
GameLib.Component.COMPONENT_DOM_ELEMENT = 0x1b;
GameLib.Component.COMPONENT_IMAGE_FACTORY = 0x1c;
//GameLib.Component.COMPONENT_IMAGE_FACTORY = 0x1c;
GameLib.Component.COMPONENT_STATS = 0x1d;
GameLib.Component.COMPONENT_GUI = 0x1e;
GameLib.Component.COMPONENT_IMAGE = 0x1f;
@ -292,6 +292,15 @@ GameLib.Component.COMPONENT_SYSTEM_PARTICLE = 0x53;
GameLib.Component.COMPONENT_PARTICLE = 0x54;
GameLib.Component.COMPONENT_AUDIO = 0x55;
GameLib.Component.COMPONENT_SYSTEM_AUDIO = 0x56;
GameLib.Component.COMPONENT_CAST = 0x57;
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
GameLib.Component.PHYSICS_RUNTIME = 0x2;
GameLib.Component.SOCKET_RUNTIME = 0x3;
GameLib.Component.STATISTICS_RUNTIME = 0x4;
GameLib.Component.DEFAULT_RUNTIME = 0x5;
GameLib.Component.GUI_RUNTIME = 0x6;
GameLib.Component.CODER_RUNTIME = 0x7;
/**
* Returns string name for component number
@ -299,94 +308,344 @@ GameLib.Component.COMPONENT_SYSTEM_AUDIO = 0x56;
* @returns {*}
* @constructor
*/
GameLib.Component.GetComponentName = function(number) {
GameLib.Component.GetComponentInfo = function(number) {
switch(number) {
case 0x1 : return 'GameLib.D3.PathFollowing';
case 0x2 : return 'GameLib.D3.Material';
case 0x3 : return 'GameLib.D3.Renderer';
case 0x4 : return 'GameLib.D3.LookAt';
case 0x5 : return 'GameLib.D3.Camera';
case 0x6 : return 'GameLib.D3.Follow';
case 0x7 : return 'GameLib.D3.Mesh';
case 0x8 : return 'GameLib.D3.Spline';
case 0x9 : return 'GameLib.D3.Light';
case 0xa : return 'GameLib.D3.InputDrive';
case 0xb : return 'GameLib.D3.Composer';
case 0xc : return 'GameLib.D3.RenderTarget';
case 0xd : return 'GameLib.D3.Pass';
case 0xe : return 'GameLib.D3.Scene';
case 0xf : return 'GameLib.D3.Raycaster';
case 0x10 : return 'GameLib.D3.InputEditor';
case 0x11 : return 'GameLib.D3.Editor';
case 0x12 : return 'GameLib.D3.Viewport';
case 0x13 : return 'GameLib.System';
case 0x14 : return 'GameLib.D3.Graphics';
case 0x15 : return 'GameLib.D3.Helper';
case 0x16 : return 'GameLib.D3.CustomCode';
case 0x17 : return 'GameLib.Mouse';
case 0x18 : return 'GameLib.D3.Skeleton';
case 0x19 : return 'GameLib.D3.Texture';
case 0x1a : return 'GameLib.EntityManager';
case 0x1b : return 'GameLib.DomElement';
case 0x1c : return 'GameLib.D3.ImageFactory';
case 0x1d : return 'GameLib.D3.Stats';
case 0x1e : return 'GameLib.GUI';
case 0x1f : return 'GameLib.D3.Image';
case 0x20 : return 'GameLib.Entity';
case 0x21 : return 'GameLib.D3.Mesh.Sphere';
case 0x22 : return 'GameLib.D3.Mesh.Plane';
case 0x23 : return 'GameLib.D3.Mesh.Curve';
case 0x24 : return 'GameLib.D3.PhysicsWorld';
case 0x25 : return 'GameLib.D3.Broadphase';
case 0x26 : return 'GameLib.D3.Solver';
case 0x27 : return 'GameLib.D3.RigidBody';
case 0x28 : return 'GameLib.D3.Shape';
case 0x29 : return 'GameLib.D3.Shape.Box';
case 0x2a : return 'GameLib.D3.Shape.Sphere';
case 0x2b : return 'GameLib.D3.Shape.TriMesh';
case 0x2c : return 'GameLib.D3.Shape.ConvexHull';
case 0x2d : return 'GameLib.D3.Shape.ConvexHull.Cylinder';
case 0x2e : return 'GameLib.D3.Shape.HeightMap';
case 0x2f : return 'GameLib.D3.Shape.Plane';
case 0x30 : return 'GameLib.D3.Controls';
case 0x31 : return 'GameLib.D3.Controls.Editor';
case 0x32 : return 'GameLib.D3.Controls.Touch';
case 0x33 : return 'GameLib.D3.FrictionMaterial';
case 0x34 : return 'GameLib.D3.FrictionContactMaterial';
case 0x35 : return 'GameLib.D3.RaycastVehicle';
case 0x36 : return 'GameLib.D3.RaycastWheel';
case 0x37 : return 'GameLib.Clock';
case 0x38 : return 'GameLib.D3.Animation';
case 0x39 : return 'GameLib.D3.Controls.Keyboard';
case 0x3a : return 'GameLib.D3.Controls.Mouse';
case 0x3b : return 'GameLib.D3.Mesh.Text';
case 0x3c : return 'GameLib.D3.Font';
case 0x3d : return 'GameLib.D3.Canvas';
case 0x3e : return 'GameLib.D3.Bone';
case 0x3f : return 'GameLib.D3.Mesh.Box';
case 0x40 : return 'GameLib.D3.Mesh.Cylinder';
case 0x41 : return 'GameLib.D3.System.Animation';
case 0x42 : return 'GameLib.D3.System.CustomCode';
case 0x43 : return 'GameLib.D3.System.GUI';
case 0x44 : return 'GameLib.D3.System.Input';
case 0x45 : return 'GameLib.D3.System.Linking';
case 0x46 : return 'GameLib.D3.System.Physics';
case 0x47 : return 'GameLib.D3.System.Render';
case 0x48 : return 'GameLib.D3.System.Storage';
case 0x49 : return 'GameLib.D3.System.Visualization';
case 0x50 : return 'GameLib.D3.Fog';
case 0x51 : return 'GameLib.D3.Mesh.Line';
case 0x52 : return 'GameLib.D3.ParticleEngine';
case 0x53 : return 'GameLib.D3.System.Particle';
case 0x54 : return 'GameLib.D3.Particle';
case 0x55 : return 'GameLib.D3.Audio';
case 0x56 : return 'GameLib.D3.System.Audio';
case 0x1 : return null;
case 0x2 : return {
name : 'GameLib.D3.Material',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x3 : return {
name : 'GameLib.D3.Renderer',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x4 : return null;
case 0x5 : return {
name : 'GameLib.D3.Camera',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x6 : return null;
case 0x7 : return {
name : 'GameLib.D3.Mesh',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x8 : return {
name : 'GameLib.D3.Spline',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x9 : return {
name : 'GameLib.D3.Light',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0xa : return null;
case 0xb : return {
name : 'GameLib.D3.Composer',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0xc : return {
name : 'GameLib.D3.RenderTarget',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0xd : return {
name : 'GameLib.D3.Pass',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0xe : return {
name : 'GameLib.D3.Scene',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0xf : return {
name : 'GameLib.D3.Raycaster',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x10 : return null;
case 0x11 : return null;
case 0x12 : return {
name : 'GameLib.D3.Viewport',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x13 : return {
name : 'GameLib.System',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x14 : return {
name : 'GameLib.GraphicsRuntime',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x15 : return {
name : 'GameLib.D3.Helper',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x16 : return {
name : 'GameLib.D3.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x17 : return {
name : 'GameLib.Mouse',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x18 : return {
name : 'GameLib.D3.Skeleton',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x19 : return {
name : 'GameLib.D3.Texture',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x1a : return {
name : 'GameLib.EntityManager',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x1b : return {
name : 'GameLib.DomElement',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x1c : return null;
case 0x1d : return {
name : 'GameLib.D3.Stats',
runtime : GameLib.Component.STATISTICS_RUNTIME
};
case 0x1e : return {
name : 'GameLib.GUI',
runtime : GameLib.Component.GUI_RUNTIME
};
case 0x1f : return {
name : 'GameLib.D3.Image',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x20 : return {
name : 'GameLib.Entity',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x21 : return {
name : 'GameLib.D3.Mesh.Sphere',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x22 : return {
name : 'GameLib.D3.Mesh.Plane',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x23 : return {
name : 'GameLib.D3.Mesh.Curve',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x24 : return {
name : 'GameLib.D3.PhysicsWorld',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x25 : return {
name : 'GameLib.D3.Broadphase',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x26 : return {
name : 'GameLib.D3.Solver',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x27 : return {
name : 'GameLib.D3.RigidBody',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x28 : return {
name : 'GameLib.D3.Shape',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x29 : return {
name : 'GameLib.D3.Shape.Box',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x2a : return {
name : 'GameLib.D3.Shape.Sphere',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x2b : return {
name : 'GameLib.D3.Shape.TriMesh',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x2c : return {
name : 'GameLib.D3.Shape.ConvexHull',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x2d : return {
name : 'GameLib.D3.Shape.ConvexHull.Cylinder',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x2e : return {
name : 'GameLib.D3.Shape.HeightMap',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x2f : return {
name : 'GameLib.D3.Shape.Plane',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x30 : return {
name : 'GameLib.D3.Controls',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x31 : return {
name : 'GameLib.D3.Controls.Editor',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x32 : return {
name : 'GameLib.D3.Controls.Touch',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x33 : return {
name : 'GameLib.D3.FrictionMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x34 : return {
name : 'GameLib.D3.FrictionContactMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x35 : return {
name : 'GameLib.D3.RaycastVehicle',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x36 : return {
name : 'GameLib.D3.RaycastWheel',
runtime : GameLib.Component.PHYSICS_RUNTIME
};
case 0x37 : return {
name : 'GameLib.Clock',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x38 : return {
name : 'GameLib.D3.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x39 : return {
name : 'GameLib.D3.Controls.Keyboard',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x3a : return {
name : 'GameLib.D3.Controls.Mouse',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x3b : return {
name : 'GameLib.D3.Mesh.Text',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x3c : return {
name : 'GameLib.D3.Font',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x3d : return {
name : 'GameLib.Canvas',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x3e : return {
name : 'GameLib.D3.Bone',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x3f : return {
name : 'GameLib.D3.Mesh.Box',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x40 : return {
name : 'GameLib.D3.Mesh.Cylinder',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x41 : return {
name : 'GameLib.D3.System.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x42 : return {
name : 'GameLib.D3.System.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x43 : return {
name : 'GameLib.D3.System.GUI',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x44 : return {
name : 'GameLib.D3.System.Input',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x45 : return {
name : 'GameLib.D3.System.Linking',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x46 : return {
name : 'GameLib.D3.System.Physics',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x47 : return {
name : 'GameLib.D3.System.Render',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x48 : return {
name : 'GameLib.D3.System.Storage',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x49 : return {
name : 'GameLib.D3.System.Visualization',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x50 : return {
name : 'GameLib.D3.Fog',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x51 : return {
name : 'GameLib.D3.Mesh.Line',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x52 : return {
name : 'GameLib.D3.ParticleEngine',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x53 : return {
name : 'GameLib.D3.System.Particle',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x54 : return {
name : 'GameLib.D3.Particle',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x55 : return {
name : 'GameLib.D3.Audio',
runtime : GameLib.Component.GRAPHICS_RUNTIME
};
case 0x56 : return {
name : 'GameLib.System.Audio',
runtime : GameLib.Component.DEFAULT_RUNTIME
};
case 0x57 : return {
name : 'GameLib.Cast',
runtime : GameLib.Component.SOCKET_RUNTIME
};
break;
}
throw new Error('Unknown component type: ' + number );
};
/**
* @return {string}
*/
GameLib.Component.GetComponentName = function(componentType) {
var info = GameLib.Component.GetComponentInfo(componentType);
if (info) {
return info.name;
}
return 'unused';
};
/**
* @return {null}
*/
GameLib.Component.GetComponentRuntime = function(componentType) {
var info = GameLib.Component.GetComponentInfo(componentType);
if (info) {
return info.runtime;
}
return null;
};
/**
* Components are linked at runtime - for storing, we just store the ID
* @returns {*}
@ -560,44 +819,21 @@ GameLib.Component.prototype.clone = function() {
apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')';
var runtimeObject = null;
var runtimeComponent = GameLib.Component.Construct(apiObject);
try {
runtimeObject = new this.constructor(this.graphics, apiObject);
} catch (e){
console.log(e);
try {
runtimeObject = new this.constructor(this.physics, apiObject);
} catch (e) {
console.log(e);
try {
runtimeObject = new this.constructor(this.coder, apiObject);
} catch (e) {
console.log(e);
console.log('failed to construct a runtime component');
return;
}
}
}
runtimeObject.isClone = true;
runtimeComponent.isClone = true;
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CLONED,
{
parent : this,
component : runtimeObject
component : runtimeComponent
}
);
runtimeObject.parentEntity = null;
// if (this.parentEntity instanceof GameLib.Entity) {
// this.parentEntity.addComponent(runtimeObject);
// }
return runtimeObject;
runtimeComponent.parentEntity = null;
return runtimeComponent;
};
/**
@ -727,5 +963,79 @@ GameLib.Component.prototype.save = function(remote) {
);
}
}
};
GameLib.Component.Construct = function(rawComponentObject) {
var runtimeComponent = null;
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
var componentClass = eval(info.name);
var fn = componentClass['FromObject'];
var runtime = null;
GameLib.Event.Emit(
GameLib.Event.GET_RUNTIME,
function(runtimeObject) {
runtime = runtimeObject;
}
);
if (rawComponentObject.componentType === GameLib.Component.COMPONENT_ENTITY) {
runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance);
} else if (info.runtime === GameLib.Component.GRAPHICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.graphics)) {
console.warn('no runtime graphics');
}
runtimeComponent = fn(runtime.graphics, rawComponentObject);
} else if (info.runtime === GameLib.Component.PHYSICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.physics)) {
console.warn('no runtime physics');
}
runtimeComponent = fn(runtime.physics, rawComponentObject);
} else if (info.runtime === GameLib.Component.GUI_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.gui)) {
console.warn('no runtime gui');
}
runtimeComponent = fn(runtime.gui, rawComponentObject);
} else if (info.runtime === GameLib.Component.SOCKET_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.sockets)) {
console.warn('no runtime sockets');
}
runtimeComponent = fn(runtime.sockets, rawComponentObject);
} else if (info.runtime === GameLib.Component.STATISTICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.statistics)) {
console.warn('no runtime statistics');
}
runtimeComponent = fn(runtime.statistics, rawComponentObject);
} else if (info.runtime === GameLib.Component.DEFAULT_RUNTIME) {
runtimeComponent = fn(rawComponentObject);
} else {
console.log('unknown runtime object found : ' + rawComponentObject.name);
console.error(rawComponentObject);
}
return runtimeComponent;
};

View File

@ -7,7 +7,7 @@
* @param parentEntity
* @constructor
*/
GameLib.D3.API.Canvas = function(
GameLib.API.Canvas = function(
id,
name,
width,
@ -40,16 +40,16 @@ GameLib.D3.API.Canvas = function(
this.parentEntity = parentEntity;
};
GameLib.D3.API.Canvas.prototype = Object.create(GameLib.Component.prototype);
GameLib.D3.API.Canvas.prototype.constructor = GameLib.D3.API.Canvas;
GameLib.API.Canvas.prototype = Object.create(GameLib.Component.prototype);
GameLib.API.Canvas.prototype.constructor = GameLib.API.Canvas;
/**
* Returns an API light from an Object light
* @param objectCanvas
* @constructor
*/
GameLib.D3.API.Canvas.FromObject = function(objectCanvas) {
return new GameLib.D3.API.Canvas(
GameLib.API.Canvas.FromObject = function(objectCanvas) {
return new GameLib.API.Canvas(
objectCanvas.id,
objectCanvas.name,
objectCanvas.width,

86
src/game-lib-api-cast.js Normal file
View File

@ -0,0 +1,86 @@
/**
* Raw Cast API object - should always correspond with the Cast Schema
* @param id
* @param name
* @param castType
* @param roomId
* @param peer
* @param serverIp
* @param port
* @param parentEntity
* @constructor
*/
GameLib.API.Cast = function(
id,
name,
castType,
roomId,
peer,
serverIp,
port,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Cast (' + this.id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(castType)) {
castType = GameLib.Cast.CAST_TYPE_ROOM;
}
this.castType = castType;
if (GameLib.Utils.UndefinedOrNull(roomId)) {
roomId = 'default';
}
this.roomId = roomId;
if (GameLib.Utils.UndefinedOrNull(peer)) {
peer = null;
}
this.peer = peer;
if (GameLib.Utils.UndefinedOrNull(serverIp)) {
serverIp = '127.0.0.1';
}
this.serverIp = serverIp;
if (GameLib.Utils.UndefinedOrNull(port)) {
port = 80;
}
this.port = port;
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
};
GameLib.API.Cast.prototype = Object.create(GameLib.Component.prototype);
GameLib.API.Cast.prototype.constructor = GameLib.API.Cast;
/**
* Creates an API Cast from an Object Cast
* @param objectCast
* @constructor
*/
GameLib.API.Cast.FromObject = function(objectCast) {
return new GameLib.API.Cast(
objectCast.id,
objectCast.name,
objectCast.castType,
objectCast.roomId,
objectCast.peer,
objectCast.serverIp,
objectCast.port,
objectCast.parentEntity
);
};

94
src/game-lib-canvas.js Normal file
View File

@ -0,0 +1,94 @@
/**
* Canvas object
* @param apiCanvas
* @returns {GameLib.Canvas}
* @constructor
*/
GameLib.Canvas = function(
apiCanvas
) {
if (GameLib.Utils.UndefinedOrNull(apiCanvas)) {
apiCanvas = {};
}
if (apiCanvas instanceof GameLib.Canvas) {
return apiCanvas;
}
GameLib.API.Canvas.call(
this,
apiCanvas.id,
apiCanvas.name,
apiCanvas.width,
apiCanvas.height,
apiCanvas.parentEntity
);
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_CANVAS
);
};
GameLib.Canvas.prototype = Object.create(GameLib.API.Canvas.prototype);
GameLib.Canvas.prototype.constructor = GameLib.Canvas;
/**
* Creates a light instance
* @returns {*}
*/
GameLib.Canvas.prototype.createInstance = function() {
this.instance = document.createElement('canvas');
this.instance.width = this.width;
this.instance.height = this.height;
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.Canvas.prototype.updateInstance = function(property) {
if (GameLib.Utils.UndefinedOrNull(property)) {
console.warn('unknown property update for Canvas: ' + property);
}
if (property === 'width') {
this.instance.width = this.width;
}
if (property === 'height') {
this.instance.height = this.height;
}
};
/**
* Converts a GameLib.Canvas to a GameLib.API.Canvas
* @returns {GameLib.API.Canvas}
*/
GameLib.Canvas.prototype.toApiObject = function() {
return new GameLib.API.Canvas(
this.id,
this.name,
this.width,
this.height,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};
/**
* Returns a new GameLib.Canvas from a GameLib.API.Canvas
* @param objectCanvas GameLib.API.Canvas
* @returns {GameLib.Canvas}
*/
GameLib.Canvas.FromObject = function(objectCanvas) {
return new GameLib.Canvas(
GameLib.API.Canvas.FromObject(objectCanvas)
);
};

266
src/game-lib-cast.js Normal file
View File

@ -0,0 +1,266 @@
/**
* Creates a Cast object
* @param socket GameLib.Socket
* @param apiCast GameLib.API.Cast
* @constructor
*/
GameLib.Cast = function(
socket,
apiCast
) {
this.socket = socket;
this.socket.isNotWebSocketThrow();
if (GameLib.Utils.UndefinedOrNull(apiCast)) {
apiCast = {};
}
if (apiCast instanceof GameLib.Cast) {
return apiCast;
}
GameLib.API.Cast.call(
this,
apiCast.id,
apiCast.name,
apiCast.castType,
apiCast.roomId,
apiCast.peer,
apiCast.serverIp,
apiCast.port,
apiCast.parentEntity
);
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_CAST,
{
peer : GameLib.Component
}
);
};
GameLib.Cast.prototype = Object.create(GameLib.API.Cast.prototype);
GameLib.Cast.prototype.constructor = GameLib.Cast;
GameLib.Cast.CAST_TYPE_ROOM = 0x1;
GameLib.Cast.CAST_TYPE_PEER = 0x2;
GameLib.Cast.CAST_TYPE_ALL = 0x3;
GameLib.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4;
/**
* We don't use a 3rd party particle engine right now
* @returns true
*/
GameLib.Cast.prototype.createInstance = function() {
this.instance = true;
// if (this.templateParticle) {
//
// this.templateParticle.mesh.position.x = this.position.x;
// this.templateParticle.mesh.position.y = this.position.y;
// this.templateParticle.mesh.position.z = this.position.z;
//
// this.templateParticle.direction.x = this.direction.x;
// this.templateParticle.direction.y = this.direction.y;
// this.templateParticle.direction.z = this.direction.z;
//
// this.templateParticle.scale.x = this.scale.x;
// this.templateParticle.scale.y = this.scale.y;
// this.templateParticle.scale.z = this.scale.z;
// }
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.Cast.prototype.updateInstance = function(property) {
if (property === 'particlesPerSecond') {
this.frequency = Number(1 / this.particlesPerSecond);
}
if (property === 'frequency') {
this.particlesPerSecond = Math.round(1 / this.frequency);
}
if (property === 'position') {
this.position.instance.x = this.position.x;
this.position.instance.y = this.position.y;
this.position.instance.z = this.position.z;
this.templateParticle.mesh.position = this.position.clone();
this.templateParticle.mesh.updateInstance('position', true);
}
if (property === 'direction') {
this.direction.instance.x = this.direction.x;
this.direction.instance.y = this.direction.y;
this.direction.instance.z = this.direction.z;
this.templateParticle.direction = this.direction.clone();
this.templateParticle.direction.updateInstance('direction', true);
}
};
GameLib.Cast.prototype.remove = function() {
if (this.removeSubscription) {
console.log('already another remove subscription for ' + this.name);
return;
}
this.removeSubscription = GameLib.Event.Subscribe(
GameLib.Event.REMOVE_PARTICLE_ENGINE,
function(data){
if (data.component === this) {
if (this.isClone) {
/**
* We only remove the things we cloned, the mesh, particle, and this
*/
GameLib.Event.Emit(
GameLib.Event.REMOVE_COMPONENT,
{
component: this.templateParticle.mesh
}
);
GameLib.Event.Emit(
GameLib.Event.REMOVE_COMPONENT,
{
component: this.templateParticle
}
);
GameLib.Event.Emit(
GameLib.Event.REMOVE_COMPONENT,
{
component: this
}
)
} else {
GameLib.Component.prototype.remove.call(this);
}
this.removeSubscription.remove();
this.removeSubscription = null;
}
}.bind(this)
);
/**
* Below signals the particle system to continue processing the particles, but don't create more, and
* we wait for the system to signal REMOVE_PARTICLE_ENGINE so we can destroy ourselves
* @type {boolean}
*/
this.disabledForRemoval = true;
};
// GameLib.Cast.prototype.getChildrenComponents = function() {
//
// var components = [];
//
// if (this.templateParticle) {
// components.push(this.templateParticle);
//
// if (this.templateParticle.mesh) {
// components.push(this.templateParticle.mesh);
//
// if (this.templateParticle.mesh.materials && this.templateParticle.mesh.materials[0]) {
//
// components.push(this.templateParticle.mesh.materials[0]);
//
// if (this.templateParticle.mesh.materials[0].diffuseMap) {
// components.push(this.templateParticle.mesh.materials[0].diffuseMap);
// }
// }
// }
// }
//
// return components;
// };
GameLib.Cast.prototype.clone = function() {
var mesh = this.templateParticle.mesh.clone();
var templateParticle = this.templateParticle.clone();
templateParticle.mesh = mesh;
templateParticle.instance = mesh.instance;
var engine = GameLib.Component.prototype.clone.call(this);
engine.templateParticle = templateParticle;
return engine;
};
GameLib.Cast.prototype.processParticles = function(delta) {
// this.particles = this.particles.reduce(
// function(result, particle){
//
// particle.position.x += particle.userData.direction.x * delta;
// particle.position.y += particle.userData.direction.y * delta;
// particle.position.z += particle.userData.direction.z * delta;
//
// particle.userData.elapsed += delta;
// if (particle.userData.elapsed > particle.userData.lifeTime) {
// particle.parent.remove(particle);
// } else {
// result.push(particle);
// }
//
// return result;
// },
// []
// );
};
GameLib.Cast.prototype.createNewParticle = function(camera) {
//
// var particle = this.templateParticle.clone(camera);
//
// this.particles.push(particle);
};
/**
* Converts a GameLib.Cast to a new GameLib.API.Cast
* @returns {GameLib.API.Cast}
*/
GameLib.Cast.prototype.toApiObject = function() {
return new GameLib.API.Cast(
this.id,
this.name,
this.position.toApiObject(),
this.direction.toApiObject(),
this.enabled,
GameLib.Utils.IdOrNull(this.templateParticle),
this.particlesPerSecond,
this.frequency,
this.elapsed,
GameLib.Utils.IdOrNull(this.camera),
this.pulse,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};
/**
* Converts from an Object Cast to a GameLib.Cast
* @param graphics GameLib.GraphicsRuntime
* @param objectCast Object
* @returns {GameLib.Cast}
* @constructor
*/
GameLib.Cast.FromObject = function(graphics, objectCast) {
var apiCast = GameLib.API.Cast.FromObject(objectCast);
return new GameLib.Cast(
graphics,
apiCast
);
};

View File

@ -1,16 +1,16 @@
/**
* Creates a camera object
* @param implementation
* Creates a Clock object
* @param graphics
* @param apiClock GameLib.API.Clock
* @constructor
*/
GameLib.Clock = function(
implementation,
graphics,
apiClock
) {
this.implementation = implementation;
this.implementation.isNotThreeThrow();
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiClock)) {
apiClock = {};

View File

@ -0,0 +1,60 @@
/**
* Coder
* @param id
* @param name
* @param coderType
* @constructor
*/
GameLib.CoderRuntime = function(
id,
name,
coderType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Coder (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(coderType)) {
coderType = GameLib.CoderRuntime.TYPE_CODE_MIRROR;
}
this.coderType = coderType;
this.createInstance();
};
/**
* GameLib.CoderRuntime Types
* @type {number}
*/
GameLib.CoderRuntime.TYPE_CODE_MIRROR = 0x1;
GameLib.CoderRuntime.prototype.createInstance = function() {
if (this.coderType === GameLib.CoderRuntime.TYPE_CODE_MIRROR) {
this.instance = CodeMirror;
} else {
this.instance = null;
}
};
GameLib.CoderRuntime.prototype.updateInstance = function(property) {
if (property === 'coderType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.CoderRuntime.prototype.isNotCodeMirrorThrow = function() {
if (!(this.instance instanceof CodeMirror)) {
console.error('Only CodeMirror supported');
throw new Error('Only CodeMirror supported');
}
};

View File

@ -1,6 +1,6 @@
/**
* Runtime color for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param parentObject GameLib.D3.*
* @param apiColor GameLib.API.Color
* @param grain Number

View File

@ -193,10 +193,10 @@ GameLib.D3.Animation.FromObject = function(objectAnimation) {
GameLib.D3.Animation.prototype.launchEditor = function(){
GameLib.Event.Emit(
GameLib.Event.GET_CODER_IMPLEMENTATION,
GameLib.Event.GET_RUNTIME,
null,
function(coder) {
this.coder = coder;
function(runtime) {
this.coder = runtime.coder;
this.coder.isNotCodeMirrorThrow();
}.bind(this)
);

View File

@ -1,6 +1,6 @@
/**
* Creates a Audio object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiAudio GameLib.D3.API.Audio
* @constructor
*/
@ -140,7 +140,7 @@ GameLib.D3.Audio.prototype.toApiObject = function() {
/**
* Converts from an Object Audio to a GameLib.D3.Audio
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectAudio Object
* @returns {GameLib.D3.Audio}
* @constructor

View File

@ -1,7 +1,7 @@
/**
* BoneWeight Superset
* @constructor
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiBoneWeight GameLib.D3.API.BoneWeight
*/
GameLib.D3.BoneWeight = function (
@ -45,7 +45,7 @@ GameLib.D3.BoneWeight.prototype.toApiObject = function() {
/**
* Returns a GameLib.D3.BoneWeight from a boneWeight Object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectBoneWeight Object
* @returns {GameLib.D3.BoneWeight}
* @constructor

View File

@ -1,7 +1,7 @@
/**
* Bone Superset
* @constructor
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiBone GameLib.D3.API.Bone
*/
GameLib.D3.Bone = function (
@ -141,7 +141,7 @@ GameLib.D3.Bone.prototype.toApiObject = function() {
/**
* Returns a GameLib.D3.Bone from a bone Object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectBone Object
* @returns {GameLib.D3.Bone}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Broadphase Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiBroadphase GameLib.D3.API.Broadphase
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Creates a Camera object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiCamera GameLib.D3.API.Camera
* @constructor
*/
@ -277,7 +277,7 @@ GameLib.D3.Camera.prototype.toApiObject = function() {
/**
* Converts from an Object Camera to a GameLib.D3.Camera
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectCamera Object
* @returns {GameLib.D3.Camera}
* @constructor

View File

@ -1,94 +0,0 @@
/**
* Canvas Superset - The apiCanvas properties get moved into the Canvas object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param apiCanvas GameLib.D3.API.Canvas
* @constructor
*/
GameLib.D3.Canvas = function(
graphics,
apiCanvas
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiCanvas)) {
apiCanvas = {};
}
if (apiCanvas instanceof GameLib.D3.Canvas) {
return apiCanvas;
}
GameLib.D3.API.Canvas.call(
this,
apiCanvas.id,
apiCanvas.name,
apiCanvas.width,
apiCanvas.height,
apiCanvas.parentEntity
);
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_CANVAS
);
};
GameLib.D3.Canvas.prototype = Object.create(GameLib.D3.API.Canvas.prototype);
GameLib.D3.Canvas.prototype.constructor = GameLib.D3.Canvas;
/**
* Creates a light instance
* @returns {*}
*/
GameLib.D3.Canvas.prototype.createInstance = function() {
this.instance = document.createElement('canvas');
this.instance.width = this.width;
this.instance.height = this.height;
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Canvas.prototype.updateInstance = function() {
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
this.createInstance();
}
this.instance.width = this.width;
this.instance.height = this.height;
};
/**
* Converts a GameLib.D3.Canvas to a GameLib.D3.API.Canvas
* @returns {GameLib.D3.API.Canvas}
*/
GameLib.D3.Canvas.prototype.toApiObject = function() {
return new GameLib.D3.API.Canvas(
this.id,
this.name,
this.width,
this.height,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};
/**
* Returns a new GameLib.D3.Canvas from a GameLib.D3.API.Canvas
* @param graphics GameLib.D3.Graphics
* @param objectCanvas GameLib.D3.API.Canvas
* @returns {GameLib.D3.Canvas}
*/
GameLib.D3.Canvas.FromObject = function(graphics, objectCanvas) {
return new GameLib.D3.Canvas(
graphics,
GameLib.D3.API.Canvas.FromObject(objectCanvas)
);
};

View File

@ -1,66 +0,0 @@
/**
* Coder
* @param id
* @param name
* @param coderType
* @constructor
*/
GameLib.D3.Coder = function Coder(
id,
name,
coderType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Coder (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(coderType)) {
coderType = GameLib.D3.Coder.CODER_TYPE_CODE_MIRROR;
}
this.coderType = coderType;
this.createInstance();
};
/**
* GameLib.D3.Coder Types
* @type {number}
*/
GameLib.D3.Coder.CODER_TYPE_CODE_MIRROR = 0x1;
/**
* @returns {THREE.Coder}
*/
GameLib.D3.Coder.prototype.createInstance = function() {
this.instance = CodeMirror;
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Coder.prototype.updateInstance = function() {
};
/**
* True if THREE physics
* @returns {boolean}
*/
GameLib.D3.Coder.prototype.isCodeMirror = function() {
return (this.coderType === GameLib.D3.Coder.CODER_TYPE_CODE_MIRROR)
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.D3.Coder.prototype.isNotCodeMirrorThrow = function() {
if (this.coderType !== GameLib.D3.Coder.CODER_TYPE_CODE_MIRROR) {
console.warn('Only CodeMirror supported for this function');
throw new Error('Only CodeMirror supported for this function');
}
};

View File

@ -1,6 +1,6 @@
/**
* Renders a scene with a camera
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiComposer GameLib.D3.API.Composer
* @constructor
*/

View File

@ -1,15 +1,11 @@
/**
* Controls Superset - The apiControls properties get moved into the Controls object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param apiControls GameLib.D3.API.Controls
* @constructor
*/
GameLib.D3.Controls = function (
graphics,
apiControls
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiControls)) {
apiControls = {};
@ -111,16 +107,14 @@ GameLib.D3.Controls.prototype.toApiObject = function() {
/**
* Converts a data object to a GameLib.D3.Controls
* @param graphics GameLib.D3.Graphics
* @param objectControls {Object}
* @constructor
*/
GameLib.D3.Controls.FromObject = function(graphics, objectControls) {
GameLib.D3.Controls.FromObject = function(objectControls) {
var apiControls = GameLib.D3.API.Controls.FromObject(objectControls);
return new GameLib.D3.Controls(
graphics,
apiControls
);

View File

@ -1,6 +1,6 @@
/**
* Controls Superset - The apiControls properties get moved into the Controls object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiControls GameLib.D3.API.Controls
* @param raycaster
* @param camera
@ -42,7 +42,6 @@ GameLib.D3.Controls.Editor = function (
GameLib.D3.Controls.call(
this,
this.graphics,
apiControls
);
};

View File

@ -1,20 +1,13 @@
/**
* Keyboard Controls
* @param graphics GameLib.D3.Graphics
* @param apiControls GameLib.D3.API.Controls
* @constructor
*/
GameLib.D3.Controls.Keyboard = function (
graphics,
apiControls
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.D3.Controls.call(
this,
this.graphics,
apiControls
);
};
@ -59,17 +52,15 @@ GameLib.D3.Controls.Keyboard.prototype.toApiObject = function() {
/**
* Construct an Keyboard Controls object from data
* @param graphics
* @param objectControls
* @returns {GameLib.D3.Controls.Keyboard}
* @constructor
*/
GameLib.D3.Controls.Keyboard.FromObject = function(graphics, objectControls) {
GameLib.D3.Controls.Keyboard.FromObject = function(objectControls) {
var apiControls = GameLib.D3.API.Controls.FromObject(objectControls);
return new GameLib.D3.Controls.Keyboard(
graphics,
apiControls
);

View File

@ -1,20 +1,13 @@
/**
* Mouse Controls
* @param graphics GameLib.D3.Graphics
* @param apiControls GameLib.D3.API.Controls
* @constructor
*/
GameLib.D3.Controls.Mouse = function (
graphics,
apiControls
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.D3.Controls.call(
this,
this.graphics,
apiControls
);
};
@ -59,17 +52,15 @@ GameLib.D3.Controls.Mouse.prototype.toApiObject = function() {
/**
* Construct an Mouse Controls object from data
* @param graphics
* @param objectControls
* @returns {GameLib.D3.Controls.Mouse}
* @constructor
*/
GameLib.D3.Controls.Mouse.FromObject = function(graphics, objectControls) {
GameLib.D3.Controls.Mouse.FromObject = function(objectControls) {
var apiControls = GameLib.D3.API.Controls.FromObject(objectControls);
return new GameLib.D3.Controls.Mouse(
graphics,
apiControls
);

View File

@ -1,19 +1,13 @@
/**
* Touch Controls
* @param graphics GameLib.D3.Graphics
* @param apiControls GameLib.D3.API.Controls
* @param sensitivity
* @constructor
*/
GameLib.D3.Controls.Touch = function (
graphics,
apiControls,
sensitivity
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(sensitivity)) {
sensitivity = 5;
}
@ -21,7 +15,6 @@ GameLib.D3.Controls.Touch = function (
GameLib.D3.Controls.call(
this,
this.graphics,
apiControls
);
};
@ -70,17 +63,15 @@ GameLib.D3.Controls.Touch.prototype.toApiObject = function() {
/**
* Construct an Touch Controls object from data
* @param graphics
* @param objectControls
* @returns {GameLib.D3.Controls.Touch}
* @constructor
*/
GameLib.D3.Controls.Touch.FromObject = function(graphics, objectControls) {
GameLib.D3.Controls.Touch.FromObject = function(objectControls) {
var apiControls = GameLib.D3.API.Controls.FromObject(objectControls);
return new GameLib.D3.Controls.Touch(
graphics,
apiControls,
objectControls.sensitivity
);

View File

@ -107,10 +107,10 @@ GameLib.D3.CustomCode.FromObject = function(objectCustomCode) {
GameLib.D3.CustomCode.prototype.launchEditor = function(){
GameLib.Event.Emit(
GameLib.Event.GET_CODER_IMPLEMENTATION,
GameLib.Event.GET_RUNTIME,
null,
function(coder) {
this.coder = coder;
function(runtime) {
this.coder = runtime.coder;
this.coder.isNotCodeMirrorThrow();
}.bind(this)
);

View File

@ -10,9 +10,9 @@ GameLib.D3.Face = function Face(
) {
this.implementation = implementation;
if (implementation instanceof GameLib.D3.Graphics) {
if (implementation instanceof GameLib.GraphicsRuntime) {
this.implementation.isNotThreeThrow();
} else if (implementation instanceof GameLib.D3.Physics) {
} else if (implementation instanceof GameLib.PhysicsRuntime) {
this.implementation.isNotCannonThrow();
} else {
throw new Error('Unhandled implementation : ' + implementation);
@ -41,7 +41,7 @@ GameLib.D3.Face = function Face(
apiFace.normal
);
if (this.implementation instanceof GameLib.D3.Graphics) {
if (this.implementation instanceof GameLib.GraphicsRuntime) {
/**
* physics faces have no color... a little sad right?
*/

View File

@ -141,7 +141,7 @@ GameLib.D3.Fog.prototype.toApiObject = function() {
/**
* Converts a scene Object to a GameLib.D3.Fog object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectFog Object
* @returns {GameLib.D3.Fog}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Font Superset - The apiFont properties get moved into the Font object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiFont GameLib.D3.API.Font
* @constructor
*/
@ -88,7 +88,7 @@ GameLib.D3.Font.prototype.toApiObject = function() {
/**
* Returns a new GameLib.D3.Font from a GameLib.D3.API.Font
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectFont GameLib.D3.API.Font
* @returns {GameLib.D3.Font}
*/

View File

@ -1,6 +1,6 @@
/**
* FrictionContactMaterial Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiFrictionContactMaterial GameLib.D3.API.FrictionContactMaterial
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* FrictionMaterial Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiFrictionMaterial GameLib.D3.API.FrictionMaterial
* @constructor
*/

View File

@ -1,66 +0,0 @@
/**
* Graphics
* @param id
* @param name
* @param graphicsType
* @constructor
*/
GameLib.D3.Graphics = function Graphics(
id,
name,
graphicsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Graphics (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(graphicsType)) {
graphicsType = GameLib.D3.Graphics.GRAPHICS_TYPE_THREE;
}
this.graphicsType = graphicsType;
this.createInstance();
};
/**
* GameLib.D3.Graphics Types
* @type {number}
*/
GameLib.D3.Graphics.GRAPHICS_TYPE_THREE = 0x1;
/**
* @returns {THREE.Graphics}
*/
GameLib.D3.Graphics.prototype.createInstance = function() {
this.instance = THREE;
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Graphics.prototype.updateInstance = function() {
};
/**
* True if THREE physics
* @returns {boolean}
*/
GameLib.D3.Graphics.prototype.isThree = function() {
return (this.graphicsType === GameLib.D3.Graphics.GRAPHICS_TYPE_THREE)
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.D3.Graphics.prototype.isNotThreeThrow = function() {
if (this.graphicsType !== GameLib.D3.Graphics.GRAPHICS_TYPE_THREE) {
console.warn('Only THREE supported for this function');
throw new Error('Only THREE supported for this function');
}
};

View File

@ -1,6 +1,6 @@
/**
* Helpers for displaying outlines or making 'invisible' scene objects visible
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param id
* @param name
* @param object

View File

@ -33,17 +33,9 @@ GameLib.D3.Image = function(
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_IMAGE,
null,
true
GameLib.Component.COMPONENT_IMAGE
);
GameLib.Event.Emit(
GameLib.Event.LOAD_IMAGE,
{
image : this
}
);
};
GameLib.D3.Image.prototype = Object.create(GameLib.D3.API.Image.prototype);
@ -54,14 +46,41 @@ GameLib.D3.Image.prototype.constructor = GameLib.D3.Image;
* @returns {*}
*/
GameLib.D3.Image.prototype.createInstance = function() {
GameLib.Component.prototype.createInstance.call(this);
GameLib.Event.Emit(
GameLib.Event.LOAD_IMAGE,
{
image : this
},
function(imageInstance) {
this.instance = imageInstance;
GameLib.Component.prototype.createInstance.call(this);
}.bind(this),
function(error) {
console.error(error);
this.instance = null;
GameLib.Component.prototype.createInstance.call(this);
}.bind(this)
);
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Image.prototype.updateInstance = function() {
this.createInstance();
GameLib.D3.Image.prototype.updateInstance = function(property) {
if (GameLib.Utils.UndefinedOrNull(property)) {
console.warn('unknown property update for Image: ' + property);
}
if (
property === 'fileName' ||
property === 'extension' ||
property === 'path'
) {
this.createInstance();
}
};
/**

View File

@ -1,6 +1,6 @@
/**
* Light Superset - The apiLight properties get moved into the Light object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiLight GameLib.D3.API.Light
* @constructor
*/
@ -257,7 +257,7 @@ GameLib.D3.Light.prototype.toApiObject = function() {
/**
* Returns a new GameLib.D3.Light from a GameLib.D3.API.Light
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectLight GameLib.D3.API.Light
* @returns {GameLib.D3.Light}
*/

View File

@ -1,6 +1,6 @@
/**
* Entities with LookAt component looks to targetPosition (default up is 0,1,0)
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiLookAt GameLib.D3.API.LookAt
* @constructor
*/

View File

@ -1,7 +1,7 @@
/**
* Material Superset - The apiMaterial properties get moved into the Material object itself, and then the instance is
* created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMaterial GameLib.D3.API.Material
* @constructor
* @returns {GameLib.D3.Material | GameLib.D3.API.Material}
@ -1254,7 +1254,7 @@ GameLib.D3.Material.prototype.getTextures = function() {
/**
* Creates a GameLib.D3.Material from a material Object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMaterial Object
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @constructor
*/
@ -1096,7 +1096,7 @@ GameLib.D3.Mesh.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param width
* @param height
@ -118,7 +118,7 @@ GameLib.D3.Mesh.Box.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param radiusTop
* @param radiusBottom
@ -182,7 +182,7 @@ GameLib.D3.Mesh.Cylinder.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param lineWidth
* @constructor
@ -80,7 +80,7 @@ GameLib.D3.Mesh.Line.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param width
* @param height
@ -216,7 +216,7 @@ GameLib.D3.Mesh.Plane.prototype.toApiObject = function() {
/**
* TODO fix all this weird loading shit
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/
@ -325,7 +325,7 @@ GameLib.D3.Mesh.Plane.prototype.generateHeightMapFromBumpMap = function() {
GameLib.D3.Mesh.Plane.prototype.createPhysicsObjects = function() {
GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_IMPLEMENTATION,
GameLib.Event.GET_PHYSICS_RUNTIME,
null,
function(physics){

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param radius
* @param widthSegments
@ -120,7 +120,7 @@ GameLib.D3.Mesh.Sphere.prototype.toApiObject = function() {
GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() {
GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_IMPLEMENTATION,
GameLib.Event.GET_PHYSICS_RUNTIME,
null,
function(physics){
var apiShapeSphere = new GameLib.D3.API.Shape(
@ -187,7 +187,7 @@ GameLib.D3.Mesh.Sphere.prototype.createPhysicsObjects = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiMesh GameLib.D3.API.Mesh
* @param font
* @param size
@ -202,7 +202,7 @@ GameLib.D3.Mesh.Text.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Mesh
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMesh {Object}
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Creates a ParticleEngine object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiParticleEngine GameLib.D3.API.ParticleEngine
* @constructor
*/
@ -289,7 +289,7 @@ GameLib.D3.ParticleEngine.prototype.toApiObject = function() {
/**
* Converts from an Object ParticleEngine to a GameLib.D3.ParticleEngine
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectParticleEngine Object
* @returns {GameLib.D3.ParticleEngine}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Creates a Particle object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiParticle GameLib.D3.API.Particle
* @constructor
*/
@ -378,7 +378,7 @@ GameLib.D3.Particle.prototype.toApiObject = function() {
/**
* Converts from an Object Particle to a GameLib.D3.Particle
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectParticle Object
* @returns {GameLib.D3.Particle}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Renders a scene with a camera
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiPass GameLib.D3.API.Pass
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* This component makes the parentEntity (ex. car) follow the path provided by the spline
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiPathFollowing GameLib.D3.API.PathFollowing
* @constructor
*/

View File

@ -105,7 +105,7 @@ GameLib.D3.PhysicsWorld.prototype.constructor = GameLib.D3.PhysicsWorld;
/**
* private
* @returns {GameLib.D3.PhysicsWorld|GameLib.D3.Physics.World|*}
* @returns {GameLib.D3.PhysicsWorld|GameLib.PhysicsRuntime.World|*}
*/
GameLib.D3.PhysicsWorld.prototype.createInstance = function() {
@ -510,7 +510,7 @@ GameLib.D3.PhysicsWorld.FromObject = function(graphics, objectComponent) {
// };
//
// /**
// * @param graphics GameLib.D3.Graphics
// * @param graphics GameLib.GraphicsRuntime
// * @param graphicsMesh THREE.Mesh
// * @param mass Number
// * @param friction Number
@ -674,7 +674,7 @@ GameLib.D3.PhysicsWorld.FromObject = function(graphics, objectComponent) {
// };
//
// /**
// * @param graphics GameLib.D3.Graphics
// * @param graphics GameLib.GraphicsRuntime
// * @param graphicsMesh THREE.Mesh
// * @returns {GameLib.D3.Shape}
// * @constructor
@ -760,7 +760,7 @@ GameLib.D3.PhysicsWorld.FromObject = function(graphics, objectComponent) {
// * @param rayscale Number
// * @param maxTriangleDistance Number
// * @param createCompoundShape Boolean
// * @param graphics GameLib.D3.Graphics
// * @param graphics GameLib.GraphicsRuntime
// * @param triangleMeshShapes GameLib.D3.Shape[]
// * @param createDebugView Boolean
// * @returns {GameLib.D3.RigidBody}

View File

@ -1,58 +0,0 @@
/**
* Physics
* @param id
* @param name
* @param physicsType
* @constructor
*/
GameLib.D3.Physics = function Physics(
id,
name,
physicsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Physics (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(physicsType)) {
physicsType = GameLib.D3.Physics.PHYSICS_TYPE_CANNON;
}
this.physicsType = physicsType;
this.createInstance();
};
/**
* GameLib.D3.Physics Types
* @type {number}
*/
GameLib.D3.Physics.PHYSICS_TYPE_CANNON = 0x1;
/**
* @returns {THREE.Physics}
*/
GameLib.D3.Physics.prototype.createInstance = function() {
this.instance = CANNON;
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Physics.prototype.updateInstance = function() {
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.D3.Physics.prototype.isNotCannonThrow = function() {
if (this.physicsType !== GameLib.D3.Physics.PHYSICS_TYPE_CANNON) {
console.warn('Only CANNON supported for this function');
throw new Error('Only CANNON supported for this function');
}
};

View File

@ -1,6 +1,6 @@
/**
* RaycastVehicle Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiRaycastVehicle GameLib.D3.API.RaycastVehicle
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* RaycastWheel Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiRaycastWheel GameLib.D3.API.RaycastWheel
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Raycaster for GameLib.D3
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiRaycaster
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Renders a scene with a camera
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiRenderTarget GameLib.D3.API.RenderTarget
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Renders a scene with a camera
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiRenderer GameLib.D3.API.Renderer
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* RigidBody Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiRigidBody GameLib.D3.API.RigidBody
* @constructor
*/

View File

@ -410,7 +410,7 @@ GameLib.D3.Scene.prototype.toApiObject = function() {
/**
* Converts a scene Object to a GameLib.D3.Scene object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectScene Object
* @returns {GameLib.D3.Scene}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Shape Superset - The apiShape properties get moved into the Shape object itself, and then the instance is created
* @param physics GameLib.D3.Physics
* @param physics GameLib.PhysicsRuntime
* @param apiShape GameLib.D3.API.Shape
* @constructor
*/
@ -110,7 +110,7 @@ GameLib.D3.Shape.prototype.toApiObject = function() {
/**
* Converts a standard object mesh to a GameLib.D3.Shape
* @param physics GameLib.D3.Physics
* @param physics GameLib.PhysicsRuntime
* @param objectShape {Object}
* @constructor
*/

View File

@ -1,7 +1,7 @@
/**
* Skeleton Superset
* @constructor
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiSkeleton GameLib.D3.API.Skeleton
*/
GameLib.D3.Skeleton = function Skeleton(
@ -217,7 +217,7 @@ GameLib.D3.Skeleton.prototype.toApiObject = function() {
/**
* Returns a GameLib.D3.Skeleton from a skeleton Object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectSkeleton Object
* @returns {GameLib.D3.Skeleton}
* @constructor

View File

@ -1,6 +1,6 @@
/**
* Solver Runtime
* @param physics GameLib.D3.Graphics
* @param physics GameLib.GraphicsRuntime
* @param apiSolver GameLib.D3.API.Solver
* @constructor
*/

View File

@ -1,6 +1,6 @@
/**
* Spline constructor
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiSpline GameLib.D3.API.Spline
* @constructor
*/
@ -115,7 +115,7 @@ GameLib.D3.Spline.prototype.toApiObject = function() {
/**
* Returns a GameLib.D3.Spline from a spline Object
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectComponent Object
* @returns {GameLib.D3.Spline}
* @constructor

View File

@ -14,10 +14,8 @@ GameLib.D3.Stats = function(
domElement,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(stats)) {
throw new Error('Need Stats object')
}
this.stats = stats;
this.stats = stats;
this.stats.isNotStatsThrow();
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
@ -60,7 +58,8 @@ GameLib.D3.Stats.prototype.resize = function() {
* Creates a helper instance
*/
GameLib.D3.Stats.prototype.createInstance = function() {
this.instance = this.stats();
this.instance = this.stats.instance();
this.resize();

View File

@ -2,7 +2,7 @@
* Texture Superset - The apiTexture properties get moved into the Texture object itself, and then the instance is
* created
* @param apiTexture
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @constructor
*/
GameLib.D3.Texture = function(
@ -83,8 +83,8 @@ GameLib.D3.Texture = function(
}.bind(this)
);
if (this.canvas instanceof GameLib.D3.API.Canvas) {
this.canvas = new GameLib.D3.Canvas(
if (this.canvas instanceof GameLib.API.Canvas) {
this.canvas = new GameLib.Canvas(
this.graphics,
this.canvas
);
@ -96,7 +96,7 @@ GameLib.D3.Texture = function(
{
'image' : GameLib.D3.Image,
'images' : [GameLib.D3.Image],
'canvas' : GameLib.D3.Canvas
'canvas' : GameLib.Canvas
}
);
};
@ -443,7 +443,7 @@ GameLib.D3.Texture.prototype.toApiObject = function() {
/**
* Converts from an Object texture to a GameLib.D3.Texture
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectTexture Object
* @constructor
*/

View File

@ -9,9 +9,9 @@ GameLib.D3.Vertex = function Vertex(
apiVertex
) {
this.implementation = implementation;
if (implementation instanceof GameLib.D3.Graphics) {
if (implementation instanceof GameLib.GraphicsRuntime) {
this.implementation.isNotThreeThrow();
} else if (implementation instanceof GameLib.D3.Physics) {
} else if (implementation instanceof GameLib.PhysicsRuntime) {
this.implementation.isNotCannonThrow();
} else {
throw new Error('Unhandled implementation : ' + implementation);
@ -37,7 +37,7 @@ GameLib.D3.Vertex = function Vertex(
null
);
if (implementation instanceof GameLib.D3.Graphics) {
if (implementation instanceof GameLib.GraphicsRuntime) {
this.boneWeights = this.boneWeights.map(
function(apiBoneWeight) {
return new GameLib.D3.BoneWeight(

View File

@ -1,6 +1,6 @@
/**
* Viewport Runtime
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiViewport GameLib.D3.API.Viewport
* @constructor
*/

View File

@ -0,0 +1,59 @@
/**
* Graphics
* @param id
* @param name
* @param graphicsType
* @constructor
*/
GameLib.GraphicsRuntime = function(
id,
name,
graphicsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Graphics (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(graphicsType)) {
graphicsType = GameLib.GraphicsRuntime.TYPE_THREE_JS;
}
this.graphicsType = graphicsType;
this.createInstance();
};
/**
* GameLib.GraphicsRuntime Types
* @type {number}
*/
GameLib.GraphicsRuntime.TYPE_THREE_JS = 0x1;
GameLib.GraphicsRuntime.prototype.createInstance = function() {
if (this.graphicsType === GameLib.GraphicsRuntime.TYPE_THREE_JS) {
this.instance = THREE;
} else {
this.instance = null;
}
};
GameLib.GraphicsRuntime.prototype.updateInstance = function(property) {
if (property === 'graphicsType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.GraphicsRuntime.prototype.isNotThreeThrow = function() {
if (this.instance !== THREE) {
console.error('Only THREE supported');
throw new Error('Only THREE supported');
}
};

View File

@ -0,0 +1,59 @@
/**
* GUI
* @param id
* @param name
* @param guiType
* @constructor
*/
GameLib.GUIRuntime = function(
id,
name,
guiType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'GUI (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(guiType)) {
guiType = GameLib.GUIRuntime.TYPE_DAT_GUI;
}
this.guiType = guiType;
this.createInstance();
};
/**
* GameLib.GUIRuntime Types
* @type {number}
*/
GameLib.GUIRuntime.TYPE_DAT_GUI = 0x1;
GameLib.GUIRuntime.prototype.createInstance = function() {
if (this.guiType === GameLib.GUIRuntime.TYPE_DAT_GUI) {
this.instance = dat.GUI;
} else {
this.instance = null;
}
};
GameLib.GUIRuntime.prototype.updateInstance = function(property) {
if (property === 'guiType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.GUIRuntime.prototype.isNotDatGuiThrow = function() {
if (this.instance !== dat.GUI) {
console.error('Only dat.gui supported');
throw new Error('Only dat.gui supported');
}
};

View File

@ -1,6 +1,6 @@
/**
* Stats component for displaying some render statistics (framerate, memory consumption, etc)
* @param gui
* @param guiRuntime
* @param id
* @param name
* @param domElement
@ -9,17 +9,15 @@
* @constructor
*/
GameLib.GUI = function(
gui,
guiRuntime,
id,
name,
domElement,
objects,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(gui)) {
throw new Error('Need GUI object')
}
this.gui = gui;
this.guiRuntime = guiRuntime;
this.guiRuntime.isNotDatGuiThrow();
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
@ -32,8 +30,7 @@ GameLib.GUI = function(
this.name = name;
if (GameLib.Utils.UndefinedOrNull(domElement)) {
console.warn('Need a DOM element for stats');
throw new Error('Need a DOM element for stats');
domElement = null;
}
this.domElement = domElement;
@ -63,15 +60,15 @@ GameLib.GUI.prototype.constructor = GameLib.GUI;
* Creates a helper instance
*/
GameLib.GUI.prototype.createInstance = function() {
this.instance = new dat.GUI( { autoPlace: false } );
this.instance = new this.guiRuntime.instance( { autoPlace: false } );
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.GUI.prototype.updateInstance = function() {
this.instance = new dat.GUI( { autoPlace: false } );
GameLib.GUI.prototype.updateInstance = function(property) {
console.log('todo: implement gui update instance');
};
/**

View File

@ -164,7 +164,7 @@ GameLib.Matrix4.prototype.toApiObject = function () {
/**
* Creates a GameLib.Matrix4 from an Object matrix
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param objectMatrix Object
* @param parentObject
* @returns {GameLib.Matrix4}

View File

@ -1,13 +1,10 @@
/**
* Runtime mouse for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param apiMouse GameLib.API.Mouse
* Runtime Mouse
* @param apiMouse
* @returns {GameLib.Mouse}
* @constructor
*/
GameLib.Mouse = function (graphics, apiMouse) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.Mouse = function (apiMouse) {
if (GameLib.Utils.UndefinedOrNull(apiMouse)){
apiMouse = {};
@ -36,23 +33,25 @@ GameLib.Mouse.prototype = Object.create(GameLib.API.Mouse.prototype);
GameLib.Mouse.prototype.constructor = GameLib.Mouse;
/**
* Creates an instance mouse
* @param update
* @returns {*}
* createInstance
*/
GameLib.Mouse.prototype.createInstance = function(update) {
GameLib.Mouse.prototype.createInstance = function() {
this.instance = true;
GameLib.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance vector, calls updateInstance on the parent object
* updateInstance
* @param property
*/
GameLib.Mouse.prototype.updateInstance = function() {
GameLib.Mouse.prototype.updateInstance = function(property) {
if (GameLib.Utils.UndefinedOrNull(property)) {
console.warn('unknown property update for Mouse: ' + property);
}
};
/**
* Converts runtime vector to API Vector
* Converts GameLib.Mouse vector to GameLib.API.Mouse
* @returns {GameLib.API.Mouse}
*/
GameLib.Mouse.prototype.toApiObject = function() {
@ -64,3 +63,15 @@ GameLib.Mouse.prototype.toApiObject = function() {
this.parentEntity
);
};
/**
* GameLib.Mouse from Object
* @param objectMouse
* @returns {GameLib.Mouse}
* @constructor
*/
GameLib.Mouse.prototype.FromObject = function(objectMouse) {
return new GameLib.Mouse(
GameLib.API.Mouse.FromObject(objectMouse)
);
};

View File

@ -0,0 +1,59 @@
/**
* Physics
* @param id
* @param name
* @param physicsType
* @constructor
*/
GameLib.PhysicsRuntime = function(
id,
name,
physicsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Physics (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(physicsType)) {
physicsType = GameLib.PhysicsRuntime.TYPE_CANNON_JS;
}
this.physicsType = physicsType;
this.createInstance();
};
/**
* GameLib.PhysicsRuntime Types
* @type {number}
*/
GameLib.PhysicsRuntime.TYPE_CANNON_JS = 0x1;
GameLib.PhysicsRuntime.prototype.createInstance = function() {
if (this.physicsType === GameLib.PhysicsRuntime.TYPE_CANNON_JS) {
this.instance = CANNON;
} else {
this.instance = null;
}
};
GameLib.PhysicsRuntime.prototype.updateInstance = function(property) {
if (property === 'physicsType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.PhysicsRuntime.prototype.isNotCannonThrow = function() {
if (this.instance !== CANNON) {
console.error('Only CANNON supported');
throw new Error('Only CANNON supported');
}
};

View File

@ -14,11 +14,11 @@ GameLib.Quaternion = function (
) {
this.implementation = implementation;
if (implementation instanceof GameLib.D3.Graphics) {
if (implementation instanceof GameLib.GraphicsRuntime) {
this.physics = null;
this.graphics = implementation;
this.graphics.isNotThreeThrow();
} else if (implementation instanceof GameLib.D3.Physics) {
} else if (implementation instanceof GameLib.PhysicsRuntime) {
this.graphics = null;
this.physics = implementation;
this.physics.isNotCannonThrow();

View File

@ -0,0 +1,59 @@
/**
* Sockets
* @param id
* @param name
* @param socketsType
* @constructor
*/
GameLib.SocketsRuntime = function(
id,
name,
socketsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Sockets (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(socketsType)) {
socketsType = GameLib.SocketsRuntime.TYPE_WEB_SOCKET;
}
this.socketsType = socketsType;
this.createInstance();
};
/**
* GameLib.SocketsRuntime Types
* @type {number}
*/
GameLib.SocketsRuntime.TYPE_WEB_SOCKET = 0x1;
GameLib.SocketsRuntime.prototype.createInstance = function() {
if (this.socketsType === GameLib.SocketsRuntime.TYPE_WEB_SOCKET) {
this.instance = WebSocket;
} else {
this.instance = null;
}
};
GameLib.SocketsRuntime.prototype.updateInstance = function(property) {
if (property === 'socketsType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.SocketsRuntime.prototype.isNotWebSocketThrow = function() {
if (!(this.instance instanceof stats)) {
console.error('Only WebSocket supported');
throw new Error('Only WebSocket supported');
}
};

View File

@ -0,0 +1,59 @@
/**
* Statistics
* @param id
* @param name
* @param statisticsType
* @constructor
*/
GameLib.StatisticsRuntime = function(
id,
name,
statisticsType
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Statistics (' + id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(statisticsType)) {
statisticsType = GameLib.StatisticsRuntime.TYPE_STATS;
}
this.statisticsType = statisticsType;
this.createInstance();
};
/**
* GameLib.StatisticsRuntime Types
* @type {number}
*/
GameLib.StatisticsRuntime.TYPE_STATS = 0x1;
GameLib.StatisticsRuntime.prototype.createInstance = function() {
if (this.statisticsType === GameLib.StatisticsRuntime.TYPE_STATS) {
this.instance = Stats;
} else {
this.instance = null;
}
};
GameLib.StatisticsRuntime.prototype.updateInstance = function(property) {
if (property === 'statisticsType') {
this.createInstance();
}
};
/**
* Logs a warning and throws an error if not cannon
*/
GameLib.StatisticsRuntime.prototype.isNotStatsThrow = function() {
if (this.instance !== Stats) {
console.error('Only stats supported');
throw new Error('Only stats supported');
}
};

View File

@ -1,21 +1,16 @@
/**
* System takes care of updating all the entities (based on their component data)
* @param apiSystem GameLib.API.System
* @param graphics
* @constructor
*/
GameLib.System.Input = function(
apiSystem,
graphics
apiSystem
) {
GameLib.System.call(
this,
apiSystem
);
this.graphics = graphics;
this.graphics.isNotThreeThrow();
this.selectAll = false;
this.controlLeft = false;
@ -67,9 +62,7 @@ GameLib.System.Input = function(
this.instanceCreatedSubscription = null;
this.removeComponentSubscription = null;
this.mouse = new GameLib.Mouse(
graphics
)
this.mouse = new GameLib.Mouse();
};
GameLib.System.Input.prototype = Object.create(GameLib.System.prototype);
@ -888,8 +881,8 @@ GameLib.System.Input.prototype.onMouseDownEdit = function(event) {
return;
}
this.mouse.x = (event.offsetX / event.target.width ) * 2 - 1;
this.mouse.y = -(event.offsetY / event.target.height) * 2 + 1;
this.mouse.position.x = (event.offsetX / event.target.width ) * 2 - 1;
this.mouse.position.y = -(event.offsetY / event.target.height) * 2 + 1;
var scenes = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Scene);
@ -898,7 +891,7 @@ GameLib.System.Input.prototype.onMouseDownEdit = function(event) {
function (result, scene) {
editorControl.raycaster.instance.setFromCamera(
this.mouse,
this.mouse.position,
editorControl.camera.instance
);

View File

@ -1,18 +1,11 @@
/**
* System takes care of updating all the entities (based on their component data)
* @param graphics
* @param camera
* @param apiSystem GameLib.API.System
* @constructor
*/
GameLib.System.Particle = function(
graphics,
camera,
apiSystem
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.System.call(
this,
apiSystem
@ -25,8 +18,6 @@ GameLib.System.Particle = function(
*/
this.engines = [];
this.camera = camera;
this.totalTime = 0;
this.instanceCreatedSubscription = null;
@ -70,17 +61,9 @@ GameLib.System.Particle.prototype.start = function() {
* @param data
*/
GameLib.System.Particle.prototype.instanceCreated = function(data) {
if (data.component instanceof GameLib.D3.ParticleEngine) {
// console.log('new particle engine');
this.particleEngines.push(data.component);
}
if (data.component instanceof GameLib.D3.Camera) {
// console.log('new camera');
this.camera = data.component;
}
};
/**

View File

@ -1,6 +1,5 @@
/**
* Storage System takes care loading and linking components and dependencies
* @param graphics
* @param apiSystem GameLib.API.System
* @param token
* @param apiUploadUrl
@ -13,7 +12,6 @@
* @constructor
*/
GameLib.System.Storage = function(
graphics,
apiSystem,
token,
apiUploadUrl,
@ -93,39 +91,6 @@ GameLib.System.Storage.prototype.start = function() {
GameLib.System.prototype.start.call(this);
GameLib.Event.Emit(
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION,
null,
function(graphics) {
this.graphics = graphics;
}.bind(this),
function() {
this.graphics = null;
}.bind(this)
);
GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_IMPLEMENTATION,
null,
function(physics) {
this.physics = physics;
}.bind(this),
function() {
this.physics = null;
}.bind(this)
);
GameLib.Event.Emit(
GameLib.Event.GET_CODER_IMPLEMENTATION,
null,
function(coder) {
this.coder = coder;
}.bind(this),
function() {
this.coder = null;
}.bind(this)
);
this.loginSubscription = this.subscribe(
GameLib.Event.LOGGED_IN,
function(data) {
@ -370,72 +335,20 @@ GameLib.System.Storage.prototype.createRuntimeObject = function(responseText, cl
return null;
}
var runtimeComponent = null;
/**
* Now we need to create the runtime component - this happens systematically.
* First, we create an API object from the Object, then a Runtime object from the API object
* Each component has a function 'FromObject' which essentially does this for you
*/
var component = object.component[0];
var componentName = GameLib.Component.GetComponentName(component.componentType);
var componentClass = eval(componentName);
var fn = componentClass['FromObject'];
if (component.componentType === GameLib.Component.COMPONENT_ENTITY) {
runtimeComponent = fn(component, GameLib.EntityManager.Instance);
} else {
try {
runtimeComponent = fn(component);
} catch (error) {
if (this.coder) {
try {
runtimeComponent = fn(this.coder, component);
} catch (error) {
}
}
if (!runtimeComponent && this.graphics) {
try {
runtimeComponent = fn(this.graphics, component);
} catch (error) {
}
}
if (!runtimeComponent && this.physics) {
try {
runtimeComponent = fn(this.physics, component);
} catch (error) {
/**
* ok - we don't cannot create this component
*/
}
}
var runtimeComponent = GameLib.Component.Construct(object.component[0]);
if (!runtimeComponent) {
if (clientErrorCallback) {
clientErrorCallback({
result: 'failure',
message: 'Could not create a runtime component: ' + object.component[0].name
});
}
if (!runtimeComponent) {
if (clientErrorCallback) {
clientErrorCallback({
result: 'failure',
message: 'Could not create a runtime component: ' + component.name
});
}
}
}
return runtimeComponent;
@ -807,13 +720,11 @@ GameLib.System.Storage.prototype.imageUploadComplete = function(data) {
var image = null;
if (imageData) {
/**
* Overrride this image if possible
* @type {GameLib.D3.Image}
*/
GameLib.D3.Image.FromObject(this.graphics, imageData);
GameLib.Component.Construct(imageData);
} else {
image = runtimeImages.reduce(
function(result, runtimeImage){
@ -828,7 +739,10 @@ GameLib.System.Storage.prototype.imageUploadComplete = function(data) {
null
);
image.updateInstance();
/**
* Even though the path did not technically change, this should trigger an image reload
*/
image.updateInstance('path');
}
}.bind(this));
@ -847,22 +761,23 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
/**
* Process all images - we have to load them in addition to creating their runtime components
*/
data.images.map(function(imageData){
var image = GameLib.D3.Image.FromObject(this.graphics, imageData);
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED,
{
component: image
}
);
}.bind(this));
data.images.map(
function(rawImageObject) {
var image = GameLib.Component.Construct(rawImageObject);
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED,
{
component: image
}
);
}.bind(this)
);
/**
* Process all textures
*/
data.textures.map(function(textureData){
var texture = GameLib.D3.Texture.FromObject(this.graphics, textureData);
data.textures.map(function(rawTextureObject){
var texture = GameLib.Component.Construct(rawTextureObject);
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED,
{
@ -874,10 +789,8 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
/**
* Process all materials
*/
data.materials.map(function(materialData){
var material = GameLib.D3.Material.FromObject(this.graphics, materialData);
data.materials.map(function(rawMaterialObject){
var material = GameLib.Component.Construct(rawMaterialObject);
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED,
{
@ -889,8 +802,8 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
/**
* Now process all meshes
*/
data.meshes.map(function(meshData){
var mesh = GameLib.D3.Mesh.FromObject(this.graphics, meshData);
data.meshes.map(function(rawMeshObject){
var mesh = GameLib.Component.Construct(rawMeshObject);
GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED,
{

View File

@ -18,11 +18,33 @@ GameLib.System.Visualization = function(
apiSystem
);
if (GameLib.Utils.UndefinedOrNull(graphics)){
GameLib.Event.Emit(
GameLib.Event.GET_GRAPHICS_RUNTIME,
null,
function(graphicsRuntime) {
graphics = graphicsRuntime;
}.bind(this),
function() {
graphics = null;
}.bind(this)
);
}
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(physics)){
GameLib.Event.Emit(
GameLib.Event.GET_PHYSICS_RUNTIME,
null,
function(physicsRuntime) {
physics = physicsRuntime;
}.bind(this),
function() {
physics = null;
}.bind(this)
);
}
this.physics = physics;
this.physics.isNotCannonThrow();
this.visualizationSubscription = null;
this.stopVisualizationSubscription = null;

View File

@ -1,6 +1,6 @@
/**
* Runtime vector2 for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param parentObject GameLib.D3.*
* @param apiVector2 GameLib.API.Vector2
* @param grain Number

View File

@ -1,6 +1,6 @@
/**
* Runtime apiVector3 for updating instance objects
* @param implementation GameLib.D3.Graphics
* @param implementation GameLib.GraphicsRuntime
* @param apiVector3 GameLib.API.Vector3
* @param parentObject GameLib.*
* @param grain Number
@ -15,11 +15,11 @@ GameLib.Vector3 = function (
this.implementation = implementation;
if (implementation instanceof GameLib.D3.Graphics) {
if (implementation instanceof GameLib.GraphicsRuntime) {
this.physics = null;
this.graphics = implementation;
this.graphics.isNotThreeThrow();
} else if (implementation instanceof GameLib.D3.Physics) {
} else if (implementation instanceof GameLib.PhysicsRuntime) {
this.graphics = null;
this.physics = implementation;
this.physics.isNotCannonThrow();

View File

@ -1,6 +1,6 @@
/**
* Runtime apiVector4 for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param graphics GameLib.GraphicsRuntime
* @param apiVector4 GameLib.API.Vector4
* @param parentObject GameLib.*
* @param grain Number