Changeset 1755 for code/trunk/src/orxonox/GraphicsEngine.h
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/GraphicsEngine.h
r1747 r1755 22 22 * Author: 23 23 * Reto Grieder 24 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 24 25 * Co-authors: 25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007,Felix Schulthess26 * Felix Schulthess 26 27 * 27 28 */ … … 41 42 42 43 #include <OgrePrerequisites.h> 43 #include <OgreLog.h>44 #include <OgreRenderWindow.h>45 #include <OgreWindowEventUtilities.h>46 44 #include "core/OrxonoxClass.h" 47 48 45 49 46 namespace orxonox … … 52 49 @brief Graphics engine manager class 53 50 */ 54 class _OrxonoxExport GraphicsEngine : public O gre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass51 class _OrxonoxExport GraphicsEngine : public OrxonoxClass 55 52 { 56 public: 57 void setConfigValues(); 58 void detailLevelParticleChanged(); 59 bool setup(); 60 bool declareRessourceLocations(); 61 bool loadRenderer(); 62 bool initialiseResources(); 63 bool createNewScene(); 53 // HACK: temporary means 54 friend class GSGraphics; 64 55 65 void destroy(); 56 public: 57 GraphicsEngine(); 58 ~GraphicsEngine(); 66 59 67 Ogre::SceneManager* getSceneManager() { return scene_; } 60 void setConfigValues(); 61 void detailLevelParticleChanged(); 68 62 69 // several window properties 70 Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } 71 size_t getWindowHandle(); 72 int getWindowWidth() const; 73 int getWindowHeight() const; 74 float getWindowAspectRatio() const; 75 float getAverageFramesPerSecond() const { return this->avgFramesPerSecond_; } 76 float getAverageTickTime() const { return this->avgTickTime_; } 77 void setAverageTickTime(float tickTime) { this->avgTickTime_ = tickTime; } 78 void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; } 63 void setLevelSceneManager(Ogre::SceneManager* sceneMgr) { this->levelSceneManager_ = sceneMgr; } 64 Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; } 79 65 80 void setWindowActivity(bool activity)81 { if (this->renderWindow_) this->renderWindow_->setActive(activity); }66 Ogre::Viewport* getViewport() { return this->viewport_; } 67 Ogre::Root* getOgreRoot() { return this->root_; } 82 68 83 void windowMoved (Ogre::RenderWindow* rw); 84 void windowResized (Ogre::RenderWindow* rw); 85 void windowFocusChanged(Ogre::RenderWindow* rw); 86 void windowClosed (Ogre::RenderWindow* rw); 69 // several window properties 70 int getWindowWidth() const; 71 int getWindowHeight() const; 72 float getWindowAspectRatio() const; 73 float getAverageFramesPerSecond() const { return this->avgFramesPerSecond_; } 74 float getAverageTickTime() const { return this->avgTickTime_; } 75 void setAverageTickTime(float tickTime) { this->avgTickTime_ = tickTime; } 76 void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; } 87 77 88 89 78 inline unsigned int getDetailLevelParticle() const 79 { return this->detailLevelParticle_; } 90 80 91 static GraphicsEngine& getSingleton();92 static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }81 static GraphicsEngine& getInstance(); 82 static GraphicsEngine* getInstancePtr() { return singletonRef_s; } 93 83 84 private: 85 // don't mess with singletons 86 GraphicsEngine(GraphicsEngine&); 94 87 95 private: 96 // don't mess with singletons 97 GraphicsEngine(); 98 ~GraphicsEngine(); 99 GraphicsEngine(GraphicsEngine&) { } 88 Ogre::Root* root_; //!< Ogre's root 89 Ogre::RenderWindow* renderWindow_; //!< the current render window 90 Ogre::SceneManager* levelSceneManager_; //!< scene manager of the game 91 Ogre::Viewport* viewport_; //!< default full size viewport 100 92 101 //! Method called by the LogListener from Ogre102 void messageLogged(const std::string&, Ogre::LogMessageLevel,103 bool, const std::string&);93 // stats 94 float avgTickTime_; //!< time in ms to tick() one frame 95 float avgFramesPerSecond_; //!< number of frames processed in one second 104 96 105 Ogre::Root* root_; //!< Ogre's root 106 Ogre::SceneManager* scene_; //!< scene manager of the game 107 Ogre::RenderWindow* renderWindow_; //!< the current render window 108 std::string resourceFile_; //!< resources file name 109 std::string ogreConfigFile_; //!< ogre config file name 110 std::string ogrePluginsFile_; //!< ogre plugins file name 111 std::string ogreLogFile_; //!< log file name for Ogre log messages 112 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 113 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 114 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 115 unsigned int detailLevelParticle_; //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high) 116 float avgTickTime_; //!< time in ms to tick() one frame 117 float avgFramesPerSecond_; //!< number of frames processed in one second 97 // config values 98 unsigned int detailLevelParticle_; //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high) 99 100 static GraphicsEngine* singletonRef_s; //!< Pointer to the Singleton 118 101 }; 119 102 }
Note: See TracChangeset
for help on using the changeset viewer.