Skip to content

Commit

Permalink
volumetric: Adds option in the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
vlj committed Jan 27, 2024
1 parent f7d64d4 commit 3ffdbde
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,11 @@ bool loadConfig()
war_setPointLightPerPixelLighting(value.value_or(false));
}

{
auto value = iniGetBoolOpt("volumetricLighting");
war_setVolumetricLighting(value.value_or(false));
}

ActivityManager::instance().endLoadingSettings();
return true;
}
Expand Down Expand Up @@ -779,6 +784,7 @@ bool saveConfig()
iniSetInteger("shadowFilterSize", (int)war_getShadowFilterSize());
iniSetInteger("shadowMapResolution", (int)war_getShadowMapResolution());
iniSetBool("pointLightsPerpixel", war_getPointLightPerPixelLighting());
iniSetBool("volumetricLighting", war_getVolumetricLighting());
iniSetInteger("configVersion", CURRCONFVERSION);

// write out ini file changes
Expand Down
18 changes: 18 additions & 0 deletions src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,11 @@ char const* graphicsOptionsLightingString()
return war_getPointLightPerPixelLighting() ? _("Per Pixel") : _("Lightmap");
}

char const* graphicsOptionsVolumetricLightingString()
{
return war_getVolumetricLighting() ? _("On") : _("Off");
}

char const *graphicsOptionsFogString()
{
return pie_GetFogEnabled() ? _("On") : _("Off");
Expand Down Expand Up @@ -1203,6 +1208,12 @@ void startGraphicsOptionsMenu()
grid->place({ 1, 1, false }, row, addMargin(makeTextButton(FRONTEND_LIGHTS_R, graphicsOptionsLightingString(), WBUT_SECONDARY)));
row.start++;

///////////
// Volumetric lighting
grid->place({ 0 }, row, addMargin(makeTextButton(FRONTEND_VOLUMETRIC_LIGHTING, _("Volumetric Lighting"), WBUT_SECONDARY)));
grid->place({ 1, 1, false }, row, addMargin(makeTextButton(FRONTEND_VOLUMETRIC_LIGHTING_R, graphicsOptionsVolumetricLightingString(), WBUT_SECONDARY)));
row.start++;

// LOD Distance
// TRANSLATORS: "LOD" = "Level of Detail" - this setting is used to describe how level of detail (in textures) is preserved as distance increases (examples: "Default", "High", etc)
std::string lodDistanceString = _("LOD Distance");
Expand Down Expand Up @@ -1295,6 +1306,13 @@ bool runGraphicsOptionsMenu()
widgSetString(psWScreen, FRONTEND_LIGHTS_R, graphicsOptionsLightingString());
break;
}
case FRONTEND_VOLUMETRIC_LIGHTING:
case FRONTEND_VOLUMETRIC_LIGHTING_R:
{
war_setVolumetricLighting(!war_getVolumetricLighting());
widgSetString(psWScreen, FRONTEND_VOLUMETRIC_LIGHTING_R, graphicsOptionsVolumetricLightingString());
break;
}
case FRONTEND_FOG:
case FRONTEND_FOG_R:
if (pie_GetFogEnabled())
Expand Down
2 changes: 2 additions & 0 deletions src/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ enum
FRONTEND_SHADOW_FILTER_SIZE_DROPDOWN,
FRONTEND_LIGHTS,
FRONTEND_LIGHTS_R,
FRONTEND_VOLUMETRIC_LIGHTING,
FRONTEND_VOLUMETRIC_LIGHTING_R,
FRONTEND_FOG,
FRONTEND_FOG_R,
FRONTEND_RADAR,
Expand Down
11 changes: 11 additions & 0 deletions src/warzoneconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct WARZONE_GLOBALS
uint32_t shadowFilterSize = 5;
uint32_t shadowMapResolution = 0; // this defaults to 0, which causes the gfx backend to figure out a recommended default based on the system properties
bool pointLightLighting = false;
bool volumetricLighting = false;
// groups UI
bool groupsMenuEnabled = true;

Expand Down Expand Up @@ -656,11 +657,21 @@ bool war_getPointLightPerPixelLighting()
return warGlobs.pointLightLighting;
}

bool war_getVolumetricLighting()
{
return warGlobs.volumetricLighting;
}

void war_setPointLightPerPixelLighting(bool perPixelEnabled)
{
warGlobs.pointLightLighting = perPixelEnabled;
}

void war_setVolumetricLighting(bool volumetricEnabled)
{
warGlobs.volumetricLighting = volumetricEnabled;
}

bool war_getGroupsMenuEnabled()
{
return warGlobs.groupsMenuEnabled;
Expand Down
3 changes: 3 additions & 0 deletions src/warzoneconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ void war_setShadowMapResolution(uint32_t resolution);
bool war_getPointLightPerPixelLighting();
void war_setPointLightPerPixelLighting(bool perPixelEnabled);

bool war_getVolumetricLighting();
void war_setVolumetricLighting(bool enabled);

bool war_getGroupsMenuEnabled();
void war_setGroupsMenuEnabled(bool enabled);

Expand Down

0 comments on commit 3ffdbde

Please sign in to comment.