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

sp::physics::NewtonSimulator Class Reference

Third party library extension: "Newton Game Dynamics" (v.2.0) physics simulation engine. More...

#include <spNewtonSimulator.hpp>

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

List of all members.

Public Member Functions

 NewtonSimulator ()
virtual ~NewtonSimulator ()
virtual io::stringc getVersion () const
 Returns the version of the physics system.
virtual void updateSimulation (const f32 StepTime=1.0f/60.0f)
virtual void setGravity (const dim::vector3df &Gravity)
virtual PhysicsMaterialcreateMaterial (f32 StaticFriction=0.5f, f32 DynamicFriction=0.5f, f32 Restitution=1.0f)
virtual StaticPhysicsObjectcreateStaticObject (PhysicsMaterial *Material, scene::Mesh *MeshGeom)
virtual RigidBodycreateRigidBody (PhysicsMaterial *Material, const ERigidBodies Type, scene::SceneNode *RootNode, const SRigidBodyConstruction &Construct=SRigidBodyConstruction())
virtual RigidBodycreateRigidBody (PhysicsMaterial *Material, scene::Mesh *Mesh)
virtual PhysicsJointcreateJoint (const EPhysicsJoints Type, PhysicsBaseObject *Object, const SPhysicsJointConstruct &Construct)
 Creates a new physics joint (also called "constraint").
virtual PhysicsJointcreateJoint (const EPhysicsJoints Type, PhysicsBaseObject *ObjectA, PhysicsBaseObject *ObjectB, const SPhysicsJointConstruct &Construct)
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)

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 NewtonWorld * getNewtonWorld ()
 Returns a pointer to the current NewtonWorld opject.

Protected Member Functions

virtual RigidBodyallocRigidBody (const ERigidBodies Type, const SRigidBodyConstruction &Construct)
virtual RigidBodyallocRigidBody (scene::Mesh *MeshGeom)

Static Protected Attributes

static NewtonWorld * NtWorld_

Detailed Description

Third party library extension: "Newton Game Dynamics" (v.2.0) physics simulation engine.


Constructor & Destructor Documentation

sp::physics::NewtonSimulator::NewtonSimulator (  ) 
virtual sp::physics::NewtonSimulator::~NewtonSimulator (  )  [virtual]

Member Function Documentation

virtual RigidBody* sp::physics::NewtonSimulator::allocRigidBody ( const ERigidBodies  Type,
const SRigidBodyConstruction Construct 
) [protected, virtual]
virtual RigidBody* sp::physics::NewtonSimulator::allocRigidBody ( scene::Mesh MeshGeom  )  [protected, virtual]
virtual PhysicsJoint* sp::physics::NewtonSimulator::createJoint ( const EPhysicsJoints  Type,
PhysicsBaseObject ObjectA,
PhysicsBaseObject ObjectB,
const SPhysicsJointConstruct Construct 
) [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.

Implements sp::physics::PhysicsSimulator.

virtual PhysicsJoint* sp::physics::NewtonSimulator::createJoint ( const EPhysicsJoints  Type,
PhysicsBaseObject Object,
const SPhysicsJointConstruct Construct 
) [virtual]

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

Implements sp::physics::PhysicsSimulator.

virtual PhysicsMaterial* sp::physics::NewtonSimulator::createMaterial ( f32  StaticFriction = 0.5f,
f32  DynamicFriction = 0.5f,
f32  Restitution = 1.0f 
) [virtual]
virtual RigidBody* sp::physics::NewtonSimulator::createRigidBody ( PhysicsMaterial Material,
scene::Mesh Mesh 
) [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!

Implements sp::physics::PhysicsSimulator.

virtual RigidBody* sp::physics::NewtonSimulator::createRigidBody ( PhysicsMaterial Material,
const ERigidBodies  Type,
scene::SceneNode RootNode,
const SRigidBodyConstruction Construct = SRigidBodyConstruction() 
) [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.

Implements sp::physics::PhysicsSimulator.

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

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

Implements sp::physics::PhysicsSimulator.

static NewtonWorld* sp::physics::NewtonSimulator::getNewtonWorld (  )  [static]

Returns a pointer to the current NewtonWorld opject.

virtual s32 sp::physics::NewtonSimulator::getThreadCount (  )  const [virtual]

Returns the count of threads.

Reimplemented from sp::physics::PhysicsSimulator.

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

Returns the version of the physics system.

Implements sp::physics::PhysicsSimulator.

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

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

Reimplemented from sp::physics::PhysicsSimulator.

virtual void sp::physics::NewtonSimulator::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 from sp::physics::PhysicsSimulator.

virtual void sp::physics::NewtonSimulator::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 from sp::physics::PhysicsSimulator.

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

Sets the count of threads used for physics computations.

Reimplemented from sp::physics::PhysicsSimulator.

virtual void sp::physics::NewtonSimulator::updateSimulation ( const f32  StepTime = 1.0f/60.0f  )  [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.

Implements sp::physics::PhysicsSimulator.


Member Data Documentation

NewtonWorld* sp::physics::NewtonSimulator::NtWorld_ [static, protected]

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