[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 | /** |
---|
[2801] | 31 | @file |
---|
| 32 | @brief |
---|
| 33 | Declaration of GraphicsManager Singleton. |
---|
[612] | 34 | */ |
---|
| 35 | |
---|
[2805] | 36 | #ifndef _GraphicsManager_H__ |
---|
| 37 | #define _GraphicsManager_H__ |
---|
[612] | 38 | |
---|
[3346] | 39 | #include "CorePrereqs.h" |
---|
[1039] | 40 | |
---|
[3196] | 41 | #include <cassert> |
---|
[715] | 42 | #include <string> |
---|
[2801] | 43 | #include <OgreLog.h> |
---|
[5695] | 44 | #include <boost/scoped_ptr.hpp> |
---|
| 45 | #include <boost/shared_ptr.hpp> |
---|
| 46 | |
---|
[3366] | 47 | #include "util/Singleton.h" |
---|
[3346] | 48 | #include "OrxonoxClass.h" |
---|
[612] | 49 | |
---|
[1625] | 50 | namespace orxonox |
---|
| 51 | { |
---|
[1214] | 52 | /** |
---|
[2801] | 53 | @brief |
---|
| 54 | Graphics engine manager class |
---|
[1214] | 55 | */ |
---|
[3366] | 56 | class _CoreExport GraphicsManager : public Singleton<GraphicsManager>, public OrxonoxClass, public Ogre::LogListener |
---|
[1214] | 57 | { |
---|
[3366] | 58 | friend class Singleton<GraphicsManager>; |
---|
[1755] | 59 | public: |
---|
[5695] | 60 | GraphicsManager(bool bLoadRenderer = true); |
---|
[2801] | 61 | ~GraphicsManager(); |
---|
[612] | 62 | |
---|
[1755] | 63 | void setConfigValues(); |
---|
[2801] | 64 | |
---|
[6417] | 65 | void postUpdate(const Clock& time); |
---|
[2801] | 66 | |
---|
[5695] | 67 | Ogre::Viewport* getViewport() { return this->viewport_; } |
---|
| 68 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
| 69 | size_t getRenderWindowHandle(); |
---|
| 70 | bool isFullScreen() const; |
---|
[2662] | 71 | |
---|
[5695] | 72 | void upgradeToGraphics(); |
---|
[5929] | 73 | void loadDebugOverlay(); |
---|
[5695] | 74 | bool rendererLoaded() const { return renderWindow_ != NULL; } |
---|
| 75 | |
---|
[2850] | 76 | void setCamera(Ogre::Camera* camera); |
---|
| 77 | |
---|
[1755] | 78 | private: |
---|
[2801] | 79 | GraphicsManager(GraphicsManager&); // don't mess with singletons |
---|
[1502] | 80 | |
---|
[2801] | 81 | // OGRE initialisation |
---|
[5695] | 82 | void loadOgreRoot(); |
---|
[2801] | 83 | void loadOgrePlugins(); |
---|
| 84 | void loadRenderer(); |
---|
[2662] | 85 | |
---|
[2801] | 86 | // event from Ogre::LogListener |
---|
| 87 | void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, |
---|
| 88 | bool maskDebug, const std::string& logName); |
---|
[612] | 89 | |
---|
[2801] | 90 | // console commands |
---|
| 91 | void printScreen(); |
---|
| 92 | |
---|
[5695] | 93 | scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h |
---|
| 94 | #if OGRE_VERSION < 0x010600 |
---|
| 95 | scoped_ptr<MemoryArchiveFactory> memoryArchiveFactory_; //!< Stores the modified particle scripts |
---|
| 96 | #endif |
---|
| 97 | scoped_ptr<Ogre::LogManager> ogreLogger_; |
---|
| 98 | scoped_ptr<Ogre::Root> ogreRoot_; //!< Ogre's root |
---|
[2801] | 99 | Ogre::RenderWindow* renderWindow_; //!< the one and only render window |
---|
| 100 | Ogre::Viewport* viewport_; //!< default full size viewport |
---|
| 101 | |
---|
[5929] | 102 | // XML files for the resources and the debug overlay |
---|
[5695] | 103 | shared_ptr<XMLFile> resources_; //!< XML with resource locations |
---|
| 104 | shared_ptr<XMLFile> extResources_; //!< XML with resource locations in the external path (only for dev runs) |
---|
[5929] | 105 | shared_ptr<XMLFile> debugOverlay_; //!< XML with various debug overlays |
---|
[5695] | 106 | |
---|
[1755] | 107 | // config values |
---|
[6105] | 108 | std::string ogreConfigFile_; //!< ogre config filename |
---|
[5695] | 109 | std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located |
---|
[2801] | 110 | std::string ogrePlugins_; //!< Comma separated list of all plugins to load |
---|
[6105] | 111 | std::string ogreLogFile_; //!< log filename for Ogre log messages |
---|
| 112 | int ogreLogLevelTrivial_; //!< Corresponding Orxonox debug level for LL_TRIVIAL |
---|
| 113 | int ogreLogLevelNormal_; //!< Corresponding Orxonox debug level for LL_NORMAL |
---|
| 114 | int ogreLogLevelCritical_; //!< Corresponding Orxonox debug level for LL_CRITICAL |
---|
[1755] | 115 | |
---|
[3366] | 116 | static GraphicsManager* singletonPtr_s; //!< Pointer to the Singleton |
---|
[1214] | 117 | }; |
---|
[612] | 118 | } |
---|
| 119 | |
---|
[2805] | 120 | #endif /* _GraphicsManager_H__ */ |
---|