Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/GraphicsManager.h @ 4725

Last change on this file since 4725 was 3370, checked in by rgrieder, 15 years ago

Merged resource branch back to the trunk. Changes:

  • Automated graphics loading by evaluating whether a GameState requires it
  • Using native Tcl library (x3n)

Windows users: Update your dependency package!

  • Property svn:eol-style set to native
File size: 3.8 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 "CorePrereqs.h"
40
41#include <cassert>
42#include <string>
43#include <OgreLog.h>
44#include "util/Singleton.h"
45#include "OrxonoxClass.h"
46
47namespace orxonox
48{
49    /**
50    @brief
51        Graphics engine manager class
52    */
53    class _CoreExport GraphicsManager : public Singleton<GraphicsManager>, public OrxonoxClass, public Ogre::LogListener
54    {
55        friend class Singleton<GraphicsManager>;
56    public:
57        GraphicsManager();
58        ~GraphicsManager();
59
60        void setConfigValues();
61
62        void update(const Clock& time);
63
64        inline Ogre::Viewport* getViewport()
65            { return this->viewport_; }
66        inline Ogre::RenderWindow* getRenderWindow()
67            { return this->renderWindow_; }
68
69        void setCamera(Ogre::Camera* camera);
70
71    private:
72        GraphicsManager(GraphicsManager&); // don't mess with singletons
73
74        // OGRE initialisation
75        void setupOgre();
76        void loadOgrePlugins();
77        void declareResources();
78        void loadRenderer();
79        void initialiseResources();
80
81        // event from Ogre::LogListener
82        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
83            bool maskDebug, const std::string& logName);
84
85        // console commands
86        void printScreen();
87
88    private:
89        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
90        Ogre::LogManager*   ogreLogger_;
91        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
92        Ogre::Viewport*     viewport_;                 //!< default full size viewport
93        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
94
95        // config values
96        std::string         resourceFile_;             //!< resources file name
97        std::string         ogreConfigFile_;           //!< ogre config file name
98        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
99        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
100        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
101        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
102        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
103        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
104
105        // console commands
106        ConsoleCommand*     ccPrintScreen_;
107
108        static GraphicsManager* singletonPtr_s;        //!< Pointer to the Singleton
109    };
110}
111
112#endif /* _GraphicsManager_H__ */
Note: See TracBrowser for help on using the repository browser.