Fixed LOS lightsource keeping references to already unloaded convex hulls and subs, causing the los effects of the previously loaded subs to be always rendered.

This commit is contained in:
Joonas Rikkonen
2018-01-12 16:17:02 +02:00
parent 567b4408ad
commit 2ba339035c
2 changed files with 23 additions and 0 deletions

View File

@@ -370,6 +370,7 @@ namespace Barotrauma.Lights
public void ClearLights()
{
lights.Clear();
losSource.Reset();
}
}

View File

@@ -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();