construct from object and new

beta.r3js.org
-=yb4f310 2017-12-05 21:19:09 +01:00
parent ee53a76cf0
commit aef4286386
5 changed files with 565 additions and 281 deletions

28
build/game-lib-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
// COMPILE TIME DEFINITIONS (Generated via gulp) // COMPILE TIME DEFINITIONS (Generated via gulp)
var __DATE__ = "Tue Dec 05 2017 17:00:21 GMT+0100 (CET)"; var __DATE__ = "Tue Dec 05 2017 21:13:00 GMT+0100 (CET)";
// END COMPILE TIME DEFINITIONS // END COMPILE TIME DEFINITIONS
/** /**
@ -1615,50 +1615,59 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x2 : return { case 0x2 : return {
name : 'GameLib.D3.Material', name : 'GameLib.D3.Material',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Material constructor : GameLib.D3.Material,
apiConstructor : GameLib.D3.API.Material
}; };
case 0x3 : return { case 0x3 : return {
name : 'GameLib.D3.Renderer', name : 'GameLib.D3.Renderer',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Renderer constructor : GameLib.D3.Renderer,
apiConstructor : GameLib.D3.API.Renderer
}; };
case 0x4 : return null; case 0x4 : return null;
case 0x5 : return { case 0x5 : return {
name : 'GameLib.D3.Camera', name : 'GameLib.D3.Camera',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Camera constructor : GameLib.D3.Camera,
apiConstructor : GameLib.D3.API.Camera
}; };
case 0x6 : return null; case 0x6 : return null;
case 0x7 : return { case 0x7 : return {
name : 'GameLib.D3.Mesh', name : 'GameLib.D3.Mesh',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh constructor : GameLib.D3.Mesh,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x8 : return { case 0x8 : return {
name : 'GameLib.D3.Spline', name : 'GameLib.D3.Spline',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Spline constructor : GameLib.D3.Spline,
apiConstructor : GameLib.D3.API.Spline
}; };
case 0x9 : return { case 0x9 : return {
name : 'GameLib.D3.Light', name : 'GameLib.D3.Light',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Light constructor : GameLib.D3.Light,
apiConstructor : GameLib.D3.API.Light
}; };
case 0xa : return null; case 0xa : return null;
case 0xb : return { case 0xb : return {
name : 'GameLib.D3.Composer', name : 'GameLib.D3.Composer',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Composer constructor : GameLib.D3.Composer,
apiConstructor : GameLib.D3.API.Composer
}; };
case 0xc : return { case 0xc : return {
name : 'GameLib.D3.RenderTarget', name : 'GameLib.D3.RenderTarget',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.RenderTarget constructor : GameLib.D3.RenderTarget,
apiConstructor : GameLib.D3.API.RenderTarget
}; };
case 0xd : return { case 0xd : return {
name : 'GameLib.D3.Pass', name : 'GameLib.D3.Pass',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Pass constructor : GameLib.D3.Pass,
apiConstructor : GameLib.D3.API.Pass
}; };
case 0xe : return { case 0xe : return {
name : 'GameLib.D3.Scene', name : 'GameLib.D3.Scene',
@ -1668,19 +1677,22 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0xf : return { case 0xf : return {
name : 'GameLib.D3.Raycaster', name : 'GameLib.D3.Raycaster',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Raycaster constructor : GameLib.D3.Raycaster,
apiConstructor : GameLib.D3.API.Raycaster
}; };
case 0x10 : return null; case 0x10 : return null;
case 0x11 : return null; case 0x11 : return null;
case 0x12 : return { case 0x12 : return {
name : 'GameLib.D3.Viewport', name : 'GameLib.D3.Viewport',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Viewport constructor : GameLib.D3.Viewport,
apiConstructor : GameLib.D3.API.Viewport
}; };
case 0x13 : return { case 0x13 : return {
name : 'GameLib.System', name : 'GameLib.System',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System constructor : GameLib.System,
apiConstructor : GameLib.API.System
}; };
case 0x14 : return { case 0x14 : return {
name : 'GameLib.GraphicsRuntime', name : 'GameLib.GraphicsRuntime',
@ -1695,43 +1707,51 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x16 : return { case 0x16 : return {
name : 'GameLib.CustomCode', name : 'GameLib.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.CustomCode constructor : GameLib.CustomCode,
apiConstructor : GameLib.API.CustomCode
}; };
case 0x17 : return { case 0x17 : return {
name : 'GameLib.Mouse', name : 'GameLib.Mouse',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Mouse constructor : GameLib.Mouse,
apiConstructor : GameLib.API.Mouse
}; };
case 0x18 : return { case 0x18 : return {
name : 'GameLib.D3.Skeleton', name : 'GameLib.D3.Skeleton',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Skeleton constructor : GameLib.D3.Skeleton,
apiConstructor : GameLib.D3.API.Skeleton
}; };
case 0x19 : return { case 0x19 : return {
name : 'GameLib.D3.Texture', name : 'GameLib.D3.Texture',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Texture constructor : GameLib.D3.Texture,
apiConstructor : GameLib.D3.API.Texture
}; };
case 0x1a : return { case 0x1a : return {
name : 'GameLib.EntityManager', name : 'GameLib.EntityManager',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.EntityManager constructor : GameLib.EntityManager,
apiConstructor : GameLib.API.EntityManager
}; };
case 0x1b : return { case 0x1b : return {
name : 'GameLib.DomElement', name : 'GameLib.DomElement',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.DomElement constructor : GameLib.DomElement,
apiConstructor : GameLib.API.DomElement
}; };
case 0x1c : return null; case 0x1c : return null;
case 0x1d : return { case 0x1d : return {
name : 'GameLib.Stats', name : 'GameLib.Stats',
runtime : GameLib.Component.STATISTICS_RUNTIME, runtime : GameLib.Component.STATISTICS_RUNTIME,
constructor : GameLib.Stats constructor : GameLib.Stats,
apiConstructor : GameLib.API.Stats
}; };
case 0x1e : return { case 0x1e : return {
name : 'GameLib.GUI', name : 'GameLib.GUI',
runtime : GameLib.Component.GUI_RUNTIME, runtime : GameLib.Component.GUI_RUNTIME,
constructor : GameLib.GUI constructor : GameLib.GUI,
apiConstructor : GameLib.API.GUI
}; };
case 0x1f : return { case 0x1f : return {
name : 'GameLib.Image', name : 'GameLib.Image',
@ -1741,252 +1761,302 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x20 : return { case 0x20 : return {
name : 'GameLib.Entity', name : 'GameLib.Entity',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Entity constructor : GameLib.Entity,
apiConstructor : GameLib.API.Entity
}; };
case 0x21 : return { case 0x21 : return {
name : 'GameLib.D3.Mesh.Sphere', name : 'GameLib.D3.Mesh.Sphere',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Sphere constructor : GameLib.D3.Mesh.Sphere,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x22 : return { case 0x22 : return {
name : 'GameLib.D3.Mesh.Plane', name : 'GameLib.D3.Mesh.Plane',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Plane constructor : GameLib.D3.Mesh.Plane,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x23 : return { case 0x23 : return {
name : 'GameLib.D3.Mesh.Curve', name : 'GameLib.D3.Mesh.Curve',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Curve constructor : GameLib.D3.Mesh.Curve,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x24 : return { case 0x24 : return {
name : 'GameLib.D3.PhysicsWorld', name : 'GameLib.D3.PhysicsWorld',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.PhysicsWorld constructor : GameLib.D3.PhysicsWorld,
apiConstructor : GameLib.D3.API.PhysicsWorld
}; };
case 0x25 : return { case 0x25 : return {
name : 'GameLib.D3.Broadphase', name : 'GameLib.D3.Broadphase',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Broadphase constructor : GameLib.D3.Broadphase,
apiConstructor : GameLib.D3.API.Broadphase
}; };
case 0x26 : return { case 0x26 : return {
name : 'GameLib.D3.Solver', name : 'GameLib.D3.Solver',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Solver constructor : GameLib.D3.Solver,
apiConstructor : GameLib.D3.API.Solver
}; };
case 0x27 : return { case 0x27 : return {
name : 'GameLib.D3.RigidBody', name : 'GameLib.D3.RigidBody',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RigidBody constructor : GameLib.D3.RigidBody,
apiConstructor : GameLib.D3.API.RigidBody
}; };
case 0x28 : return { case 0x28 : return {
name : 'GameLib.D3.Shape', name : 'GameLib.D3.Shape',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape constructor : GameLib.D3.Shape,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x29 : return { case 0x29 : return {
name : 'GameLib.D3.Shape.Box', name : 'GameLib.D3.Shape.Box',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Box constructor : GameLib.D3.Shape.Box,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2a : return { case 0x2a : return {
name : 'GameLib.D3.Shape.Sphere', name : 'GameLib.D3.Shape.Sphere',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Sphere constructor : GameLib.D3.Shape.Sphere,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2b : return { case 0x2b : return {
name : 'GameLib.D3.Shape.TriMesh', name : 'GameLib.D3.Shape.TriMesh',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.TriMesh constructor : GameLib.D3.Shape.TriMesh,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2c : return { case 0x2c : return {
name : 'GameLib.D3.Shape.ConvexHull', name : 'GameLib.D3.Shape.ConvexHull',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.ConvexHull constructor : GameLib.D3.Shape.ConvexHull,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2d : return { case 0x2d : return {
name : 'GameLib.D3.Shape.ConvexHull.Cylinder', name : 'GameLib.D3.Shape.ConvexHull.Cylinder',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.ConvexHull.Cylinder constructor : GameLib.D3.Shape.ConvexHull.Cylinder,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2e : return { case 0x2e : return {
name : 'GameLib.D3.Shape.HeightMap', name : 'GameLib.D3.Shape.HeightMap',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.D3.Shape.HeightMap constructor : GameLib.D3.Shape.HeightMap,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2f : return { case 0x2f : return {
name : 'GameLib.D3.Shape.Plane', name : 'GameLib.D3.Shape.Plane',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Plane constructor : GameLib.D3.Shape.Plane,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x30 : return { case 0x30 : return {
name : 'GameLib.Controls', name : 'GameLib.Controls',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls constructor : GameLib.Controls,
apiConstructor : GameLib.API.Controls
}; };
case 0x31 : return { case 0x31 : return {
name : 'GameLib.Controls.D3.Editor', name : 'GameLib.Controls.D3.Editor',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.Controls.D3.Editor constructor : GameLib.Controls.D3.Editor,
apiConstructor : GameLib.API.Controls
}; };
case 0x32 : return { case 0x32 : return {
name : 'GameLib.Controls.Touch', name : 'GameLib.Controls.Touch',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Touch constructor : GameLib.Controls.Touch,
apiConstructor : GameLib.API.Controls
}; };
case 0x33 : return { case 0x33 : return {
name : 'GameLib.D3.FrictionMaterial', name : 'GameLib.D3.FrictionMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.FrictionMaterial constructor : GameLib.D3.FrictionMaterial,
apiConstructor : GameLib.D3.API.FrictionMaterial
}; };
case 0x34 : return { case 0x34 : return {
name : 'GameLib.D3.FrictionContactMaterial', name : 'GameLib.D3.FrictionContactMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.FrictionContactMaterial constructor : GameLib.D3.FrictionContactMaterial,
apiConstructor : GameLib.D3.API.FrictionContactMaterial
}; };
case 0x35 : return { case 0x35 : return {
name : 'GameLib.D3.RaycastVehicle', name : 'GameLib.D3.RaycastVehicle',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RaycastVehicle constructor : GameLib.D3.RaycastVehicle,
apiConstructor : GameLib.D3.API.RaycastVehicle
}; };
case 0x36 : return { case 0x36 : return {
name : 'GameLib.D3.RaycastWheel', name : 'GameLib.D3.RaycastWheel',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RaycastWheel constructor : GameLib.D3.RaycastWheel,
apiConstructor : GameLib.D3.API.RaycastWheel
}; };
case 0x37 : return { case 0x37 : return {
name : 'GameLib.Clock', name : 'GameLib.Clock',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.Clock constructor : GameLib.Clock,
apiConstructor : GameLib.API.Clock
}; };
case 0x38 : return { case 0x38 : return {
name : 'GameLib.D3.Animation', name : 'GameLib.D3.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.D3.Animation constructor : GameLib.D3.Animation,
apiConstructor : GameLib.D3.API.Animation
}; };
case 0x39 : return { case 0x39 : return {
name : 'GameLib.Controls.Keyboard', name : 'GameLib.Controls.Keyboard',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Keyboard constructor : GameLib.Controls.Keyboard,
apiConstructor : GameLib.API.Controls
}; };
case 0x3a : return { case 0x3a : return {
name : 'GameLib.Controls.Mouse', name : 'GameLib.Controls.Mouse',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Mouse constructor : GameLib.Controls.Mouse,
apiConstructor : GameLib.API.Controls
}; };
case 0x3b : return { case 0x3b : return {
name : 'GameLib.D3.Mesh.Text', name : 'GameLib.D3.Mesh.Text',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Text constructor : GameLib.D3.Mesh.Text,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x3c : return { case 0x3c : return {
name : 'GameLib.D3.Font', name : 'GameLib.D3.Font',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Font constructor : GameLib.D3.Font,
apiConstructor : GameLib.D3.API.Font
}; };
case 0x3d : return { case 0x3d : return {
name : 'GameLib.Canvas', name : 'GameLib.Canvas',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Canvas constructor : GameLib.Canvas,
apiConstructor : GameLib.API.Canvas
}; };
case 0x3e : return { case 0x3e : return {
name : 'GameLib.D3.Bone', name : 'GameLib.D3.Bone',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Bone constructor : GameLib.D3.Bone,
apiConstructor : GameLib.D3.API.Bone
}; };
case 0x3f : return { case 0x3f : return {
name : 'GameLib.D3.Mesh.Box', name : 'GameLib.D3.Mesh.Box',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Box constructor : GameLib.D3.Mesh.Box,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x40 : return { case 0x40 : return {
name : 'GameLib.D3.Mesh.Cylinder', name : 'GameLib.D3.Mesh.Cylinder',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Cylinder constructor : GameLib.D3.Mesh.Cylinder,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x41 : return { case 0x41 : return {
name : 'GameLib.System.Animation', name : 'GameLib.System.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Animation constructor : GameLib.System.Animation,
apiConstructor : GameLib.API.System
}; };
case 0x42 : return { case 0x42 : return {
name : 'GameLib.System.CustomCode', name : 'GameLib.System.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.CustomCode constructor : GameLib.System.CustomCode,
apiConstructor : GameLib.API.System
}; };
case 0x43 : return { case 0x43 : return {
name : 'GameLib.System.GUI', name : 'GameLib.System.GUI',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.GUI constructor : GameLib.System.GUI,
apiConstructor : GameLib.API.System
}; };
case 0x44 : return { case 0x44 : return {
name : 'GameLib.System.Input', name : 'GameLib.System.Input',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Input constructor : GameLib.System.Input,
apiConstructor : GameLib.API.System
}; };
case 0x45 : return { case 0x45 : return {
name : 'GameLib.System.Linking', name : 'GameLib.System.Linking',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Linking constructor : GameLib.System.Linking,
apiConstructor : GameLib.API.System
}; };
case 0x46 : return { case 0x46 : return {
name : 'GameLib.System.Physics', name : 'GameLib.System.Physics',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Physics constructor : GameLib.System.Physics,
apiConstructor : GameLib.API.System
}; };
case 0x47 : return { case 0x47 : return {
name : 'GameLib.System.Render', name : 'GameLib.System.Render',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Render constructor : GameLib.System.Render,
apiConstructor : GameLib.API.System
}; };
case 0x48 : return { case 0x48 : return {
name : 'GameLib.System.Storage', name : 'GameLib.System.Storage',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Storage constructor : GameLib.System.Storage,
apiConstructor : GameLib.API.System
}; };
case 0x49 : return { case 0x49 : return {
name : 'GameLib.System.Visualization', name : 'GameLib.System.Visualization',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Visualization constructor : GameLib.System.Visualization,
apiConstructor : GameLib.API.System
}; };
case 0x50 : return { case 0x50 : return {
name : 'GameLib.D3.Fog', name : 'GameLib.D3.Fog',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Fog constructor : GameLib.D3.Fog,
apiConstructor : GameLib.D3.API.Fog
}; };
case 0x51 : return { case 0x51 : return {
name : 'GameLib.D3.Mesh.Line', name : 'GameLib.D3.Mesh.Line',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Line constructor : GameLib.D3.Mesh.Line,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x52 : return { case 0x52 : return {
name : 'GameLib.D3.ParticleEngine', name : 'GameLib.D3.ParticleEngine',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.ParticleEngine constructor : GameLib.D3.ParticleEngine,
apiConstructor : GameLib.D3.API.ParticleEngine
}; };
case 0x53 : return { case 0x53 : return {
name : 'GameLib.System.Particle', name : 'GameLib.System.Particle',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Particle constructor : GameLib.System.Particle,
apiConstructor : GameLib.API.System
}; };
case 0x54 : return { case 0x54 : return {
name : 'GameLib.D3.Particle', name : 'GameLib.D3.Particle',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Particle constructor : GameLib.D3.Particle,
apiConstructor : GameLib.D3.API.Particle
}; };
case 0x55 : return { case 0x55 : return {
name : 'GameLib.D3.Audio', name : 'GameLib.D3.Audio',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Audio constructor : GameLib.D3.Audio,
apiConstructor : GameLib.D3.API.Audio
}; };
case 0x56 : return { case 0x56 : return {
name : 'GameLib.System.Audio', name : 'GameLib.System.Audio',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Audio constructor : GameLib.System.Audio,
apiConstructor : GameLib.API.System
}; };
case 0x57 : return { case 0x57 : return {
name : 'GameLib.Cast', name : 'GameLib.Cast',
runtime : GameLib.Component.SOCKET_RUNTIME, runtime : GameLib.Component.SOCKET_RUNTIME,
constructor : GameLib.Cast constructor : GameLib.Cast,
apiConstructor : GameLib.API.Cast
}; };
break; break;
} }
@ -2245,7 +2315,7 @@ GameLib.Component.prototype.clone = function() {
apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')'; apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')';
var runtimeComponent = GameLib.Component.Construct(apiObject); var runtimeComponent = GameLib.Component.ConstructFromObject(apiObject);
runtimeComponent.isClone = true; runtimeComponent.isClone = true;
@ -2389,15 +2459,10 @@ GameLib.Component.prototype.save = function(remote) {
} }
}; };
GameLib.Component.Construct = function(rawComponentObject) { /**
* @return {null|Object}
var runtimeComponent = null; */
GameLib.Component.GetRuntimeObject = function(runtimeInfo) {
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
var componentClass = info.constructor;
var fn = componentClass['FromObject'];
var runtime = null; var runtime = null;
@ -2409,57 +2474,98 @@ GameLib.Component.Construct = function(rawComponentObject) {
} }
); );
if (runtimeInfo === GameLib.Component.GRAPHICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.graphics)) {
console.warn('no runtime graphics');
return null;
}
return runtime.graphics;
} else if (runtimeInfo === GameLib.Component.PHYSICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.physics)) {
console.warn('no runtime physics');
return null;
}
return runtime.physics;
} else if (runtimeInfo === GameLib.Component.GUI_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.gui)) {
console.warn('no runtime gui');
return null;
}
return runtime.gui;
} else if (runtimeInfo === GameLib.Component.SOCKET_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.sockets)) {
console.warn('no runtime sockets');
return null;
}
return runtime.sockets;
} else if (runtimeInfo === GameLib.Component.STATISTICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.statistics)) {
console.warn('no runtime statistics');
return null;
}
return runtime.statistics;
} else if (runtimeInfo === GameLib.Component.DEFAULT_RUNTIME) {
} else {
console.log('unknown runtime object found : ' + info.runtime);
}
return null;
};
GameLib.Component.Construct = function(componentType) {
var info = GameLib.Component.GetComponentInfo(componentType);
var componentClass = info.constructor;
var runtime = GameLib.Component.GetRuntimeObject(info.runtime);
if (runtime) {
return new componentClass(runtime);
} else {
return new componentClass();
}
};
GameLib.Component.ConstructFromObject = function(rawComponentObject) {
var runtimeComponent = null;
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
var componentClass = info.constructor;
var fn = componentClass['FromObject'];
if (rawComponentObject.componentType === GameLib.Component.ENTITY) { if (rawComponentObject.componentType === GameLib.Component.ENTITY) {
runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance); runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance);
} else if (info.runtime === GameLib.Component.GRAPHICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.graphics)) {
console.warn('no runtime graphics');
}
runtimeComponent = fn(runtime.graphics, rawComponentObject);
} else if (info.runtime === GameLib.Component.PHYSICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.physics)) {
console.warn('no runtime physics');
}
runtimeComponent = fn(runtime.physics, rawComponentObject);
} else if (info.runtime === GameLib.Component.GUI_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.gui)) {
console.warn('no runtime gui');
}
runtimeComponent = fn(runtime.gui, rawComponentObject);
} else if (info.runtime === GameLib.Component.SOCKET_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.sockets)) {
console.warn('no runtime sockets');
}
runtimeComponent = fn(runtime.sockets, rawComponentObject);
} else if (info.runtime === GameLib.Component.STATISTICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.statistics)) {
console.warn('no runtime statistics');
}
runtimeComponent = fn(runtime.statistics, rawComponentObject);
} else if (info.runtime === GameLib.Component.DEFAULT_RUNTIME) {
runtimeComponent = fn(rawComponentObject);
} else { } else {
console.log('unknown runtime object found : ' + rawComponentObject.name); var runtime = GameLib.Component.GetRuntimeObject(info.runtime);
console.error(rawComponentObject);
if (runtime) {
runtimeComponent = fn(runtime, rawComponentObject);
} else {
runtimeComponent = fn(rawComponentObject);
}
} }
return runtimeComponent; return runtimeComponent;
@ -7877,9 +7983,45 @@ GameLib.D3.API.Mesh.FromObject = function (objectMesh){
apiModelMatrix = GameLib.API.Matrix4.FromObject(objectMesh.modelMatrix); apiModelMatrix = GameLib.API.Matrix4.FromObject(objectMesh.modelMatrix);
} }
var meshType = GameLib.D3.API.Mesh.MESH_TYPE_NORMAL;
if (objectMesh.meshType === GameLib.D3.API.Mesh.MESH_TYPE_NORMAL ||
objectMesh.meshType === GameLib.D3.API.Mesh.MESH_TYPE_SKINNED
) {
meshType = objectMesh.meshType;
}
if (objectMesh.componentType === GameLib.Component.MESH_PLANE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_PLANE;
}
if (objectMesh.componentType === GameLib.Component.MESH_SPHERE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_SPHERE;
}
if (objectMesh.componentType === GameLib.Component.MESH_CURVE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_CURVE;
}
if (objectMesh.componentType === GameLib.Component.MESH_BOX) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_BOX;
}
if (objectMesh.componentType === GameLib.Component.MESH_CYLINDER) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER;
}
if (objectMesh.componentType === GameLib.Component.MESH_TEXT) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_TEXT;
}
if (objectMesh.componentType === GameLib.Component.MESH_TYPE_LINE) {
meshType = GameLib.D3.API.Mesh.MESH_LINE;
}
return new GameLib.D3.API.Mesh( return new GameLib.D3.API.Mesh(
objectMesh.id, objectMesh.id,
objectMesh.meshType, meshType,
objectMesh.name, objectMesh.name,
apiVertices, apiVertices,
apiFaces, apiFaces,
@ -31724,7 +31866,7 @@ GameLib.System.Storage.prototype.createRuntimeObject = function(responseText, cl
* First, we create an API object from the Object, then a Runtime object from the API object * First, we create an API object from the Object, then a Runtime object from the API object
* Each component has a function 'FromObject' which essentially does this for you * Each component has a function 'FromObject' which essentially does this for you
*/ */
var runtimeComponent = GameLib.Component.Construct(object.component[0]); var runtimeComponent = GameLib.Component.ConstructFromObject(object.component[0]);
if (!runtimeComponent) { if (!runtimeComponent) {
if (clientErrorCallback) { if (clientErrorCallback) {
@ -32116,7 +32258,7 @@ GameLib.System.Storage.prototype.imageUploadComplete = function(data) {
/** /**
* We are creating a new image * We are creating a new image
*/ */
GameLib.Component.Construct(rawImage); GameLib.Component.ConstructFromObject(rawImage);
} }
}.bind(this)); }.bind(this));
@ -32137,7 +32279,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
*/ */
data.images.map( data.images.map(
function(rawImageObject) { function(rawImageObject) {
var image = GameLib.Component.Construct(rawImageObject); var image = GameLib.Component.ConstructFromObject(rawImageObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -32151,7 +32293,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Process all textures * Process all textures
*/ */
data.textures.map(function(rawTextureObject){ data.textures.map(function(rawTextureObject){
var texture = GameLib.Component.Construct(rawTextureObject); var texture = GameLib.Component.ConstructFromObject(rawTextureObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -32164,7 +32306,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Process all materials * Process all materials
*/ */
data.materials.map(function(rawMaterialObject){ data.materials.map(function(rawMaterialObject){
var material = GameLib.Component.Construct(rawMaterialObject); var material = GameLib.Component.ConstructFromObject(rawMaterialObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -32177,7 +32319,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Now process all meshes * Now process all meshes
*/ */
data.meshes.map(function(rawMeshObject){ data.meshes.map(function(rawMeshObject){
var mesh = GameLib.Component.Construct(rawMeshObject); var mesh = GameLib.Component.ConstructFromObject(rawMeshObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {

View File

@ -314,50 +314,59 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x2 : return { case 0x2 : return {
name : 'GameLib.D3.Material', name : 'GameLib.D3.Material',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Material constructor : GameLib.D3.Material,
apiConstructor : GameLib.D3.API.Material
}; };
case 0x3 : return { case 0x3 : return {
name : 'GameLib.D3.Renderer', name : 'GameLib.D3.Renderer',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Renderer constructor : GameLib.D3.Renderer,
apiConstructor : GameLib.D3.API.Renderer
}; };
case 0x4 : return null; case 0x4 : return null;
case 0x5 : return { case 0x5 : return {
name : 'GameLib.D3.Camera', name : 'GameLib.D3.Camera',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Camera constructor : GameLib.D3.Camera,
apiConstructor : GameLib.D3.API.Camera
}; };
case 0x6 : return null; case 0x6 : return null;
case 0x7 : return { case 0x7 : return {
name : 'GameLib.D3.Mesh', name : 'GameLib.D3.Mesh',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh constructor : GameLib.D3.Mesh,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x8 : return { case 0x8 : return {
name : 'GameLib.D3.Spline', name : 'GameLib.D3.Spline',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Spline constructor : GameLib.D3.Spline,
apiConstructor : GameLib.D3.API.Spline
}; };
case 0x9 : return { case 0x9 : return {
name : 'GameLib.D3.Light', name : 'GameLib.D3.Light',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Light constructor : GameLib.D3.Light,
apiConstructor : GameLib.D3.API.Light
}; };
case 0xa : return null; case 0xa : return null;
case 0xb : return { case 0xb : return {
name : 'GameLib.D3.Composer', name : 'GameLib.D3.Composer',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Composer constructor : GameLib.D3.Composer,
apiConstructor : GameLib.D3.API.Composer
}; };
case 0xc : return { case 0xc : return {
name : 'GameLib.D3.RenderTarget', name : 'GameLib.D3.RenderTarget',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.RenderTarget constructor : GameLib.D3.RenderTarget,
apiConstructor : GameLib.D3.API.RenderTarget
}; };
case 0xd : return { case 0xd : return {
name : 'GameLib.D3.Pass', name : 'GameLib.D3.Pass',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Pass constructor : GameLib.D3.Pass,
apiConstructor : GameLib.D3.API.Pass
}; };
case 0xe : return { case 0xe : return {
name : 'GameLib.D3.Scene', name : 'GameLib.D3.Scene',
@ -367,19 +376,22 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0xf : return { case 0xf : return {
name : 'GameLib.D3.Raycaster', name : 'GameLib.D3.Raycaster',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Raycaster constructor : GameLib.D3.Raycaster,
apiConstructor : GameLib.D3.API.Raycaster
}; };
case 0x10 : return null; case 0x10 : return null;
case 0x11 : return null; case 0x11 : return null;
case 0x12 : return { case 0x12 : return {
name : 'GameLib.D3.Viewport', name : 'GameLib.D3.Viewport',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Viewport constructor : GameLib.D3.Viewport,
apiConstructor : GameLib.D3.API.Viewport
}; };
case 0x13 : return { case 0x13 : return {
name : 'GameLib.System', name : 'GameLib.System',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System constructor : GameLib.System,
apiConstructor : GameLib.API.System
}; };
case 0x14 : return { case 0x14 : return {
name : 'GameLib.GraphicsRuntime', name : 'GameLib.GraphicsRuntime',
@ -394,43 +406,51 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x16 : return { case 0x16 : return {
name : 'GameLib.CustomCode', name : 'GameLib.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.CustomCode constructor : GameLib.CustomCode,
apiConstructor : GameLib.API.CustomCode
}; };
case 0x17 : return { case 0x17 : return {
name : 'GameLib.Mouse', name : 'GameLib.Mouse',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Mouse constructor : GameLib.Mouse,
apiConstructor : GameLib.API.Mouse
}; };
case 0x18 : return { case 0x18 : return {
name : 'GameLib.D3.Skeleton', name : 'GameLib.D3.Skeleton',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Skeleton constructor : GameLib.D3.Skeleton,
apiConstructor : GameLib.D3.API.Skeleton
}; };
case 0x19 : return { case 0x19 : return {
name : 'GameLib.D3.Texture', name : 'GameLib.D3.Texture',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Texture constructor : GameLib.D3.Texture,
apiConstructor : GameLib.D3.API.Texture
}; };
case 0x1a : return { case 0x1a : return {
name : 'GameLib.EntityManager', name : 'GameLib.EntityManager',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.EntityManager constructor : GameLib.EntityManager,
apiConstructor : GameLib.API.EntityManager
}; };
case 0x1b : return { case 0x1b : return {
name : 'GameLib.DomElement', name : 'GameLib.DomElement',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.DomElement constructor : GameLib.DomElement,
apiConstructor : GameLib.API.DomElement
}; };
case 0x1c : return null; case 0x1c : return null;
case 0x1d : return { case 0x1d : return {
name : 'GameLib.Stats', name : 'GameLib.Stats',
runtime : GameLib.Component.STATISTICS_RUNTIME, runtime : GameLib.Component.STATISTICS_RUNTIME,
constructor : GameLib.Stats constructor : GameLib.Stats,
apiConstructor : GameLib.API.Stats
}; };
case 0x1e : return { case 0x1e : return {
name : 'GameLib.GUI', name : 'GameLib.GUI',
runtime : GameLib.Component.GUI_RUNTIME, runtime : GameLib.Component.GUI_RUNTIME,
constructor : GameLib.GUI constructor : GameLib.GUI,
apiConstructor : GameLib.API.GUI
}; };
case 0x1f : return { case 0x1f : return {
name : 'GameLib.Image', name : 'GameLib.Image',
@ -440,252 +460,302 @@ GameLib.Component.GetComponentInfo = function(number) {
case 0x20 : return { case 0x20 : return {
name : 'GameLib.Entity', name : 'GameLib.Entity',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Entity constructor : GameLib.Entity,
apiConstructor : GameLib.API.Entity
}; };
case 0x21 : return { case 0x21 : return {
name : 'GameLib.D3.Mesh.Sphere', name : 'GameLib.D3.Mesh.Sphere',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Sphere constructor : GameLib.D3.Mesh.Sphere,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x22 : return { case 0x22 : return {
name : 'GameLib.D3.Mesh.Plane', name : 'GameLib.D3.Mesh.Plane',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Plane constructor : GameLib.D3.Mesh.Plane,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x23 : return { case 0x23 : return {
name : 'GameLib.D3.Mesh.Curve', name : 'GameLib.D3.Mesh.Curve',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Curve constructor : GameLib.D3.Mesh.Curve,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x24 : return { case 0x24 : return {
name : 'GameLib.D3.PhysicsWorld', name : 'GameLib.D3.PhysicsWorld',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.PhysicsWorld constructor : GameLib.D3.PhysicsWorld,
apiConstructor : GameLib.D3.API.PhysicsWorld
}; };
case 0x25 : return { case 0x25 : return {
name : 'GameLib.D3.Broadphase', name : 'GameLib.D3.Broadphase',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Broadphase constructor : GameLib.D3.Broadphase,
apiConstructor : GameLib.D3.API.Broadphase
}; };
case 0x26 : return { case 0x26 : return {
name : 'GameLib.D3.Solver', name : 'GameLib.D3.Solver',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Solver constructor : GameLib.D3.Solver,
apiConstructor : GameLib.D3.API.Solver
}; };
case 0x27 : return { case 0x27 : return {
name : 'GameLib.D3.RigidBody', name : 'GameLib.D3.RigidBody',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RigidBody constructor : GameLib.D3.RigidBody,
apiConstructor : GameLib.D3.API.RigidBody
}; };
case 0x28 : return { case 0x28 : return {
name : 'GameLib.D3.Shape', name : 'GameLib.D3.Shape',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape constructor : GameLib.D3.Shape,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x29 : return { case 0x29 : return {
name : 'GameLib.D3.Shape.Box', name : 'GameLib.D3.Shape.Box',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Box constructor : GameLib.D3.Shape.Box,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2a : return { case 0x2a : return {
name : 'GameLib.D3.Shape.Sphere', name : 'GameLib.D3.Shape.Sphere',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Sphere constructor : GameLib.D3.Shape.Sphere,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2b : return { case 0x2b : return {
name : 'GameLib.D3.Shape.TriMesh', name : 'GameLib.D3.Shape.TriMesh',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.TriMesh constructor : GameLib.D3.Shape.TriMesh,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2c : return { case 0x2c : return {
name : 'GameLib.D3.Shape.ConvexHull', name : 'GameLib.D3.Shape.ConvexHull',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.ConvexHull constructor : GameLib.D3.Shape.ConvexHull,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2d : return { case 0x2d : return {
name : 'GameLib.D3.Shape.ConvexHull.Cylinder', name : 'GameLib.D3.Shape.ConvexHull.Cylinder',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.ConvexHull.Cylinder constructor : GameLib.D3.Shape.ConvexHull.Cylinder,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2e : return { case 0x2e : return {
name : 'GameLib.D3.Shape.HeightMap', name : 'GameLib.D3.Shape.HeightMap',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.D3.Shape.HeightMap constructor : GameLib.D3.Shape.HeightMap,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x2f : return { case 0x2f : return {
name : 'GameLib.D3.Shape.Plane', name : 'GameLib.D3.Shape.Plane',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.Shape.Plane constructor : GameLib.D3.Shape.Plane,
apiConstructor : GameLib.D3.API.Shape
}; };
case 0x30 : return { case 0x30 : return {
name : 'GameLib.Controls', name : 'GameLib.Controls',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls constructor : GameLib.Controls,
apiConstructor : GameLib.API.Controls
}; };
case 0x31 : return { case 0x31 : return {
name : 'GameLib.Controls.D3.Editor', name : 'GameLib.Controls.D3.Editor',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.Controls.D3.Editor constructor : GameLib.Controls.D3.Editor,
apiConstructor : GameLib.API.Controls
}; };
case 0x32 : return { case 0x32 : return {
name : 'GameLib.Controls.Touch', name : 'GameLib.Controls.Touch',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Touch constructor : GameLib.Controls.Touch,
apiConstructor : GameLib.API.Controls
}; };
case 0x33 : return { case 0x33 : return {
name : 'GameLib.D3.FrictionMaterial', name : 'GameLib.D3.FrictionMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.FrictionMaterial constructor : GameLib.D3.FrictionMaterial,
apiConstructor : GameLib.D3.API.FrictionMaterial
}; };
case 0x34 : return { case 0x34 : return {
name : 'GameLib.D3.FrictionContactMaterial', name : 'GameLib.D3.FrictionContactMaterial',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.FrictionContactMaterial constructor : GameLib.D3.FrictionContactMaterial,
apiConstructor : GameLib.D3.API.FrictionContactMaterial
}; };
case 0x35 : return { case 0x35 : return {
name : 'GameLib.D3.RaycastVehicle', name : 'GameLib.D3.RaycastVehicle',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RaycastVehicle constructor : GameLib.D3.RaycastVehicle,
apiConstructor : GameLib.D3.API.RaycastVehicle
}; };
case 0x36 : return { case 0x36 : return {
name : 'GameLib.D3.RaycastWheel', name : 'GameLib.D3.RaycastWheel',
runtime : GameLib.Component.PHYSICS_RUNTIME, runtime : GameLib.Component.PHYSICS_RUNTIME,
constructor : GameLib.D3.RaycastWheel constructor : GameLib.D3.RaycastWheel,
apiConstructor : GameLib.D3.API.RaycastWheel
}; };
case 0x37 : return { case 0x37 : return {
name : 'GameLib.Clock', name : 'GameLib.Clock',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.Clock constructor : GameLib.Clock,
apiConstructor : GameLib.API.Clock
}; };
case 0x38 : return { case 0x38 : return {
name : 'GameLib.D3.Animation', name : 'GameLib.D3.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.D3.Animation constructor : GameLib.D3.Animation,
apiConstructor : GameLib.D3.API.Animation
}; };
case 0x39 : return { case 0x39 : return {
name : 'GameLib.Controls.Keyboard', name : 'GameLib.Controls.Keyboard',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Keyboard constructor : GameLib.Controls.Keyboard,
apiConstructor : GameLib.API.Controls
}; };
case 0x3a : return { case 0x3a : return {
name : 'GameLib.Controls.Mouse', name : 'GameLib.Controls.Mouse',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Controls.Mouse constructor : GameLib.Controls.Mouse,
apiConstructor : GameLib.API.Controls
}; };
case 0x3b : return { case 0x3b : return {
name : 'GameLib.D3.Mesh.Text', name : 'GameLib.D3.Mesh.Text',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Text constructor : GameLib.D3.Mesh.Text,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x3c : return { case 0x3c : return {
name : 'GameLib.D3.Font', name : 'GameLib.D3.Font',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Font constructor : GameLib.D3.Font,
apiConstructor : GameLib.D3.API.Font
}; };
case 0x3d : return { case 0x3d : return {
name : 'GameLib.Canvas', name : 'GameLib.Canvas',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.Canvas constructor : GameLib.Canvas,
apiConstructor : GameLib.API.Canvas
}; };
case 0x3e : return { case 0x3e : return {
name : 'GameLib.D3.Bone', name : 'GameLib.D3.Bone',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Bone constructor : GameLib.D3.Bone,
apiConstructor : GameLib.D3.API.Bone
}; };
case 0x3f : return { case 0x3f : return {
name : 'GameLib.D3.Mesh.Box', name : 'GameLib.D3.Mesh.Box',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Box constructor : GameLib.D3.Mesh.Box,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x40 : return { case 0x40 : return {
name : 'GameLib.D3.Mesh.Cylinder', name : 'GameLib.D3.Mesh.Cylinder',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Cylinder constructor : GameLib.D3.Mesh.Cylinder,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x41 : return { case 0x41 : return {
name : 'GameLib.System.Animation', name : 'GameLib.System.Animation',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Animation constructor : GameLib.System.Animation,
apiConstructor : GameLib.API.System
}; };
case 0x42 : return { case 0x42 : return {
name : 'GameLib.System.CustomCode', name : 'GameLib.System.CustomCode',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.CustomCode constructor : GameLib.System.CustomCode,
apiConstructor : GameLib.API.System
}; };
case 0x43 : return { case 0x43 : return {
name : 'GameLib.System.GUI', name : 'GameLib.System.GUI',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.GUI constructor : GameLib.System.GUI,
apiConstructor : GameLib.API.System
}; };
case 0x44 : return { case 0x44 : return {
name : 'GameLib.System.Input', name : 'GameLib.System.Input',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Input constructor : GameLib.System.Input,
apiConstructor : GameLib.API.System
}; };
case 0x45 : return { case 0x45 : return {
name : 'GameLib.System.Linking', name : 'GameLib.System.Linking',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Linking constructor : GameLib.System.Linking,
apiConstructor : GameLib.API.System
}; };
case 0x46 : return { case 0x46 : return {
name : 'GameLib.System.Physics', name : 'GameLib.System.Physics',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Physics constructor : GameLib.System.Physics,
apiConstructor : GameLib.API.System
}; };
case 0x47 : return { case 0x47 : return {
name : 'GameLib.System.Render', name : 'GameLib.System.Render',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Render constructor : GameLib.System.Render,
apiConstructor : GameLib.API.System
}; };
case 0x48 : return { case 0x48 : return {
name : 'GameLib.System.Storage', name : 'GameLib.System.Storage',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Storage constructor : GameLib.System.Storage,
apiConstructor : GameLib.API.System
}; };
case 0x49 : return { case 0x49 : return {
name : 'GameLib.System.Visualization', name : 'GameLib.System.Visualization',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Visualization constructor : GameLib.System.Visualization,
apiConstructor : GameLib.API.System
}; };
case 0x50 : return { case 0x50 : return {
name : 'GameLib.D3.Fog', name : 'GameLib.D3.Fog',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Fog constructor : GameLib.D3.Fog,
apiConstructor : GameLib.D3.API.Fog
}; };
case 0x51 : return { case 0x51 : return {
name : 'GameLib.D3.Mesh.Line', name : 'GameLib.D3.Mesh.Line',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Mesh.Line constructor : GameLib.D3.Mesh.Line,
apiConstructor : GameLib.D3.API.Mesh
}; };
case 0x52 : return { case 0x52 : return {
name : 'GameLib.D3.ParticleEngine', name : 'GameLib.D3.ParticleEngine',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.ParticleEngine constructor : GameLib.D3.ParticleEngine,
apiConstructor : GameLib.D3.API.ParticleEngine
}; };
case 0x53 : return { case 0x53 : return {
name : 'GameLib.System.Particle', name : 'GameLib.System.Particle',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Particle constructor : GameLib.System.Particle,
apiConstructor : GameLib.API.System
}; };
case 0x54 : return { case 0x54 : return {
name : 'GameLib.D3.Particle', name : 'GameLib.D3.Particle',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Particle constructor : GameLib.D3.Particle,
apiConstructor : GameLib.D3.API.Particle
}; };
case 0x55 : return { case 0x55 : return {
name : 'GameLib.D3.Audio', name : 'GameLib.D3.Audio',
runtime : GameLib.Component.GRAPHICS_RUNTIME, runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Audio constructor : GameLib.D3.Audio,
apiConstructor : GameLib.D3.API.Audio
}; };
case 0x56 : return { case 0x56 : return {
name : 'GameLib.System.Audio', name : 'GameLib.System.Audio',
runtime : GameLib.Component.DEFAULT_RUNTIME, runtime : GameLib.Component.DEFAULT_RUNTIME,
constructor : GameLib.System.Audio constructor : GameLib.System.Audio,
apiConstructor : GameLib.API.System
}; };
case 0x57 : return { case 0x57 : return {
name : 'GameLib.Cast', name : 'GameLib.Cast',
runtime : GameLib.Component.SOCKET_RUNTIME, runtime : GameLib.Component.SOCKET_RUNTIME,
constructor : GameLib.Cast constructor : GameLib.Cast,
apiConstructor : GameLib.API.Cast
}; };
break; break;
} }
@ -944,7 +1014,7 @@ GameLib.Component.prototype.clone = function() {
apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')'; apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')';
var runtimeComponent = GameLib.Component.Construct(apiObject); var runtimeComponent = GameLib.Component.ConstructFromObject(apiObject);
runtimeComponent.isClone = true; runtimeComponent.isClone = true;
@ -1088,15 +1158,10 @@ GameLib.Component.prototype.save = function(remote) {
} }
}; };
GameLib.Component.Construct = function(rawComponentObject) { /**
* @return {null|Object}
var runtimeComponent = null; */
GameLib.Component.GetRuntimeObject = function(runtimeInfo) {
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
var componentClass = info.constructor;
var fn = componentClass['FromObject'];
var runtime = null; var runtime = null;
@ -1108,57 +1173,98 @@ GameLib.Component.Construct = function(rawComponentObject) {
} }
); );
if (runtimeInfo === GameLib.Component.GRAPHICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.graphics)) {
console.warn('no runtime graphics');
return null;
}
return runtime.graphics;
} else if (runtimeInfo === GameLib.Component.PHYSICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.physics)) {
console.warn('no runtime physics');
return null;
}
return runtime.physics;
} else if (runtimeInfo === GameLib.Component.GUI_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.gui)) {
console.warn('no runtime gui');
return null;
}
return runtime.gui;
} else if (runtimeInfo === GameLib.Component.SOCKET_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.sockets)) {
console.warn('no runtime sockets');
return null;
}
return runtime.sockets;
} else if (runtimeInfo === GameLib.Component.STATISTICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.statistics)) {
console.warn('no runtime statistics');
return null;
}
return runtime.statistics;
} else if (runtimeInfo === GameLib.Component.DEFAULT_RUNTIME) {
} else {
console.log('unknown runtime object found : ' + info.runtime);
}
return null;
};
GameLib.Component.Construct = function(componentType) {
var info = GameLib.Component.GetComponentInfo(componentType);
var componentClass = info.constructor;
var runtime = GameLib.Component.GetRuntimeObject(info.runtime);
if (runtime) {
return new componentClass(runtime);
} else {
return new componentClass();
}
};
GameLib.Component.ConstructFromObject = function(rawComponentObject) {
var runtimeComponent = null;
var info = GameLib.Component.GetComponentInfo(rawComponentObject.componentType);
var componentClass = info.constructor;
var fn = componentClass['FromObject'];
if (rawComponentObject.componentType === GameLib.Component.ENTITY) { if (rawComponentObject.componentType === GameLib.Component.ENTITY) {
runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance); runtimeComponent = fn(rawComponentObject, GameLib.EntityManager.Instance);
} else if (info.runtime === GameLib.Component.GRAPHICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.graphics)) {
console.warn('no runtime graphics');
}
runtimeComponent = fn(runtime.graphics, rawComponentObject);
} else if (info.runtime === GameLib.Component.PHYSICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.physics)) {
console.warn('no runtime physics');
}
runtimeComponent = fn(runtime.physics, rawComponentObject);
} else if (info.runtime === GameLib.Component.GUI_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.gui)) {
console.warn('no runtime gui');
}
runtimeComponent = fn(runtime.gui, rawComponentObject);
} else if (info.runtime === GameLib.Component.SOCKET_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.sockets)) {
console.warn('no runtime sockets');
}
runtimeComponent = fn(runtime.sockets, rawComponentObject);
} else if (info.runtime === GameLib.Component.STATISTICS_RUNTIME) {
if (GameLib.Utils.UndefinedOrNull(runtime.statistics)) {
console.warn('no runtime statistics');
}
runtimeComponent = fn(runtime.statistics, rawComponentObject);
} else if (info.runtime === GameLib.Component.DEFAULT_RUNTIME) {
runtimeComponent = fn(rawComponentObject);
} else { } else {
console.log('unknown runtime object found : ' + rawComponentObject.name); var runtime = GameLib.Component.GetRuntimeObject(info.runtime);
console.error(rawComponentObject);
if (runtime) {
runtimeComponent = fn(runtime, rawComponentObject);
} else {
runtimeComponent = fn(rawComponentObject);
}
} }
return runtimeComponent; return runtimeComponent;

View File

@ -281,9 +281,45 @@ GameLib.D3.API.Mesh.FromObject = function (objectMesh){
apiModelMatrix = GameLib.API.Matrix4.FromObject(objectMesh.modelMatrix); apiModelMatrix = GameLib.API.Matrix4.FromObject(objectMesh.modelMatrix);
} }
var meshType = GameLib.D3.API.Mesh.MESH_TYPE_NORMAL;
if (objectMesh.meshType === GameLib.D3.API.Mesh.MESH_TYPE_NORMAL ||
objectMesh.meshType === GameLib.D3.API.Mesh.MESH_TYPE_SKINNED
) {
meshType = objectMesh.meshType;
}
if (objectMesh.componentType === GameLib.Component.MESH_PLANE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_PLANE;
}
if (objectMesh.componentType === GameLib.Component.MESH_SPHERE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_SPHERE;
}
if (objectMesh.componentType === GameLib.Component.MESH_CURVE) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_CURVE;
}
if (objectMesh.componentType === GameLib.Component.MESH_BOX) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_BOX;
}
if (objectMesh.componentType === GameLib.Component.MESH_CYLINDER) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER;
}
if (objectMesh.componentType === GameLib.Component.MESH_TEXT) {
meshType = GameLib.D3.API.Mesh.MESH_TYPE_TEXT;
}
if (objectMesh.componentType === GameLib.Component.MESH_TYPE_LINE) {
meshType = GameLib.D3.API.Mesh.MESH_LINE;
}
return new GameLib.D3.API.Mesh( return new GameLib.D3.API.Mesh(
objectMesh.id, objectMesh.id,
objectMesh.meshType, meshType,
objectMesh.name, objectMesh.name,
apiVertices, apiVertices,
apiFaces, apiFaces,

View File

@ -340,7 +340,7 @@ GameLib.System.Storage.prototype.createRuntimeObject = function(responseText, cl
* First, we create an API object from the Object, then a Runtime object from the API object * First, we create an API object from the Object, then a Runtime object from the API object
* Each component has a function 'FromObject' which essentially does this for you * Each component has a function 'FromObject' which essentially does this for you
*/ */
var runtimeComponent = GameLib.Component.Construct(object.component[0]); var runtimeComponent = GameLib.Component.ConstructFromObject(object.component[0]);
if (!runtimeComponent) { if (!runtimeComponent) {
if (clientErrorCallback) { if (clientErrorCallback) {
@ -732,7 +732,7 @@ GameLib.System.Storage.prototype.imageUploadComplete = function(data) {
/** /**
* We are creating a new image * We are creating a new image
*/ */
GameLib.Component.Construct(rawImage); GameLib.Component.ConstructFromObject(rawImage);
} }
}.bind(this)); }.bind(this));
@ -753,7 +753,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
*/ */
data.images.map( data.images.map(
function(rawImageObject) { function(rawImageObject) {
var image = GameLib.Component.Construct(rawImageObject); var image = GameLib.Component.ConstructFromObject(rawImageObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -767,7 +767,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Process all textures * Process all textures
*/ */
data.textures.map(function(rawTextureObject){ data.textures.map(function(rawTextureObject){
var texture = GameLib.Component.Construct(rawTextureObject); var texture = GameLib.Component.ConstructFromObject(rawTextureObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -780,7 +780,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Process all materials * Process all materials
*/ */
data.materials.map(function(rawMaterialObject){ data.materials.map(function(rawMaterialObject){
var material = GameLib.Component.Construct(rawMaterialObject); var material = GameLib.Component.ConstructFromObject(rawMaterialObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {
@ -793,7 +793,7 @@ GameLib.System.Storage.prototype.processBlenderData = function(data) {
* Now process all meshes * Now process all meshes
*/ */
data.meshes.map(function(rawMeshObject){ data.meshes.map(function(rawMeshObject){
var mesh = GameLib.Component.Construct(rawMeshObject); var mesh = GameLib.Component.ConstructFromObject(rawMeshObject);
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.COMPONENT_CREATED, GameLib.Event.COMPONENT_CREATED,
{ {