pmtf.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. class PMTF : TestFramework
  2. {
  3. private static int PM_CREATED = 0;
  4. private ref map<int, ref ParticleManager> m_Managers = new map<int, ref ParticleManager>();
  5. //---------------------------------------------------------------------------
  6. // Manager management
  7. //---------------------------------------------------------------------------
  8. int InsertManager(ParticleManager pm)
  9. {
  10. Assert(m_Managers.Insert(PM_CREATED, pm));
  11. ++PM_CREATED;
  12. return PM_CREATED - 1;
  13. }
  14. bool GetManager(int id, out ParticleManager pm)
  15. {
  16. return m_Managers.Find(id, pm);
  17. }
  18. //---------------------------------------------------------------------------
  19. // Prints
  20. //---------------------------------------------------------------------------
  21. protected void PrintPMStats(notnull ParticleManager pm)
  22. {
  23. Debug.ParticleLog(string.Format(
  24. "Poolsize: %1 | Allocated: %2 | Virtual: %3 | Playing: %4", pm.GetPoolSize(), pm.GetAllocatedCount(), pm.GetVirtualCount(), pm.GetPlayingCount()),
  25. this, "PrintPMStats", pm);
  26. }
  27. protected void PrintActiveStats()
  28. {
  29. Debug.ParticleLog(string.Format(
  30. "Active ParticleManagers: %1 | Active ParticleSources: %2", ParticleManager.GetStaticActiveCount(), ParticleSource.GetStaticActiveCount()),
  31. this, "PrintActiveStats");
  32. }
  33. //---------------------------------------------------------------------------
  34. // Helpers
  35. //---------------------------------------------------------------------------
  36. protected ParticleManager CreatePMFixedBlocking(int size)
  37. {
  38. return new ParticleManager(new ParticleManagerSettings(size, ParticleManagerSettingsFlags.BLOCKING));
  39. }
  40. }