Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gui/src/orxonox/GraphicsManager.h @ 2802

Last change on this file since 2802 was 2801, checked in by rgrieder, 16 years ago

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).

  • Property svn:eol-style set to native
File size: 4.7 KB
RevLine 
[1035]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
[1505]3 *                    > www.orxonox.net <
[1035]4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
[1535]23 *      Reto Grieder
[1755]24 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
[1035]25 *   Co-authors:
[1755]26 *      Felix Schulthess
[1035]27 *
28 */
29
[612]30/**
[2801]31@file
32@brief
33    Declaration of GraphicsManager Singleton.
[612]34 */
35
[673]36#ifndef _GraphicsEngine_H__
37#define _GraphicsEngine_H__
[612]38
[1039]39#include "OrxonoxPrereqs.h"
40
[715]41#include <string>
[2801]42#include <cassert>
43#include <OgreLog.h>
[715]44
[1021]45#include "core/OrxonoxClass.h"
[612]46
[1625]47namespace orxonox
48{
[1214]49    /**
[2801]50    @brief
51        Graphics engine manager class
[1214]52    */
[2801]53    class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
[1214]54    {
[1755]55    public:
[2801]56        GraphicsManager();
57        ~GraphicsManager();
[612]58
[1755]59        void setConfigValues();
[2801]60        void initialise();
61
62        void update(const Clock& time);
63
[1755]64        void detailLevelParticleChanged();
[2801]65        inline unsigned int getDetailLevelParticle() const
66            { return this->detailLevelParticle_; }
[1293]67
[2801]68        // <HACK>
[1755]69        float getAverageFramesPerSecond() const   { return this->avgFramesPerSecond_; }
70        float getAverageTickTime() const          { return this->avgTickTime_; }
71        void setAverageTickTime(float tickTime)   { this->avgTickTime_ = tickTime; }
72        void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; }
[2801]73        // </HACK>
[1293]74
[2662]75        inline void setViewport(Ogre::Viewport* viewport)
76            { this->viewport_ = viewport; }
77        inline Ogre::Viewport* getViewport() const
78            { return this->viewport_; }
[2801]79        inline Ogre::RenderWindow* getRenderWindow()
80            { return this->renderWindow_; }
[2662]81
[2801]82        static GraphicsManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
83
84
[1755]85    private:
[2801]86        GraphicsManager(GraphicsManager&); // don't mess with singletons
[1502]87
[2801]88        // OGRE initialisation
89        void setupOgre();
90        void loadOgrePlugins();
91        void declareResources();
92        void loadRenderer();
93        void initialiseResources();
[2662]94
[2801]95        // event from Ogre::LogListener
96        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
97            bool maskDebug, const std::string& logName);
[612]98
[2801]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
114
[1755]115        // config values
[2801]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
[1755]125
[2801]126        // console commands
127        ConsoleCommand*     ccPrintScreen_;
128
129        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
[1214]130    };
[612]131}
132
[673]133#endif /* _GraphicsEngine_H__ */
Note: See TracBrowser for help on using the repository browser.