00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _OGREBULLETDYNAMICS_DynamicWorld_H
00032 #define _OGREBULLETDYNAMICS_DynamicWorld_H
00033
00034 #include "OgreBulletDynamicsPreRequisites.h"
00035
00036 #include "OgreBulletCollisionsWorld.h"
00037 #include "Debug/OgreBulletCollisionsDebugDrawer.h"
00038
00039 namespace OgreBulletDynamics
00040 {
00041
00042
00043 class DynamicsWorld : public OgreBulletCollisions::CollisionsWorld
00044 {
00045 public:
00046 DynamicsWorld(Ogre::SceneManager *mgr,
00047 const Ogre::AxisAlignedBox &bounds,
00048 const Ogre::Vector3 &gravity,
00049 bool init = true, bool set32BitAxisSweep = true, unsigned int maxHandles = 1500000);
00050
00051 ~DynamicsWorld();
00052
00053 template <class BTDNYWORLDCLASS>
00054 void createBtDynamicsWorld(BTDNYWORLDCLASS *&createdWorld)
00055 {
00056 createdWorld = new BTDNYWORLDCLASS(mDispatcher, mBroadphase, mConstraintsolver, &mDefaultCollisionConfiguration);
00057 mWorld = createdWorld;
00058 }
00059
00060 void stepSimulation(const Ogre::Real elapsedTime, int maxSubSteps = 1, const Ogre::Real fixedTimestep = 1./60.);
00061
00062 void addRigidBody (RigidBody *rb, short collisionGroup, short collisionMask);
00063
00064
00065 inline btDynamicsWorld * getBulletDynamicsWorld() const {return static_cast<btDynamicsWorld *> (mWorld);};
00066
00067 void removeConstraint(TypedConstraint *constraint);
00068 void addConstraint(TypedConstraint *constraint);
00069 bool isConstraintRegistered(TypedConstraint *constraint) const;
00070
00071 void addVehicle(RaycastVehicle *v);
00072
00073 private:
00074 btConstraintSolver *mConstraintsolver;
00075
00076 std::deque <TypedConstraint *> mConstraints;
00077 std::deque <ActionInterface *> mActionInterface;
00078 };
00079 }
00080 #endif //_OGREBULLETDYNAMICS_DynamicWorld_H
00081