Gems/PhysX

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago
parent 4a972d96f9
commit 27cdf174cf

@ -85,8 +85,7 @@ namespace PhysX::Benchmarks
class PhysXCharactersBenchmarkFixture class PhysXCharactersBenchmarkFixture
: public PhysX::Benchmarks::PhysXBaseBenchmarkFixture : public PhysX::Benchmarks::PhysXBaseBenchmarkFixture
{ {
public: void internalSetUp()
virtual void SetUp([[maybe_unused]] const ::benchmark::State& state) override
{ {
PhysX::Benchmarks::PhysXBaseBenchmarkFixture::SetUpInternal(); PhysX::Benchmarks::PhysXBaseBenchmarkFixture::SetUpInternal();
//need to get the Physics::System to be able to spawn the rigid bodies //need to get the Physics::System to be able to spawn the rigid bodies
@ -95,12 +94,31 @@ namespace PhysX::Benchmarks
m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, CharacterConstants::TerrainSize, CharacterConstants::TerrainSize); m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, CharacterConstants::TerrainSize, CharacterConstants::TerrainSize);
} }
virtual void TearDown([[maybe_unused]] const ::benchmark::State& state) override void internalTearDown()
{ {
m_terrainEntity = nullptr; m_terrainEntity = nullptr;
PhysX::Benchmarks::PhysXBaseBenchmarkFixture::TearDownInternal(); PhysX::Benchmarks::PhysXBaseBenchmarkFixture::TearDownInternal();
} }
public:
void SetUp(const benchmark::State&) override
{
internalSetUp();
}
void SetUp(benchmark::State&) override
{
internalSetUp();
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
}
protected: protected:
// PhysXBaseBenchmarkFixture Overrides ... // PhysXBaseBenchmarkFixture Overrides ...
AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override

@ -70,8 +70,7 @@ namespace PhysX::Benchmarks
class PhysXCharactersRagdollBenchmarkFixture class PhysXCharactersRagdollBenchmarkFixture
: public PhysX::Benchmarks::PhysXBaseBenchmarkFixture : public PhysX::Benchmarks::PhysXBaseBenchmarkFixture
{ {
public: void internalSetUp()
virtual void SetUp([[maybe_unused]] const ::benchmark::State& state) override
{ {
PhysX::Benchmarks::PhysXBaseBenchmarkFixture::SetUpInternal(); PhysX::Benchmarks::PhysXBaseBenchmarkFixture::SetUpInternal();
//need to get the Physics::System to be able to spawn the rigid bodies //need to get the Physics::System to be able to spawn the rigid bodies
@ -80,12 +79,31 @@ namespace PhysX::Benchmarks
m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, RagdollConstants::TerrainSize, RagdollConstants::TerrainSize); m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, RagdollConstants::TerrainSize, RagdollConstants::TerrainSize);
} }
virtual void TearDown([[maybe_unused]] const ::benchmark::State& state) override void internalTearDown()
{ {
m_terrainEntity = nullptr; m_terrainEntity = nullptr;
PhysX::Benchmarks::PhysXBaseBenchmarkFixture::TearDownInternal(); PhysX::Benchmarks::PhysXBaseBenchmarkFixture::TearDownInternal();
} }
public:
void SetUp(const benchmark::State&) override
{
internalSetUp();
}
void SetUp(benchmark::State&) override
{
internalSetUp();
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
}
protected: protected:
// PhysXBaseBenchmarkFixture Overrides ... // PhysXBaseBenchmarkFixture Overrides ...
AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override

@ -184,17 +184,36 @@ namespace PhysX::Benchmarks
: public PhysXBaseBenchmarkFixture : public PhysXBaseBenchmarkFixture
{ {
public: public:
virtual void SetUp([[maybe_unused]] const ::benchmark::State &state) override void internalSetUp()
{ {
PhysXBaseBenchmarkFixture::SetUpInternal(); PhysXBaseBenchmarkFixture::SetUpInternal();
} }
virtual void TearDown([[maybe_unused]] const ::benchmark::State &state) override void internalTearDown()
{ {
PhysXBaseBenchmarkFixture::TearDownInternal(); PhysXBaseBenchmarkFixture::TearDownInternal();
} }
protected: protected:
public:
void SetUp(const benchmark::State&) override
{
internalSetUp();
}
void SetUp(benchmark::State&) override
{
internalSetUp();
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
}
// PhysXBaseBenchmarkFixture Interface --------- // PhysXBaseBenchmarkFixture Interface ---------
AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() override
{ {

@ -136,8 +136,8 @@ namespace PhysX::Benchmarks
class PhysXRigidbodyBenchmarkFixture class PhysXRigidbodyBenchmarkFixture
: public PhysXBaseBenchmarkFixture : public PhysXBaseBenchmarkFixture
{ {
public: protected:
virtual void SetUp([[maybe_unused]] const ::benchmark::State &state) override virtual void internalSetUp()
{ {
PhysXBaseBenchmarkFixture::SetUpInternal(); PhysXBaseBenchmarkFixture::SetUpInternal();
//need to get the Physics::System to be able to spawn the rigid bodies //need to get the Physics::System to be able to spawn the rigid bodies
@ -146,11 +146,29 @@ namespace PhysX::Benchmarks
m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, RigidBodyConstants::TerrainSize, RigidBodyConstants::TerrainSize); m_terrainEntity = PhysX::TestUtils::CreateFlatTestTerrain(m_testSceneHandle, RigidBodyConstants::TerrainSize, RigidBodyConstants::TerrainSize);
} }
virtual void TearDown([[maybe_unused]] const ::benchmark::State &state) override virtual void internalTearDown()
{ {
m_terrainEntity = nullptr; m_terrainEntity = nullptr;
PhysXBaseBenchmarkFixture::TearDownInternal(); PhysXBaseBenchmarkFixture::TearDownInternal();
} }
public:
void SetUp(const benchmark::State&) override
{
internalSetUp();
}
void SetUp(benchmark::State&) override
{
internalSetUp();
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
}
protected: protected:
// PhysXBaseBenchmarkFixture Interface --------- // PhysXBaseBenchmarkFixture Interface ---------
@ -312,10 +330,9 @@ namespace PhysX::Benchmarks
class PhysXRigidbodyCollisionsBenchmarkFixture class PhysXRigidbodyCollisionsBenchmarkFixture
: public PhysXRigidbodyBenchmarkFixture : public PhysXRigidbodyBenchmarkFixture
{ {
public: void internalSetUp() override
void SetUp(const ::benchmark::State& state) override
{ {
PhysXRigidbodyBenchmarkFixture::SetUp(state); PhysXRigidbodyBenchmarkFixture::internalSetUp();
m_collisionBeginCount = 0; m_collisionBeginCount = 0;
m_collisionPersistCount = 0; m_collisionPersistCount = 0;
@ -346,11 +363,30 @@ namespace PhysX::Benchmarks
m_defaultScene->RegisterSceneCollisionEventHandler(m_onSceneCollisionHandler); m_defaultScene->RegisterSceneCollisionEventHandler(m_onSceneCollisionHandler);
} }
void TearDown(const ::benchmark::State& state) override void internalTearDown() override
{ {
m_onSceneCollisionHandler.Disconnect(); m_onSceneCollisionHandler.Disconnect();
PhysXRigidbodyBenchmarkFixture::TearDown(state); PhysXRigidbodyBenchmarkFixture::internalTearDown();
}
public:
void SetUp(const benchmark::State&) override
{
internalSetUp();
}
void SetUp(benchmark::State&) override
{
internalSetUp();
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
} }
protected: protected:

@ -47,14 +47,12 @@ namespace PhysX::Benchmarks
, public PhysX::GenericPhysicsFixture , public PhysX::GenericPhysicsFixture
{ {
public:
//! Spawns box entities in unique locations in 1/8 of sphere with all non-negative dimensions between radii[2, max radius]. //! Spawns box entities in unique locations in 1/8 of sphere with all non-negative dimensions between radii[2, max radius].
//! Accepts 2 parameters from \state. //! Accepts 2 parameters from \state.
//! //!
//! \state.range(0) - number of box entities to spawn //! \state.range(0) - number of box entities to spawn
//! \state.range(1) - max radius //! \state.range(1) - max radius
void SetUp(const ::benchmark::State& state) override void internalSetUp(const ::benchmark::State& state)
{ {
PhysX::GenericPhysicsFixture::SetUpInternal(); PhysX::GenericPhysicsFixture::SetUpInternal();
@ -100,13 +98,32 @@ namespace PhysX::Benchmarks
} }
} }
void TearDown([[maybe_unused]] const ::benchmark::State& state) override void internalTearDown()
{ {
m_boxes.clear(); m_boxes.clear();
m_entities.clear(); m_entities.clear();
PhysX::GenericPhysicsFixture::TearDownInternal(); PhysX::GenericPhysicsFixture::TearDownInternal();
} }
public:
void SetUp(const benchmark::State& state) override
{
internalSetUp(state);
}
void SetUp(benchmark::State& state) override
{
internalSetUp(state);
}
void TearDown(const benchmark::State&) override
{
internalTearDown();
}
void TearDown(benchmark::State&) override
{
internalTearDown();
}
protected: protected:
std::vector<EntityPtr> m_entities; std::vector<EntityPtr> m_entities;
std::vector<AZ::Vector3> m_boxes; std::vector<AZ::Vector3> m_boxes;

Loading…
Cancel
Save