My Project
IParaPhysics.h
1 #pragma once
2 #include "PEtypes.h"
3 
4 namespace ParaEngine
5 {
6  class IParaDebugDraw;
7 
8  enum PhysicsDebugDrawModes
9  {
10  PDDM_NoDebug=0,
11  PDDM_DrawWireframe = 1,
12  PDDM_DrawAabb=2,
13  PDDM_DrawFeaturesText=4,
14  PDDM_DrawContactPoints=8,
15  PDDM_NoDeactivation=16,
16  PDDM_NoHelpText = 32,
17  PDDM_DrawText=64,
18  PDDM_ProfileTimings = 128,
19  PDDM_EnableSatComparison = 256,
20  PDDM_DisableBulletLCP = 512,
21  PDDM_EnableCCD = 1024,
22  PDDM_DrawConstraints = (1 << 11),
23  PDDM_DrawConstraintLimits = (1 << 12),
24  PDDM_FastWireframe = (1<<13),
25  PDDM_MAX_DEBUG_DRAW_MODE
26  };
27 
31  {
32  DWORD m_numVertices;
33  DWORD m_numTriangles;
34  DWORD m_pointStrideBytes;
35  DWORD m_triangleStrideBytes;
36  void* m_points;
37  void* m_triangles;
38  DWORD m_flags;
39  };
40 
43  {
45  virtual void* GetUserData() = 0;
46  virtual void SetUserData(void* pData) = 0;
47 
49  virtual void* get() = 0;
50 
51  virtual void Release() = 0;
52  };
53 
57  {
58  ParaPhysicsActorDesc():m_mass(0.f), m_group(1), m_mask(-1), m_pShape(NULL) {}
61 
64 
66  float m_mass;
67 
69  short m_group;
70 
72  short m_mask;
73 
76  };
77 
80  {
82  virtual void* GetUserData() = 0;
83  virtual void SetUserData(void* pData) = 0;
84 
86  virtual void* get() = 0;
87 
88  virtual void Release() = 0;
89  };
90 
92  {
93  float m_fDistance;
94  PARAVECTOR3 m_vHitPointWorld;
95  PARAVECTOR3 m_vHitNormalWorld;
96  };
97 
101  {
102  public:
104  virtual bool InitPhysics() = 0;
105 
109  virtual bool StepSimulation(float fDeltaTime) = 0;
110 
113  virtual bool ExitPhysics() = 0;
114 
117  virtual void Release() = 0;
118 
122  virtual IParaPhysicsShape* CreateTriangleMeshShap(const ParaPhysicsTriangleMeshDesc& meshDesc) = 0;
123 
125  virtual void ReleaseShape(IParaPhysicsShape *pShape) = 0;
126 
128  virtual IParaPhysicsActor* CreateActor(const ParaPhysicsActorDesc& meshDesc) = 0;
129 
131  virtual void ReleaseActor(IParaPhysicsActor* pActor) = 0;
132 
134  virtual IParaPhysicsActor* RaycastClosestShape(const PARAVECTOR3& vOrigin, const PARAVECTOR3& vDirection, DWORD dwType, RayCastHitResult& hit, short dwGroupMask, float fSensorRange) = 0;
135 
137  virtual void SetDebugDrawer(IParaDebugDraw* debugDrawer) = 0;
138 
140  virtual IParaDebugDraw* GetDebugDrawer() = 0;
141 
143  virtual void DebugDrawObject(const PARAVECTOR3& vOrigin, const PARAMATRIX3x3& vRotation, const IParaPhysicsShape* pShape, const PARAVECTOR3& color) = 0;
144 
146  virtual void DebugDrawWorld() = 0;
147 
149  virtual void SetDebugDrawMode(int debugMode) = 0;
150 
152  virtual int GetDebugDrawMode() = 0;
153  };
154 }
short m_group
group id
Definition: IParaPhysics.h:69
PARAMATRIX3x3 m_rotation
Storage for the rotation.
Definition: IParaPhysics.h:63
Definition: PEtypes.h:327
different physics engine has different winding order.
Definition: EventBinding.h:32
Create descriptor for triangle mesh shape.
Definition: IParaPhysics.h:30
it is represent a shape that can be used to create various actors in the scene.
Definition: IParaPhysics.h:42
PARAVECTOR3 m_origin
Storage for the translation.
Definition: IParaPhysics.h:60
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IParaDebugDraw.h:10
float m_mass
if mass is zero, it is a static mesh.
Definition: IParaPhysics.h:66
Definition: IParaPhysics.h:91
ParaPhysics core interface.
Definition: IParaPhysics.h:100
it is represent a shape that can be used to create various actors in the scene.
Definition: IParaPhysics.h:79
Definition: PEtypes.h:298
short m_mask
collision mask id, -1 to collide with all meshes. specify (-1 ^ m_group) to exclude collision of the ...
Definition: IParaPhysics.h:72
Create descriptor for a physics actor.
Definition: IParaPhysics.h:56
IParaPhysicsShape * m_pShape
the collision shape of the actor. it should be the pointer returned by one of the CreateXXXShape() fu...
Definition: IParaPhysics.h:75