Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/orxonox/GraphicsEngine.h @ 1494

Last change on this file since 1494 was 1494, checked in by rgrieder, 16 years ago
  • set the svn:eol-style property to all files so, that where ever you check out, you'll get the right line endings (had to change every file with mixed endings to windows in order to set the property)
  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net < *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
23 *   Co-authors:
24 *      Reto Grieder
25 *
26 */
27
28/**
29  @file
30  @brief Declaration of GraphicsEngine Singleton.
31  @author Benjamin Knecht <beni_at_orxonox.net>
32 */
33
34#ifndef _GraphicsEngine_H__
35#define _GraphicsEngine_H__
36
37#include "OrxonoxPrereqs.h"
38
39#include <string>
40
41#include <OgrePrerequisites.h>
42#include <OgreLog.h>
43#include <OgreRenderWindow.h>
44#include <OgreWindowEventUtilities.h>
45#include "core/OrxonoxClass.h"
46
47
48namespace orxonox {
49
50    /**
51    @brief Graphics engine manager class
52    */
53    class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass
54    {
55        public:
56            void setConfigValues();
57            bool setup(std::string& dataPath);
58            void declareRessourceLocations();
59            bool loadRenderer();
60            bool initialiseResources();
61            bool createNewScene();
62
63            void destroy();
64
65            Ogre::SceneManager* getSceneManager() { return scene_; }
66            std::string& getDataPath() { return dataPath_; }
67
68            // several window properties
69            Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; }
70            size_t getWindowHandle();
71            int getWindowWidth() const;
72            int getWindowHeight() const;            float getWindowAspectRatio() const;
73            float getAverageFPS() const
74            { if (renderWindow_) return this->renderWindow_->getAverageFPS(); else return 0.0f; }
75
76            void windowMoved       (Ogre::RenderWindow* rw);
77            void windowResized     (Ogre::RenderWindow* rw);
78            void windowFocusChanged(Ogre::RenderWindow* rw);
79            void windowClosed      (Ogre::RenderWindow* rw);
80
81            static GraphicsEngine& getSingleton();
82            static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
83
84            //HACK!!!
85            void static CompositorBloomOn();
86            void static CompositorBloomOff();
87            void static CompositorMotionBlurOn();
88            void static CompositorMotionBlurOff();
89
90
91        private:
92            // don't mess with singletons
93            GraphicsEngine();
94            ~GraphicsEngine();
95            GraphicsEngine(GraphicsEngine&) { }
96
97            //! Method called by the LogListener from Ogre
98            void messageLogged(const std::string&, Ogre::LogMessageLevel,
99                             bool, const std::string&);
100
101            Ogre::Root*         root_;        //!< Ogre's root
102            Ogre::SceneManager* scene_;       //!< scene manager of the game
103            Ogre::RenderWindow* renderWindow_;//!< the current render window
104            //bool               bOverwritePath_; //!< overwrites path
105            //std::string         configPath_;  //!< path to config file
106            std::string         dataPath_;    //!< path to data file
107            std::string         ogreLogfile_; //!< log file name for Ogre log messages
108            int ogreLogLevelTrivial_;         //!< Corresponding Orxonx debug level for LL_TRIVIAL
109            int ogreLogLevelNormal_;          //!< Corresponding Orxonx debug level for LL_NORMAL
110            int ogreLogLevelCritical_;        //!< Corresponding Orxonx debug level for LL_CRITICAL
111    };
112}
113
114#endif /* _GraphicsEngine_H__ */
Note: See TracBrowser for help on using the repository browser.