BroadPhaseTest.h 1.1 KB

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