physics into GameLib.D3
parent
bc8e04638b
commit
1ea82f3aee
126
game-lib.js
126
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
|
||||
|
|
77
physics.js
77
physics.js
|
@ -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) {
|
||||
|
||||
};
|
Loading…
Reference in New Issue