PerformanceTests.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Urho;
  2. using Urho.SharpReality;
  3. using Urho.Resources;
  4. using System.Collections.Generic;
  5. using System;
  6. using Urho.Shapes;
  7. namespace Playgrounds.SharpReality
  8. {
  9. public class PerformanceTests : StereoApplication
  10. {
  11. private DebugHud hud;
  12. public PerformanceTests(ApplicationOptions opts) : base(opts)
  13. {
  14. }
  15. protected override async void Start()
  16. {
  17. base.Start();
  18. for (int i = 0; i < 5; i++)
  19. {
  20. for (int j = 0; j < 5; j++)
  21. {
  22. for (int k = 0; k < 5; k++)
  23. {
  24. var child = Scene.CreateChild();
  25. child.SetScale(0.05f);
  26. var sphere = child.CreateComponent<Box>();
  27. //sphere.Model = ResourceCache.GetModel("Sphere.mdl");
  28. var mat = Material.FromColor(Randoms.NextColor());
  29. sphere.SetMaterial(mat);
  30. child.Position = new Vector3(i * 0.12f, j * 0.12f, 1 + k * 0.12f);
  31. }
  32. }
  33. }
  34. Time.FrameEnded += Time_FrameEnded;
  35. new MonoDebugHud(this) {FpsOnly = true}.Show(Color.Green, 72);
  36. hud = Engine.CreateDebugHud();
  37. hud.ToggleAll();
  38. /*await RegisterCortanaCommands(new Dictionary<string, Action>
  39. {
  40. {"hey!", () => { }}
  41. });*/
  42. }
  43. private void Time_FrameEnded(FrameEndedEventArgs obj)
  44. {
  45. var mem1 = hud.MemoryText.Value;
  46. var mem2 = hud.ModeText.Value;
  47. var mem3 = hud.ProfilerText.Value;
  48. var mem4 = hud.StatsText.Value;
  49. }
  50. protected override void OnUpdate(float timeStep)
  51. {
  52. base.OnUpdate(timeStep);
  53. }
  54. }
  55. }