28 #ifndef HPL_PHYSICS_JOINT_H 29 #define HPL_PHYSICS_JOINT_H 31 #include "hpl1/engine/math/MathTypes.h" 32 #include "hpl1/engine/system/SystemTypes.h" 33 #include "common/stablemap.h" 35 #include "hpl1/engine/game/SaveGame.h" 37 #include "hpl1/engine/physics/PhysicsController.h" 45 class iPhysicsController;
50 typedef cSTLMapIterator<iPhysicsController *, tPhysicsControllerMap, tPhysicsControllerMapIt> cPhysicsControllerIterator;
54 enum ePhysicsJointType {
55 ePhysicsJointType_Ball,
56 ePhysicsJointType_Hinge,
57 ePhysicsJointType_Slider,
58 ePhysicsJointType_Screw,
59 ePhysicsJointType_LastEnum
64 enum ePhysicsJointSpeed {
65 ePhysicsJointSpeed_Linear,
66 ePhysicsJointSpeed_Angular,
67 ePhysicsJointSpeed_LastEnum
88 virtual bool IsScript() {
return false; }
112 float mfMinMoveSpeed;
114 float mfMinMoveFreqSpeed;
115 float mfMinMoveVolume;
117 float mfMaxMoveFreqSpeed;
118 float mfMaxMoveVolume;
119 float mfMiddleMoveSpeed;
120 float mfMiddleMoveVolume;
130 bool mbAutoDeleteCallback;
143 const tString &GetName() {
return msName; }
150 cVector3f GetPivotPoint() {
return mvPivotPoint; }
151 cVector3f GetPinDir() {
return mvPinDir; }
153 virtual ePhysicsJointType GetType() = 0;
155 virtual void SetCollideBodies(
bool abX) = 0;
156 virtual bool GetCollideBodies() = 0;
158 virtual void SetStiffness(
float afX) = 0;
159 virtual float GetStiffness() = 0;
162 virtual cVector3f GetAngularVelocity() = 0;
165 virtual float GetDistance() = 0;
166 virtual float GetAngle() = 0;
171 void SetMoveSound(
tString &asName) { msMoveSound = asName; }
173 void SetMoveSpeedType(ePhysicsJointSpeed aType) { mMoveSpeedType = aType; }
174 void SetMinMoveSpeed(
float afX) { mfMinMoveSpeed = afX; }
175 void SetMinMoveFreq(
float afX) { mfMinMoveFreq = afX; }
176 void SetMinMoveFreqSpeed(
float afX) { mfMinMoveFreqSpeed = afX; }
177 void SetMinMoveVolume(
float afX) { mfMinMoveVolume = afX; }
178 void SetMaxMoveFreq(
float afX) { mfMaxMoveFreq = afX; }
179 void SetMaxMoveVolume(
float afX) { mfMaxMoveVolume = afX; }
180 void SetMaxMoveFreqSpeed(
float afX) { mfMaxMoveFreqSpeed = afX; }
181 void SetMiddleMoveSpeed(
float afX) { mfMiddleMoveSpeed = afX; }
182 void SetMiddleMoveVolume(
float afX) { mfMiddleMoveVolume = afX; }
185 mpCallback = apCallback;
186 mbAutoDeleteCallback = abAutoDelete;
191 bool CheckBreakage();
193 void SetBreakable(
bool abX) { mbBreakable = abX; }
194 bool IsBreakable() {
return mbBreakable; }
195 void SetBreakForce(
float afForce) { mfBreakForce = afForce; }
196 float GetBreakForce() {
return mfBreakForce; }
197 void SetBreakSound(
const tString &asSound) { msBreakSound = asSound; }
199 void SetLimitAutoSleep(
bool abX) { mbLimitAutoSleep = abX; }
200 void SetLimitAutoSleepDist(
float afX) { mfLimitAutoSleepDist = afX; }
201 void SetLimitAutoSleepNumSteps(
int alX) { mlLimitAutoSleepNumSteps = alX; }
203 bool GetLimitAutoSleep() {
return mbLimitAutoSleep; }
204 float GetLimitAutoSleepDist() {
return mfLimitAutoSleepDist; }
205 int GetLimitAutoSleepNumSteps() {
return mlLimitAutoSleepNumSteps; }
207 void SetStickyMinDistance(
float afX) { mfStickyMinDistance = afX; }
208 void SetStickyMaxDistance(
float afX) { mfStickyMaxDistance = afX; }
209 float GetStickyMinDistance() {
return mfStickyMinDistance; }
210 float GetStickyMaxDistance() {
return mfStickyMaxDistance; }
214 bool IsBroken() {
return mbBroken; }
216 void SetUserData(
void *apUserData) { mpUserData = apUserData; }
220 bool ChangeController(
const tString &asName);
221 cPhysicsControllerIterator GetControllerIterator();
223 void SetAllControllersPaused(
bool abX);
225 void OnPhysicsUpdate();
227 void SetSound(
cSoundEntity *apSound) { mpSound = apSound; }
232 virtual void SaveToSaveData(
iSaveData *apSaveData);
233 virtual void LoadFromSaveData(
iSaveData *apSaveData);
252 float mfStickyMinDistance;
253 float mfStickyMaxDistance;
255 tPhysicsControllerMap m_mapControllers;
267 float mfMinMoveSpeed;
269 float mfMinMoveFreqSpeed;
270 float mfMinMoveVolume;
272 float mfMaxMoveFreqSpeed;
273 float mfMaxMoveVolume;
274 float mfMiddleMoveSpeed;
275 float mfMiddleMoveVolume;
276 ePhysicsJointSpeed mMoveSpeedType;
283 bool mbLimitAutoSleep;
284 float mfLimitAutoSleepDist;
285 int mlLimitAutoSleepNumSteps;
291 bool mbAutoDeleteCallback;
293 int mlLimitStepCount;
297 static void CheckLimitAutoSleep(
iPhysicsJoint *apJoint,
const float afMin,
const float afMax,
304 void CalcSoundFreq(
float afSpeed,
float *apFreq,
float *apVol);
311 #endif // HPL_PHYSICS_JOINT_H
Definition: PhysicsJoint.h:80
Definition: PhysicsWorld.h:115
Definition: PhysicsJoint.h:72
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: SerializeClass.h:230
Definition: SaveGame.h:130
Definition: PhysicsBody.h:117
Definition: SaveGame.h:111
Definition: Container.h:219
Definition: PhysicsController.h:122
Definition: SoundEntity.h:86
Definition: PhysicsJoint.h:135
Definition: SaveGame.h:183