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 00035 00036 extern const int FastEcslent::MaxEnts; 00037 00038 namespace OgreGFX { 00039 00040 class Engine; 00041 class GraphicsInteractionManager : public Ogre::FrameListener, public Ogre::WindowEventListener { 00042 public: 00043 GraphicsInteractionManager(FastEcslent::Engine* eng); 00044 ~GraphicsInteractionManager(void); 00045 00046 void go(void); 00047 FastEcslent::Engine* engine; 00048 UIMgr* uiMgr; 00049 WidgetMgr* widgetMgr; 00050 LobbyMgr *lobbyMgr; 00051 00052 Ogre::Root *mRoot; 00053 Ogre::SceneManager* mSceneMgr; 00054 Ogre::RenderWindow* mWindow; 00055 Ogre::Camera* mCamera; 00056 00057 GFXNode gfxNodes[FastEcslent::MaxEnts]; 00058 std::map<Ogre::SceneNode*, int> sceneNodeToEntIdMap; 00059 int nGFXNodes; 00060 00061 Ogre::Plane oceanSurface; 00062 00063 void loadGameGFX(void); 00064 00065 // Ogre::FrameListener 00066 bool frameRenderingQueued(const Ogre::FrameEvent& evt); 00067 // Ogre::WindowEventListener 00068 //Adjust mouse clipping area 00069 void windowResized(Ogre::RenderWindow* rw); 00070 //Unattach OIS before window shutdown (very important under Linux) 00071 void windowClosed(Ogre::RenderWindow* rw); 00072 00073 void makeNode(FastEcslent::Entity *); 00074 00075 private: 00076 void initGFXManagers(); 00077 bool configure(void); 00078 void chooseSceneManager(void); 00079 void createCamera(void); 00080 00081 void createUIMgr(void); 00082 void createWidgetMgr(void); 00083 00084 void createScene(void);// = 0; // Override me! 00085 void destroyScene(void); 00086 void createViewports(void); 00087 void setupResources(void); 00088 void createResourceListener(void); 00089 void loadResources(void); 00090 00091 bool setup(); 00092 bool setupGame(); 00093 void createLobbyMgr(void); 00094 void loadLobbyGFX(void); 00095 00096 //Simulation bridge 00097 void makeInitialEntityNodes(); 00098 00099 void handleDevelopingEnts(); 00100 void handleBornEnts(); 00101 void copySimState(); 00102 00103 Ogre::String mResourcesCfg; 00104 Ogre::String mPluginsCfg; 00105 00106 bool mCursorWasVisible; // was cursor visible before dialog appeared 00107 bool mShutDown; 00108 }; 00109 00110 } 00111 00112 #endif /* GRAPHICSINTERACTIONMANAGER_H_ */