Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GOgreApp.h
Go to the documentation of this file.
1 // Copyright (C) 2004-2013 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef GOGREAPP_H
22 #define GOGREAPP_H
23 
24 #include "../Math_LIB/MMatrix3x3.h"
25 #include "GUtils.h"
26 
27 #include <string>
28 
29 class TiXmlElement;
30 
31 namespace OpenSkyNet {
32  namespace Graphics {
34  class OgreApp {
35  protected:
36  Ogre::Root* _root;
37  Ogre::Camera* _camera;
38  Ogre::SceneManager* _sceneMgr;
39  Ogre::RenderWindow* _window;
40  std::map<std::string, Ogre::SceneNode*> _namesToSerializableNodes;
41  std::vector<Ogre::SceneNode*> _nonPersistentNodes;
42  std::map<std::string, Ogre::Light*> _namesToSerializableLights;
43  std::vector<Ogre::Light*> _nonPersistentLights;
44 
46  virtual void setupResources();
48  virtual bool configure(bool restoreOgreConfig_);
49  virtual void chooseSceneManager();
50  virtual void createCamera();
51  virtual void createViewports();
53  virtual void createResourceListener() {}
56  virtual void loadResources();
57 
74  void processSceneGraphXML(TiXmlElement* element_, Ogre::SceneNode* parentSceneNode_);
75  void serialize(TiXmlElement* element_, Ogre::SceneNode* parentSceneNode_);
76  public:
77  OgreApp() : _root(0), _camera(0), _sceneMgr(0), _window(0) {}
78  virtual ~OgreApp() { if (_root) delete _root; }
79 
80  inline Ogre::SceneNode* getSceneNode(const char* name_) const { return _sceneMgr->getSceneNode(Ogre::String(name_)); }
81 
82  inline Ogre::SceneManager* getSceneManager() const { return _sceneMgr; }
83 
84  inline const Ogre::Camera* getCam() const { return _camera; }
85 
86  inline Ogre::RenderWindow* getWindow() const { return _window; }
87 
88  inline const std::vector<Ogre::SceneNode*>& getNonPersistentNodes() const { return _nonPersistentNodes; }
89 
91  virtual bool setup(bool restoreOgreConfig_);
92 
94  virtual void createScene(const char* sceneGraphXML_);
95 
96  Ogre::SceneNode* createSceneNode(const char* name_, bool isPersistent_, Ogre::SceneNode* parent_);
97 
99  virtual void destroyScene(bool doDestroyPersistentData_);
100 
101  virtual void go() {
102  _root->startRendering();
103 
104  // clean up
105  destroyScene(true);
106  }
107 
110  void serializeSceneGraph(const char* sceneGraphXML_);
111  };
112  }
113 }
114 
115 #endif //GOGREAPP_H
virtual ~OgreApp()
Definition: GOgreApp.h:78
Ogre::SceneManager * getSceneManager() const
Definition: GOgreApp.h:82
Ogre::Camera * _camera
Definition: GOgreApp.h:37
virtual void createScene(const char *sceneGraphXML_)
Definition: GOgreApp.cpp:95
const std::vector< Ogre::SceneNode * > & getNonPersistentNodes() const
Definition: GOgreApp.h:88
std::vector< Ogre::Light * > _nonPersistentLights
Definition: GOgreApp.h:43
std::map< std::string, Ogre::SceneNode * > _namesToSerializableNodes
Definition: GOgreApp.h:40
std::vector< Ogre::SceneNode * > _nonPersistentNodes
Definition: GOgreApp.h:41
std::map< std::string, Ogre::Light * > _namesToSerializableLights
Definition: GOgreApp.h:42
Ogre::RenderWindow * getWindow() const
Definition: GOgreApp.h:86
Ogre::RenderWindow * _window
Definition: GOgreApp.h:39
const Ogre::Camera * getCam() const
Definition: GOgreApp.h:84
virtual void destroyScene(bool doDestroyPersistentData_)
Definition: GOgreApp.cpp:141
virtual bool configure(bool restoreOgreConfig_)
Definition: GOgreApp.cpp:62
Ogre::SceneNode * getSceneNode(const char *name_) const
Definition: GOgreApp.h:80
virtual void setupResources()
Definition: GOgreApp.cpp:41
virtual void go()
Definition: GOgreApp.h:101
virtual void createViewports()
Definition: GOgreApp.cpp:81
void processSceneGraphXML(TiXmlElement *element_, Ogre::SceneNode *parentSceneNode_)
Definition: GOgreApp.cpp:166
OgreApp()
Definition: GOgreApp.h:77
Definition: GOgreApp.h:34
Ogre::SceneNode * createSceneNode(const char *name_, bool isPersistent_, Ogre::SceneNode *parent_)
Definition: GOgreApp.cpp:132
virtual void createCamera()
Definition: GOgreApp.cpp:74
virtual void loadResources()
Definition: GOgreApp.cpp:90
Ogre::Root * _root
Definition: GOgreApp.h:36
virtual void createResourceListener()
Definition: GOgreApp.h:53
Ogre::SceneManager * _sceneMgr
Definition: GOgreApp.h:38
void serializeSceneGraph(const char *sceneGraphXML_)
Definition: GOgreApp.cpp:267
virtual void chooseSceneManager()
Definition: GOgreApp.cpp:70
void serialize(TiXmlElement *element_, Ogre::SceneNode *parentSceneNode_)
Definition: GOgreApp.cpp:208
virtual bool setup(bool restoreOgreConfig_)
Definition: GOgreApp.cpp:14