| 1 | /** | 
|---|
| 2 |   @file GraphicsEngine.h | 
|---|
| 3 |   @brief Graphics Engine | 
|---|
| 4 |   @author Benjamin Knecht <beni_at_orxonox.net> | 
|---|
| 5 |  */ | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef _GraphicsEngine_H__ | 
|---|
| 8 | #define _GraphicsEngine_H__ | 
|---|
| 9 |  | 
|---|
| 10 | #include <string> | 
|---|
| 11 |  | 
|---|
| 12 | #include <OgrePrerequisites.h> | 
|---|
| 13 | #include <OgreLog.h> | 
|---|
| 14 | #include <OgreRoot.h> | 
|---|
| 15 | #include <OgreSceneManager.h> | 
|---|
| 16 |  | 
|---|
| 17 | #include "OrxonoxPrereqs.h" | 
|---|
| 18 | #include "core/OrxonoxClass.h" | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | namespace orxonox { | 
|---|
| 22 |  | 
|---|
| 23 | /** | 
|---|
| 24 |    * graphics engine manager class | 
|---|
| 25 |  */ | 
|---|
| 26 |   class _OrxonoxExport GraphicsEngine : public OrxonoxClass, public Ogre::LogListener | 
|---|
| 27 |   { | 
|---|
| 28 |     public: | 
|---|
| 29 |       GraphicsEngine(); | 
|---|
| 30 |       inline void setConfigPath(std::string path) { this->configPath_ = path; }; | 
|---|
| 31 |       // find a better way for this | 
|---|
| 32 |       //inline Ogre::Root* getRoot() { return root_; }; | 
|---|
| 33 |       void setConfigValues(); | 
|---|
| 34 |       void setup(); | 
|---|
| 35 |       bool load(std::string path); | 
|---|
| 36 |       void loadRessourceLocations(std::string path); | 
|---|
| 37 |       Ogre::SceneManager* getSceneManager(); | 
|---|
| 38 |       void initialise(); | 
|---|
| 39 |  | 
|---|
| 40 |       // several window properties | 
|---|
| 41 |       Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } | 
|---|
| 42 |       size_t getWindowHandle(); | 
|---|
| 43 |       int getWindowWidth() const; | 
|---|
| 44 |       int getWindowHeight() const; | 
|---|
| 45 |  | 
|---|
| 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 |  | 
|---|
| 54 |       virtual ~GraphicsEngine(); | 
|---|
| 55 |  | 
|---|
| 56 |     private: | 
|---|
| 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 |  | 
|---|
| 61 |       Ogre::Root*         root_;        //!< Ogre's root | 
|---|
| 62 |       std::string         configPath_;  //!< path to config file | 
|---|
| 63 |       std::string         dataPath_;    //!< path to data file | 
|---|
| 64 |       Ogre::SceneManager* scene_;       //!< scene manager of the game | 
|---|
| 65 |       Ogre::RenderWindow* renderWindow_;//!< the current render window | 
|---|
| 66 |       //bool               bOverwritePath_; //!< overwrites path | 
|---|
| 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 | 
|---|
| 71 |  | 
|---|
| 72 |   }; | 
|---|
| 73 |  | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 | #endif /* _GraphicsEngine_H__ */ | 
|---|