1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
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: |
---|
23 | * Reto Grieder |
---|
24 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
25 | * Co-authors: |
---|
26 | * Felix Schulthess |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | /** |
---|
31 | @file |
---|
32 | @brief |
---|
33 | Declaration of GraphicsManager Singleton. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef _GraphicsManager_H__ |
---|
37 | #define _GraphicsManager_H__ |
---|
38 | |
---|
39 | #include "OrxonoxPrereqs.h" |
---|
40 | |
---|
41 | #include <cassert> |
---|
42 | #include <string> |
---|
43 | #include <OgreLog.h> |
---|
44 | #include "core/OrxonoxClass.h" |
---|
45 | |
---|
46 | namespace orxonox |
---|
47 | { |
---|
48 | /** |
---|
49 | @brief |
---|
50 | Graphics engine manager class |
---|
51 | */ |
---|
52 | class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener |
---|
53 | { |
---|
54 | public: |
---|
55 | GraphicsManager(); |
---|
56 | ~GraphicsManager(); |
---|
57 | |
---|
58 | void setConfigValues(); |
---|
59 | |
---|
60 | void update(const Clock& time); |
---|
61 | |
---|
62 | inline Ogre::Viewport* getViewport() |
---|
63 | { return this->viewport_; } |
---|
64 | inline Ogre::RenderWindow* getRenderWindow() |
---|
65 | { return this->renderWindow_; } |
---|
66 | |
---|
67 | void setCamera(Ogre::Camera* camera); |
---|
68 | |
---|
69 | inline static GraphicsManager& getInstance() |
---|
70 | { assert(singletonRef_s); return *singletonRef_s; } |
---|
71 | |
---|
72 | private: |
---|
73 | GraphicsManager(GraphicsManager&); // don't mess with singletons |
---|
74 | |
---|
75 | // OGRE initialisation |
---|
76 | void setupOgre(); |
---|
77 | void loadOgrePlugins(); |
---|
78 | void declareResources(); |
---|
79 | void loadRenderer(); |
---|
80 | void initialiseResources(); |
---|
81 | |
---|
82 | // event from Ogre::LogListener |
---|
83 | void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, |
---|
84 | bool maskDebug, const std::string& logName); |
---|
85 | |
---|
86 | // console commands |
---|
87 | void printScreen(); |
---|
88 | |
---|
89 | private: |
---|
90 | Ogre::Root* ogreRoot_; //!< Ogre's root |
---|
91 | Ogre::LogManager* ogreLogger_; |
---|
92 | Ogre::RenderWindow* renderWindow_; //!< the one and only render window |
---|
93 | Ogre::Viewport* viewport_; //!< default full size viewport |
---|
94 | OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h |
---|
95 | |
---|
96 | // config values |
---|
97 | std::string resourceFile_; //!< resources file name |
---|
98 | std::string ogreConfigFile_; //!< ogre config file name |
---|
99 | std::string ogrePluginsFolder_; //!< Folder where the Ogre plugins are located |
---|
100 | std::string ogrePlugins_; //!< Comma separated list of all plugins to load |
---|
101 | std::string ogreLogFile_; //!< log file name for Ogre log messages |
---|
102 | int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL |
---|
103 | int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL |
---|
104 | int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL |
---|
105 | |
---|
106 | // console commands |
---|
107 | ConsoleCommand* ccPrintScreen_; |
---|
108 | |
---|
109 | static GraphicsManager* singletonRef_s; //!< Pointer to the Singleton |
---|
110 | }; |
---|
111 | } |
---|
112 | |
---|
113 | #endif /* _GraphicsManager_H__ */ |
---|