BroadPhaseTest.h 1.1 KB

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