UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Recast.cpp File Reference

Macros

#define _USE_MATH_DEFINES
 

Functions

 DEFINE_LOG_CATEGORY (LogRecast)
 
float rcSqrt (float x)
 
double rcSqrt (double x)
 
rcHeightfieldrcAllocHeightfield ()
 
void rcFreeHeightField (rcHeightfield *hf)
 
rcCompactHeightfieldrcAllocCompactHeightfield ()
 
void rcFreeCompactHeightfield (rcCompactHeightfield *chf)
 
rcHeightfieldLayerSetrcAllocHeightfieldLayerSet ()
 
void rcFreeHeightfieldLayerSet (rcHeightfieldLayerSet *lset)
 
rcContourSetrcAllocContourSet ()
 
void rcFreeContourSet (rcContourSet *cset)
 
rcPolyMeshrcAllocPolyMesh ()
 
void rcFreePolyMesh (rcPolyMesh *pmesh)
 
rcPolyMeshDetailrcAllocPolyMeshDetail ()
 
void rcFreePolyMeshDetail (rcPolyMeshDetail *dmesh)
 
void rcCalcBounds (const rcReal *verts, int nv, rcReal *bmin, rcReal *bmax)
 
void rcCalcGridSize (const rcReal *bmin, const rcReal *bmax, rcReal cs, int *w, int *h)
 
bool rcCreateHeightfield (rcContext *, rcHeightfield &hf, int width, int height, const rcReal *bmin, const rcReal *bmax, rcReal cs, rcReal ch, bool bAllocateTempSpanColumns)
 
void rcResetHeightfield (rcHeightfield &hf)
 
void rcCalcTriNormals (const rcReal *verts, const int nv, const int *tris, const int nt, rcReal *norms)
 
void rcMarkWalkableTriangles (rcContext *, const rcReal walkableSlopeAngle, const rcReal *verts, int, const int *tris, int nt, unsigned char *areas)
 
void rcMarkWalkableTrianglesCos (rcContext *, const rcReal walkableSlopeCos, const rcReal *verts, int, const int *tris, int nt, unsigned char *areas)
 
void rcClearUnwalkableTriangles (rcContext *, const rcReal walkableSlopeAngle, const rcReal *verts, int, const int *tris, int nt, unsigned char *areas)
 
int rcGetHeightFieldSpanCount (rcContext *, rcHeightfield &hf)
 
bool rcBuildCompactHeightfield (rcContext *ctx, const int walkableHeight, const int walkableClimb, rcHeightfield &hf, rcCompactHeightfield &chf)
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Function Documentation

◆ DEFINE_LOG_CATEGORY()

DEFINE_LOG_CATEGORY ( LogRecast  )

◆ rcAllocCompactHeightfield()

rcCompactHeightfield * rcAllocCompactHeightfield ( )

Allocates a compact heightfield object using the Recast allocator.

Returns
A compact heightfield that is ready for initialization, or null on failure.
See also
rcBuildCompactHeightfield, rcFreeCompactHeightfield

◆ rcAllocContourSet()

rcContourSet * rcAllocContourSet ( )

Allocates a contour set object using the Recast allocator.

Returns
A contour set that is ready for initialization, or null on failure.
See also
rcBuildContours, rcFreeContourSet

◆ rcAllocHeightfield()

rcHeightfield * rcAllocHeightfield ( )

Allocates a heightfield object using the Recast allocator.

Returns
A heightfield that is ready for initialization, or null on failure.
See also
rcCreateHeightfield, rcFreeHeightField

◆ rcAllocHeightfieldLayerSet()

rcHeightfieldLayerSet * rcAllocHeightfieldLayerSet ( )

Allocates a heightfield layer set using the Recast allocator.

Returns
A heightfield layer set that is ready for initialization, or null on failure.
See also
rcBuildHeightfieldLayers, rcFreeHeightfieldLayerSet

◆ rcAllocPolyMesh()

rcPolyMesh * rcAllocPolyMesh ( )

Allocates a polygon mesh object using the Recast allocator.

Returns
A polygon mesh that is ready for initialization, or null on failure.
See also
rcBuildPolyMesh, rcFreePolyMesh

◆ rcAllocPolyMeshDetail()

rcPolyMeshDetail * rcAllocPolyMeshDetail ( )

Allocates a detail mesh object using the Recast allocator.

Returns
A detail mesh that is ready for initialization, or null on failure.
See also
rcBuildPolyMeshDetail, rcFreePolyMeshDetail

◆ rcBuildCompactHeightfield()

bool rcBuildCompactHeightfield ( rcContext ctx,
const int  walkableHeight,
const int  walkableClimb,
rcHeightfield hf,
rcCompactHeightfield chf 
)

This is just the beginning of the process of fully building a compact heightfield. Various filters may be applied applied, then the distance field and regions built. E.g: rcBuildDistanceField and rcBuildRegions

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocCompactHeightfield, rcHeightfield, rcCompactHeightfield, rcConfig

◆ rcCalcBounds()

void rcCalcBounds ( const rcReal verts,
int  nv,
rcReal bmin,
rcReal bmax 
)

Calculates the bounding box of an array of vertices.

Parameters
[in]vertsAn array of vertices. [(x, y, z) * nv]
[in]nvThe number of vertices in the verts array.
[out]bminThe minimum bounds of the AABB. [(x, y, z)] [Units: wu]
[out]bmaxThe maximum bounds of the AABB. [(x, y, z)] [Units: wu]

◆ rcCalcGridSize()

void rcCalcGridSize ( const rcReal bmin,
const rcReal bmax,
rcReal  cs,
int *  w,
int *  h 
)

Calculates the grid size based on the bounding box and grid cell size.

Parameters
[in]bminThe minimum bounds of the AABB. [(x, y, z)] [Units: wu]
[in]bmaxThe maximum bounds of the AABB. [(x, y, z)] [Units: wu]
[in]csThe xz-plane cell size. [Limit: > 0] [Units: wu]
[out]wThe width along the x-axis. [Limit: >= 0] [Units: vx]
[out]hThe height along the z-axis. [Limit: >= 0] [Units: vx]

◆ rcCalcTriNormals()

void rcCalcTriNormals ( const rcReal verts,
const int  nv,
const int *  tris,
const int  nt,
rcReal norms 
)

Calculates the normals of each triangles in an array

Parameters
[in]vertsAn array of vertices. [(x, y, z) * nv]
[in]nvThe number of vertices in the verts array.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]normsThe normal vector of each triangle. [(x, y, z) * nt]

◆ rcClearUnwalkableTriangles()

void rcClearUnwalkableTriangles ( rcContext ctx,
const rcReal  walkableSlopeAngle,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Only sets the aread id's for the unwalkable triangles. Does not alter the area id's for walkable triangles.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles

◆ rcCreateHeightfield()

bool rcCreateHeightfield ( rcContext ctx,
rcHeightfield hf,
int  width,
int  height,
const rcReal bmin,
const rcReal bmax,
rcReal  cs,
rcReal  ch,
bool  bAllocateTempSpanColumns 
)

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocHeightfield, rcHeightfield

◆ rcFreeCompactHeightfield()

void rcFreeCompactHeightfield ( rcCompactHeightfield chf)

Frees the specified compact heightfield object using the Recast allocator.

Parameters
[in]chfA compact heightfield allocated using rcAllocCompactHeightfield
See also
rcAllocCompactHeightfield

◆ rcFreeContourSet()

void rcFreeContourSet ( rcContourSet cset)

Frees the specified contour set using the Recast allocator.

Parameters
[in]csetA contour set allocated using rcAllocContourSet
See also
rcAllocContourSet

◆ rcFreeHeightField()

void rcFreeHeightField ( rcHeightfield hf)

Frees the specified heightfield object using the Recast allocator.

Parameters
[in]hfA heightfield allocated using rcAllocHeightfield
See also
rcAllocHeightfield

◆ rcFreeHeightfieldLayerSet()

void rcFreeHeightfieldLayerSet ( rcHeightfieldLayerSet lset)

Frees the specified heightfield layer set using the Recast allocator.

Parameters
[in]lsetA heightfield layer set allocated using rcAllocHeightfieldLayerSet
See also
rcAllocHeightfieldLayerSet

◆ rcFreePolyMesh()

void rcFreePolyMesh ( rcPolyMesh pmesh)

Frees the specified polygon mesh using the Recast allocator.

Parameters
[in]pmeshA polygon mesh allocated using rcAllocPolyMesh
See also
rcAllocPolyMesh

◆ rcFreePolyMeshDetail()

void rcFreePolyMeshDetail ( rcPolyMeshDetail dmesh)

Frees the specified detail mesh using the Recast allocator.

Parameters
[in]dmeshA detail mesh allocated using rcAllocPolyMeshDetail
See also
rcAllocPolyMeshDetail

◆ rcGetHeightFieldSpanCount()

int rcGetHeightFieldSpanCount ( rcContext ctx,
rcHeightfield hf 
)

Returns the number of spans contained in the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]hfAn initialized heightfield.
Returns
The number of spans in the heightfield.

◆ rcMarkWalkableTriangles()

void rcMarkWalkableTriangles ( rcContext ctx,
const rcReal  walkableSlopeAngle,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Only sets the aread id's for the walkable triangles. Does not alter the area id's for unwalkable triangles.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles

◆ rcMarkWalkableTrianglesCos()

void rcMarkWalkableTrianglesCos ( rcContext ctx,
const rcReal  walkableSlopeCos,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Sets the area id of all triangles with a slope below the specified value to RC_WALKABLE_AREA.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableSlopeCosThe cosine of maximum slope that is considered walkable. [Limits: 0 <= value < 1]
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]areasThe triangle area ids. [Length: >= nt]

◆ rcResetHeightfield()

void rcResetHeightfield ( rcHeightfield hf)

Resets all spans of heightfield.

Parameters
[in,out]hfThe heightfield to reset.
[in]bminThe minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in]bmaxThe maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in,out]hfThe heightfield toreset.

◆ rcSqrt() [1/2]

double rcSqrt ( rcReal  x)

Returns the square root of the value.

Parameters
[in]xThe value.
Returns
The square root of the vlaue.

◆ rcSqrt() [2/2]

float rcSqrt ( float  x)