From 5488f47edad634487d69b1a766451d7e84977c2d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 2 Jun 2022 20:58:03 -0600 Subject: [PATCH] light: GetDirectLighting: fix wrong order in surfpointToLightDist calculation --- light/ltface.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/light/ltface.cc b/light/ltface.cc index 0dbe4ef0..59179fe8 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1244,7 +1244,7 @@ std::map GetDirectLighting( qvec3d surfpointToLightDir; // FIXME: this is always 128 because vpl.pos and origin are always equal it seems? const float surfpointToLightDist = - max(128.0, GetDir(vpl.pos, origin, + max(128.0, GetDir(origin, vpl.pos, surfpointToLightDir)); // Clamp away hotspots, also avoid division by 0... const vec_t angle = qv::dot(surfpointToLightDir, normal); if (angle <= 0)