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::ClipmapBounds Class Reference

Public Member Functions

 ClipmapBounds (const ClipmapBoundsDescriptor &desc)
 
ClipmapBoundsRegionList UpdateCenter (const AZ::Vector2 &newCenter, AZ::Aabb *untouchedRegion=nullptr)
 
ClipmapBoundsRegionList UpdateCenter (const Vector2i &newCenter, AZ::Aabb *untouchedRegion=nullptr)
 
ClipmapBoundsRegionList TransformRegion (AZ::Aabb worldSpaceRegion)
 
ClipmapBoundsRegionList TransformRegion (const AZ::Vector2 &worldSpaceMin, const AZ::Vector2 &worldSpaceMax)
 
ClipmapBoundsRegionList TransformRegion (Aabb2i clipSpaceRegion)
 
AZ::Aabb GetWorldBounds () const
 Returns the bounds covered by this clipmap in world space. Z component is always 0.
 
float GetWorldSpaceSafeDistance () const
 
Vector2i GetCenterInClipmapSpace () const
 Returns the center of the clipmap in clipmap space.
 
AZ::Vector2 GetCenterInWorldSpace () const
 Returns the center of the clipmap in world space.
 
Vector2i GetModCenter () const
 Returns the modulated center of the clipmap in [0, size).
 

Static Public Attributes

static constexpr uint32_t MaxUpdateRegions = 6
 The biggest possible number of regions can return when calling UpdateCenter();.
 

Member Function Documentation

◆ GetWorldSpaceSafeDistance()

float Terrain::ClipmapBounds::GetWorldSpaceSafeDistance ( ) const

Returns the safe x and y distance from the center in world space. This is based on the scale, clipmap size, and m_clipmapUpdateMultiple. For example, a clipmap size 1024 with scale 0.25 and margin of 4 would have a safe distance of (1024 * 0.5 - 4) * 0.25 = 127.0f.

◆ TransformRegion() [1/3]

ClipmapBoundsRegionList Terrain::ClipmapBounds::TransformRegion ( Aabb2i  clipSpaceRegion)

Takes in a single unscaled clipmap space region and transforms it into 0-4 regions in the clipmap clamped to the bounds of the clipmap.

◆ TransformRegion() [2/3]

ClipmapBoundsRegionList Terrain::ClipmapBounds::TransformRegion ( AZ::Aabb  worldSpaceRegion)

Takes in a single world space aabb and transforms it into 0-4 regions in the clipmap clamped to the bounds of the clipmap.

◆ TransformRegion() [3/3]

ClipmapBoundsRegionList Terrain::ClipmapBounds::TransformRegion ( const AZ::Vector2 &  worldSpaceMin,
const AZ::Vector2 &  worldSpaceMax 
)

Takes in a single world space min and max 2d bounds and transforms it into 0-4 regions in the clipmap clamped to the bounds of the clipmap.

◆ UpdateCenter() [1/2]

ClipmapBoundsRegionList Terrain::ClipmapBounds::UpdateCenter ( const AZ::Vector2 &  newCenter,
AZ::Aabb *  untouchedRegion = nullptr 
)

Updates the clipmap bounds using a world coordinate center position and returns 0-6 regions that need to be updated due to moving beyond the margins. These update regions will always be at least the size of the margin, and will represent horizontal and/or vertical strips along the edges of the clipmap. An optional untouched region aabb can be passed to this function to get an aabb of areas inside the bounds of the clipmap but not updated by the center moving. This can be useful in cases where part of the bounds of the clipmap is dirty, but areas that will already be updated due to the center moving shouldn't be updated twice.

◆ UpdateCenter() [2/2]

ClipmapBoundsRegionList Terrain::ClipmapBounds::UpdateCenter ( const Vector2i newCenter,
AZ::Aabb *  untouchedRegion = nullptr 
)

Updates the clipmap bounds using a position in clipmap space (no scaling) and returns 0-6 regions that need to be updated due to moving beyond the margins. These update regions will always be at least the size of the margin, and will represent horizontal and/or vertical strips along the edges of the clipmap. An optional untouched region aabb can be passed to this function to get an aabb of areas inside the bounds of the clipmap but not updated by the center moving. This can be useful in cases where part of the bounds of the clipmap is dirty, but areas that will already be updated due to the center moving shouldn't be updated twice.


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