diff --git a/game-lib.js b/game-lib.js index 11c3af1..414a4f1 100644 --- a/game-lib.js +++ b/game-lib.js @@ -1095,6 +1095,132 @@ GameLib.D3.Bone = function( this.rawData = null;//rawData; }; +GameLib.D3.Physics = function() {}; + +/** + * Physics Engine Superset + * @param id + * @param name + * @param engineType + * @param engine + * @constructor + */ +GameLib.D3.Physics.Engine = function( + id, + name, + engineType, + engine +) { + this.id = id; + this.name = name; + this.engineType = engineType; + this.engine = engine; +}; + +/** + * Physics Engine Types + * @type {number} + */ +GameLib.D3.Physics.Engine.TYPE_CANNON = 0x1; +GameLib.D3.Physics.Engine.TYPE_AMMO = 0x2; +GameLib.D3.Physics.Engine.TYPE_GOBLIN = 0x3; + +/** + * Physics World Superset + * @param id + * @param name + * @param gravity + * @param rigidBodies GameLib.D3.Physics.RigidBody[] + * @param engine GameLib.D3.Physics.Engine + * @constructor + */ +GameLib.D3.Physics.World = function( + id, + name, + engine, + gravity, + rigidBodies +) { + this.id = id; + + this.name = name; + + this.engine = engine; + + if (typeof gravity == 'undefined'){ + gravity = 9.8; + } + this.gravity = gravity; + + if (typeof rigidBodies == 'undefined'){ + rigidBodies = []; + } + this.rigidBodies = rigidBodies; +}; + +/** + * Physics Rigid Body Superset + * @param id + * @param name + * @param position + * @param rotation + * @param scale + * @param shapes GameLib.D3.Physics.Shape[] + * @constructor + */ +GameLib.D3.Physics.RigidBody = function( + id, + name, + position, + rotation, + scale, + shapes +) { + this.position = new this.Vector3(0,0,0); +}; + +/** + * Physics Rigid Body Vehicle Superset + * @constructor + */ +GameLib.D3.Physics.RigidBody.Vehicle = function() { + +}; + +/** + * Physics Shape Superset + * @constructor + */ +GameLib.D3.Physics.Shape = function() {}; + +/** + * Physics Convex Hull Shape Superset + * @param id + * @param name + * @constructor + */ +GameLib.D3.Physics.Shape.ConvexHull = function( + id, + name +) { + this.id = id; + this.name = name; +}; + +/** + * Physics Triangle Mesh Shape Superset + * @param id + * @param name + * @constructor + */ +GameLib.D3.Physics.Shape.TriangleMesh = function( + id, + name +) { + this.id = id; + this.name = name; +}; + /** * TriangleFace * @param v0 diff --git a/physics.js b/physics.js deleted file mode 100644 index aa484dc..0000000 --- a/physics.js +++ /dev/null @@ -1,77 +0,0 @@ -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