btWorld.h
Engine/source/T3D/physics/bullet/btWorld.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _BTWORLD_H_ 25#define _BTWORLD_H_ 26 27#ifndef _T3D_PHYSICS_PHYSICSWORLD_H_ 28#include "T3D/physics/physicsWorld.h" 29#endif 30#ifndef _T3D_PHYSICS_BTDEBUGDRAW_H_ 31#include "T3D/physics/bullet/btDebugDraw.h" 32#endif 33#ifndef _BULLET_H_ 34#include "T3D/physics/bullet/bt.h" 35#endif 36#ifndef _TVECTOR_H_ 37#include "core/util/tVector.h" 38#endif 39 40class ProcessList; 41class btThreadSupportInterface; 42class PhysicsBody; 43 44 45class BtWorld : public PhysicsWorld 46{ 47protected: 48 49 BtDebugDraw mDebugDraw; 50 51 F32 mEditorTimeScale; 52 53 btDynamicsWorld *mDynamicsWorld; 54 btBroadphaseInterface *mBroadphase; 55 btCollisionDispatcher *mDispatcher; 56 btConstraintSolver *mSolver; 57 btDefaultCollisionConfiguration *mCollisionConfiguration; 58 btThreadSupportInterface *mThreadSupportCollision; 59 60 bool mErrorReport; 61 62 bool mIsEnabled; 63 64 bool mIsSimulating; 65 66 U32 mTickCount; 67 68 ProcessList *mProcessList; 69 70 void _destroy(); 71 72public: 73 74 BtWorld(); 75 virtual ~BtWorld(); 76 77 // PhysicWorld 78 virtual bool initWorld( bool isServer, ProcessList *processList ); 79 virtual void destroyWorld(); 80 virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); 81 virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes ); 82 virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); 83 virtual void onDebugDraw( const SceneRenderState *state ); 84 virtual void reset(); 85 virtual bool isEnabled() const { return mIsEnabled; } 86 87 btDynamicsWorld* getDynamicsWorld() const { return mDynamicsWorld; } 88 89 void tickPhysics( U32 elapsedMs ); 90 void getPhysicsResults(); 91 bool isWritable() const { return !mIsSimulating; } 92 93 void setEnabled( bool enabled ); 94 bool getEnabled() const { return mIsEnabled; } 95 96 void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } 97 const F32 getEditorTimeScale() const { return mEditorTimeScale; } 98 99}; 100 101#endif // _BTWORLD_H_ 102
