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:
@@ -143,8 +143,6 @@ namespace SurfaceData
|
||||
|
||||
void SurfaceDataShapeComponent::GetSurfacePoints(const AZ::Vector3& inPosition, SurfacePointList& surfacePointList) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(Entity);
|
||||
|
||||
AZStd::lock_guard<decltype(m_cacheMutex)> lock(m_cacheMutex);
|
||||
|
||||
if (m_shapeBoundsIsValid)
|
||||
@@ -160,7 +158,10 @@ namespace SurfaceData
|
||||
point.m_entityId = GetEntityId();
|
||||
point.m_position = rayOrigin + intersectionDistance * rayDirection;
|
||||
point.m_normal = AZ::Vector3::CreateAxisZ();
|
||||
AddMaxValueForMasks(point.m_masks, m_configuration.m_providerTags, 1.0f);
|
||||
for (auto& tag : m_configuration.m_providerTags)
|
||||
{
|
||||
point.m_masks[tag] = 1.0f;
|
||||
}
|
||||
surfacePointList.push_back(point);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user