Discard planes that don't intersect with sphere
This commit is contained in:
parent
ead1943820
commit
edd01952e7
|
@ -1,4 +1,4 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using KeepersCompound.LGS.Database;
|
using KeepersCompound.LGS.Database;
|
||||||
using KeepersCompound.LGS.Database.Chunks;
|
using KeepersCompound.LGS.Database.Chunks;
|
||||||
using TinyEmbree;
|
using TinyEmbree;
|
||||||
|
@ -257,6 +257,15 @@ class Program
|
||||||
continue;
|
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 y = 0; y < lightmap.Height; y++)
|
||||||
{
|
{
|
||||||
for (var x = 0; x < lightmap.Width; x++)
|
for (var x = 0; x < lightmap.Width; x++)
|
||||||
|
|
Loading…
Reference in New Issue