BroadPhaseTest.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Tests/Test.h>
  5. #include <Physics/Body/BodyManager.h>
  6. #include <Physics/Collision/BroadPhase/BroadPhase.h>
  7. // Base class for a test involving only the broad phase
  8. class BroadPhaseTest : public Test
  9. {
  10. public:
  11. JPH_DECLARE_RTTI_ABSTRACT(BroadPhaseTest)
  12. // Destructor
  13. virtual ~BroadPhaseTest() override;
  14. // Initialize the test
  15. virtual void Initialize() override;
  16. // Update the test, called after the physics update
  17. virtual void PostPhysicsUpdate(float inDeltaTime) override;
  18. protected:
  19. // Create bodies according to method outlined in "FAST SOFTWARE FOR BOX INTERSECTIONS by AFRA ZOMORODIAN" section "The balanced distribution"
  20. // http://pub.ist.ac.at/~edels/Papers/2002-J-01-FastBoxIntersection.pdf
  21. void CreateBalancedDistribution(BodyManager *inBodyManager, int inNumBodies, float inEnvironmentSize = 512.0f);
  22. ObjectToBroadPhaseLayer mObjectToBroadPhaseLayer;
  23. BroadPhase * mBroadPhase = nullptr;
  24. BodyManager * mBodyManager = nullptr;
  25. };