[1035] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1505] | 3 | * > www.orxonox.net < |
---|
[1035] | 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
[1535] | 23 | * Reto Grieder |
---|
[1755] | 24 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
[1035] | 25 | * Co-authors: |
---|
[1755] | 26 | * Felix Schulthess |
---|
[1035] | 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
[612] | 30 | /** |
---|
[7401] | 31 | @defgroup Graphics Graphics and GUI |
---|
| 32 | @ingroup Core |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | /** |
---|
[2801] | 36 | @file |
---|
[7401] | 37 | @ingroup Graphics |
---|
[2801] | 38 | @brief |
---|
| 39 | Declaration of GraphicsManager Singleton. |
---|
[612] | 40 | */ |
---|
| 41 | |
---|
[2805] | 42 | #ifndef _GraphicsManager_H__ |
---|
| 43 | #define _GraphicsManager_H__ |
---|
[612] | 44 | |
---|
[3346] | 45 | #include "CorePrereqs.h" |
---|
[1039] | 46 | |
---|
[3196] | 47 | #include <cassert> |
---|
[715] | 48 | #include <string> |
---|
[2801] | 49 | #include <OgreLog.h> |
---|
[5695] | 50 | #include <boost/scoped_ptr.hpp> |
---|
| 51 | #include <boost/shared_ptr.hpp> |
---|
| 52 | |
---|
[3366] | 53 | #include "util/Singleton.h" |
---|
[3346] | 54 | #include "OrxonoxClass.h" |
---|
[612] | 55 | |
---|
[1625] | 56 | namespace orxonox |
---|
| 57 | { |
---|
[1214] | 58 | /** |
---|
[2801] | 59 | @brief |
---|
| 60 | Graphics engine manager class |
---|
[1214] | 61 | */ |
---|
[3366] | 62 | class _CoreExport GraphicsManager : public Singleton<GraphicsManager>, public OrxonoxClass, public Ogre::LogListener |
---|
[1214] | 63 | { |
---|
[3366] | 64 | friend class Singleton<GraphicsManager>; |
---|
[1755] | 65 | public: |
---|
[5695] | 66 | GraphicsManager(bool bLoadRenderer = true); |
---|
[2801] | 67 | ~GraphicsManager(); |
---|
[612] | 68 | |
---|
[1755] | 69 | void setConfigValues(); |
---|
[2801] | 70 | |
---|
[6417] | 71 | void postUpdate(const Clock& time); |
---|
[2801] | 72 | |
---|
[5695] | 73 | Ogre::Viewport* getViewport() { return this->viewport_; } |
---|
| 74 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
| 75 | size_t getRenderWindowHandle(); |
---|
| 76 | bool isFullScreen() const; |
---|
[2662] | 77 | |
---|
[5695] | 78 | void upgradeToGraphics(); |
---|
[5929] | 79 | void loadDebugOverlay(); |
---|
[5695] | 80 | bool rendererLoaded() const { return renderWindow_ != NULL; } |
---|
| 81 | |
---|
[2850] | 82 | void setCamera(Ogre::Camera* camera); |
---|
| 83 | |
---|
[1755] | 84 | private: |
---|
[2801] | 85 | GraphicsManager(GraphicsManager&); // don't mess with singletons |
---|
[1502] | 86 | |
---|
[2801] | 87 | // OGRE initialisation |
---|
[5695] | 88 | void loadOgreRoot(); |
---|
[2801] | 89 | void loadOgrePlugins(); |
---|
| 90 | void loadRenderer(); |
---|
[2662] | 91 | |
---|
[2801] | 92 | // event from Ogre::LogListener |
---|
| 93 | void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, |
---|
| 94 | bool maskDebug, const std::string& logName); |
---|
[612] | 95 | |
---|
[2801] | 96 | // console commands |
---|
| 97 | void printScreen(); |
---|
| 98 | |
---|
[5695] | 99 | scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h |
---|
| 100 | #if OGRE_VERSION < 0x010600 |
---|
| 101 | scoped_ptr<MemoryArchiveFactory> memoryArchiveFactory_; //!< Stores the modified particle scripts |
---|
| 102 | #endif |
---|
| 103 | scoped_ptr<Ogre::LogManager> ogreLogger_; |
---|
| 104 | scoped_ptr<Ogre::Root> ogreRoot_; //!< Ogre's root |
---|
[2801] | 105 | Ogre::RenderWindow* renderWindow_; //!< the one and only render window |
---|
| 106 | Ogre::Viewport* viewport_; //!< default full size viewport |
---|
| 107 | |
---|
[5929] | 108 | // XML files for the resources and the debug overlay |
---|
[5695] | 109 | shared_ptr<XMLFile> resources_; //!< XML with resource locations |
---|
| 110 | shared_ptr<XMLFile> extResources_; //!< XML with resource locations in the external path (only for dev runs) |
---|
[5929] | 111 | shared_ptr<XMLFile> debugOverlay_; //!< XML with various debug overlays |
---|
[5695] | 112 | |
---|
[1755] | 113 | // config values |
---|
[6105] | 114 | std::string ogreConfigFile_; //!< ogre config filename |
---|
[5695] | 115 | std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located |
---|
[2801] | 116 | std::string ogrePlugins_; //!< Comma separated list of all plugins to load |
---|
[6105] | 117 | std::string ogreLogFile_; //!< log filename for Ogre log messages |
---|
| 118 | int ogreLogLevelTrivial_; //!< Corresponding Orxonox debug level for LL_TRIVIAL |
---|
| 119 | int ogreLogLevelNormal_; //!< Corresponding Orxonox debug level for LL_NORMAL |
---|
| 120 | int ogreLogLevelCritical_; //!< Corresponding Orxonox debug level for LL_CRITICAL |
---|
[1755] | 121 | |
---|
[3366] | 122 | static GraphicsManager* singletonPtr_s; //!< Pointer to the Singleton |
---|
[1214] | 123 | }; |
---|
[612] | 124 | } |
---|
| 125 | |
---|
[2805] | 126 | #endif /* _GraphicsManager_H__ */ |
---|