[612] | 1 | /** |
---|
[614] | 2 | @file GraphicsEngine.h |
---|
[612] | 3 | @brief Graphics Engine |
---|
| 4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 5 | */ |
---|
| 6 | |
---|
[673] | 7 | #ifndef _GraphicsEngine_H__ |
---|
| 8 | #define _GraphicsEngine_H__ |
---|
[612] | 9 | |
---|
[715] | 10 | #include <string> |
---|
| 11 | |
---|
[929] | 12 | #include <OgrePrerequisites.h> |
---|
[940] | 13 | #include <OgreLog.h> |
---|
[612] | 14 | #include <OgreRoot.h> |
---|
| 15 | #include <OgreSceneManager.h> |
---|
| 16 | |
---|
[729] | 17 | #include "OrxonoxPrereqs.h" |
---|
[929] | 18 | #include "core/OrxonoxClass.h" |
---|
[612] | 19 | |
---|
[729] | 20 | |
---|
[612] | 21 | namespace orxonox { |
---|
| 22 | |
---|
| 23 | /** |
---|
| 24 | * graphics engine manager class |
---|
| 25 | */ |
---|
[940] | 26 | class _OrxonoxExport GraphicsEngine : public OrxonoxClass, public Ogre::LogListener |
---|
[926] | 27 | { |
---|
[612] | 28 | public: |
---|
| 29 | GraphicsEngine(); |
---|
[715] | 30 | inline void setConfigPath(std::string path) { this->configPath_ = path; }; |
---|
[612] | 31 | // find a better way for this |
---|
[929] | 32 | //inline Ogre::Root* getRoot() { return root_; }; |
---|
[926] | 33 | void setConfigValues(); |
---|
[612] | 34 | void setup(); |
---|
[926] | 35 | bool load(std::string path); |
---|
[715] | 36 | void loadRessourceLocations(std::string path); |
---|
[612] | 37 | Ogre::SceneManager* getSceneManager(); |
---|
[929] | 38 | void initialise(); |
---|
[612] | 39 | |
---|
[919] | 40 | // several window properties |
---|
[929] | 41 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
[919] | 42 | size_t getWindowHandle(); |
---|
| 43 | int getWindowWidth() const; |
---|
| 44 | int getWindowHeight() const; |
---|
| 45 | |
---|
[929] | 46 | // Ogre Root access for Orxonox |
---|
| 47 | void frameStarted(Ogre::FrameEvent &evt) |
---|
| 48 | { if (root_) root_->_fireFrameStarted(evt); } |
---|
| 49 | void frameEnded (Ogre::FrameEvent &evt) |
---|
| 50 | { if (root_) root_->_fireFrameEnded(evt); } |
---|
| 51 | void renderOneFrame() |
---|
| 52 | { if (root_) root_->_updateAllRenderTargets(); } |
---|
| 53 | |
---|
[612] | 54 | virtual ~GraphicsEngine(); |
---|
[929] | 55 | |
---|
[612] | 56 | private: |
---|
[940] | 57 | //! Method called by the LogListener from Ogre |
---|
| 58 | void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, |
---|
| 59 | bool maskDebug, const std::string &logName); |
---|
| 60 | |
---|
[612] | 61 | Ogre::Root* root_; //!< Ogre's root |
---|
[715] | 62 | std::string configPath_; //!< path to config file |
---|
| 63 | std::string dataPath_; //!< path to data file |
---|
[612] | 64 | Ogre::SceneManager* scene_; //!< scene manager of the game |
---|
[919] | 65 | Ogre::RenderWindow* renderWindow_;//!< the current render window |
---|
[926] | 66 | //bool bOverwritePath_; //!< overwrites path |
---|
[940] | 67 | std::string ogreLogfile_; //!< log file name for Ogre log messages |
---|
| 68 | int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL |
---|
| 69 | int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL |
---|
| 70 | int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL |
---|
[612] | 71 | |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | } |
---|
| 75 | |
---|
[673] | 76 | #endif /* _GraphicsEngine_H__ */ |
---|