ITerrain

Interface to terrain engine. More...

#include

Public Member Functions

virtual bool SetCompiledData (byte *pData, int nDataSize, std::vector< struct IStatObj *> **ppStatObjTable, std::vector< IMaterial *> **ppMatTable, bool bHotUpdate=false, SHotUpdateInfo *pExportInfo=NULL)=0
Loads data into terrain engine from memory block.
virtual bool GetCompiledData (byte *pData, int nDataSize, std::vector< struct IStatObj *> **ppStatObjTable, std::vector< IMaterial *> **ppMatTable, std::vector< struct IStatInstGroup *> **ppStatInstGroupTable, EEndian eEndian, SHotUpdateInfo *pExportInfo=NULL)=0
Saves data from terrain engine into memory block.
virtual int GetCompiledDataSize (SHotUpdateInfo *pExportInfo=NULL)=0
virtual IRenderNode * AddVegetationInstance (int nStaticGroupID, const Vec3 &vPos, const float fScale, uint8 ucBright, uint8 angle, uint8 angleX=0, uint8 angleY=0)=0
Create and place a new vegetation object on the terrain.
virtual void SetOceanWaterLevel (float oceanWaterLevel)=0
Set ocean level.
virtual void MarkAndOffsetCloneRegion (const AABB &region, const Vec3 &offset)=0
virtual void CloneRegion (const AABB &region, const Vec3 &offset, float zRotation, const uint16 *pIncludeLayers=NULL, int numIncludeLayers=0)=0
virtual void ClearCloneSources ()=0
Remove all objects that were marked by MarkAndOffsetCloneRegion.
virtual int GetTerrainLightmapTexId (Vec4 &vTexGenInfo)=0
virtual void GetAtlasTexId (int &nTex0, int &nTex1, int &nTex2)=0
Return terrain texture atlas texture id's.
virtual void GetStatObjAndMatTables (DynArray< IStatObj *> *pStatObjTable, DynArray< IMaterial *> *pMatTable, DynArray< IStatInstGroup *> *pStatInstGroupTable, uint32 nObjTypeMask)=0
virtual void SetTerrainElevation (int x1, int y1, int nSizeX, int nSizeY, float *pTerrainBlock, SSurfaceTypeItem *pSurfaceData, int nSurfOrgX, int nSurfOrgY, int nSurfSizeX, int nSurfSizeY, uint32 *pResolMap, int nResolMapSizeX, int nResolMapSizeY)=0
virtual bool CanPaintSurfaceType (int x, int y, int r, uint16 usGlobalSurfaceType)=0
virtual int GetNotReadyTextureNodesCount ()=0
virtual void GetResourceMemoryUsage (ICrySizer *pSizer, const AABB &crstAABB)=0
virtual int GetDetailTextureMaterials (IMaterial *materials[])=0
virtual void ChangeOceanMaterial (IMaterial *pMat)=0
Changes the ocean material.
virtual void ResetTerrainVertBuffers (const AABB *pBox)=0
virtual void OnTerrainPaintActionComplete ()=0
Inform terrain engine about terrain painting/sculpting action finish.

Detailed Description

Interface to terrain engine.

Member Function Documentation

◆ CanPaintSurfaceType()

virtual bool ITerrain::CanPaintSurfaceType ( int x,
int y,
int r,
uint16 usGlobalSurfaceType
)
pure virtual

Checks if it is possible to paint on the terrain with a given surface type ID.

Note
Should be called by the editor to avoid overflowing the sector surface type palettes.

◆ CloneRegion()

virtual void ITerrain::CloneRegion ( const AABB & region,
const Vec3 & offset,
float zRotation,
const uint16 * pIncludeLayers = NULL,
int numIncludeLayers = 0
)
pure virtual

Clones all objects in a region of the terrain, offsetting and rotating them based on the values passed in.

Parameters
offset- Offset amount, relative to the center of the region passed in.
zRotation- Rotation around the z axis, in radians.
pIncludeLayers- Optional list of layer ids to include, zero include layers means include objects from any layer

◆ GetCompiledDataSize()

virtual int ITerrain::GetCompiledDataSize ( SHotUpdateInfo * pExportInfo = NULL)
pure virtual
Returns
terrain data memory block size.

◆ GetDetailTextureMaterials()

virtual int ITerrain::GetDetailTextureMaterials ( IMaterial * materials[])
pure virtual
Returns
number of used detail texture materials. Fills materials array if materials!=NULL.

◆ GetNotReadyTextureNodesCount()

virtual int ITerrain::GetNotReadyTextureNodesCount ( )
pure virtual
Returns
current amount of terrain textures requests for streaming, if more than 0 = there is streaming in progress.

◆ GetResourceMemoryUsage()

virtual void ITerrain::GetResourceMemoryUsage ( ICrySizer * pSizer,
const AABB & crstAABB
)
pure virtual

Retrieves the resource (mostly texture system memory) memory usage for a given region of the terrain.

Parameters
pSizerPointer to an instance of the CrySizer object. The purpose of this object is making sure each element is accounted only once.
crstAABB- Is a reference to the bounding box in which region we want to analyze the resources.

◆ GetStatObjAndMatTables()

virtual void ITerrain::GetStatObjAndMatTables ( DynArray< IStatObj *> * pStatObjTable,
DynArray< IMaterial *> * pMatTable,
DynArray< IStatInstGroup *> * pStatInstGroupTable,
uint32 nObjTypeMask
)
pure virtual
Returns
object and material table for Exporting.

◆ GetTerrainLightmapTexId()

virtual int ITerrain::GetTerrainLightmapTexId ( Vec4 & vTexGenInfo)
pure virtual
Returns
whole terrain lightmap texture id.

◆ MarkAndOffsetCloneRegion()

virtual void ITerrain::MarkAndOffsetCloneRegion ( const AABB & region,
const Vec3 & offset
)
pure virtual

Call this before any calls to CloneRegion to mark all the render nodes in the source region(s) with the flag ERF_CLONE_SOURCE. This ensures that the clone call will only get source nodes, and not cloned ones from multiple calls to CloneRegion. The offset is an optional value for offsetting the clone sources, to ensure they won't be overlapping the clones (or pass zero for no offset).

◆ ResetTerrainVertBuffers()

virtual void ITerrain::ResetTerrainVertBuffers ( const AABB * pBox)
pure virtual

Request heightmap mesh update in specified area if pBox == 0 update entire heightmap

◆ SetTerrainElevation()

virtual void ITerrain::SetTerrainElevation ( int x1,
int y1,
int nSizeX,
int nSizeY,
float * pTerrainBlock,
SSurfaceTypeItem * pSurfaceData,
int nSurfOrgX,
int nSurfOrgY,
int nSurfSizeX,
int nSurfSizeY,
uint32 * pResolMap,
int nResolMapSizeX,
int nResolMapSizeY
)
pure virtual

Updates part of height map. x1, y1, nSizeX, nSizeY are in terrain units pTerrainBlock points to a square 2D array with dimensions GetTerrainSize() by default update only elevation.