00001 /* 00002 * GraphicsInteractionManager.h 00003 * 00004 * Created on: Dec 20, 2011 00005 * Author: sushil 00006 */ 00007 00008 00009 #ifndef GRAPHICSINTERACTIONMANAGER_H_ 00010 #define GRAPHICSINTERACTIONMANAGER_H_ 00011 00012 00013 #include <map> 00014 00015 #include <OgreCamera.h> 00016 00017 #include <OgreRoot.h> 00018 #include <OgreViewport.h> 00019 #include <OgreSceneManager.h> 00020 #include <OgreRenderWindow.h> 00021 #include <OgreConfigFile.h> 00022 #include <OgreSceneNode.h> 00023 00024 #include <OgreFrameListener.h> 00025 #include <OgreWindowEventUtilities.h> 00026 00027 #include <gfxNode.h> 00028 #include <const.h> 00029 #include <uiMgr.h> 00030 #include <widgetMgr.h> 00031 #include <gfxConst.h> 00032 00033 #include <lobbyMgr.h> 00034 #include <OgreParticleSystem.h> 00035 #include <OgreParticleEmitter.h> 00036 00037 extern const int FastEcslent::MaxEnts; 00038 namespace OgreSND { // If you are in a different namespace you need to be forward declared here 00039 class SoundMgr; 00040 } 00041 00042 namespace OgreGFX { 00043 00044 class Engine; 00045 class WidgetMgr; 00046 class GraphicsInteractionManager : public Ogre::FrameListener, public Ogre::WindowEventListener { 00047 public: 00048 GraphicsInteractionManager(FastEcslent::Engine* eng); 00049 ~GraphicsInteractionManager(void); 00050 00051 void go(void); 00052 FastEcslent::Engine* engine; 00053 UIMgr* uiMgr; 00054 WidgetMgr* widgetMgr; 00055 LobbyMgr *lobbyMgr; 00056 OgreSND::SoundMgr* soundMgr; 00057 00058 Ogre::Root *mRoot; 00059 Ogre::SceneManager* mSceneMgr; 00060 Ogre::RenderWindow* mWindow; 00061 Ogre::Camera* mCamera; 00062 00063 GFXNode gfxNodes[FastEcslent::MaxEnts]; 00064 std::map<Ogre::SceneNode*, int> sceneNodeToEntIdMap; 00065 int nGFXNodes; 00066 00067 Ogre::Plane oceanSurface; 00068 00069 void loadGameGFX(void); 00070 00071 // Ogre::FrameListener 00072 bool frameRenderingQueued(const Ogre::FrameEvent& evt); 00073 // Ogre::WindowEventListener 00074 //Adjust mouse clipping area 00075 void windowResized(Ogre::RenderWindow* rw); 00076 //Unattach OIS before window shutdown (very important under Linux) 00077 void windowClosed(Ogre::RenderWindow* rw); 00078 00079 void makeNode(FastEcslent::Entity *); 00080 00081 private: 00082 void initGFXManagers(); 00083 bool configure(void); 00084 void chooseSceneManager(void); 00085 void createCamera(void); 00086 void createFrameListener(void); 00087 00088 void createUIMgr(void); 00089 void createWidgetMgr(void); 00090 void createSoundMgr(void); 00091 00092 void createScene(void);// = 0; // Override me! 00093 void destroyScene(void); 00094 void createViewports(void); 00095 void setupResources(void); 00096 void createResourceListener(void); 00097 void loadResources(void); 00098 00099 bool setup(); 00100 bool setupGame(); 00101 void createLobbyMgr(void); 00102 void loadLobbyGFX(void); 00103 00104 //Simulation bridge 00105 void makeInitialEntityNodes(); 00106 00107 void handleDevelopingEnts(); 00108 void handleBornEnts(); 00109 void copySimState(); 00110 00111 /* 00112 * Trigger explosion on a certain unit 00113 * @param node, entity node where explosion show 00114 */ 00115 void explode(Ogre::SceneNode *node); 00116 /* 00117 * Create explosion particle system 00118 */ 00119 void createParticleSystem(); 00120 00121 Ogre::String mResourcesCfg; 00122 Ogre::String mPluginsCfg; 00123 00124 bool mCursorWasVisible; // was cursor visible before dialog appeared 00125 bool mShutDown; 00126 //particle system for explosion 00127 Ogre::ParticleSystem *explosionParticleSystem; 00128 }; 00129 00130 } 00131 00132 #endif /* GRAPHICSINTERACTIONMANAGER_H_ */