Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 19, 2009, 10:58:43 AM (15 years ago)
Author:
rgrieder
Message:

Move graphic related content of GSGraphics to GraphicsManager which originally was GraphisEngine (but since we don't have an engine of our own, I renamed it).
Reduced OgreWindowEventUtilities.h dependency from GraphisManager.h (includes windows.h).

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/GraphicsManager.h

    r2797 r2801  
    2929
    3030/**
    31   @file
    32   @brief Declaration of GraphicsEngine Singleton.
    33   @author Benjamin Knecht <beni_at_orxonox.net>
     31@file
     32@brief
     33    Declaration of GraphicsManager Singleton.
    3434 */
    3535
     
    4040
    4141#include <string>
     42#include <cassert>
     43#include <OgreLog.h>
    4244
    43 #include <OgrePrerequisites.h>
    4445#include "core/OrxonoxClass.h"
    4546
     
    4748{
    4849    /**
    49     @brief Graphics engine manager class
     50    @brief
     51        Graphics engine manager class
    5052    */
    51     class _OrxonoxExport GraphicsEngine : public OrxonoxClass
     53    class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
    5254    {
    53         // HACK: temporary means
    54         friend class GSGraphics;
    55 
    5655    public:
    57         GraphicsEngine();
    58         ~GraphicsEngine();
     56        GraphicsManager();
     57        ~GraphicsManager();
    5958
    6059        void setConfigValues();
     60        void initialise();
     61
     62        void update(const Clock& time);
     63
    6164        void detailLevelParticleChanged();
     65        inline unsigned int getDetailLevelParticle() const
     66            { return this->detailLevelParticle_; }
    6267
     68        // <HACK>
    6369        float getAverageFramesPerSecond() const   { return this->avgFramesPerSecond_; }
    6470        float getAverageTickTime() const          { return this->avgTickTime_; }
    6571        void setAverageTickTime(float tickTime)   { this->avgTickTime_ = tickTime; }
    6672        void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; }
    67 
    68         inline unsigned int getDetailLevelParticle() const
    69         { return this->detailLevelParticle_; }
    70 
    71         static GraphicsEngine& getInstance();
    72         static GraphicsEngine* getInstancePtr() { return singletonRef_s; }
     73        // </HACK>
    7374
    7475        inline void setViewport(Ogre::Viewport* viewport)
     
    7677        inline Ogre::Viewport* getViewport() const
    7778            { return this->viewport_; }
     79        inline Ogre::RenderWindow* getRenderWindow()
     80            { return this->renderWindow_; }
     81
     82        static GraphicsManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     83
    7884
    7985    private:
    80         // don't mess with singletons
    81         GraphicsEngine(GraphicsEngine&);
     86        GraphicsManager(GraphicsManager&); // don't mess with singletons
    8287
    83         Ogre::Viewport*     viewport_;              //!< default full size viewport
     88        // OGRE initialisation
     89        void setupOgre();
     90        void loadOgrePlugins();
     91        void declareResources();
     92        void loadRenderer();
     93        void initialiseResources();
    8494
    85         // stats
    86         float               avgTickTime_;           //!< time in ms to tick() one frame
    87         float               avgFramesPerSecond_;    //!< number of frames processed in one second
     95        // event from Ogre::LogListener
     96        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
     97            bool maskDebug, const std::string& logName);
     98
     99        // console commands
     100        void printScreen();
     101
     102    private:
     103        bool                loaded_;
     104
     105        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
     106        Ogre::LogManager*   ogreLogger_;
     107        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
     108        Ogre::Viewport*     viewport_;                 //!< default full size viewport
     109        OgreWindowEventListener* ogreWindowEventListener_;
     110
     111        // stats (Hack)
     112        float               avgTickTime_;              //!< time in ms to tick() one frame
     113        float               avgFramesPerSecond_;       //!< number of frames processed in one second
    88114
    89115        // config values
    90         unsigned int        detailLevelParticle_;   //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
     116        unsigned int        detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
     117        std::string         resourceFile_;             //!< resources file name
     118        std::string         ogreConfigFile_;           //!< ogre config file name
     119        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
     120        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
     121        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
     122        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
     123        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
     124        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
    91125
    92         static GraphicsEngine* singletonRef_s;      //!< Pointer to the Singleton
     126        // console commands
     127        ConsoleCommand*     ccPrintScreen_;
     128
     129        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
    93130    };
    94131}
Note: See TracChangeset for help on using the changeset viewer.