00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #ifndef BT_SIMPLE_DYNAMICS_WORLD_H 00017 #define BT_SIMPLE_DYNAMICS_WORLD_H 00018 00019 #include "btDynamicsWorld.h" 00020 00021 class btDispatcher; 00022 class btOverlappingPairCache; 00023 class btConstraintSolver; 00024 00027 class btSimpleDynamicsWorld : public btDynamicsWorld 00028 { 00029 protected: 00030 00031 btConstraintSolver* m_constraintSolver; 00032 00033 bool m_ownsConstraintSolver; 00034 00035 void predictUnconstraintMotion(btScalar timeStep); 00036 00037 void integrateTransforms(btScalar timeStep); 00038 00039 btVector3 m_gravity; 00040 00041 public: 00042 00043 00044 00046 btSimpleDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration); 00047 00048 virtual ~btSimpleDynamicsWorld(); 00049 00051 virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.)); 00052 00053 virtual void setGravity(const btVector3& gravity); 00054 00055 virtual btVector3 getGravity () const; 00056 00057 virtual void addRigidBody(btRigidBody* body); 00058 00059 virtual void addRigidBody(btRigidBody* body, short group, short mask); 00060 00061 virtual void removeRigidBody(btRigidBody* body); 00062 00063 virtual void debugDrawWorld(); 00064 00065 virtual void addAction(btActionInterface* action); 00066 00067 virtual void removeAction(btActionInterface* action); 00068 00070 virtual void removeCollisionObject(btCollisionObject* collisionObject); 00071 00072 virtual void updateAabbs(); 00073 00074 virtual void synchronizeMotionStates(); 00075 00076 virtual void setConstraintSolver(btConstraintSolver* solver); 00077 00078 virtual btConstraintSolver* getConstraintSolver(); 00079 00080 virtual btDynamicsWorldType getWorldType() const 00081 { 00082 return BT_SIMPLE_DYNAMICS_WORLD; 00083 } 00084 00085 virtual void clearForces(); 00086 00087 }; 00088 00089 #endif //BT_SIMPLE_DYNAMICS_WORLD_H