History

Merge pull request #6930 from zzmp/feat/bubble-render-settings

Bubble up render settings from CPP to JS/QML

samcake committed 10 years ago

Commit f4e03522 parents 86b2a67 49c128531 files · +797 −948Browse files

Showing the changes to interface/src/Application.cpp (1 of 31 files). Show all

Unified · Split

interface/src/Application.cpp+11−27
@@ -102,7 +102,6 @@ · 101 unmodified lines
102102 #include <RenderShadowTask.h>
103103 #include <RenderDeferredTask.h>
104104 #include <ResourceCache.h>
105−#include <RenderScriptingInterface.h>
106105 #include <SceneScriptingInterface.h>
107106 #include <RecordingScriptingInterface.h>
108107 #include <ScriptCache.h>
@@ -363,7 +362,6 @@ bool setupEssentials(int& argc, char** argv) { · 254 unmodified lines
363362 #endif
364363 DependencyManager::set<DiscoverabilityManager>();
365364 DependencyManager::set<SceneScriptingInterface>();
366− DependencyManager::set<RenderScriptingInterface>();
367365 DependencyManager::set<OffscreenUi>();
368366 DependencyManager::set<AutoUpdater>();
369367 DependencyManager::set<PathUtils>();
@@ -675,12 +673,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 305 unmodified lines
675673 _offscreenContext->makeCurrent();
676674 initializeGL();
677675
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−
684676 _offscreenContext->makeCurrent();
685677
686678 // Tell our entity edit sender about our known jurisdictions
@@ -1151,9 +1143,17 @@ void Application::initializeGL() { · 464 unmodified lines
11511143 initDisplay();
11521144 qCDebug(interfaceapp, "Initialized Display.");
11531145
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+
11541153 // The UI can't be created until the primary OpenGL
11551154 // context is created, because it needs to share
11561155 // texture resources
1156+ // Needs to happen AFTER the render engine initialization to access its configuration
11571157 initializeUi();
11581158 qCDebug(interfaceapp, "Initialized Offscreen UI.");
11591159 _offscreenContext->makeCurrent();
@@ -1251,7 +1251,7 @@ void Application::initializeUi() { · 91 unmodified lines
12511251 rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data());
12521252 rootContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
12531253 rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
1254− rootContext->setContextProperty("Render", DependencyManager::get<RenderScriptingInterface>().data());
1254+ rootContext->setContextProperty("Render", _renderEngine->getConfiguration().get());
12551255
12561256 _glWidget->installEventFilter(offscreenUi.data());
12571257 offscreenUi->setMouseTranslator([=](const QPointF& pt) {
@@ -3769,29 +3769,13 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 2511 unmodified lines
37693769 {
37703770 PerformanceTimer perfTimer("EngineRun");
37713771
3772− auto renderInterface = DependencyManager::get<RenderScriptingInterface>();
3773− auto renderContext = renderInterface->getRenderContext();
3774−
37753772 renderArgs->_viewFrustum = getDisplayViewFrustum();
3776− renderContext.setArgs(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);
3773+ _renderEngine->getRenderContext()->args = renderArgs;
37853774
37863775 // Before the deferred pass, let's try to use the render engine
37873776 myAvatar->startRenderRun();
37883777 _renderEngine->run();
37893778 myAvatar->endRenderRun();
3790−
3791− auto engineContext = _renderEngine->getRenderContext();
3792− renderInterface->setItemCounts(engineContext->getItemsConfig());
3793− renderInterface->setJobGPUTimes(engineContext->getAmbientOcclusion().gpuTime);
3794−
37953779 }
37963780
37973781 activeRenderingThread = nullptr;
@@ -4200,7 +4184,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 402 unmodified lines
42004184 scriptEngine->registerFunction("HMD", "getHUDLookAtPosition3D", HMDScriptingInterface::getHUDLookAtPosition3D, 0);
42014185
42024186 scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
4203− scriptEngine->registerGlobalObject("Render", DependencyManager::get<RenderScriptingInterface>().data());
4187+ scriptEngine->registerGlobalObject("Render", _renderEngine->getConfiguration().get());
42044188
42054189 scriptEngine->registerGlobalObject("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
42064190 }