Skip to content

Commit

Permalink
Fix: Setting volumetric lighting from graphics menu
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Mar 3, 2024
1 parent 03859b0 commit ea16d23
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,9 +1342,19 @@ bool runGraphicsOptionsMenu()
case FRONTEND_VOLUMETRIC_LIGHTING_R:
{
auto previousValue = static_cast<int>(war_getVolumetricLighting());
auto newValue = previousValue + 1 % 4;
war_setVolumetricLighting(static_cast<VOLUMETRIC_LIGHT_LEVEL>(newValue));
widgSetString(psWScreen, FRONTEND_VOLUMETRIC_LIGHTING_R, graphicsOptionsVolumetricLightingString());
auto newValue = (previousValue + 1) % 4;

auto shadowConstants = gfx_api::context::get().getShadowConstants();
shadowConstants.isVolumetricLightingEnabled = static_cast<VOLUMETRIC_LIGHT_LEVEL>(newValue);
if (gfx_api::context::get().setShadowConstants(shadowConstants))
{
war_setVolumetricLighting(static_cast<VOLUMETRIC_LIGHT_LEVEL>(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:
Expand Down

0 comments on commit ea16d23

Please sign in to comment.