Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreRefAppWorld.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of the OGRE Reference Application, a layer built
00004 on top of OGRE(Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2005 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef __REFAPP_WORLD_H__
00026 #define __REFAPP_WORLD_H__
00027 
00028 #include "OgreRefAppPrerequisites.h"
00029 #include "OgreRefAppJoint.h"
00030 #include <OgreSingleton.h>
00031 
00032 namespace OgreRefApp {
00033 
00034     class _OgreRefAppExport World : public Singleton<World>
00035     {
00036     public:
00038         enum WorldType {
00039             WT_REFAPP_GENERIC,
00040             WT_REFAPP_BSP
00041         };
00042     protected:
00044         SceneManager* mSceneMgr;
00045 
00046         typedef std::map<String, ApplicationObject*> ObjectMap;
00048         ObjectMap mObjects;
00049 
00050         typedef std::map<String, Joint*> JointMap;
00051         JointMap mJoints;
00052 
00053         typedef std::set<ApplicationObject*> ObjectSet;
00055         ObjectSet mDynamicsObjects;
00056 
00057         // ODE world object
00058         dWorld* mOdeWorld;
00059 
00061         dJointGroup* mOdeContactGroup;
00062 
00063         Vector3 mGravity;
00064 
00065         IntersectionSceneQuery* mIntersectionQuery;
00066 
00068         Real mSimulationStepSize;
00069 
00071         WorldType mWorldType;
00072 
00073     public:
00078         World(SceneManager* sceneMgr, WorldType worldType = WT_REFAPP_GENERIC);
00079         ~World();
00080 
00082         SceneManager* getSceneManager(void);
00083 
00085         OgreHead* createOgreHead(const String& name, const Vector3& pos = Vector3::ZERO, 
00086             const Quaternion& orientation = Quaternion::IDENTITY);
00087 
00089         FinitePlane* createPlane(const String& name, Real width, Real height, const Vector3& pos = Vector3::ZERO, 
00090             const Quaternion& orientation = Quaternion::IDENTITY);
00091 
00093         Ball* createBall(const String& name, Real radius, const Vector3& pos = Vector3::ZERO, 
00094             const Quaternion& orientation = Quaternion::IDENTITY);
00095 
00097         Box* createBox(const String& name, Real width, Real height, Real depth,
00098             const Vector3& pos = Vector3::ZERO, 
00099             const Quaternion& orientation = Quaternion::IDENTITY);
00100 
00102         CollideCamera* createCamera(const String& name, 
00103             const Vector3& pos = Vector3::ZERO, 
00104             const Quaternion& orientation = Quaternion::IDENTITY);
00105 
00107         void clear(void);
00108 
00109         dWorld* getOdeWorld(void);
00110         dJointGroup* getOdeContactJointGroup(void);
00111 
00119         void _applyCollision(void);
00120 
00124         void _applyDynamics(Real timeElapsed);
00125 
00127         void _notifyDynamicsStateForObject(ApplicationObject* obj, bool dynamicsEnabled);
00128 
00134         void setGravity(const Vector3& vec);
00135 
00137         const Vector3& getGravity(void);
00138 
00145         Joint* createJoint(const String& name, Joint::JointType jtype,
00146             ApplicationObject* obj1, ApplicationObject* obj2);
00147 
00159         void setSimulationStepSize(Real step);
00161         Real getSimulationStepSize(void);
00162 
00176         void simulationStep(Real timeElapsed);
00192         static World& getSingleton(void);
00208         static World* getSingletonPtr(void);
00209 
00210     };
00211 
00212 
00213 }
00214 
00215 #endif
00216 

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:47 2006