Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_PHYSICS_PHYSX_SIMULATOR_H__
00009 #define __SP_PHYSICS_PHYSX_SIMULATOR_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_PHYSX
00015
00016
00017 #include "Base/spDimension.hpp"
00018 #include "Framework/Physics/PhysX/spPhysXCoreHeader.hpp"
00019 #include "Framework/Physics/spPhysicsSimulator.hpp"
00020
00021
00022 namespace sp
00023 {
00024 namespace physics
00025 {
00026
00027
00028 class SP_EXPORT PhysXSimulator : public PhysicsSimulator
00029 {
00030
00031 public:
00032
00033 PhysXSimulator();
00034 virtual ~PhysXSimulator();
00035
00036 virtual io::stringc getVersion() const;
00037
00038 virtual void updateSimulation(const f32 StepTime = 1.0f / 60.0f);
00039
00040 virtual PhysicsMaterial* createMaterial(
00041 f32 StaticFriction = 0.5f, f32 DynamicFriction = 0.5f, f32 Restitution = 0.3f
00042 );
00043
00044 virtual StaticPhysicsObject* createStaticObject(PhysicsMaterial* Material, scene::Mesh* MeshGeom);
00045
00046 virtual RigidBody* createRigidBody(
00047 PhysicsMaterial* Material, const ERigidBodies Type, scene::SceneNode* RootNode,
00048 const SRigidBodyConstruction &Construct = SRigidBodyConstruction()
00049 );
00050 virtual RigidBody* createRigidBody(PhysicsMaterial* Material, scene::Mesh* Mesh);
00051
00052 virtual PhysicsJoint* createJoint(
00053 const EPhysicsJoints Type, PhysicsBaseObject* Object, const SPhysicsJointConstruct &Construct
00054 );
00055 virtual PhysicsJoint* createJoint(
00056 const EPhysicsJoints Type, PhysicsBaseObject* ObjectA, PhysicsBaseObject* ObjectB, const SPhysicsJointConstruct &Construct
00057 );
00058
00059 protected:
00060
00061
00062
00063 PxScene* createScene();
00064
00065
00066
00067 template <typename T> inline void releaseObject(T* &Object)
00068 {
00069 if (Object)
00070 {
00071 Object->release();
00072 Object = 0;
00073 }
00074 }
00075
00076 inline PxVec3 convert(const dim::vector3df &Vec) const
00077 {
00078 return PxVec3(Vec.X, Vec.Y, Vec.Z);
00079 }
00080
00081 static scene::Transformation convert(const PxTransform &Transform);
00082
00083
00084
00085 PxPhysics* PxDevice_;
00086 PxFoundation* PxFoundation_;
00087 PxProfileZoneManager* PxProfile_;
00088 PxCooking* PxCooking_;
00089
00090 #ifdef SP_DEBUGMODE
00091 PVD::PvdConnection* PxDebuggerConnection_;
00092 #endif
00093
00094 PxScene* PxScene_;
00095
00096 };
00097
00098
00099 }
00100
00101 }
00102
00103
00104 #endif
00105
00106 #endif
00107
00108
00109
00110