start with linked objects
parent
e9ac1c9c9e
commit
70ebe7a5ec
File diff suppressed because one or more lines are too long
5331
build/game-lib.js
5331
build/game-lib.js
File diff suppressed because it is too large
Load Diff
|
@ -727,4 +727,19 @@ GameLib.Utils.UpperCaseWordsSpaces = function(word) {
|
|||
},
|
||||
''
|
||||
).trim();
|
||||
};
|
||||
|
||||
GameLib.Utils.UpperCaseUnderscore = function(word) {
|
||||
|
||||
var str = '';
|
||||
|
||||
word.map(function(letter){
|
||||
if (letter === letter.toUpperCase()) {
|
||||
str += '_' + letter;
|
||||
} else {
|
||||
str += letter.toUpperCase();
|
||||
}
|
||||
});
|
||||
|
||||
return str;
|
||||
};
|
|
@ -9,12 +9,11 @@ GameLib.API.Component = function(
|
|||
parentEntity
|
||||
) {
|
||||
this.componentType = componentType;
|
||||
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
};
|
||||
|
||||
GameLib.API.Component.prototype = Object.create(GameLib.Event.prototype);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Component Interface
|
||||
* @constructor
|
||||
* @param componentType
|
||||
* @param linkedObjects
|
||||
* @param delayed
|
||||
*/
|
||||
GameLib.Component = function(
|
||||
componentType,
|
||||
linkedObjects,
|
||||
delayed
|
||||
) {
|
||||
|
@ -16,12 +14,6 @@ GameLib.Component = function(
|
|||
this.linkedObjects = linkedObjects;
|
||||
this.linkedObjects.parentEntity = GameLib.Entity;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
this.parentEntity
|
||||
);
|
||||
|
||||
this.idToObject = {};
|
||||
|
||||
this.selected = false;
|
||||
|
@ -212,87 +204,87 @@ GameLib.Component.prototype.toString = function() {
|
|||
return this.id;
|
||||
};
|
||||
|
||||
//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_CAMERA = 0x5;
|
||||
//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_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_VIEWPORT = 0x12;
|
||||
GameLib.Component.COMPONENT_SYSTEM = 0x13;
|
||||
GameLib.Component.COMPONENT_GRAPHICS = 0x14;
|
||||
GameLib.Component.COMPONENT_HELPER = 0x15;
|
||||
GameLib.Component.COMPONENT_CUSTOM_CODE = 0x16;
|
||||
GameLib.Component.COMPONENT_MOUSE = 0x17;
|
||||
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_STATS = 0x1d;
|
||||
GameLib.Component.COMPONENT_GUI = 0x1e;
|
||||
GameLib.Component.COMPONENT_IMAGE = 0x1f;
|
||||
GameLib.Component.COMPONENT_ENTITY = 0x20;
|
||||
GameLib.Component.COMPONENT_MESH_SPHERE = 0x21;
|
||||
GameLib.Component.COMPONENT_MESH_PLANE = 0x22;
|
||||
GameLib.Component.COMPONENT_MESH_CURVE = 0x23;
|
||||
GameLib.Component.COMPONENT_PHYSICS_WORLD = 0x24;
|
||||
GameLib.Component.COMPONENT_BROADPHASE = 0x25;
|
||||
GameLib.Component.COMPONENT_SOLVER = 0x26;
|
||||
GameLib.Component.COMPONENT_RIGID_BODY = 0x27;
|
||||
GameLib.Component.COMPONENT_SHAPE = 0x28;
|
||||
GameLib.Component.COMPONENT_SHAPE_BOX = 0x29;
|
||||
GameLib.Component.COMPONENT_SHAPE_SPHERE = 0x2a;
|
||||
GameLib.Component.COMPONENT_SHAPE_TRI_MESH = 0x2b;
|
||||
GameLib.Component.COMPONENT_SHAPE_CONVEX_HULL = 0x2c;
|
||||
GameLib.Component.COMPONENT_SHAPE_CONVEX_HULL_CYLINDER = 0x2d;
|
||||
GameLib.Component.COMPONENT_SHAPE_HEIGHT_MAP = 0x2e;
|
||||
GameLib.Component.COMPONENT_SHAPE_PLANE = 0x2f;
|
||||
GameLib.Component.COMPONENT_CONTROLS = 0x30;
|
||||
GameLib.Component.COMPONENT_CONTROLS_EDITOR = 0x31;
|
||||
GameLib.Component.COMPONENT_CONTROLS_TOUCH = 0x32;
|
||||
GameLib.Component.COMPONENT_FRICTION_MATERIAL = 0x33;
|
||||
GameLib.Component.COMPONENT_FRICTION_CONTACT_MATERIAL = 0x34;
|
||||
GameLib.Component.COMPONENT_RAYCAST_VEHICLE = 0x35;
|
||||
GameLib.Component.COMPONENT_RAYCAST_WHEEL = 0x36;
|
||||
GameLib.Component.COMPONENT_CLOCK = 0x37;
|
||||
GameLib.Component.COMPONENT_ANIMATION = 0x38;
|
||||
GameLib.Component.COMPONENT_CONTROLS_KEYBOARD = 0x39;
|
||||
GameLib.Component.COMPONENT_CONTROLS_MOUSE = 0x3a;
|
||||
GameLib.Component.COMPONENT_MESH_TEXT = 0x3b;
|
||||
GameLib.Component.COMPONENT_FONT = 0x3c;
|
||||
GameLib.Component.COMPONENT_CANVAS = 0x3d;
|
||||
GameLib.Component.COMPONENT_BONE = 0x3e;
|
||||
GameLib.Component.COMPONENT_MESH_BOX = 0x3f;
|
||||
GameLib.Component.COMPONENT_MESH_CYLINDER = 0x40;
|
||||
GameLib.Component.COMPONENT_SYSTEM_ANIMATION = 0x41;
|
||||
GameLib.Component.COMPONENT_SYSTEM_CUSTOM_CODE = 0x42;
|
||||
GameLib.Component.COMPONENT_SYSTEM_GUI = 0x43;
|
||||
GameLib.Component.COMPONENT_SYSTEM_INPUT = 0x44;
|
||||
GameLib.Component.COMPONENT_SYSTEM_LINKING = 0x45;
|
||||
GameLib.Component.COMPONENT_SYSTEM_PHYSICS = 0x46;
|
||||
GameLib.Component.COMPONENT_SYSTEM_RENDER = 0x47;
|
||||
GameLib.Component.COMPONENT_SYSTEM_STORAGE = 0x48;
|
||||
GameLib.Component.COMPONENT_SYSTEM_VISUALIZATION = 0x49;
|
||||
GameLib.Component.COMPONENT_FOG = 0x50;
|
||||
GameLib.Component.COMPONENT_MESH_LINE = 0x51;
|
||||
GameLib.Component.COMPONENT_PARTICLE_ENGINE = 0x52;
|
||||
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.PATH_FOLLOWING = 0x1;
|
||||
GameLib.Component.MATERIAL = 0x2;
|
||||
GameLib.Component.RENDERER = 0x3;
|
||||
//GameLib.Component.LOOK_AT = 0x4;
|
||||
GameLib.Component.CAMERA = 0x5;
|
||||
//GameLib.Component.FOLLOW = 0x6;
|
||||
GameLib.Component.MESH = 0x7;
|
||||
GameLib.Component.SPLINE = 0x8;
|
||||
GameLib.Component.LIGHT = 0x9;
|
||||
//GameLib.Component.INPUT_DRIVE = 0xa;
|
||||
GameLib.Component.COMPOSER = 0xb;
|
||||
GameLib.Component.RENDER_TARGET = 0xc;
|
||||
GameLib.Component.PASS = 0xd;
|
||||
GameLib.Component.SCENE = 0xe;
|
||||
GameLib.Component.RAYCASTER = 0xf;
|
||||
//GameLib.Component.INPUT_EDITOR = 0x10;
|
||||
//GameLib.Component.EDITOR = 0x11;
|
||||
GameLib.Component.VIEWPORT = 0x12;
|
||||
GameLib.Component.SYSTEM = 0x13;
|
||||
GameLib.Component.GRAPHICS = 0x14;
|
||||
GameLib.Component.HELPER = 0x15;
|
||||
GameLib.Component.CUSTOM_CODE = 0x16;
|
||||
GameLib.Component.MOUSE = 0x17;
|
||||
GameLib.Component.SKELETON = 0x18;
|
||||
GameLib.Component.TEXTURE = 0x19;
|
||||
GameLib.Component.ENTITY_MANAGER = 0x1a;
|
||||
GameLib.Component.DOM_ELEMENT = 0x1b;
|
||||
//GameLib.Component.IMAGE_FACTORY = 0x1c;
|
||||
GameLib.Component.STATS = 0x1d;
|
||||
GameLib.Component.GUI = 0x1e;
|
||||
GameLib.Component.IMAGE = 0x1f;
|
||||
GameLib.Component.ENTITY = 0x20;
|
||||
GameLib.Component.MESH_SPHERE = 0x21;
|
||||
GameLib.Component.MESH_PLANE = 0x22;
|
||||
GameLib.Component.MESH_CURVE = 0x23;
|
||||
GameLib.Component.PHYSICS_WORLD = 0x24;
|
||||
GameLib.Component.BROADPHASE = 0x25;
|
||||
GameLib.Component.SOLVER = 0x26;
|
||||
GameLib.Component.RIGID_BODY = 0x27;
|
||||
GameLib.Component.SHAPE = 0x28;
|
||||
GameLib.Component.SHAPE_BOX = 0x29;
|
||||
GameLib.Component.SHAPE_SPHERE = 0x2a;
|
||||
GameLib.Component.SHAPE_TRI_MESH = 0x2b;
|
||||
GameLib.Component.SHAPE_CONVEX_HULL = 0x2c;
|
||||
GameLib.Component.SHAPE_CONVEX_HULL_CYLINDER = 0x2d;
|
||||
GameLib.Component.SHAPE_HEIGHT_MAP = 0x2e;
|
||||
GameLib.Component.SHAPE_PLANE = 0x2f;
|
||||
GameLib.Component.CONTROLS = 0x30;
|
||||
GameLib.Component.CONTROLS_EDITOR = 0x31;
|
||||
GameLib.Component.CONTROLS_TOUCH = 0x32;
|
||||
GameLib.Component.FRICTION_MATERIAL = 0x33;
|
||||
GameLib.Component.FRICTION_CONTACT_MATERIAL = 0x34;
|
||||
GameLib.Component.RAYCAST_VEHICLE = 0x35;
|
||||
GameLib.Component.RAYCAST_WHEEL = 0x36;
|
||||
GameLib.Component.CLOCK = 0x37;
|
||||
GameLib.Component.ANIMATION = 0x38;
|
||||
GameLib.Component.CONTROLS_KEYBOARD = 0x39;
|
||||
GameLib.Component.CONTROLS_MOUSE = 0x3a;
|
||||
GameLib.Component.MESH_TEXT = 0x3b;
|
||||
GameLib.Component.FONT = 0x3c;
|
||||
GameLib.Component.CANVAS = 0x3d;
|
||||
GameLib.Component.BONE = 0x3e;
|
||||
GameLib.Component.MESH_BOX = 0x3f;
|
||||
GameLib.Component.MESH_CYLINDER = 0x40;
|
||||
GameLib.Component.SYSTEM_ANIMATION = 0x41;
|
||||
GameLib.Component.SYSTEM_CUSTOM_CODE = 0x42;
|
||||
GameLib.Component.SYSTEM_GUI = 0x43;
|
||||
GameLib.Component.SYSTEM_INPUT = 0x44;
|
||||
GameLib.Component.SYSTEM_LINKING = 0x45;
|
||||
GameLib.Component.SYSTEM_PHYSICS = 0x46;
|
||||
GameLib.Component.SYSTEM_RENDER = 0x47;
|
||||
GameLib.Component.SYSTEM_STORAGE = 0x48;
|
||||
GameLib.Component.SYSTEM_VISUALIZATION = 0x49;
|
||||
GameLib.Component.FOG = 0x50;
|
||||
GameLib.Component.MESH_LINE = 0x51;
|
||||
GameLib.Component.PARTICLE_ENGINE = 0x52;
|
||||
GameLib.Component.SYSTEM_PARTICLE = 0x53;
|
||||
GameLib.Component.PARTICLE = 0x54;
|
||||
GameLib.Component.AUDIO = 0x55;
|
||||
GameLib.Component.SYSTEM_AUDIO = 0x56;
|
||||
GameLib.Component.CAST = 0x57;
|
||||
|
||||
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
|
||||
GameLib.Component.PHYSICS_RUNTIME = 0x2;
|
||||
|
@ -302,6 +294,10 @@ GameLib.Component.DEFAULT_RUNTIME = 0x5;
|
|||
GameLib.Component.GUI_RUNTIME = 0x6;
|
||||
GameLib.Component.CODER_RUNTIME = 0x7;
|
||||
|
||||
GameLib.Component.GetCompentType = function(constructor) {
|
||||
console.log('todo: implement?');
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns string name for component number
|
||||
* @param number
|
||||
|
@ -313,305 +309,379 @@ GameLib.Component.GetComponentInfo = function(number) {
|
|||
case 0x1 : return null;
|
||||
case 0x2 : return {
|
||||
name : 'GameLib.D3.Material',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Material
|
||||
};
|
||||
case 0x3 : return {
|
||||
name : 'GameLib.D3.Renderer',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Renderer
|
||||
};
|
||||
case 0x4 : return null;
|
||||
case 0x5 : return {
|
||||
name : 'GameLib.D3.Camera',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Camera
|
||||
};
|
||||
case 0x6 : return null;
|
||||
case 0x7 : return {
|
||||
name : 'GameLib.D3.Mesh',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh
|
||||
};
|
||||
case 0x8 : return {
|
||||
name : 'GameLib.D3.Spline',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Spline
|
||||
};
|
||||
case 0x9 : return {
|
||||
name : 'GameLib.D3.Light',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Light
|
||||
};
|
||||
case 0xa : return null;
|
||||
case 0xb : return {
|
||||
name : 'GameLib.D3.Composer',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Composer
|
||||
};
|
||||
case 0xc : return {
|
||||
name : 'GameLib.D3.RenderTarget',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.RenderTarget
|
||||
};
|
||||
case 0xd : return {
|
||||
name : 'GameLib.D3.Pass',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Pass
|
||||
};
|
||||
case 0xe : return {
|
||||
name : 'GameLib.D3.Scene',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Scene
|
||||
};
|
||||
case 0xf : return {
|
||||
name : 'GameLib.D3.Raycaster',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Raycaster
|
||||
};
|
||||
case 0x10 : return null;
|
||||
case 0x11 : return null;
|
||||
case 0x12 : return {
|
||||
name : 'GameLib.D3.Viewport',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Viewport
|
||||
};
|
||||
case 0x13 : return {
|
||||
name : 'GameLib.System',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.System
|
||||
};
|
||||
case 0x14 : return {
|
||||
name : 'GameLib.GraphicsRuntime',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.GraphicsRuntime
|
||||
};
|
||||
case 0x15 : return {
|
||||
name : 'GameLib.D3.Helper',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Helper
|
||||
};
|
||||
case 0x16 : return {
|
||||
name : 'GameLib.CustomCode',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.CustomCode
|
||||
};
|
||||
case 0x17 : return {
|
||||
name : 'GameLib.Mouse',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.Mouse
|
||||
};
|
||||
case 0x18 : return {
|
||||
name : 'GameLib.D3.Skeleton',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Skeleton
|
||||
};
|
||||
case 0x19 : return {
|
||||
name : 'GameLib.D3.Texture',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Texture
|
||||
};
|
||||
case 0x1a : return {
|
||||
name : 'GameLib.EntityManager',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.EntityManager
|
||||
};
|
||||
case 0x1b : return {
|
||||
name : 'GameLib.DomElement',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.DomElement
|
||||
};
|
||||
case 0x1c : return null;
|
||||
case 0x1d : return {
|
||||
name : 'GameLib.D3.Stats',
|
||||
runtime : GameLib.Component.STATISTICS_RUNTIME
|
||||
name : 'GameLib.Stats',
|
||||
runtime : GameLib.Component.STATISTICS_RUNTIME,
|
||||
constructor : GameLib.Stats
|
||||
};
|
||||
case 0x1e : return {
|
||||
name : 'GameLib.GUI',
|
||||
runtime : GameLib.Component.GUI_RUNTIME
|
||||
runtime : GameLib.Component.GUI_RUNTIME,
|
||||
constructor : GameLib.GUI
|
||||
};
|
||||
case 0x1f : return {
|
||||
name : 'GameLib.Image',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Image
|
||||
};
|
||||
case 0x20 : return {
|
||||
name : 'GameLib.Entity',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Entity
|
||||
};
|
||||
case 0x21 : return {
|
||||
name : 'GameLib.D3.Mesh.Sphere',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Sphere
|
||||
};
|
||||
case 0x22 : return {
|
||||
name : 'GameLib.D3.Mesh.Plane',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Plane
|
||||
};
|
||||
case 0x23 : return {
|
||||
name : 'GameLib.D3.Mesh.Curve',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Curve
|
||||
};
|
||||
case 0x24 : return {
|
||||
name : 'GameLib.D3.PhysicsWorld',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.PhysicsWorld
|
||||
};
|
||||
case 0x25 : return {
|
||||
name : 'GameLib.D3.Broadphase',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Broadphase
|
||||
};
|
||||
case 0x26 : return {
|
||||
name : 'GameLib.D3.Solver',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Solver
|
||||
};
|
||||
case 0x27 : return {
|
||||
name : 'GameLib.D3.RigidBody',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.RigidBody
|
||||
};
|
||||
case 0x28 : return {
|
||||
name : 'GameLib.D3.Shape',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape
|
||||
};
|
||||
case 0x29 : return {
|
||||
name : 'GameLib.D3.Shape.Box',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.Box
|
||||
};
|
||||
case 0x2a : return {
|
||||
name : 'GameLib.D3.Shape.Sphere',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.Sphere
|
||||
};
|
||||
case 0x2b : return {
|
||||
name : 'GameLib.D3.Shape.TriMesh',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.TriMesh
|
||||
};
|
||||
case 0x2c : return {
|
||||
name : 'GameLib.D3.Shape.ConvexHull',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.ConvexHull
|
||||
};
|
||||
case 0x2d : return {
|
||||
name : 'GameLib.D3.Shape.ConvexHull.Cylinder',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.ConvexHull.Cylinder
|
||||
};
|
||||
case 0x2e : return {
|
||||
name : 'GameLib.D3.Shape.HeightMap',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.HeightMap
|
||||
};
|
||||
case 0x2f : return {
|
||||
name : 'GameLib.D3.Shape.Plane',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.Shape.Plane
|
||||
};
|
||||
case 0x30 : return {
|
||||
name : 'GameLib.Controls',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Controls
|
||||
};
|
||||
case 0x31 : return {
|
||||
name : 'GameLib.D3.Controls.Editor',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
name : 'GameLib.Controls.D3.Editor',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.Controls.D3.Editor
|
||||
};
|
||||
case 0x32 : return {
|
||||
name : 'GameLib.Controls.Touch',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Controls.Touch
|
||||
};
|
||||
case 0x33 : return {
|
||||
name : 'GameLib.D3.FrictionMaterial',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.FrictionMaterial
|
||||
};
|
||||
case 0x34 : return {
|
||||
name : 'GameLib.D3.FrictionContactMaterial',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.FrictionContactMaterial
|
||||
};
|
||||
case 0x35 : return {
|
||||
name : 'GameLib.D3.RaycastVehicle',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.RaycastVehicle
|
||||
};
|
||||
case 0x36 : return {
|
||||
name : 'GameLib.D3.RaycastWheel',
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME
|
||||
runtime : GameLib.Component.PHYSICS_RUNTIME,
|
||||
constructor : GameLib.D3.RaycastWheel
|
||||
};
|
||||
case 0x37 : return {
|
||||
name : 'GameLib.Clock',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.Clock
|
||||
};
|
||||
case 0x38 : return {
|
||||
name : 'GameLib.D3.Animation',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.Animation
|
||||
};
|
||||
case 0x39 : return {
|
||||
name : 'GameLib.Controls.Keyboard',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Controls.Keyboard
|
||||
};
|
||||
case 0x3a : return {
|
||||
name : 'GameLib.Controls.Mouse',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Controls.Mouse
|
||||
};
|
||||
case 0x3b : return {
|
||||
name : 'GameLib.D3.Mesh.Text',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Text
|
||||
};
|
||||
case 0x3c : return {
|
||||
name : 'GameLib.D3.Font',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Font
|
||||
};
|
||||
case 0x3d : return {
|
||||
name : 'GameLib.Canvas',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.Canvas
|
||||
};
|
||||
case 0x3e : return {
|
||||
name : 'GameLib.D3.Bone',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Bone
|
||||
};
|
||||
case 0x3f : return {
|
||||
name : 'GameLib.D3.Mesh.Box',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Box
|
||||
};
|
||||
case 0x40 : return {
|
||||
name : 'GameLib.D3.Mesh.Cylinder',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Cylinder
|
||||
};
|
||||
case 0x41 : return {
|
||||
name : 'GameLib.D3.System.Animation',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Animation
|
||||
};
|
||||
case 0x42 : return {
|
||||
name : 'GameLib.D3.System.CustomCode',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.CustomCode
|
||||
};
|
||||
case 0x43 : return {
|
||||
name : 'GameLib.D3.System.GUI',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.GUI
|
||||
};
|
||||
case 0x44 : return {
|
||||
name : 'GameLib.D3.System.Input',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Input
|
||||
};
|
||||
case 0x45 : return {
|
||||
name : 'GameLib.D3.System.Linking',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Linking
|
||||
};
|
||||
case 0x46 : return {
|
||||
name : 'GameLib.D3.System.Physics',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Physics
|
||||
};
|
||||
case 0x47 : return {
|
||||
name : 'GameLib.D3.System.Render',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Render
|
||||
};
|
||||
case 0x48 : return {
|
||||
name : 'GameLib.D3.System.Storage',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Storage
|
||||
};
|
||||
case 0x49 : return {
|
||||
name : 'GameLib.D3.System.Visualization',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Visualization
|
||||
};
|
||||
case 0x50 : return {
|
||||
name : 'GameLib.D3.Fog',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Fog
|
||||
};
|
||||
case 0x51 : return {
|
||||
name : 'GameLib.D3.Mesh.Line',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Mesh.Line
|
||||
};
|
||||
case 0x52 : return {
|
||||
name : 'GameLib.D3.ParticleEngine',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.ParticleEngine
|
||||
};
|
||||
case 0x53 : return {
|
||||
name : 'GameLib.D3.System.Particle',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.D3.System.Particle
|
||||
};
|
||||
case 0x54 : return {
|
||||
name : 'GameLib.D3.Particle',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Particle
|
||||
};
|
||||
case 0x55 : return {
|
||||
name : 'GameLib.D3.Audio',
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME
|
||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||
constructor : GameLib.D3.Audio
|
||||
};
|
||||
case 0x56 : return {
|
||||
name : 'GameLib.System.Audio',
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME
|
||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||
constructor : GameLib.System.Audio
|
||||
};
|
||||
case 0x57 : return {
|
||||
name : 'GameLib.Cast',
|
||||
runtime : GameLib.Component.SOCKET_RUNTIME
|
||||
runtime : GameLib.Component.SOCKET_RUNTIME,
|
||||
constructor : GameLib.Cast
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
@ -634,7 +704,7 @@ GameLib.Component.GetComponentName = function(componentType) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @return {null}
|
||||
* @return {null || Object}
|
||||
*/
|
||||
GameLib.Component.GetComponentRuntime = function(componentType) {
|
||||
|
||||
|
@ -646,6 +716,22 @@ GameLib.Component.GetComponentRuntime = function(componentType) {
|
|||
return null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {null || Object}
|
||||
*/
|
||||
GameLib.Component.GetComponentConstructor = function(componentType) {
|
||||
|
||||
var info = GameLib.Component.GetComponentInfo(componentType);
|
||||
|
||||
if (info) {
|
||||
return info.constructor;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Components are linked at runtime - for storing, we just store the ID
|
||||
* @returns {*}
|
||||
|
@ -764,7 +850,7 @@ GameLib.Component.prototype.generateNewIds = function() {
|
|||
|
||||
this.buildIdToObject();
|
||||
|
||||
var codeComponents = GameLib.EntityManager.Instance.queryComponents(GameLib.CustomCode);
|
||||
var codeComponents = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.CUSTOM_CODE);
|
||||
|
||||
for (var property in this.idToObject) {
|
||||
if (this.idToObject.hasOwnProperty(property)) {
|
||||
|
@ -950,8 +1036,6 @@ GameLib.Component.prototype.save = function(remote) {
|
|||
|
||||
var apiObject = this.idToObject[property].toApiObject();
|
||||
|
||||
apiObject.componentType = this.idToObject[property].componentType;
|
||||
|
||||
toSave.push(apiObject);
|
||||
|
||||
this.publish(
|
||||
|
@ -971,7 +1055,7 @@ GameLib.Component.Construct = function(rawComponentObject) {
|
|||
|
||||
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
|
||||
|
||||
var componentClass = eval(info.name);
|
||||
var componentClass = info.constructor;
|
||||
|
||||
var fn = componentClass['FromObject'];
|
||||
|
||||
|
@ -979,12 +1063,13 @@ GameLib.Component.Construct = function(rawComponentObject) {
|
|||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GET_RUNTIME,
|
||||
null,
|
||||
function(runtimeObject) {
|
||||
runtime = runtimeObject;
|
||||
}
|
||||
);
|
||||
|
||||
if (rawComponentObject.componentType === GameLib.Component.COMPONENT_ENTITY) {
|
||||
if (rawComponentObject.componentType === GameLib.Component.ENTITY) {
|
||||
|
||||
runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance);
|
||||
|
||||
|
|
|
@ -34,10 +34,11 @@ GameLib.API.Canvas = function(
|
|||
}
|
||||
this.height = height;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)){
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.CANVAS,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Canvas.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -56,10 +56,11 @@ GameLib.API.Cast = function(
|
|||
}
|
||||
this.port = port;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.CAST,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Cast.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -21,10 +21,11 @@ GameLib.API.Clock = function(
|
|||
}
|
||||
this.name = name;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.CLOCK,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Clock.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -22,7 +22,7 @@ GameLib.API.Controls = function(
|
|||
|
||||
if (GameLib.Utils.UndefinedOrNull(controlsType)) {
|
||||
|
||||
if (this instanceof GameLib.D3.Controls.Editor) {
|
||||
if (this instanceof GameLib.Controls.D3.Editor) {
|
||||
controlsType = GameLib.Controls.CONTROLS_TYPE_EDITOR;
|
||||
}
|
||||
|
||||
|
@ -71,15 +71,29 @@ GameLib.API.Controls = function(
|
|||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
// if (GameLib.Utils.UndefinedOrNull(fullscreen)) {
|
||||
// fullscreen = false;
|
||||
// }
|
||||
// this.fullscreen = fullscreen;
|
||||
var componentType = GameLib.Component.CONTROLS;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_EDITOR) {
|
||||
componentType = GameLib.Component.CONTROLS_EDITOR;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_TOUCH) {
|
||||
componentType = GameLib.Component.CONTROLS_TOUCH
|
||||
}
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_KEYBOARD) {
|
||||
componentType = GameLib.Component.CONTROLS_KEYBOARD
|
||||
}
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_MOUSE) {
|
||||
componentType = GameLib.Component.CONTROLS_MOUSE
|
||||
}
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Controls.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -34,11 +34,11 @@ GameLib.API.CustomCode = function (
|
|||
}
|
||||
this.code = code;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.CUSTOM_CODE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.CustomCode.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -28,10 +28,11 @@ GameLib.API.DomElement = function(
|
|||
}
|
||||
this.domElementId = domElementId;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.DOM_ELEMENT,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.DomElement.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -6,13 +6,15 @@
|
|||
* @param entities GameLib.API.Entity[]
|
||||
* @param defaultEntity
|
||||
* @param defaultRenderer
|
||||
* @param parentEntity
|
||||
*/
|
||||
GameLib.API.EntityManager = function(
|
||||
id,
|
||||
name,
|
||||
entities,
|
||||
defaultEntity,
|
||||
defaultRenderer
|
||||
defaultRenderer,
|
||||
parentEntity
|
||||
) {
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
|
@ -38,6 +40,12 @@ GameLib.API.EntityManager = function(
|
|||
defaultRenderer = null;
|
||||
}
|
||||
this.defaultRenderer = defaultRenderer;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.ENTITY_MANAGER,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.EntityManager.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -61,6 +69,7 @@ GameLib.API.EntityManager.FromObject = function(objectEntityManager) {
|
|||
objectEntityManager.name,
|
||||
apiEntities,
|
||||
objectEntityManager.defaultEntity,
|
||||
objectEntityManager.defaultRenderer
|
||||
objectEntityManager.defaultRenderer,
|
||||
objectEntityManager.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -29,10 +29,11 @@ GameLib.API.Entity = function(
|
|||
}
|
||||
this.components = components;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.ENTITY,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntityManager)) {
|
||||
parentEntityManager = null;
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* Raw GUI API object - should always correspond with the GUI Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param domElement
|
||||
* @param objects
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.API.GUI = function(
|
||||
id,
|
||||
name,
|
||||
domElement,
|
||||
objects,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
name = 'GUI (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(objects)) {
|
||||
objects = [];
|
||||
}
|
||||
this.objects = objects;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.GUI,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.GUI.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.API.GUI.prototype.constructor = GameLib.API.GUI;
|
||||
|
||||
/**
|
||||
* Creates an API GUI from an Object GUI
|
||||
* @param objectGUI
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.API.GUI.FromObject = function(objectGUI) {
|
||||
|
||||
var apiDomElement = null;
|
||||
if (objectGUI.domElement) {
|
||||
if (objectGUI.domElement instanceof Object) {
|
||||
apiDomElement = GameLib.API.DomElement.FromObject(objectGUI.domElement);
|
||||
} else {
|
||||
apiDomElement = objectGUI.domElement;
|
||||
}
|
||||
}
|
||||
|
||||
return new GameLib.API.GUI(
|
||||
objectGUI.id,
|
||||
objectGUI.name,
|
||||
apiDomElement,
|
||||
objectGUI.objects,
|
||||
objectGUI.parentEntity
|
||||
);
|
||||
|
||||
};
|
|
@ -68,10 +68,11 @@ GameLib.API.Image = function(
|
|||
}
|
||||
this.size = size;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.IMAGE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Image.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -14,12 +14,6 @@ GameLib.API.Mouse = function(
|
|||
y,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
|
@ -40,6 +34,11 @@ GameLib.API.Mouse = function(
|
|||
}
|
||||
this.y = y;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.MOUSE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Mouse.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Raw Stats API object - should always correspond with the Stats Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param domElement
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.API.Stats = function(
|
||||
id,
|
||||
name,
|
||||
domElement,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Stats (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.STATS,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.API.Stats.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.API.Stats.prototype.constructor = GameLib.API.Stats;
|
||||
|
||||
/**
|
||||
* Creates an API Stats from an Object Stats
|
||||
* @param objectStats
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.API.Stats.FromObject = function(objectStats) {
|
||||
|
||||
var apiDomElement = null;
|
||||
if (objectStats.domElement) {
|
||||
if (objectStats.domElement instanceof Object) {
|
||||
apiDomElement = GameLib.API.DomElement.FromObject(objectStats.domElement);
|
||||
} else {
|
||||
apiDomElement = objectStats.domElement;
|
||||
}
|
||||
}
|
||||
|
||||
return new GameLib.API.Stats(
|
||||
objectStats.id,
|
||||
objectStats.name,
|
||||
apiDomElement,
|
||||
objectStats.parentEntity
|
||||
);
|
||||
|
||||
};
|
|
@ -22,16 +22,67 @@ GameLib.API.System = function (
|
|||
name = "System (" + this.id + ")";
|
||||
}
|
||||
this.name = name;
|
||||
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(systemType)) {
|
||||
systemType = GameLib.System.SYSTEM_TYPE_RENDER;
|
||||
systemType = GameLib.System.SYSTEM_TYPE_NONE;
|
||||
}
|
||||
this.systemType = systemType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
|
||||
var componentType = GameLib.Component.SYSTEM;
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_NONE) {
|
||||
componentType = GameLib.Component.SYSTEM;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) {
|
||||
componentType = GameLib.Component.SYSTEM_ANIMATION;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_CUSTOM) {
|
||||
componentType = GameLib.Component.SYSTEM_CUSTOM_CODE;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_GUI) {
|
||||
componentType = GameLib.Component.SYSTEM_GUI;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_INPUT) {
|
||||
componentType = GameLib.Component.SYSTEM_INPUT;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_LINKING) {
|
||||
componentType = GameLib.Component.SYSTEM_LINKING;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_PHYSICS) {
|
||||
componentType = GameLib.Component.SYSTEM_PHYSICS;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_RENDER) {
|
||||
componentType = GameLib.Component.SYSTEM_RENDER;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_STORAGE) {
|
||||
componentType = GameLib.Component.SYSTEM_STORAGE;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_VISUALIZATION) {
|
||||
componentType = GameLib.Component.SYSTEM_VISUALIZATION;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_PARTICLE) {
|
||||
componentType = GameLib.Component.SYSTEM_PARTICLE;
|
||||
}
|
||||
|
||||
if (this.systemType === GameLib.System.SYSTEM_TYPE_AUDIO) {
|
||||
componentType = GameLib.Component.SYSTEM_AUDIO;
|
||||
}
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -24,10 +24,7 @@ GameLib.Canvas = function(
|
|||
apiCanvas.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_CANVAS
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.Canvas.prototype = Object.create(GameLib.API.Canvas.prototype);
|
||||
|
|
|
@ -34,7 +34,6 @@ GameLib.Cast = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_CAST,
|
||||
{
|
||||
peer : GameLib.Component
|
||||
}
|
||||
|
|
|
@ -27,11 +27,7 @@ GameLib.Clock = function(
|
|||
apiClock.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_CLOCK
|
||||
);
|
||||
|
||||
GameLib.Component.call(this);
|
||||
} ;
|
||||
|
||||
GameLib.Clock.prototype = Object.create(GameLib.API.Clock.prototype);
|
||||
|
|
|
@ -24,8 +24,6 @@ GameLib.Controls = function (
|
|||
apiControls.parentEntity
|
||||
);
|
||||
|
||||
var componentType = GameLib.Component.COMPONENT_CONTROLS;
|
||||
|
||||
var linkedObjects = {
|
||||
domElement : GameLib.DomElement
|
||||
};
|
||||
|
@ -34,29 +32,14 @@ GameLib.Controls = function (
|
|||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_EDITOR) {
|
||||
|
||||
componentType = GameLib.Component.COMPONENT_CONTROLS_EDITOR;
|
||||
|
||||
linkedObjects.raycaster = GameLib.D3.Raycaster;
|
||||
linkedObjects.camera = GameLib.D3.Camera;
|
||||
|
||||
delayed = true;
|
||||
}
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_TOUCH) {
|
||||
componentType = GameLib.Component.COMPONENT_CONTROLS_TOUCH
|
||||
}
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_KEYBOARD) {
|
||||
componentType = GameLib.Component.COMPONENT_CONTROLS_KEYBOARD
|
||||
}
|
||||
|
||||
if (this.controlsType === GameLib.Controls.CONTROLS_TYPE_MOUSE) {
|
||||
componentType = GameLib.Component.COMPONENT_CONTROLS_MOUSE
|
||||
}
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
linkedObjects,
|
||||
delayed
|
||||
);
|
||||
|
@ -65,6 +48,8 @@ GameLib.Controls = function (
|
|||
GameLib.Controls.prototype = Object.create(GameLib.API.Controls.prototype);
|
||||
GameLib.Controls.prototype.constructor = GameLib.Controls;
|
||||
|
||||
GameLib.Controls.D3 = function() {};
|
||||
|
||||
/**
|
||||
* Controls Type
|
||||
* @type {number}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @param camera
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Controls.Editor = function (
|
||||
GameLib.Controls.D3.Editor = function (
|
||||
graphics,
|
||||
apiControls,
|
||||
raycaster,
|
||||
|
@ -50,14 +50,14 @@ GameLib.D3.Controls.Editor = function (
|
|||
* Inheritance
|
||||
* @type {GameLib.Controls}
|
||||
*/
|
||||
GameLib.D3.Controls.Editor.prototype = Object.create(GameLib.Controls.prototype);
|
||||
GameLib.D3.Controls.Editor.prototype.constructor = GameLib.D3.Controls.Editor;
|
||||
GameLib.Controls.D3.Editor.prototype = Object.create(GameLib.Controls.prototype);
|
||||
GameLib.Controls.D3.Editor.prototype.constructor = GameLib.Controls.D3.Editor;
|
||||
|
||||
/**
|
||||
* Create Instance
|
||||
* @returns {THREE.EditorControls}
|
||||
*/
|
||||
GameLib.D3.Controls.Editor.prototype.createInstance = function() {
|
||||
GameLib.Controls.D3.Editor.prototype.createInstance = function() {
|
||||
|
||||
if (!this.camera || !this.camera.instance) {
|
||||
throw new Error('No camera at time of instance');
|
||||
|
@ -78,7 +78,7 @@ GameLib.D3.Controls.Editor.prototype.createInstance = function() {
|
|||
/**
|
||||
* Update Instance
|
||||
*/
|
||||
GameLib.D3.Controls.Editor.prototype.updateInstance = function() {
|
||||
GameLib.Controls.D3.Editor.prototype.updateInstance = function() {
|
||||
|
||||
console.warn('an update instance was called on editor controls - which, if not called from within a running system at the right time will affect the order of input event handling and cause system instability');
|
||||
|
||||
|
@ -86,10 +86,10 @@ GameLib.D3.Controls.Editor.prototype.updateInstance = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* Converts a GameLib.D3.Controls.Editor to a GameLib.D3.API.Mesh
|
||||
* Converts a GameLib.Controls.D3.Editor to a GameLib.D3.API.Mesh
|
||||
* @returns {GameLib.API.Controls}
|
||||
*/
|
||||
GameLib.D3.Controls.Editor.prototype.toApiObject = function() {
|
||||
GameLib.Controls.D3.Editor.prototype.toApiObject = function() {
|
||||
|
||||
var apiControls = GameLib.Controls.prototype.toApiObject.call(this);
|
||||
|
||||
|
@ -103,14 +103,14 @@ GameLib.D3.Controls.Editor.prototype.toApiObject = function() {
|
|||
* Construct an Editor Controls object from data
|
||||
* @param graphics
|
||||
* @param objectControls
|
||||
* @returns {GameLib.D3.Controls.Editor}
|
||||
* @returns {GameLib.Controls.D3.Editor}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Controls.Editor.FromObject = function(graphics, objectControls) {
|
||||
GameLib.Controls.D3.Editor.FromObject = function(graphics, objectControls) {
|
||||
|
||||
var apiControls = GameLib.API.Controls.FromObject(objectControls);
|
||||
|
||||
return new GameLib.D3.Controls.Editor(
|
||||
return new GameLib.Controls.D3.Editor(
|
||||
graphics,
|
||||
apiControls,
|
||||
objectControls.raycaster,
|
|
@ -26,10 +26,7 @@ GameLib.CustomCode = function(
|
|||
|
||||
this.editor = null;
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_CUSTOM_CODE
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.CustomCode.prototype = Object.create(GameLib.API.CustomCode.prototype);
|
||||
|
|
|
@ -87,10 +87,11 @@ GameLib.D3.API.Animation = function (
|
|||
}
|
||||
this.meshes = meshes;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.ANIMATION,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Animation.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* @param volume
|
||||
* @param camera
|
||||
* @param overplay
|
||||
* @param paused
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -62,10 +63,11 @@ GameLib.D3.API.Audio = function(
|
|||
}
|
||||
this.paused = paused;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.AUDIO,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Audio.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* @param position GameLib.API.Vector3
|
||||
* @param scale GameLib.API.Vector3
|
||||
* @param up GameLib.API.Vector3
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.Bone = function (
|
||||
|
@ -18,7 +19,8 @@ GameLib.D3.API.Bone = function (
|
|||
position,
|
||||
quaternion,
|
||||
scale,
|
||||
up
|
||||
up,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -60,8 +62,17 @@ GameLib.D3.API.Bone = function (
|
|||
up = new GameLib.API.Vector3(0,1,0);
|
||||
}
|
||||
this.up = up;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.BONE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Bone.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Bone.prototype.constructor = GameLib.D3.API.Bone;
|
||||
|
||||
/**
|
||||
* Returns an API bone from an Object bone
|
||||
* @param objectBone
|
||||
|
@ -76,6 +87,7 @@ GameLib.D3.API.Bone.FromObject = function(objectBone) {
|
|||
GameLib.API.Vector3.FromObject(objectBone.position),
|
||||
GameLib.API.Quaternion.FromObject(objectBone.quaternion),
|
||||
GameLib.API.Vector3.FromObject(objectBone.scale),
|
||||
GameLib.API.Vector3.FromObject(objectBone.up)
|
||||
GameLib.API.Vector3.FromObject(objectBone.up),
|
||||
objectBone.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -28,10 +28,11 @@ GameLib.D3.API.Broadphase = function(
|
|||
}
|
||||
this.broadphaseType = broadphaseType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.BROADPHASE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Broadphase.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
* @param offsetX
|
||||
* @param offsetY
|
||||
* @param quaternion GameLib.Quaternion
|
||||
* @param parentEntity
|
||||
* @param eyeSeparation
|
||||
* @param focalLength
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.Camera = function(
|
||||
|
@ -42,9 +42,9 @@ GameLib.D3.API.Camera = function(
|
|||
offsetX,
|
||||
offsetY,
|
||||
quaternion,
|
||||
parentEntity,
|
||||
eyeSeparation,
|
||||
focalLength
|
||||
focalLength,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -155,10 +155,11 @@ GameLib.D3.API.Camera = function(
|
|||
}
|
||||
this.focalLength = focalLength;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.CAMERA,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Camera.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -190,9 +191,9 @@ GameLib.D3.API.Camera.FromObject = function(objectCamera) {
|
|||
objectCamera.offsetX,
|
||||
objectCamera.offsetY,
|
||||
GameLib.API.Quaternion.FromObject(objectCamera.quaternion),
|
||||
objectCamera.parentEntity,
|
||||
objectCamera.eyeSeparation,
|
||||
objectCamera.focalLength
|
||||
objectCamera.focalLength,
|
||||
objectCamera.parentEntity
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -41,10 +41,11 @@ GameLib.D3.API.Composer = function (
|
|||
}
|
||||
this.passes = passes;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPOSER,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Composer.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -56,11 +56,11 @@ GameLib.D3.API.Fog = function(
|
|||
}
|
||||
this.density = density;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.FOG,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Fog.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -27,10 +27,11 @@ GameLib.D3.API.Font = function(
|
|||
}
|
||||
this.url = url;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)){
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.FONT,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Font.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
* Raw FrictionContactMaterial API object - should always correspond with the FrictionContactMaterial Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param material1
|
||||
* @param material2
|
||||
* @param materials
|
||||
* @param friction
|
||||
* @param restitution
|
||||
* @param contactEquationStiffness
|
||||
|
@ -71,10 +70,11 @@ GameLib.D3.API.FrictionContactMaterial = function(
|
|||
}
|
||||
this.frictionEquationRelaxation = frictionEquationRelaxation;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.FRICTION_CONTACT_MATERIAL,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.FrictionContactMaterial.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -35,10 +35,11 @@ GameLib.D3.API.FrictionMaterial = function(
|
|||
}
|
||||
this.restitution = restitution;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.FRICTION_MATERIAL,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.FrictionMaterial.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -135,10 +135,11 @@ GameLib.D3.API.Light = function(
|
|||
}
|
||||
this.parentScene = parentScene;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)){
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.LIGHT,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Light.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -483,10 +483,11 @@ GameLib.D3.API.Material = function(
|
|||
}
|
||||
this.specularMap = specularMap;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.MATERIAL,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
this.needsUpdate = false;
|
||||
};
|
||||
|
|
|
@ -2,25 +2,27 @@
|
|||
* Raw Mesh API object - should always correspond with the Mesh Schema
|
||||
* @param id
|
||||
* @param meshType
|
||||
|
||||
* @param name
|
||||
* @param vertices GameLib.D3.Vertex[]
|
||||
* @param faces GameLib.D3.Face[]
|
||||
* @param materials GameLib.D3.API.Material[]
|
||||
* @param vertices
|
||||
* @param faces
|
||||
* @param materials
|
||||
* @param parentMesh
|
||||
* @param parentScene
|
||||
* @param skeleton
|
||||
* @param skinIndices
|
||||
* @param skinWeights
|
||||
* @param position GameLib.API.Vector3
|
||||
* @param quaternion GameLib.API.Quaternion
|
||||
* @param position
|
||||
* @param quaternion
|
||||
* @param rotation
|
||||
* @param scale GameLib.API.Vector3
|
||||
* @param scale
|
||||
* @param up
|
||||
* @param modelMatrix GameLib.API.Matrix4
|
||||
* @param parentEntity
|
||||
* @param modelMatrix
|
||||
* @param renderOrder
|
||||
* @param isBufferMesh
|
||||
* @param useQuaternion (use quaternion property for rotation rather than rotation property)
|
||||
* @param useQuaternion
|
||||
* @param visible
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.Mesh = function(
|
||||
|
@ -41,11 +43,11 @@ GameLib.D3.API.Mesh = function(
|
|||
scale,
|
||||
up,
|
||||
modelMatrix,
|
||||
parentEntity,
|
||||
renderOrder,
|
||||
isBufferMesh,
|
||||
useQuaternion,
|
||||
visible
|
||||
visible,
|
||||
parentEntity
|
||||
) {
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
|
@ -53,7 +55,7 @@ GameLib.D3.API.Mesh = function(
|
|||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(meshType)) {
|
||||
meshType = GameLib.D3.Mesh.MESH_TYPE_NORMAL;
|
||||
meshType = GameLib.D3.API.Mesh.MESH_TYPE_NORMAL;
|
||||
}
|
||||
this.meshType = meshType;
|
||||
|
||||
|
@ -137,11 +139,6 @@ GameLib.D3.API.Mesh = function(
|
|||
}
|
||||
this.renderOrder = renderOrder;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(isBufferMesh)) {
|
||||
isBufferMesh = false;
|
||||
}
|
||||
|
@ -156,11 +153,58 @@ GameLib.D3.API.Mesh = function(
|
|||
visible = true;
|
||||
}
|
||||
this.visible = visible;
|
||||
|
||||
var componentType = GameLib.Component.MESH;
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_PLANE) {
|
||||
componentType = GameLib.Component.MESH_PLANE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_BOX) {
|
||||
componentType = GameLib.Component.MESH_BOX
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER) {
|
||||
componentType = GameLib.Component.MESH_CYLINDER
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_SPHERE) {
|
||||
componentType = GameLib.Component.MESH_SPHERE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_LINE) {
|
||||
componentType = GameLib.Component.MESH_LINE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_TEXT) {
|
||||
componentType = GameLib.Component.MESH_TEXT;
|
||||
}
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Mesh.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Mesh.prototype.constructor = GameLib.D3.API.Mesh;
|
||||
|
||||
|
||||
/**
|
||||
* Mesh Type
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_NORMAL = 0x0;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_SKINNED = 0x1;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_CURVE = 0x2;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_SPHERE = 0x3;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_PLANE = 0x4;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_BOX = 0x5;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER = 0x6;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_TEXT = 0x7;
|
||||
GameLib.D3.API.Mesh.MESH_TYPE_LINE = 0x8;
|
||||
|
||||
/**
|
||||
* Returns an API Mesh from an Object mesh
|
||||
* @param objectMesh
|
||||
|
@ -255,10 +299,10 @@ GameLib.D3.API.Mesh.FromObject = function (objectMesh){
|
|||
apiScale,
|
||||
apiUp,
|
||||
apiModelMatrix,
|
||||
objectMesh.parentEntity,
|
||||
objectMesh.renderOrder,
|
||||
objectMesh.isBufferMesh,
|
||||
objectMesh.useQuaternion,
|
||||
objectMesh.visible
|
||||
objectMesh.visible,
|
||||
objectMesh.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -84,10 +84,11 @@ GameLib.D3.API.ParticleEngine = function(
|
|||
}
|
||||
this.pulse = pulse;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.PARTICLE_ENGINE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.ParticleEngine.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -161,10 +161,11 @@ GameLib.D3.API.Particle = function(
|
|||
}
|
||||
this.parentEngine = parentEngine;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.PARTICLE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Particle.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -57,10 +57,11 @@ GameLib.D3.API.Pass = function (
|
|||
}
|
||||
this.renderToScreen = renderToScreen;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.PASS,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Pass.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* @param rigidBodies
|
||||
* @param contactMaterials
|
||||
* @param allowSleep
|
||||
* @param defaultContactMaterial
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -78,10 +79,11 @@ GameLib.D3.API.PhysicsWorld = function(
|
|||
}
|
||||
this.defaultContactMaterial = defaultContactMaterial;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.PHYSICS_WORLD,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.PhysicsWorld.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @param chassis
|
||||
* @param wheels
|
||||
* @param raycastWheels
|
||||
* @param parentWorld
|
||||
* @param parentPhysicsWorld
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ GameLib.D3.API.RaycastVehicle = function(
|
|||
chassis,
|
||||
wheels,
|
||||
raycastWheels,
|
||||
parentWorld,
|
||||
parentPhysicsWorld,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
|
@ -44,15 +44,16 @@ GameLib.D3.API.RaycastVehicle = function(
|
|||
}
|
||||
this.raycastWheels = raycastWheels;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentWorld)) {
|
||||
parentWorld = null;
|
||||
if (GameLib.Utils.UndefinedOrNull(parentPhysicsWorld)) {
|
||||
parentPhysicsWorld = null;
|
||||
}
|
||||
this.parentWorld = parentWorld;
|
||||
this.parentPhysicsWorld = parentPhysicsWorld;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RAYCAST_VEHICLE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.RaycastVehicle.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -70,7 +71,7 @@ GameLib.D3.API.RaycastVehicle.FromObject = function(objectRaycastVehicle) {
|
|||
objectRaycastVehicle.chassis,
|
||||
objectRaycastVehicle.wheels,
|
||||
objectRaycastVehicle.raycastWheels,
|
||||
objectRaycastVehicle.parentWorld,
|
||||
objectRaycastVehicle.parentPhysicsWorld,
|
||||
objectRaycastVehicle.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -37,8 +37,8 @@ GameLib.D3.API.RaycastWheel = function(
|
|||
maxSuspensionTravel,
|
||||
customSlidingRotationalSpeed,
|
||||
useCustomSlidingRotationalSpeed,
|
||||
parentEntity,
|
||||
parentMesh
|
||||
parentMesh,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -121,15 +121,16 @@ GameLib.D3.API.RaycastWheel = function(
|
|||
}
|
||||
this.useCustomSlidingRotationalSpeed = useCustomSlidingRotationalSpeed;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentMesh)) {
|
||||
parentMesh = null;
|
||||
}
|
||||
this.parentMesh = parentMesh;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RAYCAST_WHEEL,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.RaycastWheel.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -158,8 +159,8 @@ GameLib.D3.API.RaycastWheel.FromObject = function(objectRaycastWheel) {
|
|||
objectRaycastWheel.maxSuspensionTravel,
|
||||
objectRaycastWheel.customSlidingRotationalSpeed,
|
||||
objectRaycastWheel.useCustomSlidingRotationalSpeed,
|
||||
objectRaycastWheel.parentEntity,
|
||||
objectRaycastWheel.parentMesh
|
||||
objectRaycastWheel.parentMesh,
|
||||
objectRaycastWheel.parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -4,13 +4,15 @@
|
|||
* @param name
|
||||
* @param position GameLib.API.Vector3
|
||||
* @param direction GameLib.API.Vector3
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.API.Raycaster = function(
|
||||
id,
|
||||
name,
|
||||
position,
|
||||
direction
|
||||
direction,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -32,6 +34,12 @@ GameLib.D3.API.Raycaster = function(
|
|||
direction = new GameLib.API.Vector3(0, -1, 0);
|
||||
}
|
||||
this.direction = direction;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RAYCASTER,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Raycaster.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -47,6 +55,7 @@ GameLib.D3.API.Raycaster.FromObject = function(objectRaycaster) {
|
|||
objectRaycaster.id,
|
||||
objectRaycaster.name,
|
||||
GameLib.API.Vector3.FromObject(objectRaycaster.position),
|
||||
GameLib.API.Vector3.FromObject(objectRaycaster.direction)
|
||||
GameLib.API.Vector3.FromObject(objectRaycaster.direction),
|
||||
objectRaycaster.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
/**
|
||||
* This component renders a scene
|
||||
* @param id String
|
||||
* @param name String
|
||||
* RenderTarget is used to render a scene to a target
|
||||
* @param id
|
||||
* @param name
|
||||
* @param width
|
||||
* @param height
|
||||
* @param minFilter
|
||||
* @param magFilter
|
||||
* @param format
|
||||
* @param stencilBuffer
|
||||
* @param texture
|
||||
* @param parentEntity
|
||||
|
@ -51,10 +48,11 @@ GameLib.D3.API.RenderTarget = function (
|
|||
}
|
||||
this.texture = texture;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RENDER_TARGET,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* @param bufferScene
|
||||
* @param bufferCamera
|
||||
* @param renderTarget
|
||||
* @param sortObjects
|
||||
* @param defaultScene
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -135,10 +136,11 @@ GameLib.D3.API.Renderer = function (
|
|||
}
|
||||
this.sortObjects = sortObjects;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RENDERER,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @param shapes
|
||||
* @param kinematic
|
||||
* @param parentMesh
|
||||
* @param parentWorld
|
||||
* @param parentPhysicsWorld
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ GameLib.D3.API.RigidBody = function(
|
|||
shapes,
|
||||
kinematic,
|
||||
parentMesh,
|
||||
parentWorld,
|
||||
parentPhysicsWorld,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
|
@ -142,15 +142,16 @@ GameLib.D3.API.RigidBody = function(
|
|||
}
|
||||
this.parentMesh = parentMesh;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentWorld)) {
|
||||
parentWorld = null;
|
||||
if (GameLib.Utils.UndefinedOrNull(parentPhysicsWorld)) {
|
||||
parentPhysicsWorld = null;
|
||||
}
|
||||
this.parentWorld = parentWorld;
|
||||
this.parentPhysicsWorld = parentPhysicsWorld;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.RIGID_BODY,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.RigidBody.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
@ -182,7 +183,7 @@ GameLib.D3.API.RigidBody.FromObject = function(objectRigidBody) {
|
|||
objectRigidBody.shapes,
|
||||
objectRigidBody.kinematic,
|
||||
objectRigidBody.parentMesh,
|
||||
objectRigidBody.parentWorld,
|
||||
objectRigidBody.parentPhysicsWorld,
|
||||
objectRigidBody.parentEntity
|
||||
);
|
||||
};
|
||||
|
|
|
@ -98,10 +98,11 @@ GameLib.D3.API.Scene = function(
|
|||
}
|
||||
this.gridColor = gridColor;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.SCENE,
|
||||
parentEntity
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Raw Shape API object - should always correspond with the Shape Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param shapeType
|
||||
* @param boundingSphereRadius
|
||||
* @param collisionResponse
|
||||
* @param frictionMaterial
|
||||
|
@ -12,6 +13,7 @@
|
|||
GameLib.D3.API.Shape = function(
|
||||
id,
|
||||
name,
|
||||
shapeType,
|
||||
boundingSphereRadius,
|
||||
collisionResponse,
|
||||
frictionMaterial,
|
||||
|
@ -24,35 +26,40 @@ GameLib.D3.API.Shape = function(
|
|||
}
|
||||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(shapeType)) {
|
||||
shapeType = GameLib.D3.API.Shape.SHAPE_TYPE_NONE;
|
||||
}
|
||||
this.shapeType = shapeType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
|
||||
name = 'Shape (' + this.id + ')';
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.ConvexHull) {
|
||||
name = 'Shape Convex Hull (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.ConvexHull.Cylinder) {
|
||||
name = 'Shape Convex Hull Cylinder (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.HeightMap) {
|
||||
name = 'Shape Heightmap (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Box) {
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_BOX) {
|
||||
name = 'Shape Box (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Plane) {
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL) {
|
||||
name = 'Shape Convex Hull (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL_CYLINDER) {
|
||||
name = 'Shape Convex Hull Cylinder (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_HEIGHT_MAP) {
|
||||
name = 'Shape HeightMap (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_PLANE) {
|
||||
name = 'Shape Plane (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Sphere) {
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_SPHERE) {
|
||||
name = 'Shape Sphere (' + this.id + ')';
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.TriMesh) {
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_TRIMESH) {
|
||||
name = 'Shape TriMesh (' + this.id + ')';
|
||||
}
|
||||
}
|
||||
|
@ -78,15 +85,55 @@ GameLib.D3.API.Shape = function(
|
|||
}
|
||||
this.parentMesh = parentMesh;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
var componentType = GameLib.Component.SHAPE;
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_BOX) {
|
||||
componentType = GameLib.Component.SHAPE_BOX;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL) {
|
||||
componentType = GameLib.Component.SHAPE_CONVEX_HULL;
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL_CYLINDER) {
|
||||
componentType = GameLib.Component.SHAPE_CONVEX_HULL_CYLINDER;
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_HEIGHT_MAP) {
|
||||
componentType = GameLib.Component.SHAPE_HEIGHT_MAP;
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_PLANE) {
|
||||
componentType = GameLib.Component.SHAPE_PLANE;
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_SPHERE) {
|
||||
componentType = GameLib.Component.SHAPE_SPHERE;
|
||||
}
|
||||
|
||||
if (this.shapeType === GameLib.D3.API.Shape.SHAPE_TYPE_TRIMESH) {
|
||||
componentType = GameLib.Component.SHAPE_TRI_MESH;
|
||||
}
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Shape.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Shape.prototype.constructor = GameLib.D3.API.Shape;
|
||||
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_NONE = 0x0;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_BOX = 0x1;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL = 0x2;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL_CYLINDER = 0x3;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_HEIGHT_MAP = 0x4;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_PLANE = 0x5;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_SPHERE = 0x6;
|
||||
GameLib.D3.API.Shape.SHAPE_TYPE_TRIMESH = 0x7;
|
||||
|
||||
/**
|
||||
* Creates an API Shape from an Object Shape
|
||||
* @param objectShape
|
||||
|
@ -96,6 +143,7 @@ GameLib.D3.API.Shape.FromObject = function(objectShape) {
|
|||
return new GameLib.D3.API.Shape(
|
||||
objectShape.id,
|
||||
objectShape.name,
|
||||
objectShape.shapeType,
|
||||
objectShape.boundingSphereRadius,
|
||||
objectShape.collisionResponse,
|
||||
objectShape.frictionMaterial,
|
||||
|
|
|
@ -24,11 +24,6 @@ GameLib.D3.API.Skeleton = function (
|
|||
boneTexture,
|
||||
parentEntity
|
||||
) {
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
|
@ -82,6 +77,12 @@ GameLib.D3.API.Skeleton = function (
|
|||
boneTexture = null;
|
||||
}
|
||||
this.boneTexture = boneTexture;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.SKELETON,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Skeleton.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -28,7 +28,7 @@ GameLib.D3.API.Solver = function(
|
|||
this.name = name;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(solverType)) {
|
||||
solverType = GameLib.D3.Solver.GS_SOLVER;
|
||||
solverType = GameLib.D3.API.Solver.GS_SOLVER;
|
||||
}
|
||||
this.solverType = solverType;
|
||||
|
||||
|
@ -42,15 +42,23 @@ GameLib.D3.API.Solver = function(
|
|||
}
|
||||
this.tolerance = tolerance;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.SOLVER,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Solver.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Solver.prototype.constructor = GameLib.D3.API.Solver;
|
||||
|
||||
/**
|
||||
* Solver Types
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Solver.GS_SOLVER = 0x1;
|
||||
GameLib.D3.API.Solver.SPLIT_SOLVER = 0x2;
|
||||
|
||||
/**
|
||||
* Creates an API Solver from an Object Solver
|
||||
* @param objectSolver
|
||||
|
|
|
@ -18,7 +18,7 @@ GameLib.D3.API.Spline = function(
|
|||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Spline (unknown)';
|
||||
name = 'Spline (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
|
||||
|
@ -27,10 +27,11 @@ GameLib.D3.API.Spline = function(
|
|||
}
|
||||
this.vertices = vertices;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.SPLINE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Spline.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Raw Texture API object - should always correspond with the Texture Schema
|
||||
* @param id
|
||||
* @param typeId
|
||||
* @param textureType
|
||||
* @param name
|
||||
* @param image
|
||||
* @param images
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
GameLib.D3.API.Texture = function(
|
||||
id,
|
||||
typeId,
|
||||
textureType,
|
||||
name,
|
||||
image,
|
||||
images,
|
||||
|
@ -58,20 +58,16 @@ GameLib.D3.API.Texture = function(
|
|||
forward,
|
||||
parentEntity
|
||||
) {
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(typeId)) {
|
||||
typeId = GameLib.D3.Texture.TEXTURE_TYPE_NORMAL;
|
||||
if (GameLib.Utils.UndefinedOrNull(textureType)) {
|
||||
textureType = GameLib.D3.API.Texture.TEXTURE_TYPE_NORMAL;
|
||||
}
|
||||
this.typeId = typeId;
|
||||
this.textureType = textureType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Texture (' + id + ')';
|
||||
|
@ -89,12 +85,12 @@ GameLib.D3.API.Texture = function(
|
|||
this.images = images;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(wrapS)) {
|
||||
wrapS = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
||||
wrapS = GameLib.D3.API.Texture.TYPE_REPEAT_WRAPPING;
|
||||
}
|
||||
this.wrapS = wrapS;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(wrapT)) {
|
||||
wrapT = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
||||
wrapT = GameLib.D3.API.Texture.TYPE_REPEAT_WRAPPING;
|
||||
}
|
||||
this.wrapT = wrapT;
|
||||
|
||||
|
@ -109,27 +105,27 @@ GameLib.D3.API.Texture = function(
|
|||
this.data = data;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(format)) {
|
||||
format = GameLib.D3.Texture.TYPE_RGBA_FORMAT;
|
||||
format = GameLib.D3.API.Texture.TYPE_RGBA_FORMAT;
|
||||
}
|
||||
this.format = format;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(mapping)) {
|
||||
mapping = GameLib.D3.Texture.TYPE_UV_MAPPING;
|
||||
mapping = GameLib.D3.API.Texture.TYPE_UV_MAPPING;
|
||||
}
|
||||
this.mapping = mapping;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(magFilter)) {
|
||||
magFilter = GameLib.D3.Texture.TYPE_LINEAR_FILTER;
|
||||
magFilter = GameLib.D3.API.Texture.TYPE_LINEAR_FILTER;
|
||||
}
|
||||
this.magFilter = magFilter;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(minFilter)) {
|
||||
minFilter = GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
|
||||
minFilter = GameLib.D3.API.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
|
||||
}
|
||||
this.minFilter = minFilter;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(textureType)) {
|
||||
textureType = GameLib.D3.Texture.TYPE_UNSIGNED_BYTE;
|
||||
textureType = GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE;
|
||||
}
|
||||
this.textureType = textureType;
|
||||
|
||||
|
@ -169,7 +165,7 @@ GameLib.D3.API.Texture = function(
|
|||
this.premultiplyAlpha = premultiplyAlpha;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(encoding)) {
|
||||
encoding = GameLib.D3.Texture.TYPE_LINEAR_ENCODING;
|
||||
encoding = GameLib.D3.API.Texture.TYPE_LINEAR_ENCODING;
|
||||
}
|
||||
this.encoding = encoding;
|
||||
|
||||
|
@ -194,11 +190,91 @@ GameLib.D3.API.Texture = function(
|
|||
this.forward = forward;
|
||||
|
||||
this.needsUpdate = false;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.TEXTURE,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Texture.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.API.Texture.prototype.constructor = GameLib.D3.API.Texture;
|
||||
|
||||
/**
|
||||
* Texture Formats
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_ALPHA_FORMAT = 1019;
|
||||
GameLib.D3.API.Texture.TYPE_RGB_FORMAT = 1020;
|
||||
GameLib.D3.API.Texture.TYPE_RGBA_FORMAT = 1021;
|
||||
GameLib.D3.API.Texture.TYPE_LUMINANCE_FORMAT = 1022;
|
||||
GameLib.D3.API.Texture.TYPE_LUMINANCE_ALPHA_FORMAT = 1023;
|
||||
GameLib.D3.API.Texture.TYPE_DEPTH_FORMAT = 1026;
|
||||
|
||||
/**
|
||||
* Mapping modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_UV_MAPPING = 300;
|
||||
GameLib.D3.API.Texture.TYPE_CUBE_REFLECTION_MAPPING = 301;
|
||||
GameLib.D3.API.Texture.TYPE_CUBE_REFRACTION_MAPPING = 302;
|
||||
GameLib.D3.API.Texture.TYPE_EQUI_RECTANGULAR_REFLECTION_MAPPING = 303;
|
||||
GameLib.D3.API.Texture.TYPE_EQUI_RECTANGULAR_REFRACTION_MAPPING = 304;
|
||||
GameLib.D3.API.Texture.TYPE_SPHERICAL_REFLECTION_MAPPING = 305;
|
||||
GameLib.D3.API.Texture.TYPE_CUBE_UV_REFLECTION_MAPPING = 306;
|
||||
GameLib.D3.API.Texture.TYPE_CUBE_UV_REFRACTION_MAPPING = 307;
|
||||
|
||||
/**
|
||||
* Wrapping Modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_REPEAT_WRAPPING = 1000;
|
||||
GameLib.D3.API.Texture.TYPE_CLAMP_TO_EDGE_WRAPPING = 1001;
|
||||
GameLib.D3.API.Texture.TYPE_MIRRORED_REPEAT_WRAPPING = 1002;
|
||||
|
||||
/**
|
||||
* Mipmap Filters
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_NEAREST_FILTER = 1003;
|
||||
GameLib.D3.API.Texture.TYPE_NEAREST_MIPMAP_NEAREST_FILTER = 1004;
|
||||
GameLib.D3.API.Texture.TYPE_NEAREST_MIPMAP_LINEAR_FILTER = 1005;
|
||||
GameLib.D3.API.Texture.TYPE_LINEAR_FILTER = 1006;
|
||||
GameLib.D3.API.Texture.TYPE_LINEAR_MIPMAP_NEAREST_FILTER = 1007;
|
||||
GameLib.D3.API.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER = 1008;
|
||||
|
||||
/**
|
||||
* Texture Data Types
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE = 1009;
|
||||
GameLib.D3.API.Texture.TYPE_BYTE = 1010;
|
||||
GameLib.D3.API.Texture.TYPE_SHORT = 1011;
|
||||
GameLib.D3.API.Texture.TYPE_UNSIGNED_SHORT = 1012;
|
||||
GameLib.D3.API.Texture.TYPE_INT = 1013;
|
||||
GameLib.D3.API.Texture.TYPE_UNSIGNED_INT = 1014;
|
||||
GameLib.D3.API.Texture.TYPE_FLOAT = 1015;
|
||||
GameLib.D3.API.Texture.TYPE_HALF_FLOAT = 1025;
|
||||
|
||||
/**
|
||||
* Encoding Modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.API.Texture.TYPE_LINEAR_ENCODING = 3000; // NO ENCODING AT ALL.
|
||||
GameLib.D3.API.Texture.TYPE_SRGB_ENCODING = 3001;
|
||||
GameLib.D3.API.Texture.TYPE_GAMMA_ENCODING = 3007; // USES GAMMA_FACTOR, FOR BACKWARDS COMPATIBILITY WITH WEBGLRENDERER.GAMMAINPUT/GAMMAOUTPUT
|
||||
GameLib.D3.API.Texture.TYPE_RGBE_ENCODING = 3002; // AKA RADIANCE.
|
||||
GameLib.D3.API.Texture.TYPE_LOG_LUV_ENCODING = 3003;
|
||||
GameLib.D3.API.Texture.TYPE_RGBM7_ENCODING = 3004;
|
||||
GameLib.D3.API.Texture.TYPE_RGBM16_ENCODING = 3005;
|
||||
GameLib.D3.API.Texture.TYPE_RGBD_ENCODING = 3006; // MAXRANGE IS 256.
|
||||
|
||||
GameLib.D3.API.Texture.TEXTURE_TYPE_NORMAL = 0x1;
|
||||
GameLib.D3.API.Texture.TEXTURE_TYPE_CUBE = 0x2;
|
||||
GameLib.D3.API.Texture.TEXTURE_TYPE_CANVAS = 0x3;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an API texture from Object data
|
||||
* @param objectTexture
|
||||
|
@ -207,7 +283,7 @@ GameLib.D3.API.Texture.prototype.constructor = GameLib.D3.API.Texture;
|
|||
GameLib.D3.API.Texture.FromObject = function(objectTexture) {
|
||||
return new GameLib.D3.API.Texture(
|
||||
objectTexture.id,
|
||||
objectTexture.typeId,
|
||||
objectTexture.textureType,
|
||||
objectTexture.name,
|
||||
objectTexture.image,
|
||||
objectTexture.images,
|
||||
|
|
|
@ -49,10 +49,11 @@ GameLib.D3.API.Viewport = function(
|
|||
}
|
||||
this.y = y;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.VIEWPORT,
|
||||
parentEntity
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.API.Viewport.prototype = Object.create(GameLib.Component.prototype);
|
||||
|
|
|
@ -43,7 +43,6 @@ GameLib.D3.Animation = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_ANIMATION,
|
||||
{
|
||||
'meshes' : [GameLib.D3.Mesh]
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ GameLib.D3.Audio = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_AUDIO,
|
||||
{
|
||||
'camera' : GameLib.D3.Camera
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@ GameLib.D3.Bone = function (
|
|||
apiBone.position,
|
||||
apiBone.quaternion,
|
||||
apiBone.scale,
|
||||
apiBone.up
|
||||
apiBone.up,
|
||||
apiBone.parentEntity
|
||||
);
|
||||
|
||||
this.position = new GameLib.Vector3(
|
||||
|
@ -55,10 +56,7 @@ GameLib.D3.Bone = function (
|
|||
this
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_BONE
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Bone.prototype = Object.create(GameLib.D3.API.Bone.prototype);
|
||||
|
@ -133,7 +131,8 @@ GameLib.D3.Bone.prototype.toApiObject = function() {
|
|||
this.position.toApiObject(),
|
||||
this.quaternion.toApiObject(),
|
||||
this.scale.toApiObject(),
|
||||
this.up.toApiObject()
|
||||
this.up.toApiObject(),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
return apiBone;
|
||||
|
|
|
@ -28,10 +28,7 @@ GameLib.D3.Broadphase = function (
|
|||
apiBroadphase.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_BROADPHASE
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Broadphase.prototype = Object.create(GameLib.D3.API.Broadphase.prototype);
|
||||
|
|
|
@ -40,9 +40,9 @@ GameLib.D3.Camera = function(
|
|||
apiCamera.offsetX,
|
||||
apiCamera.offsetY,
|
||||
apiCamera.quaternion,
|
||||
apiCamera.parentEntity,
|
||||
apiCamera.eyeSeparation,
|
||||
apiCamera.focalLength
|
||||
apiCamera.focalLength,
|
||||
apiCamera.parentEntity
|
||||
);
|
||||
|
||||
if (this.position instanceof GameLib.API.Vector3) {
|
||||
|
@ -80,7 +80,7 @@ GameLib.D3.Camera = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_CAMERA
|
||||
GameLib.Component.CAMERA
|
||||
);
|
||||
|
||||
} ;
|
||||
|
@ -268,9 +268,9 @@ GameLib.D3.Camera.prototype.toApiObject = function() {
|
|||
this.offsetX,
|
||||
this.offsetY,
|
||||
this.quaternion.toApiObject(),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
||||
this.eyeSeparation,
|
||||
this.focalLength
|
||||
this.focalLength,
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -32,7 +32,6 @@ GameLib.D3.Composer = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_COMPOSER,
|
||||
{
|
||||
'renderer' : GameLib.D3.Renderer,
|
||||
'renderTarget' : GameLib.D3.RenderTarget,
|
||||
|
|
|
@ -38,10 +38,7 @@ GameLib.D3.Fog = function (
|
|||
this
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_FOG
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Fog.prototype = Object.create(GameLib.D3.API.Fog.prototype);
|
||||
|
|
|
@ -27,10 +27,7 @@ GameLib.D3.Font = function(
|
|||
apiFont.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_FONT
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Font.prototype = Object.create(GameLib.D3.API.Font.prototype);
|
||||
|
|
|
@ -36,7 +36,6 @@ GameLib.D3.FrictionContactMaterial = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_FRICTION_CONTACT_MATERIAL,
|
||||
{
|
||||
materials : [GameLib.D3.FrictionMaterial]
|
||||
}
|
||||
|
|
|
@ -29,10 +29,7 @@ GameLib.D3.FrictionMaterial = function (
|
|||
apiFrictionMaterial.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_FRICTION_MATERIAL
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.FrictionMaterial.prototype = Object.create(GameLib.D3.API.FrictionMaterial.prototype);
|
||||
|
|
|
@ -41,7 +41,7 @@ GameLib.D3.Helper = function(
|
|||
|
||||
if (
|
||||
object instanceof GameLib.D3.Mesh &&
|
||||
object.meshType !== GameLib.D3.Mesh.MESH_TYPE_CURVE
|
||||
object.meshType !== GameLib.D3.API.Mesh.MESH_TYPE_CURVE
|
||||
) {
|
||||
helperType = GameLib.D3.Helper.HELPER_TYPE_EDGES;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ GameLib.D3.Helper = function(
|
|||
*/
|
||||
// GameLib.Component.call(
|
||||
// this,
|
||||
// GameLib.Component.COMPONENT_HELPER
|
||||
// GameLib.Component.HELPER
|
||||
// );
|
||||
};
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ GameLib.D3.Light = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_LIGHT,
|
||||
{
|
||||
'parentScene' : GameLib.D3.Scene
|
||||
}
|
||||
|
|
|
@ -223,7 +223,6 @@ GameLib.D3.Material = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_MATERIAL,
|
||||
{
|
||||
'alphaMap' : GameLib.D3.Texture,
|
||||
'aoMap' : GameLib.D3.Texture,
|
||||
|
|
|
@ -12,7 +12,9 @@ GameLib.D3.Mesh = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_NORMAL
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh) {
|
||||
|
@ -38,11 +40,11 @@ GameLib.D3.Mesh = function (
|
|||
apiMesh.scale,
|
||||
apiMesh.up,
|
||||
apiMesh.modelMatrix,
|
||||
apiMesh.parentEntity,
|
||||
apiMesh.renderOrder,
|
||||
apiMesh.isBufferMesh,
|
||||
apiMesh.useQuaternion,
|
||||
apiMesh.visible
|
||||
apiMesh.visible,
|
||||
apiMesh.parentEntity
|
||||
);
|
||||
|
||||
this.faces = this.faces.map(
|
||||
|
@ -136,30 +138,7 @@ GameLib.D3.Mesh = function (
|
|||
'skeleton' : GameLib.D3.Skeleton
|
||||
};
|
||||
|
||||
var componentType = GameLib.Component.COMPONENT_MESH;
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_PLANE) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_PLANE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_BOX) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_BOX
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_CYLINDER) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_CYLINDER
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_SPHERE) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_SPHERE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_LINE) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_LINE
|
||||
}
|
||||
|
||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_TEXT) {
|
||||
componentType = GameLib.Component.COMPONENT_MESH_TEXT;
|
||||
if (this.meshType === GameLib.D3.API.Mesh.MESH_TYPE_TEXT) {
|
||||
linkedObjects.font = GameLib.D3.Font;
|
||||
}
|
||||
|
||||
|
@ -173,7 +152,6 @@ GameLib.D3.Mesh = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
linkedObjects
|
||||
);
|
||||
};
|
||||
|
@ -181,20 +159,6 @@ GameLib.D3.Mesh = function (
|
|||
GameLib.D3.Mesh.prototype = Object.create(GameLib.D3.API.Mesh.prototype);
|
||||
GameLib.D3.Mesh.prototype.constructor = GameLib.D3.Mesh;
|
||||
|
||||
/**
|
||||
* Mesh Type
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Mesh.MESH_TYPE_NORMAL = 0x0;
|
||||
GameLib.D3.Mesh.MESH_TYPE_SKINNED = 0x1;
|
||||
GameLib.D3.Mesh.MESH_TYPE_CURVE = 0x2;
|
||||
GameLib.D3.Mesh.MESH_TYPE_SPHERE = 0x3;
|
||||
GameLib.D3.Mesh.MESH_TYPE_PLANE = 0x4;
|
||||
GameLib.D3.Mesh.MESH_TYPE_BOX = 0x5;
|
||||
GameLib.D3.Mesh.MESH_TYPE_CYLINDER = 0x6;
|
||||
GameLib.D3.Mesh.MESH_TYPE_TEXT = 0x7;
|
||||
GameLib.D3.Mesh.MESH_TYPE_LINE = 0x8;
|
||||
|
||||
GameLib.D3.Mesh.prototype.lookAt = function(vector) {
|
||||
|
||||
this.instance.lookAt(
|
||||
|
@ -1084,11 +1048,11 @@ GameLib.D3.Mesh.prototype.toApiObject = function() {
|
|||
this.scale.toApiObject(),
|
||||
this.up.toApiObject(),
|
||||
this.modelMatrix.toApiObject(),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
||||
this.renderOrder,
|
||||
this.isBufferMesh,
|
||||
this.useQuaternion,
|
||||
this.visible
|
||||
this.visible,
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
return apiMesh;
|
||||
|
@ -1408,7 +1372,7 @@ GameLib.D3.Mesh.prototype.getChildrenComponents = function() {
|
|||
/**
|
||||
* Push RigidBodies
|
||||
*/
|
||||
var rigidBodies = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.RigidBody);
|
||||
var rigidBodies = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.RIGID_BODY);
|
||||
rigidBodies.map(
|
||||
function(rigidBody) {
|
||||
|
||||
|
@ -1422,7 +1386,7 @@ GameLib.D3.Mesh.prototype.getChildrenComponents = function() {
|
|||
/**
|
||||
* Push Shapes
|
||||
*/
|
||||
var shapes = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Shape);
|
||||
var shapes = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.SHAPE);
|
||||
shapes.map(
|
||||
function(shape) {
|
||||
|
||||
|
|
|
@ -18,15 +18,15 @@ GameLib.D3.Mesh.Box = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_BOX
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_BOX;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,16 @@ GameLib.D3.Mesh.Curve = function (
|
|||
this.graphics = graphics;
|
||||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_CURVE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Curve) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
GameLib.D3.Mesh.call(
|
||||
this,
|
||||
this.graphics,
|
||||
|
|
|
@ -29,15 +29,15 @@ GameLib.D3.Mesh.Cylinder = function (
|
|||
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Cylinder) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_CYLINDER;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||||
radiusTop = 1;
|
||||
}
|
||||
|
|
|
@ -14,15 +14,15 @@ GameLib.D3.Mesh.Line = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_LINE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Line) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_LINE;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(lineWidth)) {
|
||||
lineWidth = 1;
|
||||
}
|
||||
|
|
|
@ -28,15 +28,15 @@ GameLib.D3.Mesh.Plane = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Plane) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_PLANE;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
}
|
||||
|
|
|
@ -18,15 +18,15 @@ GameLib.D3.Mesh.Sphere = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_SPHERE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Sphere) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_SPHERE;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ GameLib.D3.Mesh.Text = function (
|
|||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
apiMesh = {
|
||||
meshType : GameLib.D3.API.Mesh.MESH_TYPE_TEXT
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Text) {
|
||||
return apiMesh;
|
||||
}
|
||||
|
||||
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_TEXT;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(text)) {
|
||||
text = '-=<yb4f310';
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ GameLib.D3.ParticleEngine = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_PARTICLE_ENGINE,
|
||||
{
|
||||
templateParticle : GameLib.D3.Particle,
|
||||
camera : GameLib.D3.Camera
|
||||
|
|
|
@ -100,7 +100,6 @@ GameLib.D3.Particle = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_PARTICLE,
|
||||
{
|
||||
mesh : GameLib.D3.Mesh,
|
||||
parentEngine : GameLib.D3.ParticleEngine
|
||||
|
|
|
@ -33,7 +33,6 @@ GameLib.D3.Pass = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_PASS,
|
||||
{
|
||||
'camera' : GameLib.D3.Camera,
|
||||
'scene' : GameLib.D3.Scene
|
||||
|
|
|
@ -89,7 +89,6 @@ GameLib.D3.PhysicsWorld = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_PHYSICS_WORLD,
|
||||
{
|
||||
'broadphase' : GameLib.D3.Broadphase,
|
||||
'solver' : GameLib.D3.Solver,
|
||||
|
@ -158,7 +157,7 @@ GameLib.D3.PhysicsWorld.prototype.createInstance = function() {
|
|||
throw new Error('no rigidbody instance');
|
||||
}
|
||||
|
||||
rigidBody.parentWorld = this;
|
||||
rigidBody.parentPhysicsWorld = this;
|
||||
|
||||
this.instance.add(rigidBody.instance);
|
||||
|
||||
|
@ -185,10 +184,10 @@ GameLib.D3.PhysicsWorld.prototype.addRigidBody = function(rigidBody) {
|
|||
this.instance.add(rigidBody.instance);
|
||||
|
||||
/**
|
||||
* Remember to set the parentWorld for this rigidBody
|
||||
* Remember to set the parentPhysicsWorld for this rigidBody
|
||||
* @type {GameLib.D3.PhysicsWorld}
|
||||
*/
|
||||
rigidBody.parentWorld = this;
|
||||
rigidBody.parentPhysicsWorld = this;
|
||||
|
||||
/**
|
||||
* Ensure this rigidBody is in our rigidBodies array, just not too many times..
|
||||
|
@ -223,10 +222,10 @@ GameLib.D3.PhysicsWorld.prototype.removeRigidBody = function(rigidBody) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Remember to set the parentWorld for this rigidBody
|
||||
* Remember to set the parentPhysicsWorld for this rigidBody
|
||||
* @type {GameLib.D3.PhysicsWorld}
|
||||
*/
|
||||
rigidBody.parentWorld = null;
|
||||
rigidBody.parentPhysicsWorld = null;
|
||||
|
||||
/**
|
||||
* Remove from this rigidBodies array
|
||||
|
|
|
@ -27,7 +27,7 @@ GameLib.D3.RaycastVehicle = function (
|
|||
apiRaycastVehicle.chassis,
|
||||
apiRaycastVehicle.wheels,
|
||||
apiRaycastVehicle.raycastWheels,
|
||||
apiRaycastVehicle.parentWorld,
|
||||
apiRaycastVehicle.parentPhysicsWorld,
|
||||
apiRaycastVehicle.parentEntity
|
||||
);
|
||||
|
||||
|
@ -62,12 +62,11 @@ GameLib.D3.RaycastVehicle = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RAYCAST_VEHICLE,
|
||||
{
|
||||
'chassis' : GameLib.D3.RigidBody,
|
||||
'wheels' : [GameLib.D3.RigidBody],
|
||||
'raycastWheels' : [GameLib.D3.RaycastWheel],
|
||||
'parentWorld' : GameLib.D3.PhysicsWorld
|
||||
'parentPhysicsWorld' : GameLib.D3.PhysicsWorld
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -96,11 +95,11 @@ GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
|||
throw new Error('no chassis instance');
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.parentWorld)) {
|
||||
if (GameLib.Utils.UndefinedOrNull(this.parentPhysicsWorld)) {
|
||||
throw new Error('no parent world');
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.parentWorld.instance)) {
|
||||
if (GameLib.Utils.UndefinedOrNull(this.parentPhysicsWorld.instance)) {
|
||||
throw new Error('no parent world instance');
|
||||
}
|
||||
|
||||
|
@ -124,7 +123,7 @@ GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
|||
}.bind(this)
|
||||
);
|
||||
|
||||
this.instance.addToWorld(this.parentWorld.instance);
|
||||
this.instance.addToWorld(this.parentPhysicsWorld.instance);
|
||||
|
||||
GameLib.Component.prototype.createInstance.call(this);
|
||||
|
||||
|
@ -152,7 +151,7 @@ GameLib.D3.RaycastVehicle.prototype.toApiObject = function() {
|
|||
this.raycastWheels.map(function(raycastWheel){
|
||||
return GameLib.Utils.IdOrNull(raycastWheel);
|
||||
}),
|
||||
GameLib.Utils.IdOrNull(this.parentWorld),
|
||||
GameLib.Utils.IdOrNull(this.parentPhysicsWorld),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ GameLib.D3.RaycastWheel = function (
|
|||
apiRaycastWheel.maxSuspensionTravel,
|
||||
apiRaycastWheel.customSlidingRotationalSpeed,
|
||||
apiRaycastWheel.useCustomSlidingRotationalSpeed,
|
||||
apiRaycastWheel.parentEntity,
|
||||
apiRaycastWheel.parentMesh
|
||||
apiRaycastWheel.parentMesh,
|
||||
apiRaycastWheel.parentEntity
|
||||
);
|
||||
|
||||
this.directionLocal = new GameLib.Vector3(
|
||||
|
@ -62,7 +62,6 @@ GameLib.D3.RaycastWheel = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RAYCAST_WHEEL,
|
||||
{
|
||||
'parentMesh' : GameLib.D3.Mesh
|
||||
}
|
||||
|
@ -138,8 +137,8 @@ GameLib.D3.RaycastWheel.prototype.toApiObject = function() {
|
|||
this.maxSuspensionTravel,
|
||||
this.customSlidingRotationalSpeed,
|
||||
this.useCustomSlidingRotationalSpeed,
|
||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
||||
GameLib.Utils.IdOrNull(this.parentMesh)
|
||||
GameLib.Utils.IdOrNull(this.parentMesh),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
return apiRaycastWheel;
|
||||
|
|
|
@ -40,10 +40,7 @@ GameLib.D3.Raycaster = function(
|
|||
this
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RAYCASTER
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Raycaster.prototype = Object.create(GameLib.D3.API.Raycaster.prototype);
|
||||
|
@ -83,7 +80,8 @@ GameLib.D3.Raycaster.prototype.toApiObject = function() {
|
|||
this.id,
|
||||
this.name,
|
||||
this.position.toApiObject(),
|
||||
this.direction.toApiObject()
|
||||
this.direction.toApiObject(),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ GameLib.D3.RenderTarget = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RENDER_TARGET,
|
||||
{
|
||||
'texture' : GameLib.D3.Texture
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@ GameLib.D3.Renderer = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RENDERER,
|
||||
{
|
||||
'domElement' : GameLib.DomElement,
|
||||
'camera' : GameLib.D3.Camera,
|
||||
|
|
|
@ -41,7 +41,7 @@ GameLib.D3.RigidBody = function (
|
|||
apiRigidBody.shapes,
|
||||
apiRigidBody.kinematic,
|
||||
apiRigidBody.parentMesh,
|
||||
apiRigidBody.parentWorld,
|
||||
apiRigidBody.parentPhysicsWorld,
|
||||
apiRigidBody.parentEntity
|
||||
);
|
||||
|
||||
|
@ -79,11 +79,10 @@ GameLib.D3.RigidBody = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_RIGID_BODY,
|
||||
{
|
||||
'shapes' : [GameLib.D3.Shape],
|
||||
'parentMesh' : GameLib.D3.Mesh,
|
||||
'parentWorld' : GameLib.D3.PhysicsWorld
|
||||
'parentPhysicsWorld' : GameLib.D3.PhysicsWorld
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -251,7 +250,7 @@ GameLib.D3.RigidBody.prototype.toApiObject = function() {
|
|||
this.shapes.map(function(shape){return GameLib.Utils.IdOrNull(shape)}),
|
||||
this.kinematic,
|
||||
GameLib.Utils.IdOrNull(this.parentMesh),
|
||||
GameLib.Utils.IdOrNull(this.parentWorld),
|
||||
GameLib.Utils.IdOrNull(this.parentPhysicsWorld),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
|
|
@ -167,7 +167,6 @@ GameLib.D3.Scene = function (
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_SCENE,
|
||||
{
|
||||
'meshes' : [GameLib.D3.Mesh],
|
||||
'lights' : [GameLib.D3.Light],
|
||||
|
|
|
@ -12,7 +12,9 @@ GameLib.D3.Shape = function (
|
|||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {};
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_NONE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape) {
|
||||
|
@ -23,6 +25,7 @@ GameLib.D3.Shape = function (
|
|||
this,
|
||||
apiShape.id,
|
||||
apiShape.name,
|
||||
apiShape.shapeType,
|
||||
apiShape.boundingSphereRadius,
|
||||
apiShape.collisionResponse,
|
||||
apiShape.frictionMaterial,
|
||||
|
@ -30,44 +33,13 @@ GameLib.D3.Shape = function (
|
|||
apiShape.parentEntity
|
||||
);
|
||||
|
||||
var componentType = GameLib.Component.COMPONENT_SHAPE;
|
||||
|
||||
var linkedObjects = {
|
||||
frictionMaterial : GameLib.D3.FrictionMaterial,
|
||||
parentMesh : GameLib.D3.Mesh
|
||||
};
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Box) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_BOX;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.ConvexHull) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_CONVEX_HULL;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.ConvexHull.Cylinder) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_CONVEX_HULL_CYLINDER;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Sphere) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_SPHERE;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.TriMesh) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_TRI_MESH;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.Plane) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_PLANE;
|
||||
}
|
||||
|
||||
if (this instanceof GameLib.D3.Shape.HeightMap) {
|
||||
componentType = GameLib.Component.COMPONENT_SHAPE_HEIGHT_MAP;
|
||||
}
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
linkedObjects
|
||||
);
|
||||
};
|
||||
|
@ -75,6 +47,7 @@ GameLib.D3.Shape = function (
|
|||
GameLib.D3.Shape.prototype = Object.create(GameLib.D3.API.Shape.prototype);
|
||||
GameLib.D3.Shape.prototype.constructor = GameLib.D3.Shape;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a shape instance or updates it
|
||||
*/
|
||||
|
@ -98,6 +71,7 @@ GameLib.D3.Shape.prototype.toApiObject = function() {
|
|||
var apiShape = new GameLib.D3.API.Shape(
|
||||
this.id,
|
||||
this.name,
|
||||
this.shapeType,
|
||||
this.boundingSphereRadius,
|
||||
this.collisionResponse,
|
||||
GameLib.Utils.IdOrNull(this.frictionMaterial),
|
||||
|
|
|
@ -13,6 +13,16 @@ GameLib.D3.Shape.Box = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_BOX
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.Box) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(halfExtents)) {
|
||||
halfExtents = new GameLib.Vector3(
|
||||
physics,
|
||||
|
|
|
@ -20,7 +20,9 @@ GameLib.D3.Shape.ConvexHull = function (
|
|||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {};
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.ConvexHull) {
|
||||
|
|
|
@ -19,6 +19,16 @@ GameLib.D3.Shape.ConvexHull.Cylinder = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_CONVEX_HULL_CYLINDER
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.ConvexHull.Cylinder) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||||
radiusTop = 1;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,16 @@ GameLib.D3.Shape.HeightMap = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_HEIGHT_MAP
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.HeightMap) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(heightData)) {
|
||||
heightData = [[10, 10, 10], [10, 10, 10], [10, 10, 10]];
|
||||
}
|
||||
|
|
|
@ -11,6 +11,16 @@ GameLib.D3.Shape.Plane = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_PLANE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.Plane) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
GameLib.D3.Shape.call(
|
||||
this,
|
||||
this.physics,
|
||||
|
|
|
@ -13,6 +13,16 @@ GameLib.D3.Shape.Sphere = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_SPHERE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.Sphere) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,16 @@ GameLib.D3.Shape.TriMesh = function (
|
|||
this.physics = physics;
|
||||
this.physics.isNotCannonThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
||||
apiShape = {
|
||||
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_TRIMESH
|
||||
};
|
||||
}
|
||||
|
||||
if (apiShape instanceof GameLib.D3.Shape.TriMesh) {
|
||||
return apiShape;
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
||||
vertices = [];
|
||||
}
|
||||
|
|
|
@ -66,7 +66,6 @@ GameLib.D3.Skeleton = function Skeleton(
|
|||
}.bind(this)
|
||||
);
|
||||
|
||||
|
||||
this.boneMatrices = this.boneMatrices.map(
|
||||
function(boneMatrices) {
|
||||
if (boneMatrices instanceof GameLib.API.Matrix4) {
|
||||
|
@ -85,9 +84,8 @@ GameLib.D3.Skeleton = function Skeleton(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_SKELETON,
|
||||
{
|
||||
'bones' : [GameLib.D3.Bone]
|
||||
'bones' : [GameLib.D3.Bone]
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -209,7 +207,7 @@ GameLib.D3.Skeleton.prototype.toApiObject = function() {
|
|||
}
|
||||
),
|
||||
this.boneTexture,
|
||||
this.parentEntity
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
return apiSkeleton;
|
||||
|
|
|
@ -30,10 +30,7 @@ GameLib.D3.Solver = function (
|
|||
apiSolver.parentEntity
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_SOLVER
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Solver.prototype = Object.create(GameLib.D3.API.Solver.prototype);
|
||||
|
@ -45,9 +42,9 @@ GameLib.D3.Solver.prototype.constructor = GameLib.D3.Solver;
|
|||
*/
|
||||
GameLib.D3.Solver.prototype.createInstance = function() {
|
||||
|
||||
if (this.solverType === GameLib.D3.Solver.GS_SOLVER) {
|
||||
if (this.solverType === GameLib.D3.API.Solver.GS_SOLVER) {
|
||||
this.instance = new CANNON.GSSolver();
|
||||
} else if (this.solverType === GameLib.D3.Solver.SPLIT_SOLVER) {
|
||||
} else if (this.solverType === GameLib.D3.API.Solver.SPLIT_SOLVER) {
|
||||
this.instance = new CANNON.SplitSolver();
|
||||
} else {
|
||||
throw new Error('unsupported solver type: ' + this.solverType);
|
||||
|
@ -64,13 +61,13 @@ GameLib.D3.Solver.prototype.createInstance = function() {
|
|||
*/
|
||||
GameLib.D3.Solver.prototype.updateInstance = function() {
|
||||
|
||||
if (this.solverType === GameLib.D3.Solver.GS_SOLVER) {
|
||||
if (this.solverType === GameLib.D3.API.Solver.GS_SOLVER) {
|
||||
if (!(this.instance instanceof CANNON.GSSolver)) {
|
||||
this.instance = new CANNON.GSSolver();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.solverType === GameLib.D3.Solver.SPLIT_SOLVER) {
|
||||
if (this.solverType === GameLib.D3.API.Solver.SPLIT_SOLVER) {
|
||||
if (!(this.instance instanceof CANNON.SplitSolver)) {
|
||||
this.instance = new CANNON.SplitSolver();
|
||||
}
|
||||
|
@ -114,10 +111,3 @@ GameLib.D3.Solver.FromObject = function(graphics, objectComponent) {
|
|||
apiSolver
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Solver Types
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Solver.GS_SOLVER = 0x1;
|
||||
GameLib.D3.Solver.SPLIT_SOLVER = 0x2;
|
||||
|
|
|
@ -37,10 +37,7 @@ GameLib.D3.Spline = function (
|
|||
}
|
||||
);
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_SPLINE
|
||||
);
|
||||
GameLib.Component.call(this);
|
||||
};
|
||||
|
||||
GameLib.D3.Spline.prototype = Object.create(GameLib.D3.API.Spline.prototype);
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* Stats component for displaying some render statistics (framerate, memory consumption, etc)
|
||||
* @param stats
|
||||
* @param id
|
||||
* @param name
|
||||
* @param domElement
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Stats = function(
|
||||
stats,
|
||||
id,
|
||||
name,
|
||||
domElement,
|
||||
parentEntity
|
||||
) {
|
||||
this.stats = stats;
|
||||
this.stats.isNotStatsThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||||
id = GameLib.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Stats (' + id + ')';
|
||||
}
|
||||
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');
|
||||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
|
||||
parentEntity = null;
|
||||
}
|
||||
this.parentEntity = parentEntity;
|
||||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_STATS,
|
||||
{
|
||||
'domElement': GameLib.DomElement
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
GameLib.D3.Stats.prototype = Object.create(GameLib.Component.prototype);
|
||||
GameLib.D3.Stats.prototype.constructor = GameLib.D3.Stats;
|
||||
|
||||
GameLib.D3.Stats.prototype.resize = function() {
|
||||
console.log('override stats resize per implementation');
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a helper instance
|
||||
*/
|
||||
GameLib.D3.Stats.prototype.createInstance = function() {
|
||||
|
||||
this.instance = this.stats.instance();
|
||||
|
||||
this.resize();
|
||||
|
||||
this.domElement.instance.parentElement.appendChild(this.instance.dom);
|
||||
|
||||
GameLib.Component.prototype.createInstance.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the instance with the current state
|
||||
*/
|
||||
GameLib.D3.Stats.prototype.updateInstance = function() {
|
||||
this.instance = new this.stats();
|
||||
};
|
||||
|
||||
GameLib.D3.Stats.prototype.start = function() {
|
||||
this.instance.begin();
|
||||
};
|
||||
|
||||
GameLib.D3.Stats.prototype.end = function() {
|
||||
this.instance.end();
|
||||
};
|
|
@ -23,7 +23,7 @@ GameLib.D3.Texture = function(
|
|||
GameLib.D3.API.Texture.call(
|
||||
this,
|
||||
apiTexture.id,
|
||||
apiTexture.typeId,
|
||||
apiTexture.textureType,
|
||||
apiTexture.name,
|
||||
apiTexture.image,
|
||||
apiTexture.images,
|
||||
|
@ -92,7 +92,6 @@ GameLib.D3.Texture = function(
|
|||
|
||||
GameLib.Component.call(
|
||||
this,
|
||||
GameLib.Component.COMPONENT_TEXTURE,
|
||||
{
|
||||
'image' : GameLib.Image,
|
||||
'images' : [GameLib.Image],
|
||||
|
@ -104,86 +103,13 @@ GameLib.D3.Texture = function(
|
|||
GameLib.D3.Texture.prototype = Object.create(GameLib.D3.API.Texture.prototype);
|
||||
GameLib.D3.Texture.prototype.constructor = GameLib.D3.Texture;
|
||||
|
||||
/**
|
||||
* Texture Formats
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_ALPHA_FORMAT = 1019;
|
||||
GameLib.D3.Texture.TYPE_RGB_FORMAT = 1020;
|
||||
GameLib.D3.Texture.TYPE_RGBA_FORMAT = 1021;
|
||||
GameLib.D3.Texture.TYPE_LUMINANCE_FORMAT = 1022;
|
||||
GameLib.D3.Texture.TYPE_LUMINANCE_ALPHA_FORMAT = 1023;
|
||||
GameLib.D3.Texture.TYPE_DEPTH_FORMAT = 1026;
|
||||
|
||||
/**
|
||||
* Mapping modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_UV_MAPPING = 300;
|
||||
GameLib.D3.Texture.TYPE_CUBE_REFLECTION_MAPPING = 301;
|
||||
GameLib.D3.Texture.TYPE_CUBE_REFRACTION_MAPPING = 302;
|
||||
GameLib.D3.Texture.TYPE_EQUI_RECTANGULAR_REFLECTION_MAPPING = 303;
|
||||
GameLib.D3.Texture.TYPE_EQUI_RECTANGULAR_REFRACTION_MAPPING = 304;
|
||||
GameLib.D3.Texture.TYPE_SPHERICAL_REFLECTION_MAPPING = 305;
|
||||
GameLib.D3.Texture.TYPE_CUBE_UV_REFLECTION_MAPPING = 306;
|
||||
GameLib.D3.Texture.TYPE_CUBE_UV_REFRACTION_MAPPING = 307;
|
||||
|
||||
/**
|
||||
* Wrapping Modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_REPEAT_WRAPPING = 1000;
|
||||
GameLib.D3.Texture.TYPE_CLAMP_TO_EDGE_WRAPPING = 1001;
|
||||
GameLib.D3.Texture.TYPE_MIRRORED_REPEAT_WRAPPING = 1002;
|
||||
|
||||
/**
|
||||
* Mipmap Filters
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_NEAREST_FILTER = 1003;
|
||||
GameLib.D3.Texture.TYPE_NEAREST_MIPMAP_NEAREST_FILTER = 1004;
|
||||
GameLib.D3.Texture.TYPE_NEAREST_MIPMAP_LINEAR_FILTER = 1005;
|
||||
GameLib.D3.Texture.TYPE_LINEAR_FILTER = 1006;
|
||||
GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_NEAREST_FILTER = 1007;
|
||||
GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER = 1008;
|
||||
|
||||
/**
|
||||
* Texture Data Types
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_UNSIGNED_BYTE = 1009;
|
||||
GameLib.D3.Texture.TYPE_BYTE = 1010;
|
||||
GameLib.D3.Texture.TYPE_SHORT = 1011;
|
||||
GameLib.D3.Texture.TYPE_UNSIGNED_SHORT = 1012;
|
||||
GameLib.D3.Texture.TYPE_INT = 1013;
|
||||
GameLib.D3.Texture.TYPE_UNSIGNED_INT = 1014;
|
||||
GameLib.D3.Texture.TYPE_FLOAT = 1015;
|
||||
GameLib.D3.Texture.TYPE_HALF_FLOAT = 1025;
|
||||
|
||||
/**
|
||||
* Encoding Modes
|
||||
* @type {number}
|
||||
*/
|
||||
GameLib.D3.Texture.TYPE_LINEAR_ENCODING = 3000; // NO ENCODING AT ALL.
|
||||
GameLib.D3.Texture.TYPE_SRGB_ENCODING = 3001;
|
||||
GameLib.D3.Texture.TYPE_GAMMA_ENCODING = 3007; // USES GAMMA_FACTOR, FOR BACKWARDS COMPATIBILITY WITH WEBGLRENDERER.GAMMAINPUT/GAMMAOUTPUT
|
||||
GameLib.D3.Texture.TYPE_RGBE_ENCODING = 3002; // AKA RADIANCE.
|
||||
GameLib.D3.Texture.TYPE_LOG_LUV_ENCODING = 3003;
|
||||
GameLib.D3.Texture.TYPE_RGBM7_ENCODING = 3004;
|
||||
GameLib.D3.Texture.TYPE_RGBM16_ENCODING = 3005;
|
||||
GameLib.D3.Texture.TYPE_RGBD_ENCODING = 3006; // MAXRANGE IS 256.
|
||||
|
||||
GameLib.D3.Texture.TEXTURE_TYPE_NORMAL = 0x1;
|
||||
GameLib.D3.Texture.TEXTURE_TYPE_CUBE = 0x2;
|
||||
GameLib.D3.Texture.TEXTURE_TYPE_CANVAS = 0x3;
|
||||
|
||||
/**
|
||||
* Creates an instance of our texture object
|
||||
* @returns {*}
|
||||
*/
|
||||
GameLib.D3.Texture.prototype.createInstance = function() {
|
||||
|
||||
if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CUBE) {
|
||||
if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_CUBE) {
|
||||
|
||||
if (this.images.length !== 6) {
|
||||
throw new Error('not enough images for cube texture');
|
||||
|
@ -206,7 +132,7 @@ GameLib.D3.Texture.prototype.createInstance = function() {
|
|||
|
||||
this.instance = new THREE.CubeTexture(imageInstances);
|
||||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_NORMAL) {
|
||||
} else if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_NORMAL) {
|
||||
|
||||
if (
|
||||
GameLib.Utils.UndefinedOrNull(this.image) ||
|
||||
|
@ -227,7 +153,7 @@ GameLib.D3.Texture.prototype.createInstance = function() {
|
|||
|
||||
}
|
||||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CANVAS) {
|
||||
} else if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_CANVAS) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.canvas)) {
|
||||
|
||||
|
@ -291,7 +217,7 @@ GameLib.D3.Texture.prototype.updateInstance = function(property) {
|
|||
|
||||
if (property === 'image') {
|
||||
|
||||
if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_NORMAL) {
|
||||
if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_NORMAL) {
|
||||
|
||||
if (
|
||||
GameLib.Utils.UndefinedOrNull(this.image) &&
|
||||
|
@ -312,7 +238,7 @@ GameLib.D3.Texture.prototype.updateInstance = function(property) {
|
|||
}
|
||||
}
|
||||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CANVAS) {
|
||||
} else if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_CANVAS) {
|
||||
|
||||
if (
|
||||
GameLib.Utils.UndefinedOrNull(this.canvas) &&
|
||||
|
@ -333,7 +259,7 @@ GameLib.D3.Texture.prototype.updateInstance = function(property) {
|
|||
}
|
||||
}
|
||||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CUBE) {
|
||||
} else if (this.textureType === GameLib.D3.API.Texture.TEXTURE_TYPE_CUBE) {
|
||||
|
||||
console.log('todo : cube images change check here');
|
||||
|
||||
|
@ -405,7 +331,7 @@ GameLib.D3.Texture.prototype.toApiObject = function() {
|
|||
|
||||
var apiTexture = new GameLib.D3.API.Texture(
|
||||
this.id,
|
||||
this.typeId,
|
||||
this.textureType,
|
||||
this.name,
|
||||
GameLib.Utils.IdOrNull(this.image),
|
||||
this.images.map(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue