1 | /** |
---|
2 | @file GraphicsEngine.h |
---|
3 | @brief Graphics Engine |
---|
4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _GraphicsEngine_H__ |
---|
8 | #define _GraphicsEngine_H__ |
---|
9 | |
---|
10 | #include <string> |
---|
11 | |
---|
12 | #include <OgrePrerequisites.h> |
---|
13 | #include <OgreRoot.h> |
---|
14 | #include <OgreSceneManager.h> |
---|
15 | |
---|
16 | #include "OrxonoxPrereqs.h" |
---|
17 | #include "core/OrxonoxClass.h" |
---|
18 | |
---|
19 | |
---|
20 | namespace orxonox { |
---|
21 | |
---|
22 | /** |
---|
23 | * graphics engine manager class |
---|
24 | */ |
---|
25 | class _OrxonoxExport GraphicsEngine : public OrxonoxClass |
---|
26 | { |
---|
27 | public: |
---|
28 | GraphicsEngine(); |
---|
29 | inline void setConfigPath(std::string path) { this->configPath_ = path; }; |
---|
30 | // find a better way for this |
---|
31 | //inline Ogre::Root* getRoot() { return root_; }; |
---|
32 | void setConfigValues(); |
---|
33 | void setup(); |
---|
34 | bool load(std::string path); |
---|
35 | void loadRessourceLocations(std::string path); |
---|
36 | Ogre::SceneManager* getSceneManager(); |
---|
37 | void initialise(); |
---|
38 | |
---|
39 | // several window properties |
---|
40 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
41 | size_t getWindowHandle(); |
---|
42 | int getWindowWidth() const; |
---|
43 | int getWindowHeight() const; |
---|
44 | |
---|
45 | // Ogre Root access for Orxonox |
---|
46 | void frameStarted(Ogre::FrameEvent &evt) |
---|
47 | { if (root_) root_->_fireFrameStarted(evt); } |
---|
48 | void frameEnded (Ogre::FrameEvent &evt) |
---|
49 | { if (root_) root_->_fireFrameEnded(evt); } |
---|
50 | void renderOneFrame() |
---|
51 | { if (root_) root_->_updateAllRenderTargets(); } |
---|
52 | |
---|
53 | virtual ~GraphicsEngine(); |
---|
54 | |
---|
55 | private: |
---|
56 | Ogre::Root* root_; //!< Ogre's root |
---|
57 | std::string configPath_; //!< path to config file |
---|
58 | std::string dataPath_; //!< path to data file |
---|
59 | Ogre::SceneManager* scene_; //!< scene manager of the game |
---|
60 | Ogre::RenderWindow* renderWindow_;//!< the current render window |
---|
61 | //bool bOverwritePath_; //!< overwrites path |
---|
62 | |
---|
63 | }; |
---|
64 | |
---|
65 | } |
---|
66 | |
---|
67 | #endif /* _GraphicsEngine_H__ */ |
---|