Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -124,6 +124,33 @@ QStringList RenderScriptingInterface::getRenderMethodNames() const { · 123 unmodified lines | |||
| 124 | return refrenderMethodNames; | 124 | return refrenderMethodNames; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void recursivelyUpdateLightingModel(const QString& parentTaskName, std::function<void(MakeLightingModelConfig *)> updateLambda, int depth = -1) { | ||
| 128 | if (depth == -1) { | ||
| 129 | auto secondaryLightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | ||
| 130 | if (secondaryLightingModelConfig) { | ||
| 131 | updateLambda(secondaryLightingModelConfig); | ||
| 132 | } | ||
| 133 | |||
| 134 | auto mainLightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | ||
| 135 | if (mainLightingModelConfig) { | ||
| 136 | updateLambda(mainLightingModelConfig); | ||
| 137 | } | ||
| 138 | |||
| 139 | recursivelyUpdateLightingModel("RenderMainView", updateLambda, depth + 1); | ||
| 140 | } else if (depth == RenderMirrorTask::MAX_MIRROR_DEPTH) { | ||
| 141 | return; | ||
| 142 | } | ||
| 143 | |||
| 144 | for (size_t mirrorIndex = 0; mirrorIndex < RenderMirrorTask::MAX_MIRRORS_PER_LEVEL; mirrorIndex++) { | ||
| 145 | std::string mirrorTaskString = parentTaskName.toStdString() + ".RenderMirrorView" + std::to_string(mirrorIndex) + "Depth" + std::to_string(depth); | ||
| 146 | auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>(mirrorTaskString + ".LightingModel"); | ||
| 147 | if (lightingModelConfig) { | ||
| 148 | updateLambda(lightingModelConfig); | ||
| 149 | recursivelyUpdateLightingModel(QString::fromStdString(mirrorTaskString), updateLambda, depth + 1); | ||
| 150 | } | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 127 | bool RenderScriptingInterface::getShadowsEnabled() const { | 154 | bool RenderScriptingInterface::getShadowsEnabled() const { |
| 128 | return _shadowsEnabled; | 155 | return _shadowsEnabled; |
| 129 | } | 156 | } |
| @@ -140,17 +167,9 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { · 10 unmodified lines | |||
| 140 | _shadowsEnabled = (enabled); | 167 | _shadowsEnabled = (enabled); |
| 141 | _shadowsEnabledSetting.set(enabled); | 168 | _shadowsEnabledSetting.set(enabled); |
| 142 | 169 | ||
| 143 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | ||
| 144 | assert(renderConfig); | ||
| 145 | Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | 170 | Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); |
| 146 | auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | 171 | |
| 147 | if (lightingModelConfig) { | 172 | recursivelyUpdateLightingModel("", [enabled] (MakeLightingModelConfig *config) { config->setShadow(enabled); }); |
| 148 | lightingModelConfig->setShadow(enabled); | ||
| 149 | } | ||
| 150 | auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | ||
| 151 | if (secondaryLightingModelConfig) { | ||
| 152 | secondaryLightingModelConfig->setShadow(enabled); | ||
| 153 | } | ||
| 154 | }); | 173 | }); |
| 155 | } | 174 | } |
| 156 | 175 | ||
| @@ -170,16 +189,7 @@ void RenderScriptingInterface::forceHazeEnabled(bool enabled) { · 13 unmodified lines | |||
| 170 | _hazeEnabled = (enabled); | 189 | _hazeEnabled = (enabled); |
| 171 | _hazeEnabledSetting.set(enabled); | 190 | _hazeEnabledSetting.set(enabled); |
| 172 | 191 | ||
| 173 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | 192 | recursivelyUpdateLightingModel("", [enabled] (MakeLightingModelConfig *config) { config->setHaze(enabled); }); |
| 174 | assert(renderConfig); | ||
| 175 | auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | ||
| 176 | if (lightingModelConfig) { | ||
| 177 | lightingModelConfig->setHaze(enabled); | ||
| 178 | } | ||
| 179 | auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | ||
| 180 | if (secondaryLightingModelConfig) { | ||
| 181 | secondaryLightingModelConfig->setHaze(enabled); | ||
| 182 | } | ||
| 183 | }); | 193 | }); |
| 184 | } | 194 | } |
| 185 | 195 | ||
| @@ -199,16 +209,7 @@ void RenderScriptingInterface::forceBloomEnabled(bool enabled) { · 13 unmodified lines | |||
| 199 | _bloomEnabled = (enabled); | 209 | _bloomEnabled = (enabled); |
| 200 | _bloomEnabledSetting.set(enabled); | 210 | _bloomEnabledSetting.set(enabled); |
| 201 | 211 | ||
| 202 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | 212 | recursivelyUpdateLightingModel("", [enabled] (MakeLightingModelConfig *config) { config->setBloom(enabled); }); |
| 203 | assert(renderConfig); | ||
| 204 | auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | ||
| 205 | if (lightingModelConfig) { | ||
| 206 | lightingModelConfig->setBloom(enabled); | ||
| 207 | } | ||
| 208 | auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | ||
| 209 | if (secondaryLightingModelConfig) { | ||
| 210 | secondaryLightingModelConfig->setBloom(enabled); | ||
| 211 | } | ||
| 212 | }); | 213 | }); |
| 213 | } | 214 | } |
| 214 | 215 | ||
| @@ -229,7 +230,8 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 14 unmodified lines | |||
| 229 | _ambientOcclusionEnabledSetting.set(enabled); | 230 | _ambientOcclusionEnabledSetting.set(enabled); |
| 230 | 231 | ||
| 231 | Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); | 232 | Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); |
| 232 | ModelMeshPartPayload::enableMaterialProceduralShaders = enabled; | 233 | |
| 234 | recursivelyUpdateLightingModel("", [enabled] (MakeLightingModelConfig *config) { config->setAmbientOcclusion(enabled); }); | ||
| 233 | }); | 235 | }); |
| 234 | } | 236 | } |
| 235 | 237 | ||