Back to index

supertuxkart  0.5+dfsg1
btDynamicsWorld.h
Go to the documentation of this file.
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_DYNAMICS_WORLD_H
00017 #define BT_DYNAMICS_WORLD_H
00018 
00019 #include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
00020 class btTypedConstraint;
00021 class btRaycastVehicle;
00022 class btConstraintSolver;
00023 
00024 class btDynamicsWorld;
00026 typedef void (*btInternalTickCallback)(const btDynamicsWorld *world, btScalar timeStep);
00027 
00028 enum btDynamicsWorldType
00029 {
00030        BT_SIMPLE_DYNAMICS_WORLD=1,
00031        BT_DISCRETE_DYNAMICS_WORLD=2,
00032        BT_CONTINUOUS_DYNAMICS_WORLD=3
00033 };
00034 
00036 class btDynamicsWorld : public btCollisionWorld
00037 {
00038        public:
00039               
00040 
00041               btDynamicsWorld(btDispatcher* dispatcher,btBroadphaseInterface* broadphase,btCollisionConfiguration* collisionConfiguration)
00042               :btCollisionWorld(dispatcher,broadphase,collisionConfiguration), m_internalTickCallback(0)
00043               {
00044               }
00045 
00046               virtual ~btDynamicsWorld()
00047               {
00048               }
00049               
00052               virtual int          stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.))=0;
00053                      
00054               virtual void  debugDrawWorld() = 0;
00055                             
00056               virtual void  addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false) { (void)constraint;};
00057 
00058               virtual void  removeConstraint(btTypedConstraint* constraint) {(void)constraint;};
00059 
00060               virtual void  addVehicle(btRaycastVehicle* vehicle) {(void)vehicle;};
00061 
00062               virtual void  removeVehicle(btRaycastVehicle* vehicle) {(void)vehicle;};
00063 
00064               //once a rigidbody is added to the dynamics world, it will get this gravity assigned
00065               //existing rigidbodies in the world get gravity assigned too, during this method
00066               virtual void  setGravity(const btVector3& gravity) = 0;
00067               virtual btVector3 getGravity () const = 0;
00068 
00069               virtual void  addRigidBody(btRigidBody* body) = 0;
00070 
00071               virtual void  removeRigidBody(btRigidBody* body) = 0;
00072 
00073               virtual void  setConstraintSolver(btConstraintSolver* solver) = 0;
00074 
00075               virtual btConstraintSolver* getConstraintSolver() = 0;
00076               
00077               virtual       int           getNumConstraints() const { return 0;            }
00078               
00079               virtual btTypedConstraint* getConstraint(int index)            {      (void)index;         return 0;            }
00080               
00081               virtual const btTypedConstraint* getConstraint(int index) const       {      (void)index;  return 0;     }
00082 
00083               virtual btDynamicsWorldType getWorldType() const=0;
00084 
00085               virtual void  clearForces() = 0;
00086 
00088               void setInternalTickCallback(btInternalTickCallback cb) { m_internalTickCallback = cb; }
00089               
00090               btInternalTickCallback m_internalTickCallback;
00091 
00092 
00093 };
00094 
00095 #endif //BT_DYNAMICS_WORLD_H
00096 
00097