diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs index 0cd602cac..9d2ed314f 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs @@ -370,6 +370,7 @@ namespace Barotrauma.Lights public void ClearLights() { lights.Clear(); + losSource.Reset(); } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs index 07bd5dd0a..3bf19416c 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightSource.cs @@ -641,6 +641,28 @@ namespace Barotrauma.Lights ); } + public void Reset() + { + hullsInRange.Clear(); + diffToSub.Clear(); + NeedsHullCheck = true; + NeedsRecalculation = true; + + vertexCount = 0; + if (lightVolumeBuffer != null) + { + lightVolumeBuffer.Dispose(); + lightVolumeBuffer = null; + } + + indexCount = 0; + if (lightVolumeIndexBuffer != null) + { + lightVolumeIndexBuffer.Dispose(); + lightVolumeIndexBuffer = null; + } + } + public void Remove() { if (LightSprite != null) LightSprite.Remove();