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
+4 -3
View File
@@ -135,8 +135,9 @@ namespace Barotrauma.Lights
foreach (LightSource light in lights)
{
if (!light.hullsInRange.Any() || light.Color.A < 0.01f || light.Range < 1.0f) continue;
if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue;
if (light.Color.A < 0.01f || light.Range < 1.0f) continue;
if (light.hullsInRange == null) light.UpdateHullsInRange();
if (!light.hullsInRange.Any() || !MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue;
//clear alpha to 1
ClearAlphaToOne(graphics, spriteBatch);
@@ -170,7 +171,7 @@ namespace Barotrauma.Lights
foreach (LightSource light in lights)
{
if (light.hullsInRange.Any() || light.Color.A < 0.01f) continue;
if (light.hullsInRange==null || light.hullsInRange.Any() || light.Color.A < 0.01f) continue;
//if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue;
light.Draw(spriteBatch);