Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2845 was 2817, checked in by rgrieder, 16 years ago

Removed GameState template and renamed GameStateBase to GameState.
Moved statistics stuff (fps and tick time) to Game and removed the remaining hacks in GSGraphics and GSRoot.

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
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:
23 *      Reto Grieder
24 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
25 *   Co-authors:
26 *      Felix Schulthess
27 *
28 */
29
30/**
31@file
32@brief
33    Declaration of GraphicsManager Singleton.
34 */
35
36#ifndef _GraphicsManager_H__
37#define _GraphicsManager_H__
38
39#include "OrxonoxPrereqs.h"
40
41#include <string>
42#include <cassert>
43#include <OgreLog.h>
44
45#include "core/OrxonoxClass.h"
46
47namespace orxonox
48{
49    /**
50    @brief
51        Graphics engine manager class
52    */
53    class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
54    {
55    public:
56        GraphicsManager();
57        ~GraphicsManager();
58
59        void setConfigValues();
60        void initialise();
61
62        void update(const Clock& time);
63
64        void detailLevelParticleChanged();
65        inline unsigned int getDetailLevelParticle() const
66            { return this->detailLevelParticle_; }
67
68        inline void setViewport(Ogre::Viewport* viewport)
69            { this->viewport_ = viewport; }
70        inline Ogre::Viewport* getViewport() const
71            { return this->viewport_; }
72        inline Ogre::RenderWindow* getRenderWindow()
73            { return this->renderWindow_; }
74
75        static GraphicsManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
76
77
78    private:
79        GraphicsManager(GraphicsManager&); // don't mess with singletons
80
81        // OGRE initialisation
82        void setupOgre();
83        void loadOgrePlugins();
84        void declareResources();
85        void loadRenderer();
86        void initialiseResources();
87
88        // event from Ogre::LogListener
89        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
90            bool maskDebug, const std::string& logName);
91
92        // console commands
93        void printScreen();
94
95    private:
96        bool                loaded_;
97
98        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
99        Ogre::LogManager*   ogreLogger_;
100        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
101        Ogre::Viewport*     viewport_;                 //!< default full size viewport
102        OgreWindowEventListener* ogreWindowEventListener_;
103
104        // stats (Hack)
105        float               avgTickTime_;              //!< time in ms to tick() one frame
106        float               avgFramesPerSecond_;       //!< number of frames processed in one second
107
108        // config values
109        unsigned int        detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
110        std::string         resourceFile_;             //!< resources file name
111        std::string         ogreConfigFile_;           //!< ogre config file name
112        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
113        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
114        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
115        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
116        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
117        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
118
119        // console commands
120        ConsoleCommand*     ccPrintScreen_;
121
122        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
123    };
124}
125
126#endif /* _GraphicsManager_H__ */
Note: See TracBrowser for help on using the repository browser.