Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_PHYSICS_NEWTON_SIMULATOR_H__
00009 #define __SP_PHYSICS_NEWTON_SIMULATOR_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_NEWTON
00015
00016
00017 #include "Base/spDimension.hpp"
00018 #include "Framework/Physics/spPhysicsSimulator.hpp"
00019
00020 #include <boost/function.hpp>
00021
00022
00023 struct NewtonWorld;
00024
00025 namespace sp
00026 {
00027 namespace physics
00028 {
00029
00030
00032 class SP_EXPORT NewtonSimulator : public PhysicsSimulator
00033 {
00034
00035 public:
00036
00037 NewtonSimulator();
00038 virtual ~NewtonSimulator();
00039
00040 virtual io::stringc getVersion() const;
00041
00042 virtual void updateSimulation(const f32 StepTime = 1.0f / 60.0f);
00043 virtual void setGravity(const dim::vector3df &Gravity);
00044
00045 virtual PhysicsMaterial* createMaterial(
00046 f32 StaticFriction = 0.5f, f32 DynamicFriction = 0.5f, f32 Restitution = 1.0f
00047 );
00048
00049 virtual StaticPhysicsObject* createStaticObject(PhysicsMaterial* Material, scene::Mesh* MeshGeom);
00050
00051 virtual RigidBody* createRigidBody(
00052 PhysicsMaterial* Material, const ERigidBodies Type, scene::SceneNode* RootNode,
00053 const SRigidBodyConstruction &Construct = SRigidBodyConstruction()
00054 );
00055 virtual RigidBody* createRigidBody(PhysicsMaterial* Material, scene::Mesh* Mesh);
00056
00057 virtual PhysicsJoint* createJoint(
00058 const EPhysicsJoints Type, PhysicsBaseObject* Object, const SPhysicsJointConstruct &Construct
00059 );
00060 virtual PhysicsJoint* createJoint(
00061 const EPhysicsJoints Type, PhysicsBaseObject* ObjectA, PhysicsBaseObject* ObjectB, const SPhysicsJointConstruct &Construct
00062 );
00063
00064 virtual void setThreadCount(s32 Count);
00065 virtual s32 getThreadCount() const;
00066
00067 virtual void setSolverModel(s32 Model);
00068
00069 static void setContactCallback(const PhysicsContactCallback &Callback);
00070
00072 static NewtonWorld* getNewtonWorld();
00073
00074 protected:
00075
00076
00077
00078 virtual RigidBody* allocRigidBody(const ERigidBodies Type, const SRigidBodyConstruction &Construct);
00079 virtual RigidBody* allocRigidBody(scene::Mesh* MeshGeom);
00080
00081
00082
00083 static NewtonWorld* NtWorld_;
00084
00085 };
00086
00087
00088 }
00089
00090 }
00091
00092
00093 #endif
00094
00095 #endif
00096
00097
00098
00099