Remove infinite radius sphere special casing

This commit is contained in:
Jarrod Doyle 2024-10-27 08:14:47 +00:00
parent 0c26aa1f0e
commit 7ff91b2fda
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 2 additions and 4 deletions

View File

@ -571,10 +571,7 @@ class Program
var cellSphere = new MathUtils.Sphere(cell.SphereCenter, cell.SphereRadius);
foreach (var light in lights)
{
// Lights should only get added if their radius intersects with the cell
// 0 radius (infinite) lights are a special case with max float
if (light.radius == float.MaxValue ||
MathUtils.Intersects(cellSphere, new MathUtils.Sphere(light.position, light.radius)))
if (MathUtils.Intersects(cellSphere, new MathUtils.Sphere(light.position, light.radius)))
{
cell.LightIndexCount++;
cell.LightIndices.Add((ushort)light.lightTableIndex);

View File

@ -76,6 +76,7 @@ public static class MathUtils
return d2 < r2;
}
// Should automagically handle max float radii
public static bool Intersects(Sphere sphere, Sphere other)
{
var rsum = sphere.Radius + other.Radius;