Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -56,6 +56,7 @@ void RenderScriptingInterface::loadSettings() { · 55 unmodified lines | ||
| 56 | 56 | _hazeEnabled = _hazeEnabledSetting.get(); |
| 57 | 57 | _bloomEnabled = _bloomEnabledSetting.get(); |
| 58 | 58 | _ambientOcclusionEnabled = _ambientOcclusionEnabledSetting.get(); |
| 59 | + _localLightingEnabled = _localLightingSetting.get(); | |
| 59 | 60 | _proceduralMaterialsEnabled = _proceduralMaterialsEnabledSetting.get(); |
| 60 | 61 | _antialiasingMode = static_cast<AntialiasingSetupConfig::Mode>(_antialiasingModeSetting.get()); |
| 61 | 62 | _viewportResolutionScale = _viewportResolutionScaleSetting.get(); |
| @@ -75,6 +76,7 @@ void RenderScriptingInterface::loadSettings() { · 13 unmodified lines | ||
| 75 | 76 | forceHazeEnabled(_hazeEnabled); |
| 76 | 77 | forceBloomEnabled(_bloomEnabled); |
| 77 | 78 | forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); |
| 79 | + forceLocalLightingEnabled(_localLightingEnabled); | |
| 78 | 80 | forceProceduralMaterialsEnabled(_proceduralMaterialsEnabled); |
| 79 | 81 | forceAntialiasingMode(_antialiasingMode); |
| 80 | 82 | forceViewportResolutionScale(_viewportResolutionScale); |
| @@ -245,6 +247,36 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 164 unmodified lines | ||
| 245 | 247 | }); |
| 246 | 248 | } |
| 247 | 249 | |
| 250 | +static void recursivelyUpdateLocalLightingSetting(const QString& parentTaskName, bool enabled, int depth = -1) { | |
| 251 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 252 | + | |
| 253 | + if (depth == -1) { | |
| 254 | + auto secondaryLightPassConfig = renderConfig->getConfig<LightClusteringPass>("RenderSecondView.LightClustering"); | |
| 255 | + if (secondaryLightPassConfig) { | |
| 256 | + secondaryLightPassConfig->setLocalLightingEnabled(enabled); | |
| 257 | + } | |
| 258 | + | |
| 259 | + auto mainLightPassConfig = renderConfig->getConfig<LightClusteringPass>("RenderMainView.LightClustering"); | |
| 260 | + if (mainLightPassConfig) { | |
| 261 | + mainLightPassConfig->setLocalLightingEnabled(enabled); | |
| 262 | + qDebug() << "RenderMainView.LightClustering" << mainLightPassConfig->localLightingEnabled; | |
| 263 | + } | |
| 264 | + | |
| 265 | + recursivelyUpdateLocalLightingSetting("RenderMainView", enabled, depth + 1); | |
| 266 | + } else if (depth == RenderMirrorTask::MAX_MIRROR_DEPTH) { | |
| 267 | + return; | |
| 268 | + } | |
| 269 | + | |
| 270 | + for (size_t mirrorIndex = 0; mirrorIndex < RenderMirrorTask::MAX_MIRRORS_PER_LEVEL; mirrorIndex++) { | |
| 271 | + std::string mirrorTaskString = parentTaskName.toStdString() + ".RenderMirrorView" + std::to_string(mirrorIndex) + "Depth" + std::to_string(depth); | |
| 272 | + auto lightPassConfig = renderConfig->getConfig<LightClusteringPass>(mirrorTaskString + ".LightClustering"); | |
| 273 | + if (lightPassConfig) { | |
| 274 | + lightPassConfig->setLocalLightingEnabled(enabled); | |
| 275 | + recursivelyUpdateLocalLightingSetting(QString::fromStdString(mirrorTaskString), enabled, depth + 1); | |
| 276 | + } | |
| 277 | + } | |
| 278 | +} | |
| 279 | + | |
| 248 | 280 | bool RenderScriptingInterface::getLocalLightingEnabled() const { |
| 249 | 281 | return _localLightingEnabled; |
| 250 | 282 | } |
| @@ -262,12 +294,7 @@ void RenderScriptingInterface::forceLocalLightingEnabled(bool enabled) { · 11 unmodified lines | ||
| 262 | 294 | _localLightingSetting.set(enabled); |
| 263 | 295 | Menu::getInstance()->setIsOptionChecked(MenuOption::LocalLights, enabled); |
| 264 | 296 | |
| 265 | − auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 266 | − auto config = renderConfig->getConfig<LightClusteringPass>("LightClustering"); | |
| 267 | − | |
| 268 | − if (config) { | |
| 269 | − config->setLocalLightingEnabled(enabled); | |
| 270 | − } | |
| 297 | + recursivelyUpdateLocalLightingSetting("", enabled); | |
| 271 | 298 | }); |
| 272 | 299 | } |
| 273 | 300 | |