Remove infinite radius sphere special casing
This commit is contained in:
parent
0c26aa1f0e
commit
7ff91b2fda
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue