Non-terrain-gem changes in support of upcoming terrain work. (#3345)
In preparation for a prototype Terrain Gem to get submitted, there are a few changes that are needed outside of the Terrain Gem as well: The TerrainDataNotificationBus lives in AzFramework/Terrain, and needed to be extended to contain an optional OnTerrainDataChanged event to notify other systems when a terrain region has changed. The HeightmapUpdateNotificationBus was removed, as this was a legacy file from the old already-removed terrain system. The EditorWrappedComponentBase<> wrapper received a small optimization to ensure that ConfigurationChanged() is only called when the value of visibility actually changes. With prefabs, it appears that sometimes OnEntityVisibilityChanged could be called multiple times in a row with the same visibility value. The TerrainSurfaceDataSystemComponent was updated to use the correct busses, and is ready to be moved to the Terrain Gem in a subsequent PR. Signed-off-by: Mike Balfour 82224783+mbalfour-amzn@users.noreply.github.com
This commit is contained in:
@@ -102,11 +102,25 @@ namespace AzFramework
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void OnTerrainDataCreateBegin() {};
|
||||
virtual void OnTerrainDataCreateEnd() {};
|
||||
enum TerrainDataChangedMask : uint8_t
|
||||
{
|
||||
None = 0b00000000,
|
||||
Settings = 0b00000001,
|
||||
HeightData = 0b00000010,
|
||||
ColorData = 0b00000100,
|
||||
SurfaceData = 0b00001000
|
||||
};
|
||||
|
||||
virtual void OnTerrainDataDestroyBegin() {};
|
||||
virtual void OnTerrainDataDestroyEnd() {};
|
||||
virtual void OnTerrainDataCreateBegin() {}
|
||||
virtual void OnTerrainDataCreateEnd() {}
|
||||
|
||||
virtual void OnTerrainDataDestroyBegin() {}
|
||||
virtual void OnTerrainDataDestroyEnd() {}
|
||||
|
||||
virtual void OnTerrainDataChanged(
|
||||
[[maybe_unused]] const AZ::Aabb& dirtyRegion, [[maybe_unused]] TerrainDataChangedMask dataChangedMask)
|
||||
{
|
||||
}
|
||||
};
|
||||
using TerrainDataNotificationBus = AZ::EBus<TerrainDataNotifications>;
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
/**
|
||||
* the EBus is used to request information about potential vegetation surfaces
|
||||
*/
|
||||
class HeightmapUpdateNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Occurs when the terrain height map is modified.
|
||||
virtual void HeightmapModified(const AZ::Aabb& bounds) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<HeightmapUpdateNotification> HeightmapUpdateNotificationBus;
|
||||
}
|
||||
@@ -53,7 +53,6 @@ set(FILES
|
||||
HMDBus.h
|
||||
VRCommon.h
|
||||
StereoRendererBus.h
|
||||
HeightmapUpdateNotificationBus.h
|
||||
INavigationSystem.h
|
||||
IMNM.h
|
||||
SFunctor.h
|
||||
|
||||
Reference in New Issue
Block a user