00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 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 __ROOT__ 00026 #define __ROOT__ 00027 00028 // Precompiler options 00029 #include "OgrePrerequisites.h" 00030 00031 #include "OgreSingleton.h" 00032 #include "OgreString.h" 00033 #include "OgreSceneManagerEnumerator.h" 00034 #include "OgreMeshManager.h" 00035 #include "OgreTextureManager.h" 00036 #include "OgreDynLibManager.h" 00037 #include "OgrePlatformManager.h" 00038 #include "OgreArchiveManager.h" 00039 00040 #include <exception> 00041 00042 #if OGRE_PLATFORM == PLATFORM_LINUX || OGRE_PLATFORM == PLATFORM_APPLE 00043 # define SET_TERM_HANDLER { std::set_terminate( &Root::termHandler ); } 00044 #else 00045 #define SET_TERM_HANDLER { set_terminate( &Root::termHandler ); } 00046 #endif 00047 00048 namespace Ogre 00049 { 00050 typedef std::vector<RenderSystem*> RenderSystemList; 00051 00065 class _OgreExport Root : public Singleton<Root> 00066 { 00067 // To allow update of active renderer if 00068 // RenderSystem::initialise is used directly 00069 friend class RenderSystem; 00070 private: 00071 RenderSystemList mRenderers; 00072 RenderSystem* mActiveRenderer; 00073 String mVersion; 00074 00075 // Singletons 00076 Math* mMath; 00077 LogManager* mLogManager; 00078 ControllerManager* mControllerManager; 00079 SceneManagerEnumerator* mSceneManagerEnum; 00080 DynLibManager* mDynLibManager; 00081 PlatformManager* mPlatformManager; 00082 ArchiveManager* mArchiveManager; 00083 MaterialManager* mMaterialManager; 00084 MeshManager* mMeshManager; 00085 ParticleSystemManager* mParticleManager; 00086 SkeletonManager* mSkeletonManager; 00087 GuiManager* mGuiManager; 00088 OverlayManager* mOverlayManager; 00089 FontManager* mFontManager; 00090 ArchiveFactory *mZipArchiveFactory; 00091 Codec* mPNGCodec, *mJPGCodec, *mJPEGCodec, *mTGACodec; 00092 00093 std::vector<DynLib*> mPluginLibs; 00100 void loadPlugins( const String& pluginsfile = "plugins.cfg" ); 00103 void unloadPlugins(); 00104 00105 public: 00106 00107 static void termHandler(); 00108 00114 Root(const String& pluginFileName = "plugins.cfg"); 00115 ~Root(); 00116 00122 void saveConfig(void); 00123 00136 bool restoreConfig(void); 00137 00154 bool showConfigDialog(void); 00155 00167 void addRenderSystem(RenderSystem* newRend); 00168 00176 void setSceneManager(SceneType sType, SceneManager* sm); 00177 00184 RenderSystemList* getAvailableRenderers(void); 00185 00203 void setRenderSystem(RenderSystem* system); 00204 00207 RenderSystem* getRenderSystem(void); 00208 00224 RenderWindow* initialise(bool autoCreateWindow); 00225 00252 SceneManager* getSceneManager(SceneType sceneType); 00253 00269 TextureManager* getTextureManager(void); 00270 00276 MeshManager* getMeshManager(void); 00277 00281 String getErrorDescription(long errorNumber); 00282 00300 void addFrameListener(FrameListener* newListener); 00301 00306 void removeFrameListener(FrameListener* oldListener); 00307 00333 void startRendering(void); 00334 00342 void shutdown(void); 00358 static Root& getSingleton(void); 00359 00401 void addResourceLocation(const String& name, const String& locType, ResourceType resType = RESTYPE_ALL); 00402 00411 void convertColourValue(const ColourValue& colour, unsigned long* pDest); 00412 00449 RenderWindow* createRenderWindow(const String &name, int width, int height, int colourDepth, 00450 bool fullScreen, int left = 0, int top = 0, bool depthBuffer = true, 00451 RenderWindow* parentWindowHandle = 0); 00452 00455 void detachRenderTarget( RenderTarget* pWin ); 00456 00459 void detachRenderTarget( const String & name ); 00460 00463 RenderTarget * getRenderTarget(const String &name); 00464 00472 void showDebugOverlay(bool show); 00473 00474 00475 }; 00476 } // Namespace Ogre 00477 #endif
Copyright © 2002 by The OGRE Team