Open 3D Engine Terrain Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Terrain::TerrainClipmapManager Class Reference

#include <TerrainClipmapManager.h>

Inherits TerrainMacroMaterialNotificationBus::Handler, TerrainAreaMaterialNotificationBus::Handler, and AzFramework::Terrain::TerrainDataNotificationBus::Handler.

Public Types

enum  ClipmapName : uint32_t {
  MacroColor = 0 , MacroNormal , DetailColor , DetailNormal ,
  DetailHeight , DetailRoughness , DetailSpecularF0 , DetailMetalness ,
  DetailOcclusion , Count
}
 Name for each clipmap image.
 

Public Member Functions

 AZ_RTTI (TerrainClipmapManager, "{5892AEE6-F3FA-4DFC-BBEC-77E1B91506A2}")
 
 AZ_DISABLE_COPY_MOVE (TerrainClipmapManager)
 
void SetConfiguration (const ClipmapConfiguration &config)
 
bool IsClipmapEnabled () const
 
void Initialize (AZ::Data::Instance< AZ::RPI::ShaderResourceGroup > &terrainSrg)
 
bool IsInitialized () const
 
void Reset ()
 
void TriggerFullRefresh ()
 Reset full refresh flag so that all the clipmap image will be repainted.
 
void UpdateSrgIndices (AZ::Data::Instance< AZ::RPI::ShaderResourceGroup > &srg)
 
void Update (const AZ::Vector3 &cameraPosition, const AZ::RPI::Scene *scene, AZ::Data::Instance< AZ::RPI::ShaderResourceGroup > &terrainSrg)
 
void ImportClipmap (ClipmapName clipmapName, AZ::RHI::FrameGraphAttachmentInterface attachmentDatabase) const
 
void UseClipmap (ClipmapName clipmapName, AZ::RHI::ScopeAttachmentAccess access, AZ::RHI::FrameGraphInterface frameGraph) const
 
AZ::Data::Instance< AZ::RPI::AttachmentImage > GetClipmapImage (ClipmapName clipmapName) const
 Get the clipmap images for passes using them.
 
void GetMacroDispatchThreadNum (uint32_t &outThreadX, uint32_t &outThreadY, uint32_t &outThreadZ) const
 Get the dispatch thread num for the clipmap compute shader based on the current frame.
 
void GetDetailDispatchThreadNum (uint32_t &outThreadX, uint32_t &outThreadY, uint32_t &outThreadZ) const
 
uint32_t GetClipmapSize () const
 Get the size of the clipmap from config.
 
bool HasMacroClipmapUpdate () const
 Returns if there are clipmap regions requiring update.
 
bool HasDetailClipmapUpdate () const
 

Static Public Attributes

static constexpr const char * ClipmapDataShaderInput = "m_clipmapData"
 Shader input names.
 
static constexpr const char * ClipmapImageShaderInput [ClipmapName::Count]
 

Friends

class TerrainClipmapGenerationPass
 

Detailed Description

This class manages all terrain clipmaps' creation and update. It should be owned by the TerrianFeature Processor and provide data and images for the ClipmapGenerationPass and terrain forward rendering pass.

Member Function Documentation

◆ ImportClipmap()

void Terrain::TerrainClipmapManager::ImportClipmap ( ClipmapName  clipmapName,
AZ::RHI::FrameGraphAttachmentInterface  attachmentDatabase 
) const

Import the clipmap to the frame graph and set scope attachment access, so that the compute pass can build dependencies accordingly.

Member Data Documentation

◆ ClipmapImageShaderInput

constexpr const char* Terrain::TerrainClipmapManager::ClipmapImageShaderInput[ClipmapName::Count]
staticconstexpr
Initial value:
= {
"m_macroColorClipmaps",
"m_macroNormalClipmaps",
"m_detailColorClipmaps",
"m_detailNormalClipmaps",
"m_detailHeightClipmaps",
"m_detailRoughnessClipmaps",
"m_detailSpecularF0Clipmaps",
"m_detailMetalnessClipmaps",
"m_detailOcclusionClipmaps",
}

The documentation for this class was generated from the following file: