Bubble up render settings from CPP to JS/QML
Showing the changes to interface/src/Application.cpp (1 of 31 files). Show all
Unified · Split
| @@ -102,7 +102,6 @@ · 101 unmodified lines | |||
| 102 | #include <RenderShadowTask.h> | 102 | #include <RenderShadowTask.h> |
| 103 | #include <RenderDeferredTask.h> | 103 | #include <RenderDeferredTask.h> |
| 104 | #include <ResourceCache.h> | 104 | #include <ResourceCache.h> |
| 105 | #include <RenderScriptingInterface.h> | ||
| 106 | #include <SceneScriptingInterface.h> | 105 | #include <SceneScriptingInterface.h> |
| 107 | #include <RecordingScriptingInterface.h> | 106 | #include <RecordingScriptingInterface.h> |
| 108 | #include <ScriptCache.h> | 107 | #include <ScriptCache.h> |
| @@ -363,7 +362,6 @@ bool setupEssentials(int& argc, char** argv) { · 254 unmodified lines | |||
| 363 | #endif | 362 | #endif |
| 364 | DependencyManager::set<DiscoverabilityManager>(); | 363 | DependencyManager::set<DiscoverabilityManager>(); |
| 365 | DependencyManager::set<SceneScriptingInterface>(); | 364 | DependencyManager::set<SceneScriptingInterface>(); |
| 366 | DependencyManager::set<RenderScriptingInterface>(); | ||
| 367 | DependencyManager::set<OffscreenUi>(); | 365 | DependencyManager::set<OffscreenUi>(); |
| 368 | DependencyManager::set<AutoUpdater>(); | 366 | DependencyManager::set<AutoUpdater>(); |
| 369 | DependencyManager::set<PathUtils>(); | 367 | DependencyManager::set<PathUtils>(); |
| @@ -675,12 +673,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 305 unmodified lines | |||
| 675 | _offscreenContext->makeCurrent(); | 673 | _offscreenContext->makeCurrent(); |
| 676 | initializeGL(); | 674 | initializeGL(); |
| 677 | 675 | ||
| 678 | // Start rendering | ||
| 679 | render::CullFunctor cullFunctor = LODManager::shouldRender; | ||
| 680 | _renderEngine->addTask(make_shared<RenderShadowTask>(cullFunctor)); | ||
| 681 | _renderEngine->addTask(make_shared<RenderDeferredTask>(cullFunctor)); | ||
| 682 | _renderEngine->registerScene(_main3DScene); | ||
| 683 | |||
| 684 | _offscreenContext->makeCurrent(); | 676 | _offscreenContext->makeCurrent(); |
| 685 | 677 | ||
| 686 | // Tell our entity edit sender about our known jurisdictions | 678 | // Tell our entity edit sender about our known jurisdictions |
| @@ -1151,9 +1143,17 @@ void Application::initializeGL() { · 464 unmodified lines | |||
| 1151 | initDisplay(); | 1143 | initDisplay(); |
| 1152 | qCDebug(interfaceapp, "Initialized Display."); | 1144 | qCDebug(interfaceapp, "Initialized Display."); |
| 1153 | 1145 | ||
| 1146 | // Set up the render engine | ||
| 1147 | render::CullFunctor cullFunctor = LODManager::shouldRender; | ||
| 1148 | _renderEngine->addJob<RenderShadowTask>("RenderShadowTask", cullFunctor); | ||
| 1149 | _renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", cullFunctor); | ||
| 1150 | _renderEngine->registerScene(_main3DScene); | ||
| 1151 | // TODO: Load a cached config file | ||
| 1152 | |||
| 1154 | // The UI can't be created until the primary OpenGL | 1153 | // The UI can't be created until the primary OpenGL |
| 1155 | // context is created, because it needs to share | 1154 | // context is created, because it needs to share |
| 1156 | // texture resources | 1155 | // texture resources |
| 1156 | // Needs to happen AFTER the render engine initialization to access its configuration | ||
| 1157 | initializeUi(); | 1157 | initializeUi(); |
| 1158 | qCDebug(interfaceapp, "Initialized Offscreen UI."); | 1158 | qCDebug(interfaceapp, "Initialized Offscreen UI."); |
| 1159 | _offscreenContext->makeCurrent(); | 1159 | _offscreenContext->makeCurrent(); |
| @@ -1251,7 +1251,7 @@ void Application::initializeUi() { · 91 unmodified lines | |||
| 1251 | rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data()); | 1251 | rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data()); |
| 1252 | rootContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data()); | 1252 | rootContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data()); |
| 1253 | rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data()); | 1253 | rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data()); |
| 1254 | rootContext->setContextProperty("Render", DependencyManager::get<RenderScriptingInterface>().data()); | 1254 | rootContext->setContextProperty("Render", _renderEngine->getConfiguration().get()); |
| 1255 | 1255 | ||
| 1256 | _glWidget->installEventFilter(offscreenUi.data()); | 1256 | _glWidget->installEventFilter(offscreenUi.data()); |
| 1257 | offscreenUi->setMouseTranslator([=](const QPointF& pt) { | 1257 | offscreenUi->setMouseTranslator([=](const QPointF& pt) { |
| @@ -3769,29 +3769,13 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 2511 unmodified lines | |||
| 3769 | { | 3769 | { |
| 3770 | PerformanceTimer perfTimer("EngineRun"); | 3770 | PerformanceTimer perfTimer("EngineRun"); |
| 3771 | 3771 | ||
| 3772 | auto renderInterface = DependencyManager::get<RenderScriptingInterface>(); | ||
| 3773 | auto renderContext = renderInterface->getRenderContext(); | ||
| 3774 | |||
| 3775 | renderArgs->_viewFrustum = getDisplayViewFrustum(); | 3772 | renderArgs->_viewFrustum = getDisplayViewFrustum(); |
| 3776 | renderContext.setArgs(renderArgs); | 3773 | _renderEngine->getRenderContext()->args = renderArgs; |
| 3777 | |||
| 3778 | bool occlusionStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugAmbientOcclusion); | ||
| 3779 | bool shadowStatus = Menu::getInstance()->isOptionChecked(MenuOption::DebugShadows); | ||
| 3780 | bool antialiasingStatus = Menu::getInstance()->isOptionChecked(MenuOption::Antialiasing); | ||
| 3781 | bool showOwnedStatus = Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowOwned); | ||
| 3782 | renderContext.setOptions(occlusionStatus, antialiasingStatus, showOwnedStatus, shadowStatus); | ||
| 3783 | |||
| 3784 | _renderEngine->setRenderContext(renderContext); | ||
| 3785 | 3774 | ||
| 3786 | // Before the deferred pass, let's try to use the render engine | 3775 | // Before the deferred pass, let's try to use the render engine |
| 3787 | myAvatar->startRenderRun(); | 3776 | myAvatar->startRenderRun(); |
| 3788 | _renderEngine->run(); | 3777 | _renderEngine->run(); |
| 3789 | myAvatar->endRenderRun(); | 3778 | myAvatar->endRenderRun(); |
| 3790 | |||
| 3791 | auto engineContext = _renderEngine->getRenderContext(); | ||
| 3792 | renderInterface->setItemCounts(engineContext->getItemsConfig()); | ||
| 3793 | renderInterface->setJobGPUTimes(engineContext->getAmbientOcclusion().gpuTime); | ||
| 3794 | |||
| 3795 | } | 3779 | } |
| 3796 | 3780 | ||
| 3797 | activeRenderingThread = nullptr; | 3781 | activeRenderingThread = nullptr; |
| @@ -4200,7 +4184,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 402 unmodified lines | |||
| 4200 | scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0); | 4184 | scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0); |
| 4201 | 4185 | ||
| 4202 | scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); | 4186 | scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data()); |
| 4203 | scriptEngine->registerGlobalObject("Render", DependencyManager::get<RenderScriptingInterface>().data()); | 4187 | scriptEngine->registerGlobalObject("Render", _renderEngine->getConfiguration().get()); |
| 4204 | 4188 | ||
| 4205 | scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data()); | 4189 | scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data()); |
| 4206 | } | 4190 | } |