Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2008, 1:37:36 AM (16 years ago)
Author:
rgrieder
Message:

merged gui back to trunk.
update the media repository!

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/GraphicsEngine.h

    r1747 r1755  
    2222 *   Author:
    2323 *      Reto Grieder
     24 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
    2425 *   Co-authors:
    25  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007, Felix Schulthess
     26 *      Felix Schulthess
    2627 *
    2728 */
     
    4142
    4243#include <OgrePrerequisites.h>
    43 #include <OgreLog.h>
    44 #include <OgreRenderWindow.h>
    45 #include <OgreWindowEventUtilities.h>
    4644#include "core/OrxonoxClass.h"
    47 
    4845
    4946namespace orxonox
     
    5249    @brief Graphics engine manager class
    5350    */
    54     class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass
     51    class _OrxonoxExport GraphicsEngine : public OrxonoxClass
    5552    {
    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;
    6455
    65             void destroy();
     56    public:
     57        GraphicsEngine();
     58        ~GraphicsEngine();
    6659
    67             Ogre::SceneManager* getSceneManager() { return scene_; }
     60        void setConfigValues();
     61        void detailLevelParticleChanged();
    6862
    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_; }
    7965
    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_; }
    8268
    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; }
    8777
    88             inline unsigned int getDetailLevelParticle() const
    89               { return this->detailLevelParticle_; }
     78        inline unsigned int getDetailLevelParticle() const
     79        { return this->detailLevelParticle_; }
    9080
    91             static GraphicsEngine& getSingleton();
    92             static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
     81        static GraphicsEngine& getInstance();
     82        static GraphicsEngine* getInstancePtr() { return singletonRef_s; }
    9383
     84    private:
     85        // don't mess with singletons
     86        GraphicsEngine(GraphicsEngine&);
    9487
    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
    10092
    101             //! Method called by the LogListener from Ogre
    102             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
    10496
    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
    118101    };
    119102}
Note: See TracChangeset for help on using the changeset viewer.