36#ifdef SO3_FLASH_ENABLE
44#ifdef SO3_BUILD_DEFERRED
68#include <OgreMeshLodGenerator.h>
72 #include "OgreD3D9RenderWindow.h"
73 #include "OgreD3D9DeviceManager.h"
82 #include <android/asset_manager.h>
83 #include <OgreGLRenderSystemCommon.h>
86#include <boost/algorithm/string.hpp>
87#include <boost/lexical_cast.hpp>
105 template<> SRoot* Ogre::Singleton<SRoot>::msSingleton = 0;
119 return (*msSingleton);
129 mShaderGenerator = 0;
132 mResourcesReleased =
false;
142 fullScreenWindow = 0;
145 quadBufferFocalLength = 1.0f;
146 quadBufferEyesSeparation = 0.06f;
150 mDebugEnable =
false;
151 mDebugInitialized =
false;
154 mRootInitialised =
false;
155 mSlicePlane = Ogre::Vector4(1.0f, 0.0f, 0.0f, 0.0f);
156 mSlicePlaneState =
false;
159 staticPluginOctree = 0;
161#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(SO3_USE_METAL) && !defined(RPI)
164 staticPluginParticleFX = 0;
166#ifdef SO3_BUILD_DEFERRED
172 mMaterialMgrListener = 0;
175#ifdef SO3_DEVELOPPER_BUILD
178 staticPluginD3D9 = 0;
180 staticPluginD3D11 = 0;
184# ifndef SO3_USE_OPENGLES2
186 staticPluginOpenGL3 = 0;
187# elif !defined(SO3_USE_METAL)
188 staticPluginOpenGL = 0;
190# elif !defined(SO3_USE_METAL)
191 staticPluginOpenGLES2 = 0;
194# if defined(__APPLE__) && defined(SO3_USE_METAL)
195 staticPluginMetal = 0;
201 staticPluginVulkan = 0;
202 staticPluginGLSLang = 0;
209 O3Root = OGRE_NEW Ogre::Root();
211 O3Root = OGRE_NEW Ogre::Root(
"",
"");
215 O3Root = OGRE_NEW Ogre::Root(
"",
"",
"");
219 O3Root->getWorkQueue()->setMainThreadProcessingTimeLimit(4);
237#ifdef SO3_FLASH_ENABLE
244 #if SO3_WEB_NAVIGATOR_BUILD == 1
245 ScolWindowHandle hwndScol = (ScolWindowHandle)SCgetExtra(
"hscol");
248 std::string webBrowserCacheDir =
firstPartition + std::string(
"tmp/CefCache");
251 CreateDirectory(webBrowserCacheDir.c_str(), 0);
266 Ogre::LogManager::getSingleton().getDefaultLog()->addListener((Ogre::LogListener*)
this);
270 Ogre::ScriptCompilerManager::getSingleton().setListener(resourceLoader);
276 O3OverlaySystem =
new Ogre::OverlaySystem();
279 ScolWindowHandle
win = (ScolWindowHandle)SCgetExtra(
"hscol");
281 mMainWidth = ANativeWindow_getWidth(
win);
282 mMainHeight = ANativeWindow_getHeight(
win);
286 new Ogre::MeshLodGenerator();
293 if (rendererName !=
"Direct3D11 Rendering Subsystem")
296 Ogre::D3D11Device& device =
static_cast<Ogre::D3D11RenderSystem*
>(
GetOgreRenderSystem())->_getDevice();
297 return (
void*) device.get();
308 return mRootInitialised;
311#ifdef SO3_BUILD_DEFERRED
314 return deferredManager;
318void SRoot::ClearSceneManagerPassMaps()
320 for (
const auto& m : O3Root->getSceneManagers())
322 Ogre::SceneManager* pScene = m.second;
325 Ogre::RenderQueue* pQueue = pScene->getRenderQueue();
334void SRoot::messageLogged(
const Ogre::String& message, Ogre::LogMessageLevel lml,
bool maskDebug,
const Ogre::String &logName,
bool& skipMessage)
338 case Ogre::LogMessageLevel::LML_CRITICAL:
339 case Ogre::LogMessageLevel::LML_NORMAL:
340 MMechostr(MSKRUNTIME,
"%s\n", message.c_str());
342 case Ogre::LogMessageLevel::LML_TRIVIAL:
343 MMechostr(MSKDEBUG,
"%s\n", message.c_str());
349 LogListenerList::iterator iLogListenerList = logListenerList.begin();
350 while(iLogListenerList != logListenerList.end())
352 (*iLogListenerList)->messageLogged(message);
360 if(logListenerList.count(newLogListener))
361 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot add this listener, it already exists in the listener list!",
"SRoot::AddLogListener");
363 logListenerList.insert(newLogListener);
368 if(!logListenerList.count(existingLogListener))
369 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot remove listener, this listener does not exists in the listener list!",
"SRoot::RemoveLogListener");
371 logListenerList.erase(existingLogListener);
386 Ogre::LogManager::getSingleton().getDefaultLog()->setMinLogLevel(level);
392 Ogre::String val = value;
393 if(value.find(
"[Quality]") != string::npos)
394 val = value.substr(0, value.find(
"[Quality]")-2);
396 Ogre::ConfigOptionMap m_system_caps = this->O3Root->getRenderSystem()->getConfigOptions();
397 Ogre::ConfigOptionMap::iterator itr = m_system_caps.begin();
398 while(itr != m_system_caps.end()&&!finded)
400 if(itr->first ==
"FSAA" )
402 Ogre::StringVector possible_values = (itr)->second.possibleValues;
403 Ogre::StringVector::iterator pv_itr = possible_values.begin();
404 while(pv_itr != possible_values.end() && !finded)
406 if(!strcmp(val.c_str(),pv_itr->c_str()))
419 SSceneMap::iterator iScene = sceneList.begin();
420 while (iScene != sceneList.end())
426 if (Ogre::MeshLodGenerator::getSingletonPtr())
427 delete Ogre::MeshLodGenerator::getSingletonPtr();
429 mSlicePlaneParams.reset();
430 mCommonParams.reset();
431 destroyRTShaderSystem();
440 if (O3Root->getRenderSystem())
441 O3Root->getRenderSystem()->removeListener(
this);
443 SAFE_DELETE(O3OverlaySystem);
446 MMechostr(MSKDEBUG,
"SO3Root cleanup : keyboardHook");
447 SO3_SAFE_DELETE(keyboardHook);
449#ifdef SO3_BUILD_DEFERRED
451 MMechostr(MSKDEBUG,
"SO3Root cleanup : deferredManager");
452 SO3_SAFE_DELETE(deferredManager);
456 MMechostr(MSKDEBUG,
"SO3Root cleanup : pluginManager");
457 SO3_SAFE_DELETE(pluginManager);
460 MMechostr(MSKDEBUG,
"SO3Root cleanup : widgetManager");
461 SO3_SAFE_DELETE(widgetManager);
465 MMechostr(MSKDEBUG,
"SO3Root cleanup : objWindowWidgetFactory");
466 SO3_SAFE_DELETE(objWindowWidgetFactory);
469#ifdef SO3_FLASH_ENABLE
471 MMechostr(MSKDEBUG,
"SO3Root cleanup : flashWidgetFactory");
472 SO3_SAFE_DELETE(flashWidgetFactory);
476 MMechostr(MSKDEBUG,
"SO3Root cleanup : bitmapWidgetFactory");
477 SO3_SAFE_DELETE(bitmapWidgetFactory);
480 #if SO3_WEB_NAVIGATOR_BUILD == 1
482 MMechostr(MSKDEBUG,
"SO3Root cleanup : webNavigatorWidgetFactory");
483 SO3_SAFE_DELETE(webNavigatorWidgetFactory);
486 MMechostr(MSKDEBUG,
"SO3Root cleanup : webNavigatorManager");
490 MMechostr(MSKDEBUG,
"SO3Root cleanup : LogListener");
491 Ogre::LogManager::getSingleton().getDefaultLog()->removeListener((Ogre::LogListener*)
this);
494 MMechostr(MSKDEBUG,
"SO3Root cleanup : dummyWindow");
505 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_RESOURCE_GROUP);
506 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_DYNAMIC_RESOURCE_GROUP);
507 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_DYNAMIC_READABLE_RESOURCE_GROUP);
508 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_HYDRAX_RESOURCE_GROUP);
509 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_SKYX_RESOURCE_GROUP);
510 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP);
512 catch (Ogre::Exception &e)
514 MMechostr(MSKRUNTIME,
"SO3Root error: %s\n", e.getFullDescription().c_str());
518 MMechostr(MSKDEBUG,
"SO3Root cleanup : resourceLoader");
519 Ogre::ScriptCompilerManager::getSingleton().setListener(0);
520 SO3_SAFE_DELETE(resourceLoader);
525 MMechostr(MSKDEBUG,
"SO3Root cleanup : O3Root");
526 SO3_SAFE_DELETE(O3Root);
529 MMechostr(MSKDEBUG,
"SO3Root cleanup : UnloadOgrePlugins");
532 MMechostr(MSKDEBUG,
"SO3Root cleanup : Done");
546 ClearSceneManagerPassMaps();
548 SO3_SAFE_DELETE(existingScene);
553 SSceneMap::iterator iSceneSearched = sceneList.find(sceneName);
554 if(iSceneSearched != sceneList.end())
555 return iSceneSearched->second;
567 string sceneName = existingScene->
GetName();
568 SSceneMap::iterator iSceneSearched = sceneList.find(sceneName);
569 if(iSceneSearched == sceneList.end())
571 sceneList.insert(SSceneMap::value_type(sceneName, existingScene));
581 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Can not add Scene named \""+ sceneName +
"\", an element with the same name already exist!",
"SRoot::AddScene");
594 SSceneMap::iterator iSceneSearched = sceneList.find(sceneName);
595 if(iSceneSearched != sceneList.end())
597 sceneList.erase(iSceneSearched);
602 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Can not remove Scene named \""+ sceneName +
"\", element not found!",
"SRoot::RemoveScene");
611 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(name,
false);
612 mManualGroups.push_back(name);
614 catch (Ogre::Exception &e)
616 MMechostr(MSKRUNTIME,
"AddManualRessourceGroup error: %s\n", e.getFullDescription().c_str());
624 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(name);
625 mManualGroups.remove(name);
627 catch (Ogre::Exception &e)
629 MMechostr(MSKRUNTIME,
"RemoveManualRessourceGroup error: %s\n", e.getFullDescription().c_str());
635 for (manualGroupList::iterator it = mManualGroups.begin(); it != mManualGroups.end(); it++)
639 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(*it);
641 catch (Ogre::Exception &)
646 mManualGroups.clear();
652 if (floattex && !alpha)
654 if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT32_RGB, Ogre::TU_RENDERTARGET))
656 format = Ogre::PF_FLOAT32_RGB;
659 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT16_RGB, Ogre::TU_RENDERTARGET))
661 format = Ogre::PF_FLOAT16_RGB;
664 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT32_GR, Ogre::TU_RENDERTARGET))
666 format = Ogre::PF_FLOAT32_GR;
669 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT16_GR, Ogre::TU_RENDERTARGET))
671 format = Ogre::PF_FLOAT16_GR;
674 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT32_R, Ogre::TU_RENDERTARGET))
676 format = Ogre::PF_FLOAT32_R;
679 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT16_R, Ogre::TU_RENDERTARGET))
681 format = Ogre::PF_FLOAT16_R;
690 if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT32_RGBA, Ogre::TU_RENDERTARGET))
692 format = Ogre::PF_FLOAT32_RGBA;
695 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT16_RGBA, Ogre::TU_RENDERTARGET))
697 format = Ogre::PF_FLOAT16_RGBA;
700 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_R11G11B10_FLOAT, Ogre::TU_RENDERTARGET))
702 format = Ogre::PF_R11G11B10_FLOAT;
705 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT32_GR, Ogre::TU_RENDERTARGET))
707 format = Ogre::PF_FLOAT32_GR;
710 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_FLOAT16_GR, Ogre::TU_RENDERTARGET))
712 format = Ogre::PF_FLOAT16_GR;
721 if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET))
723 format = Ogre::PF_R8G8B8;
726 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET))
728 format = Ogre::PF_B8G8R8;
734 if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET))
736 format = Ogre::PF_A8R8G8B8;
739 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_A8B8G8R8, Ogre::TU_RENDERTARGET))
741 format = Ogre::PF_A8B8G8R8;
744 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_R8G8B8A8, Ogre::TU_RENDERTARGET))
746 format = Ogre::PF_R8G8B8A8;
749 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_B8G8R8A8, Ogre::TU_RENDERTARGET))
751 format = Ogre::PF_B8G8R8A8;
754 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_X8R8G8B8, Ogre::TU_RENDERTARGET))
756 format = Ogre::PF_X8R8G8B8;
759 else if (Ogre::TextureManager::getSingleton().isFormatSupported(Ogre::TEX_TYPE_2D, Ogre::PF_X8B8G8R8, Ogre::TU_RENDERTARGET))
761 format = Ogre::PF_X8B8G8R8;
768SWindow*
SRoot::CreateRenderWindow(
const ScolWindowHandle windowHandle,
const std::string& windowName,
const int& width,
const int& height,
const std::string& renderWindowFsaa)
770 std::string newWindowName = windowName +
"_" + boost::lexical_cast<std::string, unsigned int>(++windowIndex);
772 if(renderWindowFsaa ==
"default")
773 newWindow =
new SWindow(
this, windowHandle, newWindowName, width, height, defaultFsaa);
775 newWindow =
new SWindow(
this, windowHandle, newWindowName, width, height, renderWindowFsaa);
778 Ogre::Profiler* prof = Ogre::Profiler::getSingletonPtr();
780 prof->setEnabled(
true);
789 if (fullScreenWindow == existingWindow)
790 fullScreenWindow = 0;
793 SO3_SAFE_DELETE(existingWindow);
800 SWindowMap::const_iterator iWindowSearched = lWin.begin();
802 while((iWindowSearched != lWin.end()) && (winfound == 0))
804 if (iWindowSearched->second->GetWindowHandle() == hwnd)
805 winfound = iWindowSearched->second;
814 SWindowMap::iterator iWindowSearched = windowList.find(windowName);
815 if(iWindowSearched != windowList.end())
816 return iWindowSearched->second;
828 string windowName = existingWindow->
GetName();
829 SWindowMap::iterator iWindowSearched = windowList.find(windowName);
830 if(iWindowSearched == windowList.end())
832 windowList.insert(SWindowMap::value_type(windowName, existingWindow));
837 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Can not add Window named \""+ windowName +
"\", an element with the same name already exist!",
"SRoot::AddWindow");
848 SWindowMap::iterator iWindowSearched = windowList.find(windowName);
849 if(iWindowSearched != windowList.end())
851 windowList.erase(iWindowSearched);
856 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Can not remove Window named \""+ windowName +
"\", element not found!",
"SRoot::RemoveWindow");
870void SRoot::SetRenderSystem(
const RenderSystem& selectedRenderSystem,
const bool& activateQuadBuffer)
873 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Cannot set render system to \"none\", invalid render system.",
"SRoot::SetRenderSystem");
876 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Render system is still setted, cannot change render system while running.",
"SRoot::SetRenderSystem");
879 #if OGRE_VERSION < ((1 << 16) | (7 << 8) | 0)
880 Ogre::RenderSystemList* renderSystemList = O3Root->getAvailableRenderers();
881 if(renderSystemList == NULL)
883 const Ogre::RenderSystemList renderSystemList = O3Root->getAvailableRenderers();
884 if(renderSystemList.empty())
886 OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR,
"No supported render system found!",
"SRoot::SetRenderSystem");
891 switch(selectedRenderSystem)
894 O3Render = O3Root->getRenderSystemByName(
"Direct3D9 Rendering Subsystem");
895 renderSystem = selectedRenderSystem;
898 O3Render->setConfigOption(
"Use Multihead",
"Auto");
899 O3Render->setConfigOption(
"Resource Creation Policy",
"Create on all devices");
900 O3Render->setConfigOption(
"Auto hardware buffer management",
"Yes");
904 O3Render = O3Root->getRenderSystemByName(
"Direct3D11 Rendering Subsystem");
906 renderSystem = selectedRenderSystem;
909 O3Render = O3Root->getRenderSystemByName(
"Vulkan Rendering Subsystem");
910 renderSystem = selectedRenderSystem;
913 O3Render = O3Root->getRenderSystemByName(
"Tiny Rendering Subsystem");
914 renderSystem = selectedRenderSystem;
917 O3Render = O3Root->getRenderSystemByName(
"Metal Rendering Subsystem");
918 renderSystem = selectedRenderSystem;
921 #ifndef SO3_USE_OPENGLES2
923 O3Render = O3Root->getRenderSystemByName(
"OpenGL Rendering Subsystem");
926 if (activateQuadBuffer)
928 MMechostr(MSKRUNTIME,
"Rendering Stereo mode : QuadBuffer\n");
929 O3Render->setConfigOption(
"Stereo Mode",
"QuadBuffer");
933 MMechostr(MSKRUNTIME,
"Rendering Stereo mode : Mono\n");
934 O3Render->setConfigOption(
"Stereo Mode",
"Mono");
937 catch (Ogre::Exception &)
939 MMechostr(MSKRUNTIME,
"Rendering Stereo mode : Not supported\n");
942 O3Render = O3Root->getRenderSystemByName(
"OpenGL 3+ Rendering Subsystem");
945 O3Render = O3Root->getRenderSystemByName(
"OpenGL ES 2.x Rendering Subsystem");
947 renderSystem = selectedRenderSystem;
954#ifndef SO3_USE_OPENGLES2
956 O3Render = O3Root->getRenderSystemByName(
"OpenGL Rendering Subsystem");
958 O3Render = O3Root->getRenderSystemByName(
"OpenGL 3+ Rendering Subsystem");
961 O3Render = O3Root->getRenderSystemByName(
"OpenGL ES 2.x Rendering Subsystem");
965 O3Root->setRenderSystem(O3Render);
967 catch(Ogre::Exception&)
971 #ifndef SO3_USE_OPENGLES2
973 O3Render = O3Root->getRenderSystemByName(
"OpenGL Rendering Subsystem");
975 O3Render = O3Root->getRenderSystemByName(
"OpenGL 3+ Rendering Subsystem");
978 O3Render = O3Root->getRenderSystemByName(
"OpenGL ES 2.x Rendering Subsystem");
980 O3Root->setRenderSystem(O3Render);
986 O3Root->getSingleton().initialise(
false);
989 O3Root->getRenderSystem()->addListener(
this);
995 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Cannot get render system multisampling information for \"none\", invalid render system.",
"SRoot::GetMultisamplingMode");
997 Ogre::RenderSystem* selectedRenderSystem = 0;
998 std::vector<std::string> multisamplingModes;
1002 switch(wishedRenderSystem)
1006 #ifndef SO3_USE_DX11
1007 selectedRenderSystem = O3Root->getRenderSystemByName(
"Direct3D9 Rendering Subsystem");
1009 selectedRenderSystem = O3Root->getRenderSystemByName(
"Direct3D11 Rendering Subsystem");
1013 selectedRenderSystem = O3Root->getRenderSystemByName(
"Vulkan Rendering Subsystem");
1015 selectedRenderSystem = O3Root->getRenderSystemByName(
"Tiny Rendering Subsystem");
1017 selectedRenderSystem = O3Root->getRenderSystemByName(
"Metal Rendering Subsystem");
1019 #ifndef SO3_USE_OPENGLES2
1021 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL Rendering Subsystem");
1023 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL 3+ Rendering Subsystem");
1026 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL ES 2.x Rendering Subsystem");
1031 catch (Ogre::Exception &)
1033 #ifndef SO3_USE_OPENGLES2
1035 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL Rendering Subsystem");
1037 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL 3+ Rendering Subsystem");
1040 selectedRenderSystem = O3Root->getRenderSystemByName(
"OpenGL ES 2.x Rendering Subsystem");
1044 if (selectedRenderSystem != 0)
1046 Ogre::ConfigOptionMap m_system_caps = selectedRenderSystem->getConfigOptions();
1047 Ogre::ConfigOptionMap::iterator itr = m_system_caps.find(
"FSAA");
1048 if (itr == m_system_caps.end())
1049 itr = m_system_caps.find(
"Anti aliasing");
1051 if (itr != m_system_caps.end())
1053 Ogre::StringVector possible_values = itr->second.possibleValues;
1054 Ogre::StringVector::iterator pv_itr = possible_values.begin();
1055 while (pv_itr != possible_values.end())
1057 multisamplingModes.push_back(*pv_itr);
1063 return multisamplingModes;
1091bool SRoot::LoadOgrePlugins()
1093#ifdef SO3_DEVELOPPER_BUILD
1095# ifndef SO3_USE_DX11
1099 staticPluginD3D9 = OGRE_NEW Ogre::D3D9Plugin();
1100 Ogre::Root::getSingleton().installPlugin(staticPluginD3D9);
1102 catch(Ogre::Exception&)
1105 MMechostr(MSKRUNTIME,
"Error on D3D9 plugin load\n");
1110 staticPluginD3D11 = OGRE_NEW Ogre::D3D11Plugin();
1111 Ogre::Root::getSingleton().installPlugin(staticPluginD3D11);
1113 catch(Ogre::Exception&)
1116 MMechostr(MSKRUNTIME,
"Error on D3D11 plugin load\n");
1121#if !defined(SO3_USE_METAL)
1124# ifndef SO3_USE_OPENGLES2
1126 staticPluginOpenGL3 = OGRE_NEW Ogre::GL3PlusPlugin();
1127 Ogre::Root::getSingleton().installPlugin(staticPluginOpenGL3);
1128# elif !defined(SO3_USE_METAL)
1129 staticPluginOpenGL = OGRE_NEW Ogre::GLPlugin();
1130 Ogre::Root::getSingleton().installPlugin(staticPluginOpenGL);
1132# elif !defined(SO3_USE_METAL)
1133 staticPluginOpenGLES2 = OGRE_NEW Ogre::GLES2Plugin();
1134 Ogre::Root::getSingleton().installPlugin(staticPluginOpenGLES2);
1137 catch(Ogre::Exception&)
1140 #ifndef SO3_USE_OPENGLES2
1141 MMechostr(MSKRUNTIME,
"Error on OpenGL plugin load\n");
1143 MMechostr(MSKRUNTIME,
"Error on OpenGLES2 plugin load\n");
1148# if defined(__APPLE__) && defined(SO3_USE_METAL)
1151 staticPluginMetal = OGRE_NEW Ogre::MetalPlugin();
1152 Ogre::Root::getSingleton().installPlugin(staticPluginMetal);
1154 catch (Ogre::Exception&)
1157 MMechostr(MSKRUNTIME,
"Error on Metal renderer plugin load\n");
1175 staticPluginVulkan = OGRE_NEW Ogre::VulkanPlugin();
1176 Ogre::Root::getSingleton().installPlugin(staticPluginVulkan);
1178 catch (Ogre::Exception&)
1181 MMechostr(MSKRUNTIME,
"Error on Vulkan renderer plugin load\n");
1186 staticPluginGLSLang = OGRE_NEW Ogre::GLSLangPlugin();
1187 Ogre::Root::getSingleton().installPlugin(staticPluginGLSLang);
1189 catch (Ogre::Exception&)
1192 MMechostr(MSKRUNTIME,
"Error on GLSLang plugin load\n");
1199 Ogre::Root::getSingleton().loadPlugin(
"plugins/SO3_RenderSystem_GL_d.dll");
1200 Ogre::Root::getSingleton().loadPlugin(
"plugins/SO3_RenderSystem_Direct3D9_d.dll");
1202 Ogre::Root::getSingleton().loadPlugin(
"plugins/SO3_RenderSystem_GL.dll");
1203 Ogre::Root::getSingleton().loadPlugin(
"plugins/SO3_RenderSystem_Direct3D9.dll");
1210 staticPluginParticleFX = OGRE_NEW Ogre::ParticleFXPlugin();
1211 Ogre::Root::getSingleton().installPlugin(staticPluginParticleFX);
1213 catch(Ogre::Exception&)
1216 MMechostr(MSKRUNTIME,
"Error on Particle FX plugin load\n");
1220 Ogre::STBIImageCodec::startup();
1222#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(SO3_USE_METAL) && !defined(RPI)
1225 staticPluginCG = OGRE_NEW Ogre::CgPlugin();
1226 Ogre::Root::getSingleton().installPlugin(staticPluginCG);
1228 catch(Ogre::Exception&)
1231 MMechostr(MSKRUNTIME,
"Error on CG plugin load\n");
1237 staticPluginOctree = OGRE_NEW Ogre::OctreePlugin();
1238 Ogre::Root::getSingleton().installPlugin(staticPluginOctree);
1240 catch(Ogre::Exception&)
1243 MMechostr(MSKRUNTIME,
"Error on Octree plugin load\n");
1248 scolFileSystemArchiveFactory = OGRE_NEW SO3ScolFileSystemArchiveFactory();
1249 Ogre::ArchiveManager::getSingleton().addArchiveFactory(scolFileSystemArchiveFactory);
1253 struct android_app* androidApp = (
struct android_app*)SCgetExtra(
"this_inst");
1254 if (androidApp != NULL)
1256 Ogre::ArchiveManager::getSingleton().addArchiveFactory(
new Ogre::APKFileSystemArchiveFactory(androidApp->activity->assetManager));
1257 Ogre::ArchiveManager::getSingleton().addArchiveFactory(
new Ogre::APKZipArchiveFactory(androidApp->activity->assetManager));
1265bool SRoot::UnloadOgrePlugins()
1267 OGRE_DELETE scolFileSystemArchiveFactory;
1268 OGRE_DELETE staticPluginOctree;
1270#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(SO3_USE_METAL) && !defined(RPI)
1271 OGRE_DELETE staticPluginCG;
1274 OGRE_DELETE staticPluginParticleFX;
1276 Ogre::STBIImageCodec::shutdown();
1278# ifdef SO3_DEVELOPPER_BUILD
1280# ifndef SO3_USE_DX11
1281 OGRE_DELETE staticPluginD3D9;
1283 OGRE_DELETE staticPluginD3D11;
1287# ifndef SO3_USE_OPENGLES2
1289 OGRE_DELETE staticPluginOpenGL3;
1290# elif !defined(SO3_USE_METAL)
1291 OGRE_DELETE staticPluginOpenGL;
1293# elif !defined(SO3_USE_METAL)
1294 OGRE_DELETE staticPluginOpenGLES2;
1297# if defined(__APPLE__) && defined(SO3_USE_METAL)
1298 OGRE_DELETE staticPluginMetal;
1303 OGRE_DELETE staticPluginGLSLang;
1304 OGRE_DELETE staticPluginVulkan;
1313 if (dummyWindow == 0)
1318 Ogre::NameValuePairList viewConfig;
1319 viewConfig[
"hidden"] =
"Yes";
1320 viewConfig[
"Resource Creation Policy"] =
"Create on all devices";
1321 viewConfig[
"Multi device memory hint"] =
"Auto hardware buffers management";
1322 viewConfig[
"vsync"] =
"No";
1324 dummyWindow = Ogre::Root::getSingleton().createRenderWindow(
"OgreDummyWindow", 1, 1,
false, &viewConfig);
1325 dummyWindow->setAutoUpdated(
false);
1326 dummyWindow->setDeactivateOnFocusChange(
false);
1339 mSlicePlaneParams = Ogre::GpuProgramManager::getSingleton().createSharedParameters(
"SO3SlicePlaneParams");
1340 mSlicePlaneParams->addConstantDefinition(
"slicePlane", Ogre::GCT_FLOAT4);
1342 if (mSlicePlaneState)
1343 mSlicePlaneParams->setNamedConstant(
"slicePlane", mSlicePlane);
1345 mSlicePlaneParams->setNamedConstant(
"slicePlane", Ogre::Vector4::ZERO);
1348 mCommonParams = Ogre::GpuProgramManager::getSingleton().createSharedParameters(
"SO3CameraParams");
1349 mCommonParams->addConstantDefinition(
"cameraProjection", Ogre::GCT_FLOAT4);
1350 mCommonParams->setNamedConstant(
"cameraProjection", Ogre::Vector4::ZERO);
1351 mCommonParams->addConstantDefinition(
"cameraParams", Ogre::GCT_FLOAT4);
1352 mCommonParams->setNamedConstant(
"cameraParams", Ogre::Vector4::ZERO);
1356 #if OGRE_VERSION < ((1 << 16) | (7 << 8) | 0)
1357 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_RESOURCE_GROUP);
1358 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DYNAMIC_RESOURCE_GROUP);
1359 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DYNAMIC_READABLE_RESOURCE_GROUP);
1360 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_HYDRAX_RESOURCE_GROUP);
1361 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_SKYX_RESOURCE_GROUP);
1362 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP);
1364#ifdef SO3_BUILD_DEFERRED
1365 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DEFERRED_RESOURCE_GROUP);
1368 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_RESOURCE_GROUP,
false);
1369 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DYNAMIC_RESOURCE_GROUP,
false);
1370 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DYNAMIC_READABLE_RESOURCE_GROUP,
true);
1371 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_HYDRAX_RESOURCE_GROUP,
true);
1372 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_SKYX_RESOURCE_GROUP,
true);
1373 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP,
true);
1375#ifdef SO3_BUILD_DEFERRED
1376 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(SO3_INTERNAL_DEFERRED_RESOURCE_GROUP,
true);
1380 MMechostr(MSKDEBUG,
">> Add Ogre ressource locations\n");
1390 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/OgreCore.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1391 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/rtshaderlib.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1392 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/SO3Core.zip",
"Zip", SO3_INTERNAL_RESOURCE_GROUP,
true);
1393 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/Hydrax.zip",
"Zip", SO3_INTERNAL_HYDRAX_RESOURCE_GROUP,
true);
1394 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/SkyX.zip",
"Zip", SO3_INTERNAL_SKYX_RESOURCE_GROUP,
true);
1395 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/SO3SelectionBuffer.zip",
"Zip", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP,
true);
1397#ifdef SO3_BUILD_DEFERRED
1398 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/SO3Deferred.zip",
"Zip", SO3_INTERNAL_DEFERRED_RESOURCE_GROUP,
true);
1400 #elif defined(ANDROID)
1401 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/ogrecore.zip",
"APKZip", Ogre::RGN_INTERNAL,
true);
1402 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/rtshaderlib.zip",
"APKZip", Ogre::RGN_INTERNAL,
true);
1403 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/so3core.zip",
"APKZip", SO3_INTERNAL_RESOURCE_GROUP,
true);
1404 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/hydrax.zip",
"APKZip", SO3_INTERNAL_HYDRAX_RESOURCE_GROUP,
true);
1405 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/skyx.zip",
"APKZip", SO3_INTERNAL_SKYX_RESOURCE_GROUP,
true);
1406 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/so3selectionbuffer.zip",
"APKZip", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP,
true);
1407 #elif defined(SO3_USE_OPENGLES2)
1408 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/ogrecore.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1409 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/rtshaderlib.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1410 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/so3core.zip",
"Zip", SO3_INTERNAL_RESOURCE_GROUP,
true);
1411 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/hydrax.zip",
"Zip", SO3_INTERNAL_HYDRAX_RESOURCE_GROUP,
true);
1412 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/skyx.zip",
"Zip", SO3_INTERNAL_SKYX_RESOURCE_GROUP,
true);
1413 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/so3selectionbuffer.zip",
"Zip", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP,
true);
1415 std::string baseDir = (
char*)SCgetExtra(
"scolExecDir");
1416 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/ogrecore.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1417 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/rtshaderlib.zip",
"Zip", Ogre::RGN_INTERNAL,
true);
1418 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/so3core.zip",
"Zip", SO3_INTERNAL_RESOURCE_GROUP,
true);
1419 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/hydrax.zip",
"Zip", SO3_INTERNAL_HYDRAX_RESOURCE_GROUP,
true);
1420 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/skyx.zip",
"Zip", SO3_INTERNAL_SKYX_RESOURCE_GROUP,
true);
1421 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/so3selectionbuffer.zip",
"Zip", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP,
true);
1424 initialiseRTShaderSystem();
1427 MMechostr(MSKDEBUG,
">> Initialise Ogre ressource groups\n");
1428 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
1430 const Ogre::GpuProgramManager::SyntaxCodes &syntaxCodes = Ogre::GpuProgramManager::getSingleton().getSupportedSyntax();
1431 for (Ogre::GpuProgramManager::SyntaxCodes::const_iterator iter = syntaxCodes.begin(); iter != syntaxCodes.end(); ++iter)
1433 MMechostr(MSKDEBUG,
">>> Ogre Supported shader syntax %s\n", (*iter).c_str());
1437 Ogre::MaterialPtr defmat = Ogre::MaterialManager::getSingletonPtr()->getByName(
"BaseWhite", Ogre::RGN_INTERNAL);
1438 defmat->setAmbient(Ogre::ColourValue(0.5f, 0.5f, 0.5f, 1.0f));
1439 defmat->setDiffuse(Ogre::ColourValue::White);
1440 defmat->setSpecular(Ogre::ColourValue::White);
1441 defmat->setShininess(40.0f);
1442 defmat->getTechnique(0)->getPass(0)->setVertexProgram(
"SO3/Internal/Default_vp");
1443 defmat->getTechnique(0)->getPass(0)->setFragmentProgram(
"SO3/Internal/Default_fp");
1446 Ogre::MaterialPtr defmatnolight = Ogre::MaterialManager::getSingletonPtr()->getByName(
"BaseWhiteNoLighting", Ogre::RGN_INTERNAL);
1447 defmatnolight->setAmbient(Ogre::ColourValue::White);
1448 defmatnolight->setDiffuse(Ogre::ColourValue::White);
1449 defmatnolight->setSpecular(Ogre::ColourValue::White);
1450 defmatnolight->setShininess(40.0f);
1451 defmatnolight->setReceiveShadows(
false);
1452 defmatnolight->getTechnique(0)->getPass(0)->setVertexProgram(
"SO3/Internal/Default_nolight_vp");
1453 defmatnolight->getTechnique(0)->getPass(0)->setFragmentProgram(
"SO3/Internal/Default_fp");
1454 defmatnolight->load();
1457 if (!mDebugInitialized)
1460 CreateBoneHelperMesh();
1462 mDebugInitialized =
true;
1464#ifdef SO3_BUILD_DEFERRED
1472 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"[WARNING] Deferred rendering not supported, deactivating it!");
1473 deferredManager = 0;
1479 mRootInitialised =
true;
1481 catch(Ogre::Exception &e)
1483 MMechostr(MSKDEBUG,
">> Ogre Load error %s\n", e.getDescription().c_str());
1484 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: "+ e.getDescription());
1490 dummyWindow->update();
1502 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: Can not set a DirectX window in fullscreen if this this not the first created window.");
1507 if (state && (fullScreenWindow == 0))
1514 catch (Ogre::Exception &e)
1516 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: "+ e.getDescription());
1520 fullScreenWindow = window;
1523 else if (!state && (fullScreenWindow == window))
1530 catch (Ogre::Exception &e)
1532 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: "+ e.getDescription());
1536 fullScreenWindow = 0;
1545 mDebugEnable = enable;
1546 SSceneMap::iterator iScene = sceneList.begin();
1547 while(iScene != sceneList.end())
1549 iScene->second->SetDebugEnable(enable);
1556 return mDebugEnable;
1559void SRoot::SetDebugDisplay(
const int& color,
const int& posx,
const int& posy,
const int& width,
const int& height,
const int& charHeight)
1561 SSceneMap::iterator iScene = sceneList.begin();
1562 while(iScene != sceneList.end())
1564 iScene->second->SetDebugDisplay(color, posx, posy, width, height, charHeight);
1571 SSceneMap::iterator iScene = sceneList.begin();
1572 while(iScene != sceneList.end())
1574 iScene->second->SetDebugText(text);
1579void SRoot::CreateBoneHelperMesh()
1582 Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(
"SO3/Bone/Helper/Material", SO3_INTERNAL_RESOURCE_GROUP);
1583 material->setReceiveShadows(
false);
1584 material->getTechnique(0)->getPass(0)->setLightingEnabled(
true);
1585 material->getTechnique(0)->getPass(0)->setAmbient(1, 0, 0);
1586 material->getTechnique(0)->getPass(0)->setDiffuse(1, 0, 0, 1);
1587 material->getTechnique(0)->getPass(0)->setSelfIllumination(1, 0, 0);
1588 material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(
false);
1593 SSceneMap::iterator iScene = sceneList.begin();
1594 while(iScene != sceneList.end())
1596 iScene->second->UpdateCamera(viewport);
1603 SSceneMap::iterator iScene = sceneList.begin();
1604 while(iScene != sceneList.end())
1606 iScene->second->RegisterViewport(viewport);
1613 SSceneMap::iterator iScene = sceneList.begin();
1614 while(iScene != sceneList.end())
1616 iScene->second->UnregisterViewport(viewport);
1623 if ((eventName ==
"DeviceLost") || (eventName ==
"BeforeDeviceReset"))
1627 else if ((eventName ==
"DeviceRestored") || (eventName ==
"AfterDeviceReset"))
1629 mDeviceLost =
false;
1644 if (windowList.empty() || !mResourcesReleased)
1648 struct android_app* androidApp = (
struct android_app*)SCgetExtra(
"this_inst");
1649 ScolWindowHandle awindow = (ScolWindowHandle)SCgetExtra(
"hscol");
1650 AConfiguration* config = AConfiguration_new();
1653 AConfiguration_fromAssetManager(config, androidApp->activity->assetManager);
1656 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1657 while ((iWindowSearched != lWin.end()))
1661 MMechostr(MSKDEBUG,
">>> ReloadInternalRessources\n");
1663 iWindowSearched->second->SetWindowHandle(awindow);
1664 iWindowSearched->second->GetOgreRenderWindowPointer()->_notifySurfaceCreated(awindow, config);
1666 int nwidth = (int)ANativeWindow_getWidth(awindow);
1667 int nheight = (int)ANativeWindow_getHeight(awindow);
1675 iWindowSearched->second->ResumeWindow();
1676 iWindowSearched->second->SetSizeDirty();
1678 catch (Ogre::Exception &e)
1680 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"ReloadInternalRessources : An exception has occurred: " + e.getDescription());
1686 SSceneMap::iterator iScene = sceneList.begin();
1687 while (iScene != sceneList.end())
1689 iScene->second->ReloadInternalRessources();
1696 AConfiguration_delete(config);
1698 mResourcesReleased =
false;
1703 if (mResourcesReleased)
1710 mShaderGenerator->removeAllShaderBasedTechniques();
1712 if (windowList.empty())
1716 SSceneMap::iterator iScene = sceneList.begin();
1717 while (iScene != sceneList.end())
1719 iScene->second->DestroyInternalRessources();
1724 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1725 while ((iWindowSearched != lWin.end()))
1727 MMechostr(MSKDEBUG,
">>> DestroyInternalRessources\n");
1730 iWindowSearched->second->PauseWindow();
1732 iWindowSearched->second->GetOgreRenderWindowPointer()->_notifySurfaceDestroyed();
1736 catch (Ogre::Exception &e)
1738 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"DestroyInternalRessources : An exception has occurred: " + e.getDescription());
1745 mResourcesReleased =
true;
1757 if (windowList.empty())
1761 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1762 while ((iWindowSearched != lWin.end()))
1764 iWindowSearched->second->SetSizeDirty();
1769 Ogre::Root::getSingleton().clearEventTimes();
1786 if (windowList.empty() || mPaused)
1793 struct android_app* androidApp = (
struct android_app*)SCgetExtra(
"this_inst");
1794 ScolWindowHandle awindow = (ScolWindowHandle)SCgetExtra(
"hscol");
1795 if (androidApp == 0 || awindow == 0)
1798 int aWidth = ANativeWindow_getWidth(awindow);
1799 int aHeight = ANativeWindow_getHeight(awindow);
1800 if (aWidth != mMainWidth || aHeight != mMainHeight)
1802 mMainWidth = aWidth;
1803 mMainHeight = aHeight;
1808 so3win->
Size(0, 0, mMainWidth, mMainHeight, 1);
1814# ifndef SO3_USE_DX11
1821 valid = (device != 0) ? !device->isDeviceLost() :
false;
1823 catch (Ogre::Exception&)
1830 if (mDeviceLost || !valid)
1833 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1834 while ((iWindowSearched != lWin.end()))
1836 iWindowSearched->second->Update();
1846 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1847 while ((iWindowSearched != lWin.end()))
1898 iWindowSearched->second->UpdateScreenPos();
1899 if (iWindowSearched->second->GetSizeDirty())
1901 iWindowSearched->second->WindowMovedOrResized();
1907 SWindowMap::const_iterator iWindowSearched = lWin.begin();
1908 while((iWindowSearched != lWin.end()))
1911 if (iWindowSearched->second->GetOgreRenderWindowPointer()->isActive())
1913 if (iWindowSearched->second->GetSizeDirty())
1914 iWindowSearched->second->WindowMovedOrResized();
1921 if (iWindowSearched->second->GetSizeDirty())
1923 iWindowSearched->second->WindowMovedOrResized();
1937#if SO3_WEB_NAVIGATOR_BUILD == 1
1938 if(webNavigatorManager != 0)
1939 webNavigatorManager->
Update();
1943 SSceneMap::iterator iScene = sceneList.begin();
1944 while(iScene != sceneList.end())
1946 iScene->second->PreUpdate();
1951 Ogre::Root* ogreRoot = Ogre::Root::getSingletonPtr();
1955 ret = ogreRoot->renderOneFrame();
1957 catch (Ogre::Exception &e)
1959 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: "+ e.getDescription());
1964 iScene = sceneList.begin();
1965 while(iScene != sceneList.end())
1967 iScene->second->PostUpdate();
1974 SWindowMap::const_iterator iWindow = windowList.begin();
1975 while ((iWindow != windowList.end()))
1977 iWindow->second->CleanViewports();
1989 if(O3Render->getCapabilities() != 0)
1991 if (O3Render->getCapabilities() && O3Render->getCapabilities()->hasCapability(Ogre::RSC_QUAD_BUFFER))
1993 Ogre::ConfigOptionMap rendererConfigOptions = O3Render->getConfigOptions();
1994 Ogre::ConfigOptionMap::iterator iQuadBuffer = rendererConfigOptions.find(
"Stereo Mode");
1995 return ((renderSystem ==
SO3_OPENGL_RENDERER) && (iQuadBuffer != rendererConfigOptions.end()) && (iQuadBuffer->second.currentValue ==
"QuadBuffer"));
2005 return quadBufferFocalLength;
2010 return quadBufferEyesSeparation;
2021 bool configForced =
false;
2022 bool hasQuadBufferEyeSep =
false;
2023 bool hasQuadBufferFocal =
false;
2027 string iniFileFsaa =
"";
2028 int iniFileActivateQuadBuffer = 0;
2033 char temporaryPath[MAX_PATH];
2034 GetCurrentDirectory(MAX_PATH, temporaryPath);
2035 std::string execpath(temporaryPath);
2036 boost::algorithm::replace_all(execpath,
"\\",
"/");
2039 std::string execsubdir;
2040 size_t lastSlash = execpath.find_last_of(
'/');
2041 if(lastSlash != execpath.npos)
2042 execsubdir = execpath.substr(lastSlash);
2045 string scolUserPath;
2046 HRESULT hr_scolpath = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, temporaryPath);
2047 if(SUCCEEDED(hr_scolpath))
2048 scolUserPath = string(temporaryPath) + execsubdir;
2051 std::string execpath((
const char*)SCgetExtra(
"scolExecDir"));
2052 std::string scolUserPath((
const char*)SCgetExtra(
"userFilesDir"));
2055 string iniFilePath = scolUserPath +
"/usmuser.ini";
2058 FILE* pFile = fopen(iniFilePath.c_str(),
"r");
2068 iniFilePath = execpath +
"/usm.ini";
2070 iniFilePath =
"usm.ini";
2078 std::ifstream iniFile(iniFilePath.c_str());
2080 struct android_app* androidApp = (
struct android_app*)SCgetExtra(
"this_inst");
2081 std::stringstream iniFile;
2084 AAsset* asset = AAssetManager_open(androidApp->activity->assetManager, iniFilePath.c_str(), AASSET_MODE_RANDOM);
2087 iniFile.write(
reinterpret_cast<const char *
>(AAsset_getBuffer(asset)), AAsset_getLength(asset));
2088 AAsset_close(asset);
2095 while(std::getline(iniFile, line))
2098 size_t firstComment = line.find_first_of(
'#');
2099 if(firstComment != line.npos)
2100 line = line.substr(0, firstComment);
2103 if(line.find(SO3_CONFIG_RENDERER_KEYWORD) != string::npos)
2106 if((line.find(SO3_CONFIG_RENDERER_DIRECTX) != string::npos)
2107 ||(line.find(SO3_CONFIG_RENDERER_DIRECTX9) != string::npos)
2108 ||(line.find(SO3_CONFIG_RENDERER_DIRECTX11) != string::npos))
2109# ifndef SO3_USE_DX11
2115 if(line.find(SO3_CONFIG_RENDERER_OPENGL) != string::npos)
2117 else if (line.find(SO3_CONFIG_RENDERER_VULKAN) != string::npos)
2119 else if (line.find(SO3_CONFIG_RENDERER_TINY) != string::npos)
2121 else if (line.find(SO3_CONFIG_RENDERER_METAL) != string::npos)
2127 if(line.find(SO3_CONFIG_FSAA_KEYWORD) != string::npos)
2130 size_t keywordLength = string(SO3_CONFIG_FSAA_KEYWORD).length() + 1;
2131 if(line.length() > keywordLength)
2132 iniFileFsaa = line.substr(keywordLength);
2136 if(line.find(SO3_CONFIG_VSYNC_KEYWORD) != string::npos)
2139 size_t keywordLength = string(SO3_CONFIG_VSYNC_KEYWORD).length() + 1;
2140 if(line.length() > keywordLength)
2142 string vSyncValue = boost::algorithm::to_lower_copy(line.substr(keywordLength));
2143 if((vSyncValue ==
"1") || (vSyncValue ==
"yes") || (vSyncValue ==
"true") || (vSyncValue ==
"on"))
2149 if(line.find(SO3_CONFIG_QUAD_BUFFER_KEYWORD) != string::npos)
2152 size_t keywordLength = string(SO3_CONFIG_QUAD_BUFFER_KEYWORD).length() + 1;
2153 if(line.length() > keywordLength)
2155 string quadBufferValue = boost::algorithm::to_lower_copy(line.substr(keywordLength));
2156 if((quadBufferValue ==
"1") || (quadBufferValue ==
"yes") || (quadBufferValue ==
"true") || (quadBufferValue ==
"on"))
2157 iniFileActivateQuadBuffer = 1;
2159 iniFileActivateQuadBuffer = -1;
2164 if(line.find(SO3_CONFIG_FOCAL_LENGTH_KEYWORD) != string::npos)
2167 size_t keywordLength = string(SO3_CONFIG_FOCAL_LENGTH_KEYWORD).length() + 1;
2168 if(line.length() > keywordLength)
2170 std::istringstream is(line.substr(keywordLength));
2171 is >> quadBufferFocalLength;
2172 hasQuadBufferFocal =
true;
2177 if(line.find(SO3_CONFIG_EYES_SEPARATION_KEYWORD) != string::npos)
2180 size_t keywordLength = string(SO3_CONFIG_EYES_SEPARATION_KEYWORD).length() + 1;
2181 if(line.length() > keywordLength)
2183 std::istringstream is(line.substr(keywordLength));
2184 is >> quadBufferEyesSeparation;
2185 hasQuadBufferEyeSep =
true;
2198 configForced =
true;
2219 bool wantsQuadBuffer =
false;
2220 switch(iniFileActivateQuadBuffer)
2223 wantsQuadBuffer =
false;
2224 configForced =
true;
2227 wantsQuadBuffer =
false;
2230 wantsQuadBuffer =
true;
2235 if(!hasQuadBufferEyeSep || !hasQuadBufferFocal)
2236 configForced =
true;
2239 if(iniFileFsaa.empty())
2242 configForced =
true;
2244 defaultFsaa = iniFileFsaa;
2248 SetRenderSystem(iniFileRenderSystem, wantsQuadBuffer);
2251 if(configForced ==
true)
2252 WriteConfigFile(iniFilePath);
2255void SRoot::WriteConfigFile(
const std::string& filename)
2258 std::stringstream content;
2259 std::ifstream inputIniFile(filename.c_str());
2262 bool QuadBufferSetted =
false;
2266 while (std::getline(inputIniFile, line))
2268 if((line.find(SO3_CONFIG_RENDERER_KEYWORD) == string::npos)
2269 &&(line.find(SO3_CONFIG_FSAA_KEYWORD) == string::npos)
2270 &&(line.find(SO3_CONFIG_FOCAL_LENGTH_KEYWORD) == string::npos)
2271 &&(line.find(SO3_CONFIG_EYES_SEPARATION_KEYWORD) == string::npos))
2273 if (line.find(SO3_CONFIG_QUAD_BUFFER_KEYWORD) != string::npos)
2274 QuadBufferSetted =
true;
2277 content << line << std::endl;
2280 inputIniFile.close();
2285 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_DIRECTX9 << std::endl;
2289 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_DIRECTX11 << std::endl;
2293 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_OPENGL << std::endl;
2297 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_VULKAN << std::endl;
2301 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_TINY << std::endl;
2305 content << SO3_CONFIG_RENDERER_KEYWORD <<
" " << SO3_CONFIG_RENDERER_METAL << std::endl;
2309 content << SO3_CONFIG_FSAA_KEYWORD <<
" " << defaultFsaa << std::endl;
2312 if(O3Render != 0 && !QuadBufferSetted)
2317 content << SO3_CONFIG_QUAD_BUFFER_KEYWORD <<
" yes" << std::endl;
2322 content << SO3_CONFIG_QUAD_BUFFER_KEYWORD <<
" no" << std::endl;
2327 content << SO3_CONFIG_FOCAL_LENGTH_KEYWORD <<
" " << quadBufferFocalLength << std::endl;
2330 content << SO3_CONFIG_EYES_SEPARATION_KEYWORD <<
" " << quadBufferEyesSeparation << std::endl;
2333 std::ofstream outputIniFile(filename.c_str(), std::ios::out | std::ios::trunc);
2336 outputIniFile << content.str();
2337 outputIniFile.close();
2346 mShaderGenerator->removeAllShaderBasedTechniques(mat->getName(), mat->getGroup());
2353 mShaderGenerator->invalidateMaterial(Ogre::MSN_SHADERGEN, mat->getName(), mat->getGroup());
2360 Ogre::RTShader::ShaderGenerator* mGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
2362 std::string cSchemeName = schemeName;
2363 if (cSchemeName != Ogre::MSN_SHADERGEN)
2364 cSchemeName = cSchemeName.erase(0, 15);
2367 Ogre::Technique* tech = 0;
2370 Ogre::Material::Techniques techList = originalMaterial->getTechniques();
2371 for (
unsigned int i = 0; i < techList.size(); i++)
2373 Ogre::Technique* curTechnique = techList[i];
2374 Ogre::String curScheme = curTechnique->getSchemeName();
2375 Ogre::Any bindedSTechnique = curTechnique->getUserObjectBindings().getUserAny(
"STechnique");
2376 if (bindedSTechnique.has_value())
2378 STechnique* so3Technique = Ogre::any_cast<STechnique*> (bindedSTechnique);
2382 if (curScheme == cSchemeName)
2385 curTechnique->setSchemeName(curScheme);
2386 tech = curTechnique;
2395 Ogre::Material::Techniques techList = originalMaterial->getSupportedTechniques();
2396 tech = (techList.size() > 0) ? techList[0] : 0;
2403 Ogre::Technique::Passes passList = tech->getPasses();
2404 for (
unsigned short i = 0; i < passList.size(); i++)
2406 Ogre::Pass* pass = passList[i];
2407 Ogre::Any bindedSPass = pass->getUserObjectBindings().getUserAny(
"SPass");
2408 bool isGenerated =
false;
2409 if (bindedSPass.has_value())
2411 SPass* matPass = Ogre::any_cast<SPass*> (bindedSPass);
2415 if (pass->hasVertexProgram() && pass->hasFragmentProgram() && !isGenerated)
2417 Ogre::GpuProgramPtr vp = pass->getVertexProgram();
2418 Ogre::GpuProgramPtr fp = pass->getFragmentProgram();
2419 if (vp && fp && vp->isSupported() && fp->isSupported())
2425 if (nbGoodPass == tech->getNumPasses())
2427 tech->setSchemeName(schemeName);
2429 originalMaterial->compile();
2437 techList = originalMaterial->getTechniques();
2438 for (
unsigned int i = 0; i < techList.size(); i++)
2440 Ogre::Technique* curTechnique = techList[i];
2441 if ((curTechnique->getSchemeName() == Ogre::MSN_DEFAULT) || (curTechnique->getSchemeName() ==
"basic_mat") || (curTechnique->getSchemeName() ==
"SO3_LEGACY"))
2443 tech = curTechnique;
2452 Ogre::Technique::Passes passList = tech->getPasses();
2453 for (
unsigned short i = 0; i < passList.size(); i++)
2455 Ogre::Pass* ambpass = 0;
2456 Ogre::Pass* pass = passList[i];
2458 bool isShadowPass =
false;
2460 SSceneMap::iterator iScene = sceneList.begin();
2461 while (iScene != sceneList.end())
2463 if (iScene->second->GetShadowManager() && iScene->second->GetShadowManager()->IsShadowMaterialPass(pass))
2464 isShadowPass =
true;
2472 if (pass && (pass->getIlluminationStage() == Ogre::IS_AMBIENT))
2476 else if (pass && (pass->getIlluminationStage() == Ogre::IS_PER_LIGHT || pass->getIteratePerLight()))
2480 ambpass->setAmbient(pass->getAmbient());
2481 ambpass->setDiffuse(pass->getDiffuse());
2482 ambpass->setEmissive(pass->getEmissive());
2483 ambpass->setSpecular(pass->getSpecular());
2484 ambpass->setShininess(pass->getShininess());
2486 size_t nbTex = pass->getNumTextureUnitStates();
2487 for (
size_t t = 0; t < nbTex; t++)
2489 Ogre::TextureUnitState* ustate = pass->getTextureUnitState(t);
2490 ambpass->addTextureUnitState(ustate);
2493 ambpass->setVertexProgram(
"",
true);
2494 ambpass->setFragmentProgram(
"",
true);
2496 ambpass->setIlluminationStage(Ogre::IS_UNKNOWN);
2497 tech->removePass(i);
2501 pass->setIlluminationStage(Ogre::IS_UNKNOWN);
2502 pass->setDepthWriteEnabled(
true);
2503 pass->setDepthCheckEnabled(
true);
2504 pass->setVertexProgram(
"",
true);
2505 pass->setFragmentProgram(
"",
true);
2506 pass->setMaxSimultaneousLights(3);
2507 pass->setIteratePerLight(
false);
2533 bool techniqueCreated = mGenerator->createShaderBasedTechnique(
2535 tech->getSchemeName(),
2538 if (!techniqueCreated)
2541 techniqueCreated = mGenerator->createShaderBasedTechnique(
2546 if (!techniqueCreated)
2548 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"Material scheme conversion failed from " + tech->getSchemeName() +
" to " + schemeName +
" on material : " + originalMaterial->getName());
2554 Ogre::Technique::Passes passList = tech->getPasses();
2555 for (
unsigned short i = 0; i < passList.size(); i++)
2557 Ogre::Pass* pass = passList[i];
2558 bool ignoreSlicePlane =
true;
2560 Ogre::Any bindedSTechnique = tech->getUserObjectBindings().getUserAny(
"STechnique");
2561 if (bindedSTechnique.has_value())
2563 STechnique* so3Technique = Ogre::any_cast<STechnique*> (bindedSTechnique);
2571 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"Material scheme converted from " + tech->getSchemeName() +
" to " + schemeName +
" on material : " + originalMaterial->getName() +
" with group : " + originalMaterial->getGroup());
2576 mGenerator->validateMaterial(schemeName, originalMaterial->getName(), originalMaterial->getGroup());
2578 catch (Ogre::Exception &)
2580 return Ogre::MaterialManager::getSingletonPtr()->getByName(
"BaseWhite", Ogre::RGN_INTERNAL)->getBestTechnique();
2583 if (originalMaterial->getLoadingState() == Ogre::Resource::LOADSTATE_UNLOADED)
2584 originalMaterial->compile();
2604 techList = originalMaterial->getTechniques();
2605 for(
unsigned int i = 0; i < techList.size(); i++)
2607 Ogre::Technique* curTech = techList[i];
2608 MMechostr(MSKDEBUG,
">>>> Material %s technique scheme name : %s > %s\n", originalMaterial->getName().c_str(), schemeName.c_str(), curTech->getSchemeName().c_str());
2609 if (curTech->getSchemeName() == schemeName)
2631 Ogre::RTShader::ShaderGenerator* mGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
2632 if (mGenerator->hasRenderState(tech->getSchemeName()))
2634 Ogre::Material* mat = tech->getParent();
2635 mGenerator->validateMaterialIlluminationPasses(tech->getSchemeName(), mat->getName(), mat->getGroup());
2643 Ogre::RTShader::ShaderGenerator* mGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
2644 if (mGenerator->hasRenderState(tech->getSchemeName()))
2646 Ogre::Material* mat = tech->getParent();
2647 mGenerator->invalidateMaterialIlluminationPasses(tech->getSchemeName(), mat->getName(), mat->getGroup());
2653bool SRoot::initialiseRTShaderSystem()
2655 if (Ogre::RTShader::ShaderGenerator::initialize())
2657 mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
2660 mShaderGenerator->addSubRenderStateFactory(curFactory);
2663 mShaderGenerator->addSubRenderStateFactory(curFactory);
2666 if (mMaterialMgrListener == NULL)
2669 Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
2673 mDummyScene = O3Root->createSceneManager(Ogre::SMT_DEFAULT,
"DummyScene");
2674 Ogre::AxisAlignedBox octreeBox(-1, -1, -1, 1, 1, 1);
2675 int octreeDepth = 0;
2676 mDummyScene->setOption(
"Size", &octreeBox);
2677 mDummyScene->setOption(
"Depth", &octreeDepth);
2679 Ogre::RenderQueue* rq = mDummyScene->getRenderQueue();
2680 rq->getQueueGroup(Ogre::RENDER_QUEUE_WORLD_GEOMETRY_1)->setShadowsEnabled(
false);
2681 rq->getQueueGroup(Ogre::RENDER_QUEUE_WORLD_GEOMETRY_2)->setShadowsEnabled(
false);
2682 rq->getQueueGroup(Ogre::RENDER_QUEUE_MAIN)->setShadowsEnabled(
false);
2684 mShaderGenerator->addSceneManager(mDummyScene);
2686 auto mainRenderState = mShaderGenerator->getRenderState(Ogre::MSN_SHADERGEN);
2688 mainRenderState->setLightCount(0);
2689 mainRenderState->setLightCountAutoUpdate(
true);
2690 mainRenderState->resetToBuiltinSubRenderStates();
2692 auto perPixelLightModel = mShaderGenerator->createSubRenderState(Ogre::RTShader::SRS_PER_VERTEX_LIGHTING);
2693 mainRenderState->addTemplateSubRenderState(perPixelLightModel);
2695 mShaderGenerator->invalidateScheme(Ogre::MSN_SHADERGEN);
2704void SRoot::destroyRTShaderSystem()
2707 Ogre::MaterialManager::getSingleton().setActiveScheme(Ogre::MSN_DEFAULT);
2711 mShaderGenerator->removeSceneManager(mDummyScene);
2712 O3Root->destroySceneManager(mDummyScene);
2717 if (mMaterialMgrListener != NULL)
2719 Ogre::MaterialManager::getSingleton().removeListener(mMaterialMgrListener);
2720 delete mMaterialMgrListener;
2721 mMaterialMgrListener = NULL;
2724 if (mShaderGenerator)
2726 mShaderGenerator->destroy();
2727 mShaderGenerator = 0;
2735 if (!mSlicePlaneParams || (mSlicePlaneState == state))
2738 mSlicePlaneState = state;
2740 if (mSlicePlaneState)
2741 mSlicePlaneParams->setNamedConstant(
"slicePlane", mSlicePlane);
2743 mSlicePlaneParams->setNamedConstant(
"slicePlane", Ogre::Vector4::ZERO);
2745 Ogre::ResourceManager::ResourceMapIterator it = Ogre::MaterialManager::getSingleton().getResourceIterator();
2746 while (it.hasMoreElements())
2748 Ogre::MaterialPtr mat = Ogre::static_pointer_cast<Ogre::Material>(it.getNext());
2751 Ogre::Material::Techniques techs = mat->getTechniques();
2752 for (
unsigned int i = 0; i < techs.size(); i++)
2754 Ogre::Technique* tech = techs[i];
2757 if (tech->getSchemeName().find(std::string(SO3_INTERNAL_RESOURCE_GROUP)) != Ogre::String::npos || tech->getResourceGroup().find(std::string(SO3_INTERNAL_RESOURCE_GROUP)) != Ogre::String::npos)
2760 if (((tech->getSchemeName() != Ogre::MSN_SHADERGEN) &&
2761 (tech->getSchemeName() !=
"SO3_LEGACY") &&
2762 (tech->getSchemeName() !=
"Default") &&
2763 (tech->getSchemeName() !=
"basic_mat")))
2766 Ogre::Any bindedSTechnique = tech->getUserObjectBindings().getUserAny(
"STechnique");
2767 if (!bindedSTechnique.has_value())
2770 STechnique* stechnique = Ogre::any_cast<STechnique*> (bindedSTechnique);
2787 mSlicePlane = plane;
2789 if (!mSlicePlaneParams || !mSlicePlaneState)
2792 mSlicePlaneParams->setNamedConstant(
"slicePlane", mSlicePlane);
2799 return mSlicePlaneState;
2815 if (!renderSystem->isReverseDepthBufferEnabled())
2817 prjA = zfar / (zfar - znear);
2818 prjB = (-zfar * znear) / (zfar - znear);
2822 prjA = -znear / (zfar - znear);
2823 prjB = (zfar * znear) / (zfar - znear);
2827 mCommonParams->setNamedConstant(
"cameraProjection", Ogre::Vector4(prjA, prjB, 0.0, 0.0));
2828 mCommonParams->setNamedConstant(
"cameraParams", Ogre::Vector4(znear, zfar, focalLength, fov));
void(* SetRenderDeviceGetFunction)(std::function< void *()> fptr)
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
std::string firstPartition(((packdir) SCgetExtra("FirstPack")) ->path)
SRoot * scolRoot
Shared data.
static CSMGpuConstants & getSingleton()
static CSMGpuConstants * getSingletonPtr()
static void DestroyManager()
std::string GetName() const
SException indicating that a call to an unimplemented functionnality was done.
bool GetIgnoreSlicePlane()
bool GetRttPixelFormat(Ogre::PixelFormat &format, bool alpha=false, bool floattex=false)
void UnregisterViewport(SViewPort *viewport)
SScene * GetScene(const std::string &sceneName)
void SetLogEnable(const bool &state)
SDeferredShading * GetDeferredManager()
void DestroyInternalRessources()
RenderSystem GetRenderSystem()
void RemoveScene(SScene *existingScene)
const SWindowMap & GetRenderWindowList() const
bool IsRenderInitialised()
void AddRenderWindow(SWindow *existingWindow)
bool GetQuadBufferEnable()
SWindow * CreateRenderWindow(const ScolWindowHandle windowHandle, const std::string &windowName, const int &width, const int &height, const std::string &renderWindowFsaa="default")
void SetLogMask(const Ogre::LogMessageLevel &level)
bool SetFullScreenState(SWindow *window, const bool &state, const int &width, const int &height)
void AddLogListener(SLogListener *newLogListener)
SWindow * GetRenderWindow(const std::string &windowName)
void RegisterViewport(SViewPort *viewport)
Ogre::Root * GetOgreRootPointer()
void RemoveLogListener(SLogListener *existingLogListener)
void InitRenderer(SWindow *pwin=0)
void RemoveManualRessourceGroup(std::string name)
bool checkFSAA(const Ogre::String &val)
SScene * CreateScene(const std::string &newSceneName)
void DeleteScene(SScene *existingScene)
void SetDebugDisplay(const int &color, const int &posx, const int &posy, const int &width, const int &height, const int &charHeight)
void SetProgramCameraParameter(float fov, float znear, float zfar, float focalLength)
void UpdateCamera(SViewPort *viewport)
void DeleteRenderWindow(SWindow *existingWindow)
void AddManualRessourceGroup(std::string name)
std::vector< std::string > GetMultisamplingMode(const RenderSystem &wishedRenderSystem)
bool GetSlicePlaneState()
const SSceneMap & GetSceneList() const
void SetSlicePlane(Ogre::Vector4 plane)
void ReloadInternalRessources()
Ogre::RenderSystem * GetOgreRenderSystem()
virtual void eventOccurred(const Ogre::String &eventName, const Ogre::NameValuePairList *parameters)
float GetQuadBufferFocalLength()
void AddScene(SScene *existingScene)
void SetSlicePlaneState(bool state)
void SetDebugEnable(const bool &enable)
void RemoveGeneratedMaterial(Ogre::Material *mat)
void SetDebugText(const std::string &text)
static SRoot & getSingleton()
static SRoot * getSingletonPtr()
virtual void messageLogged(const Ogre::String &message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String &logName, bool &skipMessage)
Ogre::Vector4 GetSlicePlane()
void InvalidateGeneratedMaterial(Ogre::Material *mat)
void ClearManualRessourceGroups()
bool CheckDirectxVersion()
void RemoveRenderWindow(SWindow *existingWindow)
float GetQuadBufferEyesSeparation()
void SetDebugEnable(const bool &enable)
Ogre::SceneManager * GetOgreScenePointer()
virtual void ApplyShader()
void UpdateGeneratedTech(bool full=false)
SMaterial * GetParentMaterial()
const Ogre::String GetOriginalScheme()
Ogre::RenderWindow * GetOgreRenderWindowPointer()
int Size(const int &x, const int &y, const int &w, const int &h, const int &ext)
virtual bool afterIlluminationPassesCreated(Ogre::Technique *tech)
virtual bool beforeIlluminationPassesCleared(Ogre::Technique *tech)
virtual Ogre::Technique * handleSchemeNotFound(unsigned short schemeIndex, const Ogre::String &schemeName, Ogre::Material *originalMaterial, unsigned short lodIndex, const Ogre::Renderable *rend)
std::unordered_map< std::string, SScene * > SSceneMap
std::unordered_map< std::string, SWindow * > SWindowMap