Skip to content

Commit

Permalink
fix nan in shader lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Jun 12, 2024
1 parent a455e3f commit c70995c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/cage/shader/functions/attenuation.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ float attenuation(vec4 att, float dist)
// att: // type, minDistance, maxDistance, unused
float minDistance = att[1];
float maxDistance = att[2];
dist = clamp(dist, minDistance, maxDistance);
switch (int(att[0]))
{
case 0: // none
Expand Down
1 change: 1 addition & 0 deletions sources/libengine/graphics/renderPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ namespace cage

UniLight initializeLightUni(const Mat4 &model, const LightComponent &lc)
{
CAGE_ASSERT(lc.minDistance > 0 && lc.maxDistance > lc.minDistance);
static constexpr Real RoundingOffset = 1e-7;
UniLight uni;
uni.color = Vec4(colorGammaToLinear(lc.color), lc.intensity);
Expand Down

0 comments on commit c70995c

Please sign in to comment.