From ea16d2371c4b7df87283489722efa7342a522dcd Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:24:26 -0500 Subject: [PATCH] Fix: Setting volumetric lighting from graphics menu --- src/frontend.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/frontend.cpp b/src/frontend.cpp index 182cc83b70e..4100348f976 100644 --- a/src/frontend.cpp +++ b/src/frontend.cpp @@ -1342,9 +1342,19 @@ bool runGraphicsOptionsMenu() case FRONTEND_VOLUMETRIC_LIGHTING_R: { auto previousValue = static_cast(war_getVolumetricLighting()); - auto newValue = previousValue + 1 % 4; - war_setVolumetricLighting(static_cast(newValue)); - widgSetString(psWScreen, FRONTEND_VOLUMETRIC_LIGHTING_R, graphicsOptionsVolumetricLightingString()); + auto newValue = (previousValue + 1) % 4; + + auto shadowConstants = gfx_api::context::get().getShadowConstants(); + shadowConstants.isVolumetricLightingEnabled = static_cast(newValue); + if (gfx_api::context::get().setShadowConstants(shadowConstants)) + { + war_setVolumetricLighting(static_cast(newValue)); + widgSetString(psWScreen, FRONTEND_VOLUMETRIC_LIGHTING_R, graphicsOptionsVolumetricLightingString()); + } + else + { + debug(LOG_ERROR, "Failed to set volumetric lighting value: %d", (int)newValue); + } break; } case FRONTEND_FOG: