Discard planes that don't intersect with sphere

This commit is contained in:
Jarrod Doyle 2024-09-24 08:13:27 +01:00
parent ead1943820
commit edd01952e7
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using KeepersCompound.LGS.Database;
using KeepersCompound.LGS.Database.Chunks;
using TinyEmbree;
@ -257,6 +257,15 @@ class Program
continue;
}
// If there aren't *any* points on the plane that are in range of the light
// then none of the lightmap points will be so we can discard.
// The more compact a map is the less effective this is
var planeDist = MathUtils.DistanceFromPlane(plane, light.position);
if (planeDist > light.radius)
{
continue;
}
for (var y = 0; y < lightmap.Height; y++)
{
for (var x = 0; x < lightmap.Width; x++)