Optimization: FindHull spatial hashing, itemcomponent sounds in a dictionary, got rid of Item.Updated, rendering fixes, disposing shadow vertex buffers

This commit is contained in:
Regalis11
2015-12-21 11:01:35 +02:00
parent a62c6d6711
commit 2ff8643c02
16 changed files with 354 additions and 136 deletions
+34 -3
View File
@@ -51,9 +51,7 @@ namespace Barotrauma
Sounds.SoundManager.LowPassHFGain = 1.0f;
}
int rendc;
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
@@ -61,6 +59,39 @@ namespace Barotrauma
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(double deltaTime)
{
//if (PlayerInput.KeyHit(Keys.T))
//{
// Stopwatch sw = new Stopwatch();
// sw.Start();
// Rand.SetSyncedSeed(123);
// for (int i = 0; i<10000; i++)
// {
// Hull.FindHull(new Vector2(
// Rand.Range(Submarine.Borders.X, Submarine.Borders.Right, false),
// Rand.Range(Submarine.Borders.Y - Submarine.Borders.Height, Submarine.Borders.Y, false)),
// Hull.hullList[Rand.Int(Hull.hullList.Count-1)], false);
// }
// sw.Stop();
// Debug.WriteLine("FindHull1: "+sw.ElapsedMilliseconds);
// sw.Restart();
// Rand.SetSyncedSeed(123);
// for (int i = 0; i < 10000; i++)
// {
// Hull.FindHull2(new Vector2(
// Rand.Range(Submarine.Borders.X, Submarine.Borders.Right, false),
// Rand.Range(Submarine.Borders.Y - Submarine.Borders.Height, Submarine.Borders.Y, false)),
// Hull.hullList[Rand.Int(Hull.hullList.Count - 1)], false);
// }
// sw.Stop();
// Debug.WriteLine("FindHull2: " + sw.ElapsedMilliseconds);
// var askdnkjd = 1;
//}
//the accumulator code is based on this article:
//http://gafferongames.com/game-physics/fix-your-timestep/
Physics.accumulator += deltaTime;