Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

sp::physics::PhysicsSimulator Class Reference

#include <spPhysicsSimulator.hpp>

Inheritance diagram for sp::physics::PhysicsSimulator:
sp::physics::NewtonSimulator sp::physics::PhysXSimulator

List of all members.

Public Member Functions

virtual ~PhysicsSimulator ()
virtual io::stringc getVersion () const =0
 Returns the version of the physics system.
virtual void updateSimulation (const f32 StepTime=1.0f/60.0f)=0
virtual void setGravity (const dim::vector3df &Gravity)
virtual PhysicsMaterialcreateMaterial (f32 StaticFriction=0.5f, f32 DynamicFriction=0.5f, f32 Restitution=0.3f)=0
virtual void deleteMaterial (PhysicsMaterial *Material)
 Deletes the specified physics material.
virtual StaticPhysicsObjectcreateStaticObject (PhysicsMaterial *Material, scene::Mesh *Mesh)=0
virtual void deleteStaticObject (StaticPhysicsObject *Object)
 Deletes the specified static body.
virtual RigidBodycreateRigidBody (PhysicsMaterial *Material, const ERigidBodies Type, scene::SceneNode *RootNode, const SRigidBodyConstruction &Construct=SRigidBodyConstruction())=0
virtual RigidBodycreateRigidBody (PhysicsMaterial *Material, scene::Mesh *Mesh)=0
virtual void deleteRigidBody (RigidBody *Object)
 Delete the specified rigid body but not its root node.
virtual PhysicsJointcreateJoint (const EPhysicsJoints Type, PhysicsBaseObject *Object, const SPhysicsJointConstruct &Construct)=0
 Creates a new physics joint (also called "constraint").
virtual PhysicsJointcreateJoint (const EPhysicsJoints Type, PhysicsBaseObject *ObjectA, PhysicsBaseObject *ObjectB, const SPhysicsJointConstruct &Construct)=0
virtual void deleteJoint (PhysicsJoint *Object)
virtual void clearScene (bool RigidBodies=true, bool StaticObjects=true, bool Joints=true)
virtual void setThreadCount (s32 Count)
 Sets the count of threads used for physics computations.
virtual s32 getThreadCount () const
 Returns the count of threads.
virtual void setSolverModel (s32 Model)
EPhysicsSimulators getType () const
 Returns the type of the simulator.
dim::vector3df getGravity () const
 Returns the global gravity.
std::list< RigidBody * > getRigidBodyList () const
std::list< StaticPhysicsObject * > getStaticBodyList () const
std::list< PhysicsMaterial * > getMaterialList () const
std::list< PhysicsJoint * > getJointList () const

Static Public Member Functions

static void setContactCallback (const PhysicsContactCallback &Callback)
 Sets the contact callback. This callback procedure will be called when a collision contact occured.
static PhysicsContactCallback getContactCallback ()

Protected Member Functions

 PhysicsSimulator (const EPhysicsSimulators Type)

Protected Attributes

EPhysicsSimulators Type_
std::list< RigidBody * > RigidBodyList_
std::list< StaticPhysicsObject * > StaticBodyList_
std::list< PhysicsMaterial * > MaterialList_
std::list< PhysicsJoint * > JointList_
dim::vector3df Gravity_

Static Protected Attributes

static PhysicsContactCallback ContactCallback_

Constructor & Destructor Documentation

virtual sp::physics::PhysicsSimulator::~PhysicsSimulator (  )  [virtual]
sp::physics::PhysicsSimulator::PhysicsSimulator ( const EPhysicsSimulators  Type  )  [protected]

Member Function Documentation

virtual void sp::physics::PhysicsSimulator::clearScene ( bool  RigidBodies = true,
bool  StaticObjects = true,
bool  Joints = true 
) [virtual]

Deletes all physics objects

Parameters:
RigidBodies,: Specifies whether all rigid bodies are to be deleted.
StaticObjects,: Specifies whether all static objects are to be deleted.
Joints,: Specifies whether all joints are to be deleted.
virtual PhysicsJoint* sp::physics::PhysicsSimulator::createJoint ( const EPhysicsJoints  Type,
PhysicsBaseObject Object,
const SPhysicsJointConstruct Construct 
) [pure virtual]

Creates a new physics joint (also called "constraint").

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

virtual PhysicsJoint* sp::physics::PhysicsSimulator::createJoint ( const EPhysicsJoints  Type,
PhysicsBaseObject ObjectA,
PhysicsBaseObject ObjectB,
const SPhysicsJointConstruct Construct 
) [pure virtual]

Adds a new joint connected child body to this rigid body.

Parameters:
Child,: Specifies the child rigid body which is to be added with a joint. If this parameter is 0 this rigid body is the child and will be appended to the physics world.
Type,: Specifies the type of the joint. E.g. when you want to have a physics door use the JOINT_HINGE type.
PivotPoint,: Specifies the global point where the joint is to be set.
Returns:
Pointer to the new BodyJoint object.

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

virtual PhysicsMaterial* sp::physics::PhysicsSimulator::createMaterial ( f32  StaticFriction = 0.5f,
f32  DynamicFriction = 0.5f,
f32  Restitution = 0.3f 
) [pure virtual]
virtual RigidBody* sp::physics::PhysicsSimulator::createRigidBody ( PhysicsMaterial Material,
scene::Mesh Mesh 
) [pure virtual]

Creates a new mesh physics rigid body. If you only want to use the mesh as the physics geometry you can change the root node by calling RigidBody::setRootNode".

Parameters:
Material,: Specifies the physics material which is to be used for the rigid body.
MeshGeom,: Specifies the root mesh node.
Note:
Don't use to large mesh geometries for rigid bodies. This kind of physics simulation is very time consuming!

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

virtual RigidBody* sp::physics::PhysicsSimulator::createRigidBody ( PhysicsMaterial Material,
const ERigidBodies  Type,
scene::SceneNode RootNode,
const SRigidBodyConstruction Construct = SRigidBodyConstruction() 
) [pure virtual]

Creates a new physics rigid body. This is an interactive physics object.

Parameters:
Material,: Specifies the physics material which is to be used for the rigid body.
RootNode,: Specifies the root scene node which is to be manipulated in its location and orientation.
Type,: Specifies the type of the body.
Construct,: Specifies the construction of the body. E.g. size, radius and/or height.

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

virtual StaticPhysicsObject* sp::physics::PhysicsSimulator::createStaticObject ( PhysicsMaterial Material,
scene::Mesh Mesh 
) [pure virtual]

Creates a new physics static body. This is a none interactive environment object. Those objects represents the physics world.

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

virtual void sp::physics::PhysicsSimulator::deleteJoint ( PhysicsJoint Object  )  [virtual]
virtual void sp::physics::PhysicsSimulator::deleteMaterial ( PhysicsMaterial Material  )  [virtual]

Deletes the specified physics material.

virtual void sp::physics::PhysicsSimulator::deleteRigidBody ( RigidBody Object  )  [virtual]

Delete the specified rigid body but not its root node.

virtual void sp::physics::PhysicsSimulator::deleteStaticObject ( StaticPhysicsObject Object  )  [virtual]

Deletes the specified static body.

static PhysicsContactCallback sp::physics::PhysicsSimulator::getContactCallback (  )  [static]
dim::vector3df sp::physics::PhysicsSimulator::getGravity (  )  const [inline]

Returns the global gravity.

std::list<PhysicsJoint*> sp::physics::PhysicsSimulator::getJointList (  )  const [inline]
std::list<PhysicsMaterial*> sp::physics::PhysicsSimulator::getMaterialList (  )  const [inline]
std::list<RigidBody*> sp::physics::PhysicsSimulator::getRigidBodyList (  )  const [inline]
std::list<StaticPhysicsObject*> sp::physics::PhysicsSimulator::getStaticBodyList (  )  const [inline]
virtual s32 sp::physics::PhysicsSimulator::getThreadCount (  )  const [virtual]

Returns the count of threads.

Reimplemented in sp::physics::NewtonSimulator.

EPhysicsSimulators sp::physics::PhysicsSimulator::getType (  )  const [inline]

Returns the type of the simulator.

virtual io::stringc sp::physics::PhysicsSimulator::getVersion (  )  const [pure virtual]

Returns the version of the physics system.

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.

static void sp::physics::PhysicsSimulator::setContactCallback ( const PhysicsContactCallback Callback  )  [static]

Sets the contact callback. This callback procedure will be called when a collision contact occured.

Reimplemented in sp::physics::NewtonSimulator.

virtual void sp::physics::PhysicsSimulator::setGravity ( const dim::vector3df Gravity  )  [virtual]

Sets the gravity for each object. You can also set the gravity individually for each rigid body.

Parameters:
Gravity,: Specifies the gravity vector which is to be set. By default (0 | -9.81 | 0).

Reimplemented in sp::physics::NewtonSimulator.

virtual void sp::physics::PhysicsSimulator::setSolverModel ( s32  Model  )  [virtual]

Sets the solver model. Use higher values if speed is more important than accuracy.

Parameters:
Model,: If 0 the accuracy is exact. If greater than 0 you can configure the accuracy if speed is more important.

Reimplemented in sp::physics::NewtonSimulator.

virtual void sp::physics::PhysicsSimulator::setThreadCount ( s32  Count  )  [virtual]

Sets the count of threads used for physics computations.

Reimplemented in sp::physics::NewtonSimulator.

virtual void sp::physics::PhysicsSimulator::updateSimulation ( const f32  StepTime = 1.0f/60.0f  )  [pure virtual]

Updates the whole simulation. Call this in each frame of your game loop.

Parameters:
StepTime,: Specifies the speed of simulation for the current frame.

Implemented in sp::physics::NewtonSimulator, and sp::physics::PhysXSimulator.


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines