[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 | |
---|
[1039] | 39 | #include "OrxonoxPrereqs.h" |
---|
| 40 | |
---|
[3196] | 41 | #include <cassert> |
---|
[715] | 42 | #include <string> |
---|
[2801] | 43 | #include <OgreLog.h> |
---|
[1021] | 44 | #include "core/OrxonoxClass.h" |
---|
[612] | 45 | |
---|
[1625] | 46 | namespace orxonox |
---|
| 47 | { |
---|
[1214] | 48 | /** |
---|
[2801] | 49 | @brief |
---|
| 50 | Graphics engine manager class |
---|
[1214] | 51 | */ |
---|
[2801] | 52 | class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener |
---|
[1214] | 53 | { |
---|
[1755] | 54 | public: |
---|
[2801] | 55 | GraphicsManager(); |
---|
| 56 | ~GraphicsManager(); |
---|
[612] | 57 | |
---|
[1755] | 58 | void setConfigValues(); |
---|
[2801] | 59 | void initialise(); |
---|
| 60 | |
---|
| 61 | void update(const Clock& time); |
---|
| 62 | |
---|
[1755] | 63 | void detailLevelParticleChanged(); |
---|
[2801] | 64 | inline unsigned int getDetailLevelParticle() const |
---|
| 65 | { return this->detailLevelParticle_; } |
---|
[1293] | 66 | |
---|
[3196] | 67 | inline Ogre::Viewport* getViewport() |
---|
[2662] | 68 | { return this->viewport_; } |
---|
[2801] | 69 | inline Ogre::RenderWindow* getRenderWindow() |
---|
| 70 | { return this->renderWindow_; } |
---|
[2662] | 71 | |
---|
[2850] | 72 | void setCamera(Ogre::Camera* camera); |
---|
| 73 | |
---|
[3196] | 74 | inline static GraphicsManager& getInstance() |
---|
| 75 | { assert(singletonRef_s); return *singletonRef_s; } |
---|
[2801] | 76 | |
---|
[1755] | 77 | private: |
---|
[2801] | 78 | GraphicsManager(GraphicsManager&); // don't mess with singletons |
---|
[1502] | 79 | |
---|
[2801] | 80 | // OGRE initialisation |
---|
| 81 | void setupOgre(); |
---|
| 82 | void loadOgrePlugins(); |
---|
| 83 | void declareResources(); |
---|
| 84 | void loadRenderer(); |
---|
| 85 | void initialiseResources(); |
---|
[2662] | 86 | |
---|
[2801] | 87 | // event from Ogre::LogListener |
---|
| 88 | void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, |
---|
| 89 | bool maskDebug, const std::string& logName); |
---|
[612] | 90 | |
---|
[2801] | 91 | // console commands |
---|
| 92 | void printScreen(); |
---|
| 93 | |
---|
| 94 | private: |
---|
| 95 | bool loaded_; |
---|
| 96 | |
---|
| 97 | Ogre::Root* ogreRoot_; //!< Ogre's root |
---|
| 98 | Ogre::LogManager* ogreLogger_; |
---|
| 99 | Ogre::RenderWindow* renderWindow_; //!< the one and only render window |
---|
| 100 | Ogre::Viewport* viewport_; //!< default full size viewport |
---|
| 101 | OgreWindowEventListener* ogreWindowEventListener_; |
---|
| 102 | |
---|
[1755] | 103 | // config values |
---|
[2801] | 104 | unsigned int detailLevelParticle_; //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high) |
---|
| 105 | std::string resourceFile_; //!< resources file name |
---|
| 106 | std::string ogreConfigFile_; //!< ogre config file name |
---|
| 107 | std::string ogrePluginsFolder_; //!< Folder where the Ogre plugins are located |
---|
| 108 | std::string ogrePlugins_; //!< Comma separated list of all plugins to load |
---|
| 109 | std::string ogreLogFile_; //!< log file name for Ogre log messages |
---|
| 110 | int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL |
---|
| 111 | int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL |
---|
| 112 | int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL |
---|
[1755] | 113 | |
---|
[2801] | 114 | // console commands |
---|
| 115 | ConsoleCommand* ccPrintScreen_; |
---|
| 116 | |
---|
| 117 | static GraphicsManager* singletonRef_s; //!< Pointer to the Singleton |
---|
[1214] | 118 | }; |
---|
[612] | 119 | } |
---|
| 120 | |
---|
[2805] | 121 | #endif /* _GraphicsManager_H__ */ |
---|