PerformanceTestScene.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. // Base class for a test scene to test performance
  6. class PerformanceTestScene
  7. {
  8. public:
  9. // Virtual destructor
  10. virtual ~PerformanceTestScene() { }
  11. // Get name of test for debug purposes
  12. virtual const char * GetName() const = 0;
  13. // Get the number of MB that the temp allocator should preallocate
  14. virtual size_t GetTempAllocatorSizeMB() const { return 32; }
  15. // Get the max number of bodies to support in the physics system
  16. virtual uint GetMaxBodies() const { return 10240; }
  17. // Get the max number of body pairs to support in the physics system
  18. virtual uint GetMaxBodyPairs() const { return 65536; }
  19. // Get the max number of contact constraints to support in the physics system
  20. virtual uint GetMaxContactConstraints() const { return 20480; }
  21. // Load assets for the scene
  22. virtual bool Load([[maybe_unused]] const String &inAssetPath) { return true; }
  23. // Start a new test by adding objects to inPhysicsSystem
  24. virtual void StartTest(PhysicsSystem &inPhysicsSystem, EMotionQuality inMotionQuality) = 0;
  25. // Step the test
  26. virtual void UpdateTest([[maybe_unused]] PhysicsSystem &inPhysicsSystem, [[maybe_unused]] TempAllocator &ioTempAllocator, [[maybe_unused]] float inDeltaTime) { }
  27. // Update the hash with the state of the scene
  28. virtual void UpdateHash([[maybe_unused]] uint64 &ioHash) const { }
  29. // Stop a test and remove objects from inPhysicsSystem
  30. virtual void StopTest(PhysicsSystem &inPhysicsSystem) { }
  31. };