Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 81 files). Show all
Unified · Split
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | // |
| 10 | 10 | #include "RenderScriptingInterface.h" |
| 11 | 11 | |
| 12 | +#include <RenderCommonTask.h> | |
| 12 | 13 | #include <ScriptEngineCast.h> |
| 13 | 14 | |
| 14 | 15 | #include "LightingModel.h" |
| @@ -79,14 +80,35 @@ void RenderScriptingInterface::setRenderMethod(RenderMethod renderMethod) { · 64 unmodified lines | ||
| 79 | 80 | emit settingsChanged(); |
| 80 | 81 | } |
| 81 | 82 | } |
| 83 | + | |
| 84 | +void recursivelyUpdateMirrorRenderMethods(const QString& parentTaskName, int renderMethod, int depth) { | |
| 85 | + if (depth == RenderMirrorTask::MAX_MIRROR_DEPTH) { | |
| 86 | + return; | |
| 87 | + } | |
| 88 | + | |
| 89 | + for (size_t mirrorIndex = 0; mirrorIndex < RenderMirrorTask::MAX_MIRRORS_PER_LEVEL; mirrorIndex++) { | |
| 90 | + std::string mirrorTaskString = parentTaskName.toStdString() + ".RenderMirrorView" + std::to_string(mirrorIndex) + "Depth" + std::to_string(depth) + ".DeferredForwardSwitch"; | |
| 91 | + auto mirrorConfig = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig(QString::fromStdString(mirrorTaskString))); | |
| 92 | + if (mirrorConfig) { | |
| 93 | + mirrorConfig->setBranch((int)renderMethod); | |
| 94 | + recursivelyUpdateMirrorRenderMethods(QString::fromStdString(mirrorTaskString) + (renderMethod == 1 ? ".RenderForwardTask" : ".RenderShadowsAndDeferredTask.RenderDeferredTask"), | |
| 95 | + renderMethod, depth + 1); | |
| 96 | + } | |
| 97 | + } | |
| 98 | +} | |
| 99 | + | |
| 82 | 100 | void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) { |
| 83 | 101 | _renderSettingLock.withWriteLock([&] { |
| 84 | 102 | _renderMethod = (int)renderMethod; |
| 85 | 103 | _renderMethodSetting.set((int)renderMethod); |
| 86 | 104 | |
| 87 | − auto config = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch")); | |
| 105 | + QString configName = "RenderMainView.DeferredForwardSwitch"; | |
| 106 | + auto config = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig(configName)); | |
| 88 | 107 | if (config) { |
| 89 | 108 | config->setBranch((int)renderMethod); |
| 109 | + | |
| 110 | + recursivelyUpdateMirrorRenderMethods(configName + (renderMethod == RenderMethod::FORWARD ? ".RenderForwardTask" : ".RenderShadowsAndDeferredTask.RenderDeferredTask"), | |
| 111 | + (int)renderMethod, 0); | |
| 90 | 112 | } |
| 91 | 113 | }); |
| 92 | 114 | } |