Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/GraphicsManager.h @ 11247

Last change on this file since 11247 was 11085, checked in by landauf, 9 years ago

enable glow shader in all scenes

  • Property svn:eol-style set to native
File size: 5.3 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/**
[7401]31    @defgroup Graphics Graphics and GUI
32    @ingroup Core
33*/
34
35/**
[2801]36@file
[7401]37@ingroup Graphics
[2801]38@brief
39    Declaration of GraphicsManager Singleton.
[612]40 */
41
[2805]42#ifndef _GraphicsManager_H__
43#define _GraphicsManager_H__
[612]44
[3346]45#include "CorePrereqs.h"
[1039]46
[3196]47#include <cassert>
[715]48#include <string>
[11071]49#include <memory>
50
[2801]51#include <OgreLog.h>
[5695]52
[8423]53#include "util/DestructionHelper.h"
[3366]54#include "util/Singleton.h"
[9667]55#include "config/Configurable.h"
[612]56
[8079]57// tolua_begin
[1625]58namespace orxonox
59{
[1214]60    /**
[2801]61    @brief
62        Graphics engine manager class
[1214]63    */
[8079]64    class _CoreExport GraphicsManager
65// tolua_end
[9667]66        : public Singleton<GraphicsManager>, public Configurable, public Ogre::LogListener
[8079]67    { // tolua_export
[3366]68        friend class Singleton<GraphicsManager>;
[1755]69    public:
[5695]70        GraphicsManager(bool bLoadRenderer = true);
[612]71
[8423]72        //! Leave empty and use cleanup() instead
[11071]73        ~GraphicsManager() = default;
[8423]74        /// Destructor that also executes when object fails to construct
75        void destroy();
76
[1755]77        void setConfigValues();
[2801]78
[6417]79        void postUpdate(const Clock& time);
[2801]80
[5695]81        Ogre::Viewport* getViewport()         { return this->viewport_; }
82        Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; }
83        size_t getRenderWindowHandle();
[8079]84
85// tolua_begin
86        static GraphicsManager& getInstance() { return Singleton<GraphicsManager>::getInstance(); } // tolua_export
87
[5695]88        bool isFullScreen() const;
[8079]89        unsigned int getWindowWidth() const;
90        unsigned int getWindowHeight() const;
[2662]91
[8079]92        bool hasVSyncEnabled() const;
93        std::string getFSAAMode() const;
94// tolua_end
95
[5695]96        void upgradeToGraphics();
[5929]97        void loadDebugOverlay();
[10624]98        void unloadDebugOverlay();
[11071]99        bool rendererLoaded() const { return renderWindow_ != nullptr; }
[5695]100
[2850]101        void setCamera(Ogre::Camera* camera);
102
[1755]103    private:
[11071]104        // non-copyable:
105        GraphicsManager(const GraphicsManager&) = delete;
106        GraphicsManager& operator=(const GraphicsManager&) = delete;
[1502]107
[2801]108        // OGRE initialisation
[5695]109        void loadOgreRoot();
[2801]110        void loadOgrePlugins();
111        void loadRenderer();
[2662]112
[2801]113        // event from Ogre::LogListener
[9675]114#if OGRE_VERSION >= 0x010800
[11071]115        virtual void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName, bool& skipThisMessage) override;
[9675]116#else
[11071]117        virtual void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName) override;
[9675]118#endif
[612]119
[2801]120        // console commands
121        void printScreen();
[8079]122        std::string setScreenResolution(unsigned int width, unsigned int height, bool fullscreen);
123        std::string setFSAA(const std::string& mode);
124        std::string setVSync(bool vsync);
[2801]125
[8423]126        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
127        Ogre::LogManager*        ogreLogger_;
128        Ogre::Root*              ogreRoot_;                //!< Ogre's root
[11085]129        Ogre::RenderWindow*      renderWindow_;            //!< the one and only render window
130        Ogre::Viewport*          viewport_;                //!< default full size viewport
131        GlowMaterialListener*    glowMaterialListener_;    //!< Material Listener for the 'Glow' compositor
132        float                    lastFrameStartTime_;      //!< Time stamp of the beginning of the last frame
133        float                    lastFrameEndTime_;        //!< Time stamp of the end of the last frame
[2801]134
[5929]135        // XML files for the resources and the debug overlay
[11071]136        std::shared_ptr<XMLFile> resources_;           //!< XML with resource locations
137        std::shared_ptr<XMLFile> extResources_;        //!< XML with resource locations in the external path (only for dev runs)
138        std::shared_ptr<XMLFile> debugOverlay_;        //!< XML with various debug overlays
[5695]139
[1755]140        // config values
[6105]141        std::string         ogreConfigFile_;           //!< ogre config filename
[2801]142        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
[6105]143        std::string         ogreLogFile_;              //!< log filename for Ogre log messages
[1755]144
[8423]145        /// Helper object that executes the surrogate destructor destroy()
146        DestructionHelper<GraphicsManager> destructionHelper_;
147
[3366]148        static GraphicsManager* singletonPtr_s;        //!< Pointer to the Singleton
[8079]149// tolua_begin
[1214]150    };
[612]151}
[8079]152// tolua_end
[612]153
[2805]154#endif /* _GraphicsManager_H__ */
Note: See TracBrowser for help on using the repository browser.