Updating lightSource.hullsInRange when a convex hull is removed, some cleanup

This commit is contained in:
Regalis
2016-05-11 20:20:11 +03:00
parent 5e951bc225
commit 5301a57108
4 changed files with 24 additions and 84 deletions
+8 -1
View File
@@ -86,7 +86,7 @@ namespace Barotrauma.Lights
{
range = MathHelper.Clamp(value, 0.0f, 2048.0f);
if (Math.Abs(prevHullUpdateRange - range)<5.0f) return;
if (Math.Abs(prevHullUpdateRange - range) < 5.0f) return;
UpdateHullsInRange();
prevHullUpdateRange = range;
@@ -136,6 +136,8 @@ namespace Barotrauma.Lights
{
if (!CastShadows) return;
if (hullsInRange == null) hullsInRange = new List<ConvexHull>();
hullsInRange.Clear();
if (range < 1.0f || color.A < 0.01f) return;
@@ -156,6 +158,11 @@ namespace Barotrauma.Lights
}
}
public void NeedsHullUpdate()
{
hullsInRange = null;
}
public void Draw(SpriteBatch spriteBatch)
{
if (range > 1.0f)