2fe4524458
* Terrain API fixups Moved SurfaceData definitions in AzFramework out of terrain into separate files. Added some missing API calls: Get*FromVector2, GetSurfacePoint* Changed OrderedSurfaceTagWeightSet to SurfaceTagWeightList Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * PR feedback - remove IsClose check. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed PhysX test compile failures by redcoding a bunch of "dummy terrain" implementation that's unused. It was originally added for the PhysX Terrain component, but that component is long gone and has been superceded by the more generic PhysX Heightfield Collider. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed up failing terrain unit tests. Added API changes, and changed the assumption on where the surface weight sort is taking place. The component is no longer expected to provide the sorted list, it only needs to be sorted at the end coming out of the terrain system, so the unit tests have been modified to reflect that. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
67 lines
2.3 KiB
C++
67 lines
2.3 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#ifdef HAVE_BENCHMARK
|
|
|
|
#include <AzTest/AzTest.h>
|
|
#include <PhysXTestEnvironment.h>
|
|
|
|
#include <AzFramework/Physics/SystemBus.h>
|
|
|
|
namespace PhysX::Benchmarks
|
|
{
|
|
static constexpr float DefaultTimeStep = 0.0166667f; // 0.0166667f (60fps)
|
|
|
|
//! The Benchmark environment is used for one time setup and tear down of shared resources
|
|
class PhysXBenchmarkEnvironment
|
|
: public AZ::Test::BenchmarkEnvironmentBase
|
|
, public PhysX::Environment
|
|
|
|
{
|
|
public:
|
|
~PhysXBenchmarkEnvironment();
|
|
|
|
protected:
|
|
void SetUpBenchmark() override;
|
|
void TearDownBenchmark() override;
|
|
};
|
|
|
|
//! Base Fixture for running physX benchmarks
|
|
class PhysXBaseBenchmarkFixture
|
|
: public benchmark::Fixture
|
|
, protected Physics::DefaultWorldBus::Handler
|
|
{
|
|
public:
|
|
// Physics::DefaultWorldBus::Handler Interface -------------
|
|
AzPhysics::SceneHandle GetDefaultSceneHandle() const override;
|
|
// Physics::DefaultWorldBus::Handler Interface -------------
|
|
|
|
//! Run the simulation for a set number of frames. This will execute as each frame as quickly as possible
|
|
//! @param numFrames - The number of 'game' frames to run the simulation
|
|
//! @param timeStep - The frame time of the 'game' frame. Default - 0.0166667f (60fps)
|
|
void UpdateSimulation(unsigned int numFrames, float timeStep = DefaultTimeStep);
|
|
|
|
void StepScene1Tick(float timeStep = DefaultTimeStep);
|
|
protected:
|
|
void SetUpInternal();
|
|
void TearDownInternal();
|
|
|
|
//! allows each fixture to setup and define the default World Config
|
|
virtual AzPhysics::SceneConfiguration GetDefaultSceneConfiguration() = 0;
|
|
|
|
//! Creates the default scene
|
|
//! - Calls GetWorldEventHandler() to attached an event handle if provided by the fixture
|
|
AzPhysics::SceneHandle CreateDefaultTestScene();
|
|
|
|
AzPhysics::Scene* m_defaultScene = nullptr;
|
|
AzPhysics::SceneHandle m_testSceneHandle = AzPhysics::InvalidSceneHandle;
|
|
};
|
|
} // namespace PhysX::Benchmarks
|
|
#endif //HAVE_BENCHMARK
|