From d1e5daedf091af1a3fc5631b7834c921b6d69d9b Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 8 Apr 2023 23:36:09 -0600 Subject: [PATCH] light: fix lighting output change in last commit if the center of a surface light fragment was exactly coplanar with a wall, the last commit would reject it whereas previously, we would still emit light --- light/surflight.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/light/surflight.cc b/light/surflight.cc index e6b44438..f6d16bc0 100644 --- a/light/surflight.cc +++ b/light/surflight.cc @@ -84,10 +84,13 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys qvec3f point = w.center() + facenormal; // optimization - cull surface lights in the void - if (Light_PointInWorld(bsp, point)) + // also try to move them if they're slightly inside a wall + auto [fixed_point, success] = FixLightOnFace(bsp, point, false, 0.5f); + if (!success) { return; + } - points.push_back(point); + points.push_back(fixed_point); }); // Calculate emit color and intensity...