Skip to content

Commit

Permalink
softgpu: Correct handling of NAN attenuation.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Jan 7, 2022
1 parent fa80c44 commit b86bdc9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GPU/Software/Lighting.cpp
Expand Up @@ -86,11 +86,13 @@ void Process(VertexData& vertex, bool hasColor) {
// TODO: Should this normalize (0, 0, 0) to (0, 0, 1)?
float d = L.NormalizeOr001();

float att = 1.f;
float att = 1.0f;
if (!gstate.isDirectionalLight(light)) {
att = 1.f / Dot(GetLightVec(gstate.latt, light), Vec3f(1.0f, d, d * d));
if (att > 1.f) att = 1.f;
if (att < 0.f) att = 0.f;
att = 1.0f / Dot(GetLightVec(gstate.latt, light), Vec3f(1.0f, d, d * d));
if (!(att > 0.0f))
att = 0.0f;
else if (att > 1.0f)
att = 1.0f;
}

float spot = 1.f;
Expand Down

0 comments on commit b86bdc9

Please sign in to comment.