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

Inherits AzFramework::Terrain::TerrainDataRequestBus::Handler, Terrain::TerrainSystemServiceRequestBus::Handler, and AZ::TickBus::Handler.

Public Member Functions

void Activate () override
 
void Deactivate () override
 
void RegisterArea (AZ::EntityId areaId) override
 
void UnregisterArea (AZ::EntityId areaId) override
 
void RefreshArea (AZ::EntityId areaId, AzFramework::Terrain::TerrainDataNotifications::TerrainDataChangedMask changeMask) override
 
void RefreshRegion (const AZ::Aabb &dirtyRegion, AzFramework::Terrain::TerrainDataNotifications::TerrainDataChangedMask changeMask) override
 
float GetTerrainHeightQueryResolution () const override
 
void SetTerrainHeightQueryResolution (float queryResolution) override
 
float GetTerrainSurfaceDataQueryResolution () const override
 
void SetTerrainSurfaceDataQueryResolution (float queryResolution) override
 
virtual AZ::Aabb GetTerrainAabb () const override
 
AzFramework::Terrain::FloatRange GetTerrainHeightBounds () const override
 
void SetTerrainHeightBounds (const AzFramework::Terrain::FloatRange &heightRange) override
 
bool TerrainAreaExistsInBounds (const AZ::Aabb &bounds) const override
 
float GetHeight (const AZ::Vector3 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
float GetHeightFromVector2 (const AZ::Vector2 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
float GetHeightFromFloats (float x, float y, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
AzFramework::SurfaceData::SurfaceTagWeight GetMaxSurfaceWeight (const AZ::Vector3 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
AzFramework::SurfaceData::SurfaceTagWeight GetMaxSurfaceWeightFromVector2 (const AZ::Vector2 &inPosition, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
AzFramework::SurfaceData::SurfaceTagWeight GetMaxSurfaceWeightFromFloats (const float x, const float y, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfaceWeights (const AZ::Vector3 &inPosition, AzFramework::SurfaceData::SurfaceTagWeightList &outSurfaceWeights, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfaceWeightsFromVector2 (const AZ::Vector2 &inPosition, AzFramework::SurfaceData::SurfaceTagWeightList &outSurfaceWeights, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfaceWeightsFromFloats (float x, float y, AzFramework::SurfaceData::SurfaceTagWeightList &outSurfaceWeights, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
const char * GetMaxSurfaceName (const AZ::Vector3 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
bool GetIsHole (const AZ::Vector3 &position, Sampler sampler=Sampler::BILINEAR) const override
 
bool GetIsHoleFromVector2 (const AZ::Vector2 &position, Sampler sampler=Sampler::BILINEAR) const override
 
bool GetIsHoleFromFloats (float x, float y, Sampler sampler=Sampler::BILINEAR) const override
 
AZ::Vector3 GetNormal (const AZ::Vector3 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
AZ::Vector3 GetNormalFromVector2 (const AZ::Vector2 &position, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
AZ::Vector3 GetNormalFromFloats (float x, float y, Sampler sampler=Sampler::BILINEAR, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfacePoint (const AZ::Vector3 &inPosition, AzFramework::SurfaceData::SurfacePoint &outSurfacePoint, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfacePointFromVector2 (const AZ::Vector2 &inPosition, AzFramework::SurfaceData::SurfacePoint &outSurfacePoint, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
void GetSurfacePointFromFloats (float x, float y, AzFramework::SurfaceData::SurfacePoint &outSurfacePoint, Sampler sampler=Sampler::DEFAULT, bool *terrainExistsPtr=nullptr) const override
 
void QueryList (const AZStd::span< const AZ::Vector3 > &inPositions, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointListFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT) const override
 
void QueryListOfVector2 (const AZStd::span< const AZ::Vector2 > &inPositions, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointListFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT) const override
 
void QueryRegion (const AzFramework::Terrain::TerrainQueryRegion &queryRegion, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointRegionFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT) const override
 
AzFramework::EntityContextId GetTerrainRaycastEntityContextId () const override
 
AzFramework::RenderGeometry::RayResult GetClosestIntersection (const AzFramework::RenderGeometry::RayRequest &ray) const override
 
AZStd::shared_ptr< AzFramework::Terrain::TerrainJobContext > QueryListAsync (const AZStd::span< const AZ::Vector3 > &inPositions, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointListFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT, AZStd::shared_ptr< AzFramework::Terrain::QueryAsyncParams > params=nullptr) const override
 
AZStd::shared_ptr< AzFramework::Terrain::TerrainJobContext > QueryListOfVector2Async (const AZStd::span< const AZ::Vector2 > &inPositions, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointListFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT, AZStd::shared_ptr< AzFramework::Terrain::QueryAsyncParams > params=nullptr) const override
 
AZStd::shared_ptr< AzFramework::Terrain::TerrainJobContext > QueryRegionAsync (const AzFramework::Terrain::TerrainQueryRegion &queryRegion, TerrainDataMask requestedData, AzFramework::Terrain::SurfacePointRegionFillCallback perPositionCallback, Sampler sampler=Sampler::DEFAULT, AZStd::shared_ptr< AzFramework::Terrain::QueryAsyncParams > params=nullptr) const override
 

Member Function Documentation

◆ GetHeight()

float Terrain::TerrainSystem::GetHeight ( const AZ::Vector3 &  position,
Sampler  sampler = Sampler::BILINEAR,
bool *  terrainExistsPtr = nullptr 
) const
override

Returns terrains height in meters at location x,y. @terrainExistsPtr: Can be nullptr. If != nullptr then, if there's no terrain at location x,y or location x,y is inside a terrain HOLE then *terrainExistsPtr will become false, otherwise *terrainExistsPtr will become true.

◆ GetIsHole()

bool Terrain::TerrainSystem::GetIsHole ( const AZ::Vector3 &  position,
Sampler  sampler = Sampler::BILINEAR 
) const
override

Returns true if there's a hole at location x,y. Also returns true if there's no terrain data at location x,y.

◆ GetMaxSurfaceName()

const char * Terrain::TerrainSystem::GetMaxSurfaceName ( const AZ::Vector3 &  position,
Sampler  sampler = Sampler::BILINEAR,
bool *  terrainExistsPtr = nullptr 
) const
override

Convenience function for low level systems that can't do a reverse lookup from Crc to string. Everyone else should use GetMaxSurfaceWeight or GetMaxSurfaceWeightFromFloats. Not available in the behavior context. Returns nullptr if the position is inside a hole or outside of the terrain boundaries.

◆ GetMaxSurfaceWeight()

AzFramework::SurfaceData::SurfaceTagWeight Terrain::TerrainSystem::GetMaxSurfaceWeight ( const AZ::Vector3 &  position,
Sampler  sampler = Sampler::BILINEAR,
bool *  terrainExistsPtr = nullptr 
) const
override

Given an XY coordinate, return the max surface type and weight. @terrainExists: Can be nullptr. If != nullptr then, if there's no terrain at location x,y or location x,y is inside a terrain HOLE then *terrainExistsPtr will be set to false, otherwise *terrainExistsPtr will be set to true.

◆ GetNormal()

AZ::Vector3 Terrain::TerrainSystem::GetNormal ( const AZ::Vector3 &  position,
Sampler  sampler = Sampler::BILINEAR,
bool *  terrainExistsPtr = nullptr 
) const
override

@terrainExists: Can be nullptr. If != nullptr then, if there's no terrain at location x,y or location x,y is inside a terrain HOLE then *terrainExistsPtr will be set to false, otherwise *terrainExistsPtr will be set to true.

◆ QueryList()

void Terrain::TerrainSystem::QueryList ( const AZStd::span< const AZ::Vector3 > &  inPositions,
TerrainDataMask  requestedData,
AzFramework::Terrain::SurfacePointListFillCallback  perPositionCallback,
Sampler  sampler = Sampler::DEFAULT 
) const
override

Given a list of XY coordinates, call the provided callback function with surface data corresponding to each XY coordinate in the list.

◆ QueryRegion()

void Terrain::TerrainSystem::QueryRegion ( const AzFramework::Terrain::TerrainQueryRegion &  queryRegion,
TerrainDataMask  requestedData,
AzFramework::Terrain::SurfacePointRegionFillCallback  perPositionCallback,
Sampler  sampler = Sampler::DEFAULT 
) const
override

Given a region(aabb) and a step size, call the provided callback function with surface data corresponding to the coordinates in the region.


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