Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/resource2/src/core/GraphicsManager.h @ 5614

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

Creating Ogre::Root in non graphics mode as well. This allows to always make use of the ResourceGroupManager.
Also removed resource related parts from GraphicsManager.

This revision does not run!

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