72class _SO3_Export
SRoot :
public Ogre::Singleton<SRoot>,
public Ogre::LogListener,
public Ogre::RenderSystem::Listener
77 SO3_NONE_RENDER_SYSTEM = -1,
91 bool mRootInitialised;
92 unsigned int windowIndex;
93 RenderSystem renderSystem;
94 std::string defaultFsaa;
95 Ogre::RenderSystem* O3Render;
97 Ogre::RTShader::ShaderGenerator* mShaderGenerator;
100#ifdef SO3_BUILD_DEFERRED
108 Ogre::ParticleFXPlugin* staticPluginParticleFX;
109 Ogre::SceneManager* mDummyScene;
111#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(SO3_USE_METAL) && !defined(RPI)
112 Ogre::CgPlugin* staticPluginCG;
115 Ogre::OctreePlugin* staticPluginOctree;
116 Ogre::OverlaySystem* O3OverlaySystem;
120#ifdef SO3_FLASH_ENABLE
126 #if SO3_WEB_NAVIGATOR_BUILD == 1
132 typedef std::set<SLogListener*> LogListenerList;
133 LogListenerList logListenerList;
136#ifdef SO3_DEVELOPPER_BUILD
139 Ogre::D3D9Plugin* staticPluginD3D9;
141 Ogre::D3D11Plugin* staticPluginD3D11;
145# ifndef SO3_USE_OPENGLES2
147 Ogre::GL3PlusPlugin* staticPluginOpenGL3;
148# elif !defined(SO3_USE_METAL)
149 Ogre::GLPlugin* staticPluginOpenGL;
151# elif !defined(SO3_USE_METAL)
152 Ogre::GLES2Plugin* staticPluginOpenGLES2;
155# if defined(__APPLE__) && defined(SO3_USE_METAL)
156 Ogre::MetalPlugin* staticPluginMetal;
162 Ogre::VulkanPlugin* staticPluginVulkan;
163 Ogre::GLSLangPlugin* staticPluginGLSLang;
167 bool mDebugInitialized;
169 Ogre::RenderWindow* dummyWindow;
171 float quadBufferFocalLength;
172 float quadBufferEyesSeparation;
174 bool mResourcesReleased;
175 Ogre::GpuSharedParametersPtr mSlicePlaneParams;
176 Ogre::GpuSharedParametersPtr mCommonParams;
177 bool mSlicePlaneState;
178 Ogre::Vector4 mSlicePlane;
198 void* GetD3Ddevice();
204 void InitRenderer(
SWindow* pwin = 0);
208 bool IsRenderInitialised();
213 bool SetFullScreenState(
SWindow* window,
const bool& state,
const int& width,
const int& height);
221 void RemoveLogListener(
SLogListener* existingLogListener);
225 void SetLogEnable(
const bool& state);
233 void SetLogMask(
const Ogre::LogMessageLevel& level);
237 Ogre::Root* GetOgreRootPointer();
241 Ogre::RenderSystem* GetOgreRenderSystem();
251#ifdef SO3_BUILD_DEFERRED
259 static SRoot& getSingleton();
263 static SRoot* getSingletonPtr();
268 SScene* CreateScene(
const std::string& newSceneName);
273 void DeleteScene(
SScene* existingScene);
278 SScene* GetScene(
const std::string& sceneName);
280 void AddManualRessourceGroup(std::string name);
282 void RemoveManualRessourceGroup(std::string name);
284 void ClearManualRessourceGroups();
293 bool checkFSAA(
const Ogre::String& val);
297 RenderSystem GetRenderSystem();
301 std::vector<std::string> GetMultisamplingMode(
const RenderSystem& wishedRenderSystem);
306 SWindow* CreateRenderWindow(
const ScolWindowHandle windowHandle,
const std::string& windowName,
const int& width,
const int& height,
const std::string& renderWindowFsaa=
"default");
311 void DeleteRenderWindow(
SWindow* existingWindow);
316 const SWindowMap& GetRenderWindowList()
const;
321 SWindow* GetRenderWindow(
const std::string& windowName);
326 SWindow* GetRenderWindow(
const ScolWindowHandle& hwnd);
331 bool CheckDirectxVersion();
335 void SetDebugEnable(
const bool& enable);
339 bool GetDebugEnable();
343 void SetDebugDisplay(
const int& color,
const int& posx,
const int& posy,
const int& width,
const int& height,
const int& charHeight);
347 void SetDebugText(
const std::string& text);
357 void RegisterViewport(
SViewPort* viewport);
362 void UnregisterViewport(
SViewPort* viewport);
370 void DestroyInternalRessources();
374 void ReloadInternalRessources();
386 bool GetQuadBufferEnable();
390 float GetQuadBufferFocalLength();
394 float GetQuadBufferEyesSeparation();
398 bool GetVSyncEnable();
406 bool GetRttPixelFormat(Ogre::PixelFormat &format,
bool alpha =
false,
bool floattex =
false);
410 void InvalidateGeneratedMaterial(Ogre::Material* mat);
414 void RemoveGeneratedMaterial(Ogre::Material* mat);
419 void ParseConfigFile();
423 void SetSlicePlaneState(
bool state);
427 void SetSlicePlane(Ogre::Vector4 plane);
431 bool GetSlicePlaneState();
435 Ogre::Vector4 GetSlicePlane();
439 void SetProgramCameraParameter(
float fov,
float znear,
float zfar,
float focalLength);
444 virtual void messageLogged(
const Ogre::String& message, Ogre::LogMessageLevel lml,
bool maskDebug,
const Ogre::String& logName,
bool& skipMessage);
449 virtual void eventOccurred(
const Ogre::String &eventName,
const Ogre::NameValuePairList *parameters);
454 void AddScene(
SScene* existingScene);
459 void RemoveScene(
SScene* existingScene);
464 void RemoveScene(
const std::string& sceneName);
469 void AddRenderWindow(
SWindow* existingWindow);
474 void RemoveRenderWindow(
SWindow* existingWindow);
479 void RemoveRenderWindow(
const std::string& windowName);
484 void ClearSceneManagerPassMaps();
488 bool LoadOgrePlugins();
492 bool UnloadOgrePlugins();
496 void CreateBoneHelperMesh();
501 void WriteConfigFile(
const std::string& filename);
507 void SetRenderSystem(
const RenderSystem& selectedRenderSystem,
const bool& activateQuadBuffer);
509 bool initialiseRTShaderSystem();
510 void destroyRTShaderSystem();