Skip to content

Commit

Permalink
Fix: Setting per pixel 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 fa0d3c0 commit 3fdefb7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,22 @@ bool runGraphicsOptionsMenu()
case FRONTEND_LIGHTS:
case FRONTEND_LIGHTS_R:
{
war_setPointLightPerPixelLighting(!war_getPointLightPerPixelLighting());
widgSetString(psWScreen, FRONTEND_LIGHTS_R, graphicsOptionsLightingString());
bool newValue = !war_getPointLightPerPixelLighting();
if (getTerrainShaderQuality() != TerrainShaderQuality::NORMAL_MAPPING)
{
newValue = false; // point light per pixel lighting is only supported in normal_mapping mode
}
auto shadowConstants = gfx_api::context::get().getShadowConstants();
shadowConstants.isPointLightPerPixelEnabled = newValue;
if (gfx_api::context::get().setShadowConstants(shadowConstants))
{
war_setPointLightPerPixelLighting(newValue);
widgSetString(psWScreen, FRONTEND_LIGHTS_R, graphicsOptionsLightingString());
}
else
{
debug(LOG_ERROR, "Failed to set per pixel point lighting value: %d", (int)newValue);
}
break;
}
case FRONTEND_FOG:
Expand Down

0 comments on commit 3fdefb7

Please sign in to comment.