Skip to content

Commit

Permalink
Don't rerender shadows when only the directional light color changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Greve committed Feb 24, 2024
1 parent 722d168 commit 2a19139
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion SourceFiles/MapRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,19 @@ class MapRenderer

void SetDirectionalLight(DirectionalLight new_directional_light)
{
m_should_rerender_shadows = true;
// Compare the new direction with the current direction
if (m_directionalLight.direction.x != new_directional_light.direction.x ||
m_directionalLight.direction.y != new_directional_light.direction.y ||
m_directionalLight.direction.z != new_directional_light.direction.z)
{
m_should_rerender_shadows = true; // Set to true only if the direction has changed
}

m_directionalLight = new_directional_light;
m_per_frame_cb_changed = true;
}


const DirectionalLight GetDirectionalLight() { return m_directionalLight; }

void UpdateTerrainWaterLevel(float new_water_level)
Expand Down

0 comments on commit 2a19139

Please sign in to comment.