[1035] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1494] | 3 | * > www.orxonox.net < * |
---|
[1035] | 4 | * |
---|
| 5 | * License notice: |
---|
| 6 | * |
---|
| 7 | * This program is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU General Public License |
---|
| 9 | * as published by the Free Software Foundation; either version 2 |
---|
| 10 | * of the License, or (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program; if not, write to the Free Software |
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 20 | * |
---|
| 21 | * Author: |
---|
| 22 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
| 23 | * Co-authors: |
---|
| 24 | * Reto Grieder |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
[612] | 28 | /** |
---|
[1035] | 29 | @file |
---|
| 30 | @brief Declaration of GraphicsEngine Singleton. |
---|
[612] | 31 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 32 | */ |
---|
| 33 | |
---|
[673] | 34 | #ifndef _GraphicsEngine_H__ |
---|
| 35 | #define _GraphicsEngine_H__ |
---|
[612] | 36 | |
---|
[1039] | 37 | #include "OrxonoxPrereqs.h" |
---|
| 38 | |
---|
[715] | 39 | #include <string> |
---|
| 40 | |
---|
[1021] | 41 | #include <OgrePrerequisites.h> |
---|
[1024] | 42 | #include <OgreLog.h> |
---|
[1214] | 43 | #include <OgreRenderWindow.h> |
---|
| 44 | #include <OgreWindowEventUtilities.h> |
---|
[1021] | 45 | #include "core/OrxonoxClass.h" |
---|
[612] | 46 | |
---|
[729] | 47 | |
---|
[612] | 48 | namespace orxonox { |
---|
| 49 | |
---|
[1214] | 50 | /** |
---|
[1032] | 51 | @brief Graphics engine manager class |
---|
[1214] | 52 | */ |
---|
[1293] | 53 | class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass |
---|
[1214] | 54 | { |
---|
| 55 | public: |
---|
| 56 | void setConfigValues(); |
---|
[1293] | 57 | bool setup(std::string& dataPath); |
---|
| 58 | void declareRessourceLocations(); |
---|
| 59 | bool loadRenderer(); |
---|
| 60 | bool initialiseResources(); |
---|
| 61 | bool createNewScene(); |
---|
| 62 | |
---|
[1214] | 63 | void destroy(); |
---|
[612] | 64 | |
---|
[1293] | 65 | Ogre::SceneManager* getSceneManager() { return scene_; } |
---|
| 66 | std::string& getDataPath() { return dataPath_; } |
---|
| 67 | |
---|
[1214] | 68 | // several window properties |
---|
| 69 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
| 70 | size_t getWindowHandle(); |
---|
| 71 | int getWindowWidth() const; |
---|
[1494] | 72 | int getWindowHeight() const; float getWindowAspectRatio() const; |
---|
[1414] | 73 | float getAverageFPS() const |
---|
| 74 | { if (renderWindow_) return this->renderWindow_->getAverageFPS(); else return 0.0f; } |
---|
[1021] | 75 | |
---|
[1293] | 76 | void windowMoved (Ogre::RenderWindow* rw); |
---|
| 77 | void windowResized (Ogre::RenderWindow* rw); |
---|
| 78 | void windowFocusChanged(Ogre::RenderWindow* rw); |
---|
| 79 | void windowClosed (Ogre::RenderWindow* rw); |
---|
| 80 | |
---|
[1214] | 81 | static GraphicsEngine& getSingleton(); |
---|
| 82 | static GraphicsEngine* getSingletonPtr() { return &getSingleton(); } |
---|
[1021] | 83 | |
---|
[1466] | 84 | //HACK!!! |
---|
| 85 | void static CompositorBloomOn(); |
---|
| 86 | void static CompositorBloomOff(); |
---|
| 87 | void static CompositorMotionBlurOn(); |
---|
| 88 | void static CompositorMotionBlurOff(); |
---|
| 89 | |
---|
| 90 | |
---|
[1214] | 91 | private: |
---|
| 92 | // don't mess with singletons |
---|
| 93 | GraphicsEngine(); |
---|
| 94 | ~GraphicsEngine(); |
---|
| 95 | GraphicsEngine(GraphicsEngine&) { } |
---|
[1024] | 96 | |
---|
[1214] | 97 | //! Method called by the LogListener from Ogre |
---|
| 98 | void messageLogged(const std::string&, Ogre::LogMessageLevel, |
---|
| 99 | bool, const std::string&); |
---|
[612] | 100 | |
---|
[1214] | 101 | Ogre::Root* root_; //!< Ogre's root |
---|
| 102 | Ogre::SceneManager* scene_; //!< scene manager of the game |
---|
| 103 | Ogre::RenderWindow* renderWindow_;//!< the current render window |
---|
| 104 | //bool bOverwritePath_; //!< overwrites path |
---|
[1293] | 105 | //std::string configPath_; //!< path to config file |
---|
[1214] | 106 | std::string dataPath_; //!< path to data file |
---|
| 107 | std::string ogreLogfile_; //!< log file name for Ogre log messages |
---|
| 108 | int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL |
---|
| 109 | int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL |
---|
| 110 | int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL |
---|
| 111 | }; |
---|
[612] | 112 | } |
---|
| 113 | |
---|
[673] | 114 | #endif /* _GraphicsEngine_H__ */ |
---|