Add benchmarks and unit tests for GetSurfacePoints*. (#7216)

* Add benchmarks and unit tests for GetSurfacePoints*.
The benchmarks are very enlightening - the existing implementation of GetSurfacePointsFromRegion (and GetSurfacePointsFromList) is currently measurably *slower* than just calling GetSurfacePoints() many times in a loop.  This is due to all of the extra allocation overhead that's currently happening with the way these data structures are built.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Small syntax improvement

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Small update to the benchmark to use filtered results.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Removed accidental extra include.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
Mike Balfour
2022-01-31 12:54:16 -06:00
committed by GitHub
parent 25878f9487
commit b975111a93
14 changed files with 551 additions and 112 deletions
@@ -12,7 +12,6 @@
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/Component/TransformBus.h>
#include <Source/Components/SurfaceDataColliderComponent.h>
@@ -23,23 +22,6 @@
namespace UnitTest
{
// Mock out a generic Physics Collider Component, which is a required dependency for adding a SurfaceDataColliderComponent.
struct MockPhysicsColliderComponent
: public AZ::Component
{
public:
AZ_COMPONENT(MockPhysicsColliderComponent, "{4F7C36DE-6475-4E0A-96A7-BFAF21C07C95}", AZ::Component);
void Activate() override {}
void Deactivate() override {}
static void Reflect(AZ::ReflectContext* reflect) { AZ_UNUSED(reflect); }
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC("PhysXColliderService", 0x4ff43f7c));
}
};
class MockPhysicsWorldBusProvider
: public AzPhysics::SimulatedBodyComponentRequestsBus::Handler
{