00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef __SO3ROOT_H__
00036 #define __SO3ROOT_H__
00037
00038 #include "../SCOLBasic/SO3Std.h"
00039 #include <OgreSingleton.h>
00040 #ifdef SO3_DEVELOPPER_BUILD
00041 # if SO3_PLUGIN_WEB_MANAGER_BUILD == 1
00042 # include "../SO3Plugins/SO3WebNavigator/SO3WebNavigatorPlugin.h"
00043 # endif
00044 #endif
00045
00046 namespace SO3
00047 {
00048
00049 class _SO3_Export SRoot : public Ogre::Singleton<SRoot>, public Ogre::LogListener
00050 {
00051 public:
00052 enum RenderSystem
00053 {
00054 SO3_NONE_RENDER_SYSTEM = -1,
00055 SO3_DIRECTX9_RENDERER,
00056 SO3_DIRECTX11_RENDERER,
00057 SO3_OPENGL_RENDERER,
00058 };
00059
00060 protected:
00061 private:
00062 RenderSystem renderSystem;
00063 Ogre::RenderSystem* O3Render;
00064 Ogre::Root* O3Root;
00065 SO3ScolFileSystemArchiveFactory* scolFileSystemArchiveFactory;
00066 SO3ScolUrlArchiveFactory* scolUrlArchiveFactory;
00067 SSceneMap sceneList;
00068 SWindowMap windowList;
00069 SPluginManager* pluginManager;
00070 Ogre::ParticleFXPlugin* staticPluginParticleFX;
00071 Ogre::CgPlugin* staticPluginCG;
00072 Ogre::OctreePlugin* staticPluginOctree;
00073 Ogre::StereoPlugin* staticPluginStereo;
00074 SWidgetManager* widgetManager;
00075 SFlashWidgetFactory* flashWidgetFactory;
00076 SBitmapWidgetFactory* bitmapWidgetFactory;
00077 SObjWindowWidgetFactory* objWindowWidgetFactory;
00078 SKeyboardHook* keyboardHook;
00079 SWindow* fullScreenWindow;
00080 typedef std::set<SLogListener*> LogListenerList;
00081 LogListenerList logListenerList;
00082 bool mLogEnable;
00083 #ifdef SO3_DEVELOPPER_BUILD
00084 Ogre::D3D9Plugin* staticPluginD3D9;
00085
00086
00087 Ogre::GLPlugin* staticPluginOpenGL;
00088 # if SO3_PLUGIN_WEB_MANAGER_BUILD == 1
00089 SWebNavigatorPlugin* staticWebNavigatorPlugin;
00090 # endif
00091 #endif
00092 Ogre::Overlay* SO3DebugOverlay;
00093 Ogre::OverlayContainer* SO3DebugPanel;
00094 Ogre::TextAreaOverlayElement* SO3DebugTextArea;
00095 Ogre::ResourcePtr SO3DebugFont;
00096 Ogre::MaterialPtr SO3DebugMaterial;
00097 bool debugPanelInitialized;
00098 WindowHandle rootWindowHandle;
00099 Ogre::RenderWindow* dummyWindow;
00100
00101 public:
00105 SRoot(WindowHandle windowHandle);
00106
00110 ~SRoot();
00111
00115 void InitRenderer();
00116
00120 bool SetFullScreenState(SWindow* window, bool state, int width, int height);
00121
00124 void AddLogListener(SLogListener* newLogListener);
00125
00128 void RemoveLogListener(SLogListener* existingLogListener);
00129
00132 void SetLogEnable(bool state);
00133
00136 bool GetLogEnable();
00137
00140 void SetLogMask(Ogre::LoggingLevel level);
00141
00144 Ogre::Root* GetOgreRootPointer();
00145
00148 static SRoot& getSingleton();
00149
00152 static SRoot* getSingletonPtr();
00153
00156 WindowHandle GetRootWindowHandle();
00157
00161 SScene* CreateScene(std::string newSceneName, const int scolChannel);
00162
00166 void DeleteScene(SScene* existingScene);
00167
00171 SScene* GetScene(std::string sceneName);
00172
00176 const SSceneMap& GetSceneList() const;
00177
00180 bool checkFSAA(Ogre::String val);
00181
00184 RenderSystem GetRenderSystem();
00185
00189 void SetRenderSystem(RenderSystem selectedRenderSystem);
00190
00193 std::vector<std::string> GetMultisamplingMode(RenderSystem wishedRenderSystem);
00194
00198 SWindow* CreateRenderWindow(WindowHandle windowHandle, std::string windowName, int width, int height, std::string fsaa);
00199
00203 void DeleteRenderWindow(SWindow* existingWindow);
00204
00208 const SWindowMap& GetRenderWindowList() const;
00209
00213 SWindow* GetRenderWindow(std::string windowName);
00214
00218 SWindow* GetRenderWindow(WindowHandle hwnd);
00219
00223 bool CheckDirectxVersion();
00224
00227 void SetDebugEnable(bool enable);
00228
00231 bool GetDebugEnable();
00232
00235 void SetDebugDisplay(SMaterial* material, int color, int posx, int posy, int width, int height, int charHeight);
00236
00239 void SetDebugText(std::string text);
00240
00243 bool Update();
00244 protected:
00247 virtual void messageLogged(const Ogre::String& message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String& logName, bool& skipMessage);
00248
00252 void AddScene(SScene* existingScene);
00253
00257 void RemoveScene(SScene* existingScene);
00258
00262 void RemoveScene(std::string sceneName);
00263
00267 void AddRenderWindow(SWindow* existingWindow);
00268
00272 void RemoveRenderWindow(SWindow* existingWindow);
00273
00277 void RemoveRenderWindow(std::string windowName);
00278 private:
00281 bool LoadOgrePlugins();
00282
00285 bool UnloadOgrePlugins();
00286
00289 bool LoadSO3Plugins();
00290
00293 bool UnloadSO3Plugins();
00294
00297 void CreateBoneHelperMesh();
00298
00302 SRoot();
00303 };
00304
00305 }
00306
00307 #endif