misc small terrain bugfixes (#5834)

* Removed "chatty" profile markers.
These three markers were making terrain refreshes take ~200% longer in profile builds.

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

* Terrain surface data wasn't updating its AABB correctly.
The code was making an invalid assumption that changes to the world bounds would result in an invalid dirtyRegion.  It actually gets a valid region encapsulating the old and new bounds.  The fix is an additional check to see if the terrain bounds changed.

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

* Addressed previous PR feedback that terrainSystem ought to be a local variable in each test.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
Mike Balfour
2021-11-23 09:21:27 -06:00
committed by GitHub
parent ea0afae502
commit 39ba06b84e
5 changed files with 40 additions and 47 deletions
@@ -214,10 +214,10 @@ namespace Terrain
{
AZ_Assert((m_providerHandle != SurfaceData::InvalidSurfaceDataRegistryHandle), "Invalid surface data handle");
// Our terrain was valid before and after, it just changed in some way. If we have a valid dirty region passed in
// then it's possible that the heightmap has been modified in the Editor. Otherwise, just notify that the entire
// terrain has changed in some way.
if (dirtyRegion.IsValid())
// Our terrain was valid before and after, it just changed in some way. If we have a valid dirty region, and the terrain
// bounds themselves haven't changed, just notify that our terrain data has changed within the bounds. Otherwise, notify
// that the entire terrain provider needs to be updated, since it either has new bounds or the entire set of data is dirty.
if (dirtyRegion.IsValid() && m_terrainBounds.IsClose(terrainBoundsBeforeUpdate))
{
SurfaceData::SurfaceDataSystemRequestBus::Broadcast(
&SurfaceData::SurfaceDataSystemRequestBus::Events::RefreshSurfaceData, dirtyRegion);