Simple MapEntity visibility culling (structures outside the camera view or items with nothing to render aren't drawn)

Could be optimized further, but already gives a pretty nice performance boost
This commit is contained in:
Regalis
2016-11-30 21:09:11 +02:00
parent 42ff4a0d9a
commit a2442bfcb8
5 changed files with 61 additions and 41 deletions
+5
View File
@@ -888,6 +888,11 @@ namespace Barotrauma
}
}
public override bool IsVisible(Rectangle worldView)
{
return drawableComponents.Count > 0 || body == null || body.Enabled;
}
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{
if (!Visible) return;