Files
o3de/Gems/Terrain/Code/Source/TerrainRenderer/TerrainAreaMaterialRequestBus.h
T
Ken Pruiksma 97920feaf1 Detail material Id texture created from surface weights. (#4984)
* Added some structs for detail materials

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Added some template functions for looking up materials. Added lookups for all the relevant detail material fields in StandardPBR.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Added some structs for detail materials

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Added some template functions for looking up materials. Added lookups for all the relevant detail material fields in StandardPBR.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Added support for generating a detail material texture with IDs populated from surface weights.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updated TerrainAreaMaterailRequestBus to have separate calls for region vs materials instead of the awkward out parameter
Update MaterialPropertyDescriptor so that you can retrieve enum names by ID
Several bug fixes / updates to the terrain feature processor dealing with detail materials.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updating detail material texture based on offsets. Not quite working yet but close. Added visualization for detail material in shader (currently on, will be turned off before final commit)

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Small bugfixes
* Fix compile error in non-unity builds
* Fixed backwards x/y loops causing the wrong pixels to update
* Fixed selection of surface type with multiple surface weights

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

* Adding seam to detail texture debug display. Offseting edges by a half-pixel to avoid bleed. Disabling debugging detail textures by default.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Missing file from last commit for detail material change.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Cleanups

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* bug fix

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Bug fix in the terrain fp for TerrainAreaMaterialRequestBus returning incomplete materials on GetSurfaceMaterialMappings

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Some PR updates. Exposing detail material id debugging through a cvar.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Various updates from review.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* PR updates dealing with debug texture boundary line.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Hiding some fields from the terrain material

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Fixing type in generic lambda for linux / android

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

Co-authored-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
2021-10-27 10:12:13 -05:00

77 lines
2.9 KiB
C++

/*
* 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/Component/ComponentBus.h>
#include <SurfaceData/SurfaceDataTypes.h>
#include <Atom/RPI.Public/Material/Material.h>
namespace Terrain
{
//! This bus provides retrieval of information from Terrain Surfaces.
class TerrainAreaMaterialRequests
: public AZ::ComponentBus
{
public:
////////////////////////////////////////////////////////////////////////
// EBusTraits
using MutexType = AZStd::recursive_mutex;
////////////////////////////////////////////////////////////////////////
virtual ~TerrainAreaMaterialRequests() = default;
//! Get the Aabb for the region where a TerrainSurfaceMaterialMapping exists
virtual const AZ::Aabb& GetTerrainSurfaceMaterialRegion() const = 0;
//! Get the Material asset assigned to a particular surface tag.
virtual const AZStd::vector<struct TerrainSurfaceMaterialMapping>& GetSurfaceMaterialMappings() const = 0;
};
using TerrainAreaMaterialRequestBus = AZ::EBus<TerrainAreaMaterialRequests>;
//! Notifications for when the surface -> material mapping changes..
class TerrainAreaMaterialNotifications : public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
virtual void OnTerrainSurfaceMaterialMappingCreated(
[[maybe_unused]] AZ::EntityId entityId,
[[maybe_unused]] SurfaceData::SurfaceTag surface,
[[maybe_unused]] AZ::Data::Instance<AZ::RPI::Material> material)
{
}
virtual void OnTerrainSurfaceMaterialMappingDestroyed(
[[maybe_unused]] AZ::EntityId entityId,
[[maybe_unused]] SurfaceData::SurfaceTag surface)
{
}
virtual void OnTerrainSurfaceMaterialMappingChanged(
[[maybe_unused]] AZ::EntityId entityId,
[[maybe_unused]] SurfaceData::SurfaceTag surface,
[[maybe_unused]] AZ::Data::Instance<AZ::RPI::Material> material)
{
}
virtual void OnTerrainSurfaceMaterialMappingRegionChanged(
[[maybe_unused]] AZ::EntityId entityId,
[[maybe_unused]] const AZ::Aabb& oldRegion,
[[maybe_unused]] const AZ::Aabb& newRegion)
{
}
};
using TerrainAreaMaterialNotificationBus = AZ::EBus<TerrainAreaMaterialNotifications>;
} // namespace Terrain