Light rendering optimization
This commit is contained in:
@@ -60,6 +60,10 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void DrawLOS(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 pos)
|
||||
{
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
if (!LosEnabled) return;
|
||||
|
||||
Rectangle camView = new Rectangle(cam.WorldView.X, cam.WorldView.Y - cam.WorldView.Height, cam.WorldView.Width, cam.WorldView.Height);
|
||||
@@ -75,6 +79,9 @@ namespace Barotrauma.Lights
|
||||
convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
||||
}
|
||||
|
||||
sw.Stop();
|
||||
|
||||
Debug.WriteLine("drawlos: " + sw.ElapsedTicks + " (" + sw.ElapsedMilliseconds + ")");
|
||||
if (!ObstructVision) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative);
|
||||
@@ -82,6 +89,7 @@ namespace Barotrauma.Lights
|
||||
spriteBatch.End();
|
||||
|
||||
ObstructVision = false;
|
||||
|
||||
}
|
||||
|
||||
public void OnMapLoaded()
|
||||
@@ -94,6 +102,10 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void UpdateLightMap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
Matrix shadowTransform = cam.ShaderTransform
|
||||
@@ -152,6 +164,10 @@ namespace Barotrauma.Lights
|
||||
graphics.SetRenderTarget(null);
|
||||
|
||||
|
||||
Debug.WriteLine("lights: " + sw.ElapsedTicks + " (" + sw.ElapsedMilliseconds + ")");
|
||||
if (!ObstructVision) return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
||||
|
||||
Reference in New Issue
Block a user