diff --git a/game.js b/game.js new file mode 100644 index 0000000..0b724be --- /dev/null +++ b/game.js @@ -0,0 +1,24 @@ +function Game() {} + +/** + * Games are collections of scenes and physics worlds + * @param id + * @param name + * @param path + * @param scenes THREE.Scene[] + * @param worlds GameLib.D3.Physics.World[] + * @constructor + */ +Game = function( + id, + name, + path, + scenes, + worlds +) { + this.id = id; + this.name = name; + this.path = path; + this.scenes = scenes; + this.worlds = worlds; +}; \ No newline at end of file diff --git a/physics.js b/physics.js new file mode 100644 index 0000000..aa484dc --- /dev/null +++ b/physics.js @@ -0,0 +1,77 @@ +function Physics( + GameLib.D3 +) { + this.GameLib.D3 = GameLib.D3; +} + +Physics.GameLib.D3.Physics = function( + id, + name, + world, + rigidBodies, + physicsEngineType, + physics +) { + this.physics = physics; +}; + +Physics.GameLib.D3.Physics.TYPE_CANNON = 0x1; +Physics.GameLib.D3.Physics.TYPE_AMMO = 0x2; +Physics.GameLib.D3.Physics.TYPE_GOBLIN = 0x3; + +Physics.GameLib.D3.Physics.World = function( + id, + name, + gravity +) { + this.id = id; + + this.name = name; + + if (typeof gravity == 'undefined'){ + gravity = 9.8; + } + this.gravity = gravity; + +}; + +Physics.GameLib.D3.Physics.RigidVehicle = function() { + +}; + +Physics.GameLib.D3.Physics.RigidBody = function( + id, + name, + position, + rotation, + scale, + shapes +) { + this.position = new this.Vector3(0,0,0); +}; + +Physics.GameLib.D3.Physics.Shape = function() {}; + +Physics.GameLib.D3.Physics.Shape.ConvexHull = function( + id, + name +) { + this.id = id; + this.name = name; +}; + +Physics.GameLib.D3.Physics.Shape.TriangleMesh = function( + id, + name +) { + this.id = id; + this.name = name; +}; + + +/** + * @var shape Physics.GameLib.D3.Physics.Shape.TriangleMesh + */ +Physics.GameLib.D3.Physics.Shape.TriangleMesh.prototype.generateViewMesh = function(normalLength, scale) { + +}; \ No newline at end of file