![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "CoreMinimal.h"#include "Stats/Stats.h"#include "Recast/Recast.h"#include "Recast/RecastAlloc.h"#include "Recast/RecastAssert.h"Classes | |
| struct | rcRegion |
| struct | rcSweepSpan |
Namespaces | |
| namespace | RecastRegionFunc |
| namespace | UE |
| namespace | UE::Recast |
| namespace | UE::Recast::Private |
Macros | |
| #define | _USE_MATH_DEFINES |
Functions | |
| bool | rcBuildDistanceField (rcContext *ctx, rcCompactHeightfield &chf) |
| void | UE::Recast::Private::rcMarkBorderRegions (const rcBorderSize borderSize, const int w, const int h, rcCompactHeightfield &chf, unsigned short *srcReg, unsigned short &id) |
| bool | rcBuildRegionsMonotone (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int minRegionArea, const int mergeRegionArea) |
| bool | rcBuildRegionsChunky (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int minRegionArea, const int mergeRegionArea, const int regionChunkSize) |
| bool | rcGatherRegionsNoFilter (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, unsigned short *spanBuf4) |
| helper function from RecastRegion.cpp, requires distance data in compact height field | |
| bool | rcBuildRegions (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int minRegionArea, const int mergeRegionArea) |
| #define _USE_MATH_DEFINES |
| bool rcBuildDistanceField | ( | rcContext * | ctx, |
| rcCompactHeightfield & | chf | ||
| ) |
This is usually the second to the last step in creating a fully built compact heightfield. This step is required before regions are built using rcBuildRegions or rcBuildRegionsMonotone.
After this step, the distance data is available via the rcCompactHeightfield::maxDistance and rcCompactHeightfield::dist fields.
| bool rcBuildRegions | ( | rcContext * | ctx, |
| rcCompactHeightfield & | chf, | ||
| const rcBorderSize | borderSize, | ||
| const int | minRegionArea, | ||
| const int | mergeRegionArea | ||
| ) |
Non-null regions will consist of connected, non-overlapping walkable spans that form a single contour. Contours will form simple polygons.
If multiple regions form an area that is smaller than minRegionArea, then all spans will be re-assigned to the zero (null) region.
Watershed partitioning can result in smaller than necessary regions, especially in diagonal corridors. mergeRegionArea helps reduce unecessarily small regions.
See the rcConfig documentation for more information on the configuration parameters.
The region data will be available via the rcCompactHeightfield::maxRegions and rcCompactSpan::reg fields.
| bool rcBuildRegionsChunky | ( | rcContext * | ctx, |
| rcCompactHeightfield & | chf, | ||
| const rcBorderSize | borderSize, | ||
| const int | minRegionArea, | ||
| const int | mergeRegionArea, | ||
| const int | chunkSize | ||
| ) |
Builds region data for the heightfield using simple monotone partitioning.
| [in,out] | ctx | The build context to use during the operation. |
| [in,out] | chf | A populated compact heightfield. |
| [in] | borderSize | The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx] |
| [in] | minRegionArea | The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]. |
| [in] | mergeRegionArea | Any regions with a span count smaller than this value will, if possible, be merged with larger regions. [Limit: >=0] [Units: vx] |
| [in] | chunkSize | Size of subregion [Units: vx] |
| bool rcBuildRegionsMonotone | ( | rcContext * | ctx, |
| rcCompactHeightfield & | chf, | ||
| const rcBorderSize | borderSize, | ||
| const int | minRegionArea, | ||
| const int | mergeRegionArea | ||
| ) |
Non-null regions will consist of connected, non-overlapping walkable spans that form a single contour. Contours will form simple polygons.
If multiple regions form an area that is smaller than minRegionArea, then all spans will be re-assigned to the zero (null) region.
Partitioning can result in smaller than necessary regions. mergeRegionArea helps reduce unecessarily small regions.
See the rcConfig documentation for more information on the configuration parameters.
The region data will be available via the rcCompactHeightfield::maxRegions and rcCompactSpan::reg fields.
| bool rcGatherRegionsNoFilter | ( | rcContext * | ctx, |
| rcCompactHeightfield & | chf, | ||
| const rcBorderSize | borderSize, | ||
| unsigned short * | spanBuf4 | ||
| ) |
helper function from RecastRegion.cpp, requires distance data in compact height field
@UE: rcBuildRegions is now split into two functions: gathering regions and merging them it allows reusing existing code for building layer set (flood fill based partitioning)
spanBuf4 is temporary buffer, allocated and freed by caller (size = chf.spanCount * 4)