Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/ogrebullet/Dynamics/OgreBulletDynamicsWorld.h @ 2122

Last change on this file since 2122 was 2119, checked in by rgrieder, 16 years ago

Merged physics branch into physics_new branch.

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1/***************************************************************************
2
3This source file is part of OGREBULLET
4(Object-oriented Graphics Rendering Engine Bullet Wrapper)
5For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
6
7Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
8
9
10
11This program is free software; you can redistribute it and/or modify it under
12the terms of the GPL General Public License with runtime exception as published by the Free Software
13Foundation; either version 2 of the License, or (at your option) any later
14version.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GPL General Public License with runtime exception for more details.
19
20You should have received a copy of the GPL General Public License with runtime exception along with
21this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22Place - Suite 330, Boston, MA 02111-1307, USA, or go to
23http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24-----------------------------------------------------------------------------
25*/
26
27#ifndef _OGREBULLETDYNAMICS_DynamicWorld_H
28#define _OGREBULLETDYNAMICS_DynamicWorld_H
29
30#include "OgreBulletDynamicsPreRequisites.h"
31
32#include "OgreBulletCollisionsWorld.h"
33#include "Debug/OgreBulletCollisionsDebugDrawer.h"
34
35namespace OgreBulletDynamics
36{
37    // -------------------------------------------------------------------------
38    // basic rigid body class
39    class DynamicsWorld : public OgreBulletCollisions::CollisionsWorld
40    {
41    public:
42        DynamicsWorld(Ogre::SceneManager *mgr, 
43            const Ogre::AxisAlignedBox &bounds, 
44            const Ogre::Vector3 &gravity,
45            bool init = true);
46
47            ~DynamicsWorld();
48
49        template <class BTDNYWORLDCLASS>
50            void createBtDynamicsWorld(BTDNYWORLDCLASS *&createdWorld)
51            {
52                                createdWorld = new BTDNYWORLDCLASS(mDispatcher, mBroadphase, mConstraintsolver, &mDefaultCollisionConfiguration);
53                mWorld = createdWorld;
54            }
55
56        void stepSimulation(const Ogre::Real elapsedTime, int maxSubSteps = 1, const Ogre::Real fixedTimestep = 1./60.);
57
58        void addRigidBody (RigidBody *rb, short collisionGroup, short collisionMask);
59
60        void setDebugDrawer(OgreBulletCollisions::DebugDrawer *debugdrawer)
61        {
62            mDebugDrawer = debugdrawer;
63            (static_cast <btDiscreteDynamicsWorld *> (mWorld))->setDebugDrawer(mDebugDrawer);
64        };
65
66        OgreBulletCollisions::DebugDrawer *getDebugDrawer(){return mDebugDrawer;};
67
68        inline btDynamicsWorld * getBulletDynamicsWorld() const {return static_cast<btDynamicsWorld *> (mWorld);};
69
70        void removeConstraint(TypedConstraint *constraint);
71        void addConstraint(TypedConstraint *constraint);
72        bool isConstraintRegistered(TypedConstraint *constraint) const;
73
74        void addVehicle(RaycastVehicle *v);
75
76    private:
77        OgreBulletCollisions::DebugDrawer                 *mDebugDrawer;
78
79        btConstraintSolver                                *mConstraintsolver;
80
81        std::deque <TypedConstraint *>                    mConstraints;
82    };
83}
84#endif //_OGREBULLETDYNAMICS_DynamicWorld_H
85
Note: See TracBrowser for help on using the repository browser.