Add a GetNumSamplesFromRegion function which returns the number of samples given a region and step size. Update Terrain Feature Processor to use this function to get the number of samples instead of computing num samples independently.

Signed-off-by: amzn-sj <srikkant@amazon.com>
This commit is contained in:
amzn-sj
2022-01-19 18:04:56 -08:00
parent 4b5f4042f2
commit 7bba4172ec
5 changed files with 34 additions and 10 deletions
@@ -161,6 +161,10 @@ namespace AzFramework
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
//! Returns the number of samples for a given region and step size.
virtual AZStd::pair<size_t, size_t> GetNumSamplesFromRegion(const AZ::Aabb& inRegion,
const AZ::Vector2& stepSize) const = 0;
//! Given a region(aabb) and a step size, call the provided callback function with surface data corresponding to the
//! coordinates in the region.
virtual void ProcessHeightsFromRegion(const AZ::Aabb& inRegion,
@@ -92,6 +92,8 @@ namespace UnitTest
ProcessSurfaceWeightsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessSurfacePointsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD2(
GetNumSamplesFromRegion, AZStd::pair<size_t, size_t>(const AZ::Aabb&, const AZ::Vector2&));
MOCK_CONST_METHOD4(
ProcessHeightsFromRegion, void(const AZ::Aabb&, const AZ::Vector2&, AzFramework::Terrain::SurfacePointRegionFillCallback, Sampler));
MOCK_CONST_METHOD4(