28 #ifndef HPL_PHYSICS_WORLD_H 29 #define HPL_PHYSICS_WORLD_H 31 #include "hpl1/engine/graphics/GraphicsTypes.h" 32 #include "hpl1/engine/math/MathTypes.h" 33 #include "hpl1/engine/system/SystemTypes.h" 34 #include "common/stablemap.h" 36 #include "hpl1/engine/physics/CollideData.h" 38 #include "hpl1/engine/game/SaveGame.h" 45 class iLowLevelGraphics;
46 class iPhysicsMaterial;
49 class iPhysicsJointBall;
50 class iPhysicsJointHinge;
51 class iPhysicsJointScrew;
52 class iPhysicsJointSlider;
53 class iPhysicsController;
55 class cBoundingVolume;
78 typedef cSTLMapIterator<iPhysicsMaterial *, tPhysicsMaterialMap, tPhysicsMaterialMapIt> cPhysicsMaterialIterator;
80 typedef cSTLIterator<iPhysicsBody *, tPhysicsBodyList, tPhysicsBodyListIt> cPhysicsBodyIterator;
81 typedef cSTLIterator<iPhysicsJoint *, tPhysicsJointList, tPhysicsJointListIt> cPhysicsJointIterator;
83 enum ePhysicsAccuracy {
85 ePhysicsAccuracy_Medium,
86 ePhysicsAccuracy_High,
87 ePhysicsAccuracy_LastEnum
103 virtual bool BeforeIntersect(
iPhysicsBody *pBody) {
return true; }
125 void Update(
float afTimeStep);
126 virtual void Simulate(
float afTimeStep) = 0;
128 virtual void SetMaxTimeStep(
float afTimeStep) = 0;
129 virtual float GetMaxTimeStep() = 0;
135 virtual void SetGravity(
const cVector3f &avGravity) = 0;
138 virtual void SetAccuracyLevel(ePhysicsAccuracy aAccuracy) = 0;
139 virtual ePhysicsAccuracy GetAccuracyLevel() = 0;
150 virtual iCollideShape *CreateCylinderShape(
float afRadius,
float afHeight,
cMatrixf *apOffsetMtx) = 0;
151 virtual iCollideShape *CreateCapsuleShape(
float afRadius,
float afHeight,
cMatrixf *apOffsetMtx) = 0;
153 virtual iCollideShape *CreateCompundShape(tCollideShapeVec &avShapes) = 0;
177 cPhysicsJointIterator GetJointIterator();
188 cPhysicsMaterialIterator GetMaterialIterator();
200 cPhysicsBodyIterator GetBodyIterator();
206 void GetBodiesInBV(
cBoundingVolume *apBV, tPhysicsBodyList *apBodyList);
216 void SetLogDebug(
bool abX) { mbLogDebug = abX; }
217 bool GetLogDebug() {
return mbLogDebug; }
225 void SetSaveContactPoints(
bool abX) { mbSaveContactPoints = abX; }
226 bool GetSaveContactPoints() {
return mbSaveContactPoints; }
228 const cColor &aLineColor);
232 bool abCalcDist,
bool abCalcNormal,
bool abCalcPoint,
233 bool abUsePrefilter =
false) = 0;
240 bool correctNormalDirection =
false) = 0;
242 bool CheckShapeWorldCollision(
cVector3f *apNewPos,
244 iPhysicsBody *apSkipBody = NULL,
bool abSkipStatic =
false,
245 bool abIsCharacter =
false,
247 bool abCollideCharacter =
true,
248 bool abDebug =
false);
252 cWorld3D *GetWorld3D() {
return mpWorld3D; }
253 void SetWorld3D(
cWorld3D *apWorld3D) { mpWorld3D = apWorld3D; }
257 tCollideShapeList mlstShapes;
258 tPhysicsBodyList mlstBodies;
259 tCharacterBodyList mlstCharBodies;
260 tPhysicsMaterialMap m_mapMaterials;
261 tPhysicsJointList mlstJoints;
262 tPhysicsControllerList mlstControllers;
268 bool mbSaveContactPoints;
273 #endif // HPL_PHYSICS_WORLD_H
Definition: PhysicsWorld.h:92
Definition: VertexBuffer.h:90
Definition: PhysicsWorld.h:100
Definition: PhysicsWorld.h:115
T * iterator
Definition: array.h:54
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: BoundingVolume.h:71
Definition: CollideShape.h:50
Definition: SaveGame.h:214
Definition: PhysicsJointScrew.h:48
Definition: PhysicsBody.h:117
Definition: PhysicsJointHinge.h:47
Definition: World3D.h:179
Definition: CollideData.h:46
ListInternal::Iterator< t_T > iterator
Definition: list.h:52
Definition: PhysicsMaterial.h:77
Definition: PhysicsJointBall.h:48
Definition: CharacterBody.h:153
Definition: PhysicsController.h:122
Definition: PhysicsJointSlider.h:48
Definition: PhysicsJoint.h:135
Definition: PhysicsWorld.h:107
Definition: LowLevelGraphics.h:200