23 static const float RC_PI = 3.14159265f;
652 template<
class T>
inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
658 template<
class T>
inline T
rcMin(T a, T b) {
return a < b ? a : b; }
664 template<
class T>
inline T
rcMax(T a, T b) {
return a > b ? a : b; }
669 template<
class T>
inline T
rcAbs(T a) {
return a < 0 ? -a : a; }
674 template<
class T>
inline T
rcSqr(T a) {
return a * a; }
681 template<
class T>
inline T
rcClamp(T value, T minInclusive, T maxInclusive)
683 return value < minInclusive ? minInclusive: (value > maxInclusive ? maxInclusive : value);
699 inline void rcVcross(
float* dest,
const float* v1,
const float* v2)
701 dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
702 dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
703 dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
710 inline float rcVdot(
const float* v1,
const float* v2)
712 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
720 inline void rcVmad(
float* dest,
const float* v1,
const float* v2,
const float s)
722 dest[0] = v1[0]+v2[0]*s;
723 dest[1] = v1[1]+v2[1]*s;
724 dest[2] = v1[2]+v2[2]*s;
731 inline void rcVadd(
float* dest,
const float* v1,
const float* v2)
733 dest[0] = v1[0]+v2[0];
734 dest[1] = v1[1]+v2[1];
735 dest[2] = v1[2]+v2[2];
742 inline void rcVsub(
float* dest,
const float* v1,
const float* v2)
744 dest[0] = v1[0]-v2[0];
745 dest[1] = v1[1]-v2[1];
746 dest[2] = v1[2]-v2[2];
752 inline void rcVmin(
float* mn,
const float* v)
754 mn[0] =
rcMin(mn[0], v[0]);
755 mn[1] =
rcMin(mn[1], v[1]);
756 mn[2] =
rcMin(mn[2], v[2]);
762 inline void rcVmax(
float* mx,
const float* v)
764 mx[0] =
rcMax(mx[0], v[0]);
765 mx[1] =
rcMax(mx[1], v[1]);
766 mx[2] =
rcMax(mx[2], v[2]);
772 inline void rcVcopy(
float* dest,
const float* v)
783 inline float rcVdist(
const float* v1,
const float* v2)
785 float dx = v2[0] - v1[0];
786 float dy = v2[1] - v1[1];
787 float dz = v2[2] - v1[2];
788 return rcSqrt(dx*dx + dy*dy + dz*dz);
797 float dx = v2[0] - v1[0];
798 float dy = v2[1] - v1[1];
799 float dz = v2[2] - v1[2];
800 return dx*dx + dy*dy + dz*dz;
824 void rcCalcBounds(
const float* verts,
int numVerts,
float* minBounds,
float* maxBounds);
833 void rcCalcGridSize(
const float* minBounds,
const float* maxBounds,
float cellSize,
int* sizeX,
int* sizeZ);
851 const float* minBounds,
const float* maxBounds,
852 float cellSize,
float cellHeight);
874 const int* tris,
int numTris,
unsigned char* triAreaIDs);
895 const int* tris,
int numTris,
unsigned char* triAreaIDs);
917 unsigned short spanMin,
unsigned short spanMax,
918 unsigned char areaID,
int flagMergeThreshold);
938 const float* v0,
const float* v1,
const float* v2,
939 unsigned char areaID,
rcHeightfield& heightfield,
int flagMergeThreshold = 1);
958 const float* verts,
int numVerts,
959 const int* tris,
const unsigned char* triAreaIDs,
int numTris,
979 const float* verts,
int numVerts,
980 const unsigned short* tris,
const unsigned char* triAreaIDs,
int numTris,
1000 const float* verts,
const unsigned char* triAreaIDs,
int numTris,
1130 void rcMarkBoxArea(
rcContext* context,
const float* boxMinBounds,
const float* boxMaxBounds,
unsigned char areaId,
1151 float minY,
float maxY,
unsigned char areaId,
1167 int rcOffsetPoly(
const float* verts,
int numVerts,
float offset,
float* outVerts,
int maxOutVerts);
1227 int borderSize,
int minRegionArea,
int mergeRegionArea);
1235 const unsigned int shift = (
unsigned int)direction * 6;
1236 const unsigned int con = span.
con;
1237 span.
con = (con & ~(0x3f << shift)) | (((
unsigned int)neighborIndex & 0x3f) << shift);
1246 const unsigned int shift = (
unsigned int)direction * 6;
1247 return (span.
con >> shift) & 0x3f;
1255 static const int offset[4] = { -1, 0, 1, 0, };
1256 return offset[direction & 0x03];
1265 static const int offset[4] = { 0, 1, 0, -1 };
1266 return offset[direction & 0x03];
1275 static const int dirs[5] = { 3, 0, -1, 2, 1 };
1276 return dirs[((offsetZ + 1) << 1) + offsetX];
1295 int borderSize,
int walkableHeight,
1310 float maxError,
int maxEdgeLen,
1343 float sampleDist,
float sampleMaxError,
float rcVdot(const float *v1, const float *v2)
Derives the dot product of two vectors.
Definition: Recast.h:710
rcTimerLabel
Recast performance timer categories.
Definition: Recast.h:40
@ RC_TIMER_BUILD_REGIONS_FILTER
The time to filter out small regions. (See: rcBuildRegions, rcBuildRegionsMonotone)
Definition: Recast.h:90
@ RC_TIMER_BUILD_POLYMESHDETAIL
The time to build the polygon mesh detail. (See: rcBuildPolyMeshDetail)
Definition: Recast.h:94
@ RC_TIMER_MERGE_POLYMESH
The time to merge polygon meshes. (See: rcMergePolyMeshes)
Definition: Recast.h:66
@ RC_TIMER_MERGE_POLYMESHDETAIL
The time to merge polygon mesh details. (See: rcMergePolyMeshDetails)
Definition: Recast.h:96
@ RC_TIMER_BUILD_DISTANCEFIELD
The total time to build the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:76
@ RC_TIMER_BUILD_POLYMESH
The time to build the polygon mesh. (See: rcBuildPolyMesh)
Definition: Recast.h:64
@ RC_TIMER_BUILD_COMPACTHEIGHTFIELD
The time to build the compact heightfield. (See: rcBuildCompactHeightfield)
Definition: Recast.h:48
@ RC_MAX_TIMERS
The maximum number of timers. (Used for iterating timers.)
Definition: Recast.h:98
@ RC_TIMER_MARK_BOX_AREA
The time to mark a box area. (See: rcMarkBoxArea)
Definition: Recast.h:70
@ RC_TIMER_RASTERIZE_TRIANGLES
The time to rasterize the triangles. (See: rcRasterizeTriangle)
Definition: Recast.h:46
@ RC_TIMER_FILTER_BORDER
The time to filter ledge spans. (See: rcFilterLedgeSpans)
Definition: Recast.h:56
@ RC_TIMER_BUILD_REGIONS_FLOOD
The time to flood regions while applying the watershed algorithm. (See: rcBuildRegions)
Definition: Recast.h:88
@ RC_TIMER_BUILD_CONTOURS
The total time to build the contours. (See: rcBuildContours)
Definition: Recast.h:50
@ RC_TIMER_BUILD_CONTOURS_TRACE
The time to trace the boundaries of the contours. (See: rcBuildContours)
Definition: Recast.h:52
@ RC_TIMER_BUILD_REGIONS_WATERSHED
The total time to apply the watershed algorithm. (See: rcBuildRegions)
Definition: Recast.h:84
@ RC_TIMER_TEMP
A user defined build time.
Definition: Recast.h:44
@ RC_TIMER_BUILD_REGIONS_EXPAND
The time to expand regions while applying the watershed algorithm. (See: rcBuildRegions)
Definition: Recast.h:86
@ RC_TIMER_BUILD_DISTANCEFIELD_BLUR
The time to blur the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:80
@ RC_TIMER_BUILD_DISTANCEFIELD_DIST
The time to build the distances of the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:78
@ RC_TIMER_BUILD_LAYERS
The time to build heightfield layers. (See: rcBuildHeightfieldLayers)
Definition: Recast.h:92
@ RC_TIMER_BUILD_CONTOURS_SIMPLIFY
The time to simplify the contours. (See: rcBuildContours)
Definition: Recast.h:54
@ RC_TIMER_MARK_CYLINDER_AREA
The time to mark a cylinder area. (See: rcMarkCylinderArea)
Definition: Recast.h:72
@ RC_TIMER_MARK_CONVEXPOLY_AREA
The time to mark a convex polygon area. (See: rcMarkConvexPolyArea)
Definition: Recast.h:74
@ RC_TIMER_ERODE_AREA
The time to erode the walkable area. (See: rcErodeWalkableArea)
Definition: Recast.h:68
@ RC_TIMER_TOTAL
The user defined total time of the build.
Definition: Recast.h:42
@ RC_TIMER_FILTER_WALKABLE
The time to filter low height spans. (See: rcFilterWalkableLowHeightSpans)
Definition: Recast.h:58
@ RC_TIMER_BUILD_REGIONS
The total time to build the regions. (See: rcBuildRegions, rcBuildRegionsMonotone)
Definition: Recast.h:82
@ RC_TIMER_FILTER_LOW_OBSTACLES
The time to filter low obstacles. (See: rcFilterLowHangingWalkableObstacles)
Definition: Recast.h:62
@ RC_TIMER_MEDIAN_AREA
The time to apply the median filter. (See: rcMedianFilterWalkableArea)
Definition: Recast.h:60
float rcVdist(const float *v1, const float *v2)
Returns the distance between two points.
Definition: Recast.h:783
void rcVmad(float *dest, const float *v1, const float *v2, const float s)
Performs a scaled vector addition.
Definition: Recast.h:720
float rcSqrt(float x)
Returns the square root of the value.
Definition: Recast.cpp:53
static const int RC_SPAN_MAX_HEIGHT
Defines the maximum value for rcSpan::smin and rcSpan::smax.
Definition: Recast.h:286
void rcSwap(T &a, T &b)
Swaps the values of the two parameters.
Definition: Recast.h:652
void rcVcross(float *dest, const float *v1, const float *v2)
Derives the cross product of two vectors.
Definition: Recast.h:699
void rcVmax(float *mx, const float *v)
Selects the maximum value of each element from the specified vectors.
Definition: Recast.h:762
static const unsigned char RC_NULL_AREA
Represents the null area.
Definition: Recast.h:635
static const int RC_SPANS_PER_POOL
The number of spans allocated per span spool.
Definition: Recast.h:290
static const int RC_AREA_BORDER
Area border flag.
Definition: Recast.h:611
static const unsigned char RC_WALKABLE_AREA
The default area id used to indicate a walkable polygon.
Definition: Recast.h:640
void rcIgnoreUnused(const T &)
Used to ignore unused function parameters and silence any compiler warnings.
Definition: Recast.h:26
void rcVsub(float *dest, const float *v1, const float *v2)
Performs a vector subtraction.
Definition: Recast.h:742
rcBuildContoursFlags
Contour build flags.
Definition: Recast.h:616
@ RC_CONTOUR_TESS_WALL_EDGES
Tessellate solid (impassable) edges during contour simplification.
Definition: Recast.h:617
@ RC_CONTOUR_TESS_AREA_EDGES
Tessellate edges between areas during contour simplification.
Definition: Recast.h:618
static const int RC_NOT_CONNECTED
The value returned by rcGetCon if the specified direction is not connected to another span.
Definition: Recast.h:644
static const unsigned short RC_MESH_NULL_IDX
An value which indicates an invalid index within a mesh.
Definition: Recast.h:630
static const int RC_SPAN_HEIGHT_BITS
Defines the number of bits allocated to rcSpan::smin and rcSpan::smax.
Definition: Recast.h:284
rcLogCategory
Recast log categories.
Definition: Recast.h:31
@ RC_LOG_WARNING
A warning log entry.
Definition: Recast.h:33
@ RC_LOG_PROGRESS
A progress log entry.
Definition: Recast.h:32
@ RC_LOG_ERROR
An error log entry.
Definition: Recast.h:34
static const int RC_CONTOUR_REG_MASK
Applied to the region id field of contour vertices in order to extract the region id.
Definition: Recast.h:625
static const int RC_BORDER_VERTEX
Border vertex flag.
Definition: Recast.h:604
T rcSqr(T a)
Returns the square of the value.
Definition: Recast.h:674
void rcVcopy(float *dest, const float *v)
Performs a vector copy.
Definition: Recast.h:772
float rcVdistSqr(const float *v1, const float *v2)
Returns the square of the distance between two points.
Definition: Recast.h:795
T rcMin(T a, T b)
Returns the minimum of two values.
Definition: Recast.h:658
void rcVmin(float *mn, const float *v)
Selects the minimum value of each element from the specified vectors.
Definition: Recast.h:752
static const unsigned short RC_MULTIPLE_REGS
Polygon touches multiple regions.
Definition: Recast.h:595
void rcVadd(float *dest, const float *v1, const float *v2)
Performs a vector addition.
Definition: Recast.h:731
static const unsigned short RC_BORDER_REG
Heightfield border flag.
Definition: Recast.h:587
static const float RC_PI
The value of PI used by Recast.
Definition: Recast.h:23
T rcMax(T a, T b)
Returns the maximum of two values.
Definition: Recast.h:664
void rcVnormalize(float *v)
Normalizes the vector.
Definition: Recast.h:805
T rcClamp(T value, T minInclusive, T maxInclusive)
Clamps the value to the specified range.
Definition: Recast.h:681
T rcAbs(T a)
Returns the absolute value.
Definition: Recast.h:669
Provides an interface for optional logging and performance tracking of the Recast build process.
Definition: Recast.h:115
virtual ~rcContext()
Definition: Recast.h:120
void enableLog(bool state)
Enables or disables logging.
Definition: Recast.h:124
int getAccumulatedTime(const rcTimerLabel label) const
Returns the total accumulated time of the specified performance timer.
Definition: Recast.h:159
void resetTimers()
Clears all performance timers. (Resets all to unused.)
Definition: Recast.h:146
virtual void doStopTimer(const rcTimerLabel label)
Stops the specified performance timer.
Definition: Recast.h:180
void startTimer(const rcTimerLabel label)
Starts the specified performance timer.
Definition: Recast.h:150
void stopTimer(const rcTimerLabel label)
Stops the specified performance timer.
Definition: Recast.h:154
virtual void doResetTimers()
Clears all timers. (Resets all to unused.)
Definition: Recast.h:172
void resetLog()
Clears all log entries.
Definition: Recast.h:127
virtual void doLog(const rcLogCategory category, const char *msg, const int len)
Logs a message.
Definition: Recast.h:169
bool m_timerEnabled
True if the performance timers are enabled.
Definition: Recast.h:191
void enableTimer(bool state)
Enables or disables the performance timers.
Definition: Recast.h:143
virtual int doGetAccumulatedTime(const rcTimerLabel label) const
Returns the total accumulated time of the specified performance timer.
Definition: Recast.h:185
virtual void doResetLog()
Clears all log entries.
Definition: Recast.cpp:81
void log(const rcLogCategory category, const char *format,...)
Logs a message.
Definition: Recast.cpp:58
rcContext(bool state=true)
Constructor.
Definition: Recast.h:119
bool m_logEnabled
True if logging is enabled.
Definition: Recast.h:188
virtual void doStartTimer(const rcTimerLabel label)
Starts the specified performance timer.
Definition: Recast.h:176
A helper to first start a timer and then stop it when this helper goes out of scope.
Definition: Recast.h:197
~rcScopedTimer()
Definition: Recast.h:203
rcScopedTimer(rcContext *ctx, const rcTimerLabel label)
Constructs an instance and starts the timer.
Definition: Recast.h:202
void rcFilterLowHangingWalkableObstacles(rcContext *context, int walkableClimb, rcHeightfield &heightfield)
Marks non-walkable spans as walkable if their maximum is within walkableClimb of the span below them.
Definition: RecastFilter.cpp:29
void rcFilterWalkableLowHeightSpans(rcContext *context, int walkableHeight, rcHeightfield &heightfield)
Marks walkable spans as not walkable if the clearance above the span is less than the specified walka...
Definition: RecastFilter.cpp:176
void rcMarkConvexPolyArea(rcContext *context, const float *verts, int numVerts, float minY, float maxY, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
Applies the area id to the all spans within the specified convex polygon.
Definition: RecastArea.cpp:432
rcPolyMesh * rcAllocPolyMesh()
Allocates a polygon mesh object using the Recast allocator.
Definition: Recast.cpp:222
bool rcRasterizeTriangle(rcContext *context, const float *v0, const float *v1, const float *v2, unsigned char areaID, rcHeightfield &heightfield, int flagMergeThreshold=1)
Rasterizes a single triangle into the specified heightfield.
Definition: RecastRasterization.cpp:457
bool rcBuildDistanceField(rcContext *ctx, rcCompactHeightfield &chf)
Builds the distance field for the specified compact heightfield.
Definition: RecastRegion.cpp:1258
bool rcBuildPolyMeshDetail(rcContext *ctx, const rcPolyMesh &mesh, const rcCompactHeightfield &chf, float sampleDist, float sampleMaxError, rcPolyMeshDetail &dmesh)
Builds a detail mesh from the provided polygon mesh.
Definition: RecastMeshDetail.cpp:1182
rcContourSet * rcAllocContourSet()
Allocates a contour set object using the Recast allocator.
Definition: Recast.cpp:188
void rcMarkCylinderArea(rcContext *context, const float *position, float radius, float height, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
Applies the area id to all spans within the specified y-axis-aligned cylinder.
Definition: RecastArea.cpp:633
void rcFreePolyMesh(rcPolyMesh *polyMesh)
Frees the specified polygon mesh using the Recast allocator.
Definition: Recast.cpp:227
bool rcBuildCompactHeightfield(rcContext *context, int walkableHeight, int walkableClimb, const rcHeightfield &heightfield, rcCompactHeightfield &compactHeightfield)
Builds a compact heightfield representing open space, from a heightfield representing solid space.
Definition: Recast.cpp:403
rcHeightfield * rcAllocHeightfield()
Allocates a heightfield object using the Recast allocator.
Definition: Recast.cpp:86
void rcFreePolyMeshDetail(rcPolyMeshDetail *detailMesh)
Frees the specified detail mesh using the Recast allocator.
Definition: Recast.cpp:265
bool rcBuildLayerRegions(rcContext *ctx, rcCompactHeightfield &chf, int borderSize, int minRegionArea)
Builds region data for the heightfield by partitioning the heightfield in non-overlapping layers.
Definition: RecastRegion.cpp:1666
bool rcCreateHeightfield(rcContext *context, rcHeightfield &heightfield, int sizeX, int sizeZ, const float *minBounds, const float *maxBounds, float cellSize, float cellHeight)
Initializes a new heightfield.
Definition: Recast.cpp:306
rcPolyMeshDetail * rcAllocPolyMeshDetail()
Allocates a detail mesh object using the Recast allocator.
Definition: Recast.cpp:260
void rcFreeHeightField(rcHeightfield *heightfield)
Frees the specified heightfield object using the Recast allocator.
Definition: Recast.cpp:91
void rcMarkWalkableTriangles(rcContext *context, float walkableSlopeAngle, const float *verts, int numVerts, const int *tris, int numTris, unsigned char *triAreaIDs)
Sets the area id of all triangles with a slope below the specified value to RC_WALKABLE_AREA.
Definition: Recast.cpp:336
rcCompactHeightfield * rcAllocCompactHeightfield()
Allocates a compact heightfield object using the Recast allocator.
Definition: Recast.cpp:122
void rcFreeHeightfieldLayerSet(rcHeightfieldLayerSet *layerSet)
Frees the specified heightfield layer set using the Recast allocator.
Definition: Recast.cpp:165
bool rcBuildHeightfieldLayers(rcContext *ctx, const rcCompactHeightfield &chf, int borderSize, int walkableHeight, rcHeightfieldLayerSet &lset)
Builds a layer set from the specified compact heightfield.
Definition: RecastLayers.cpp:104
bool rcMergePolyMeshDetails(rcContext *ctx, rcPolyMeshDetail **meshes, const int nmeshes, rcPolyMeshDetail &mesh)
Merges multiple detail meshes into a single detail mesh.
Definition: RecastMeshDetail.cpp:1401
int rcGetDirOffsetY(int direction)
Gets the standard height (z-axis) offset for the specified direction.
Definition: Recast.h:1263
int rcGetDirOffsetX(int direction)
Gets the standard width (x-axis) offset for the specified direction.
Definition: Recast.h:1253
bool rcMedianFilterWalkableArea(rcContext *context, rcCompactHeightfield &compactHeightfield)
Applies a median filter to walkable area types (based on area id), removing noise.
Definition: RecastArea.cpp:289
bool rcBuildPolyMesh(rcContext *ctx, const rcContourSet &cset, const int nvp, rcPolyMesh &mesh)
Builds a polygon mesh from the provided contours.
Definition: RecastMesh.cpp:990
bool rcAddSpan(rcContext *context, rcHeightfield &heightfield, int x, int z, unsigned short spanMin, unsigned short spanMax, unsigned char areaID, int flagMergeThreshold)
Adds a span to the specified heightfield.
Definition: RecastRasterization.cpp:191
void rcCalcGridSize(const float *minBounds, const float *maxBounds, float cellSize, int *sizeX, int *sizeZ)
Calculates the grid size based on the bounding box and grid cell size.
Definition: Recast.cpp:300
void rcSetCon(rcCompactSpan &span, int direction, int neighborIndex)
Sets the neighbor connection data for the specified direction.
Definition: Recast.h:1233
void rcCalcBounds(const float *verts, int numVerts, float *minBounds, float *maxBounds)
Calculates the bounding box of an array of vertices.
Definition: Recast.cpp:287
void rcFreeCompactHeightfield(rcCompactHeightfield *compactHeightfield)
Frees the specified compact heightfield object using the Recast allocator.
Definition: Recast.cpp:127
bool rcMergePolyMeshes(rcContext *ctx, rcPolyMesh **meshes, const int nmeshes, rcPolyMesh &mesh)
Merges multiple polygon meshes into a single mesh.
Definition: RecastMesh.cpp:1309
void rcMarkBoxArea(rcContext *context, const float *boxMinBounds, const float *boxMaxBounds, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
Applies an area id to all spans within the specified bounding box.
Definition: RecastArea.cpp:371
int rcGetHeightFieldSpanCount(rcContext *context, const rcHeightfield &heightfield)
Returns the number of spans contained in the specified heightfield.
Definition: Recast.cpp:384
bool rcBuildRegionsMonotone(rcContext *ctx, rcCompactHeightfield &chf, int borderSize, int minRegionArea, int mergeRegionArea)
Builds region data for the heightfield using simple monotone partitioning.
Definition: RecastRegion.cpp:1357
void rcClearUnwalkableTriangles(rcContext *context, float walkableSlopeAngle, const float *verts, int numVerts, const int *tris, int numTris, unsigned char *triAreaIDs)
Sets the area id of all triangles with a slope greater than or equal to the specified value to RC_NUL...
Definition: Recast.cpp:360
int rcGetCon(const rcCompactSpan &span, int direction)
Gets neighbor connection data for the specified direction.
Definition: Recast.h:1244
void rcFilterLedgeSpans(rcContext *context, int walkableHeight, int walkableClimb, rcHeightfield &heightfield)
Marks spans that are ledges as not-walkable.
Definition: RecastFilter.cpp:67
bool rcRasterizeTriangles(rcContext *context, const float *verts, int numVerts, const int *tris, const unsigned char *triAreaIDs, int numTris, rcHeightfield &heightfield, int flagMergeThreshold=1)
Rasterizes an indexed triangle mesh into the specified heightfield.
Definition: RecastRasterization.cpp:477
rcHeightfieldLayerSet * rcAllocHeightfieldLayerSet()
Allocates a heightfield layer set using the Recast allocator.
Definition: Recast.cpp:160
bool rcCopyPolyMesh(rcContext *ctx, const rcPolyMesh &src, rcPolyMesh &dst)
Copies the poly mesh data from src to dst.
Definition: RecastMesh.cpp:1487
bool rcBuildContours(rcContext *ctx, const rcCompactHeightfield &chf, float maxError, int maxEdgeLen, rcContourSet &cset, int buildFlags=RC_CONTOUR_TESS_WALL_EDGES)
Builds a contour set from the region outlines in the provided compact heightfield.
Definition: RecastContour.cpp:823
void rcFreeContourSet(rcContourSet *contourSet)
Frees the specified contour set using the Recast allocator.
Definition: Recast.cpp:193
bool rcErodeWalkableArea(rcContext *context, int erosionRadius, rcCompactHeightfield &compactHeightfield)
Erodes the walkable area within the heightfield by the specified radius.
Definition: RecastArea.cpp:75
int rcGetDirForOffset(int offsetX, int offsetZ)
Gets the direction for the specified offset.
Definition: Recast.h:1273
bool rcBuildRegions(rcContext *ctx, rcCompactHeightfield &chf, int borderSize, int minRegionArea, int mergeRegionArea)
Builds region data for the heightfield using watershed partitioning.
Definition: RecastRegion.cpp:1530
int rcOffsetPoly(const float *verts, int numVerts, float offset, float *outVerts, int maxOutVerts)
Expands a convex polygon along its vertex normals by the given offset amount.
Definition: RecastArea.cpp:532
Provides information on the content of a cell column in a compact heightfield.
Definition: Recast.h:337
unsigned int count
Number of spans in the column.
Definition: Recast.h:339
unsigned int index
Index to the first span in the column.
Definition: Recast.h:338
A compact, static heightfield representing unobstructed space.
Definition: Recast.h:354
int walkableHeight
The walkable height used during the build of the field. (See: rcConfig::walkableHeight)
Definition: Recast.h:361
rcCompactSpan * spans
Array of spans. [Size: spanCount].
Definition: Recast.h:371
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:359
rcCompactHeightfield()
Definition: Recast.cpp:132
unsigned short maxDistance
The maximum distance value of any span within the field.
Definition: Recast.h:364
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:369
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:367
int borderSize
The AABB border size used during the build of the field. (See: rcConfig::borderSize)
Definition: Recast.h:363
unsigned short maxRegions
The maximum region id of any span within the field.
Definition: Recast.h:365
int spanCount
The number of spans in the heightfield.
Definition: Recast.h:360
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:368
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:358
rcCompactCell * cells
Array of cells. [Size: width*height].
Definition: Recast.h:370
unsigned char * areas
Array containing area id data. [Size: spanCount].
Definition: Recast.h:373
int walkableClimb
The walkable climb used during the build of the field. (See: rcConfig::walkableClimb)
Definition: Recast.h:362
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:366
~rcCompactHeightfield()
Definition: Recast.cpp:152
unsigned short * dist
Array containing border distance data. [Size: spanCount].
Definition: Recast.h:372
Represents a span of unobstructed space within a compact heightfield.
Definition: Recast.h:344
unsigned short y
The lower extent of the span. (Measured from the heightfield's base.)
Definition: Recast.h:345
unsigned int h
The height of the span. (Measured from y.)
Definition: Recast.h:348
unsigned int con
Packed neighbor connection data.
Definition: Recast.h:347
unsigned short reg
The id of the region the span belongs to. (Or zero if not in a region.)
Definition: Recast.h:346
Specifies a configuration to use when performing Recast builds.
Definition: Recast.h:217
int maxVertsPerPoly
The maximum number of vertices allowed for polygons generated during the contour to polygon conversio...
Definition: Recast.h:272
int maxEdgeLen
The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx].
Definition: Recast.h:257
int walkableHeight
Minimum floor to 'ceiling' height that will still allow the floor area to be considered walkable.
Definition: Recast.h:247
int height
The height of the field along the z-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:222
float maxSimplificationError
The maximum distance a simplified contour's border edges should deviate the original raw contour.
Definition: Recast.h:261
int borderSize
The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx].
Definition: Recast.h:228
int walkableRadius
The distance to erode/shrink the walkable area of the heightfield away from obstructions.
Definition: Recast.h:254
float walkableSlopeAngle
The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees].
Definition: Recast.h:243
int walkableClimb
Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx].
Definition: Recast.h:250
int width
The width of the field along the x-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:219
float bmax[3]
The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:240
float detailSampleDist
Sets the sampling distance to use when generating the detail mesh.
Definition: Recast.h:276
int tileSize
The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx].
Definition: Recast.h:225
int mergeRegionArea
Any regions with a span count smaller than this value will, if possible, be merged with larger region...
Definition: Recast.h:268
float ch
The y-axis cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:234
float detailSampleMaxError
The maximum distance the detail mesh surface should deviate from heightfield data.
Definition: Recast.h:280
float cs
The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:231
int minRegionArea
The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx].
Definition: Recast.h:264
float bmin[3]
The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:237
Represents a group of related contours.
Definition: Recast.h:433
rcContourSet()
Definition: Recast.cpp:198
int height
The height of the set. (Along the z-axis in cell units.)
Definition: Recast.h:444
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:441
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:439
int nconts
The number of contours in the set.
Definition: Recast.h:438
~rcContourSet()
Definition: Recast.cpp:212
rcContour * conts
An array of the contours in the set. [Size: nconts].
Definition: Recast.h:437
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:442
int borderSize
The AABB border size used to generate the source data from which the contours were derived.
Definition: Recast.h:445
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:440
int width
The width of the set. (Along the x-axis in cell units.)
Definition: Recast.h:443
float maxError
The max edge error that this contour set was simplified with.
Definition: Recast.h:446
Represents a simple, non-overlapping contour in field space.
Definition: Recast.h:421
int nrverts
The number of vertices in the raw contour.
Definition: Recast.h:425
unsigned char area
The area id of the contour.
Definition: Recast.h:427
int * rverts
Raw contour vertex and connection data. [Size: 4 * nrverts].
Definition: Recast.h:424
int * verts
Simplified contour vertex and connection data. [Size: 4 * nverts].
Definition: Recast.h:422
unsigned short reg
The region id of the contour.
Definition: Recast.h:426
int nverts
The number of vertices in the simplified contour.
Definition: Recast.h:423
Represents a set of heightfield layers.
Definition: Recast.h:406
rcHeightfieldLayerSet()
Definition: Recast.cpp:170
rcHeightfieldLayer * layers
The layers in the set. [Size: nlayers].
Definition: Recast.h:410
~rcHeightfieldLayerSet()
Definition: Recast.cpp:176
int nlayers
The number of layers in the set.
Definition: Recast.h:411
Represents a heightfield layer within a layer set.
Definition: Recast.h:384
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:386
unsigned char * cons
Packed neighbor connection information. [Size: Same as heights].
Definition: Recast.h:399
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:388
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:390
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:389
int hmin
The minimum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:395
unsigned char * areas
Area ids. [Size: Same as heights].
Definition: Recast.h:398
int hmax
The maximum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:396
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:385
int maxx
The maximum x-bounds of usable data.
Definition: Recast.h:392
unsigned char * heights
The heightfield. [Size: width * height].
Definition: Recast.h:397
int maxy
The maximum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:394
int minx
The minimum x-bounds of usable data.
Definition: Recast.h:391
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:387
int miny
The minimum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:393
A dynamic heightfield representing obstructed space.
Definition: Recast.h:313
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:319
rcSpan * freelist
The next free span.
Definition: Recast.h:327
rcSpan ** spans
Heightfield of spans (width*height).
Definition: Recast.h:323
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:322
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:321
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:320
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:318
rcSpanPool * pools
Linked list of span pools.
Definition: Recast.h:326
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:317
~rcHeightfield()
Definition: Recast.cpp:109
rcHeightfield()
Definition: Recast.cpp:96
Contains triangle meshes that represent detailed height data associated with the polygons in its asso...
Definition: Recast.h:487
unsigned char * tris
The mesh triangles. [Size: 4*ntris].
Definition: Recast.h:492
float * verts
The mesh vertices. [Size: 3*nverts].
Definition: Recast.h:491
unsigned int * meshes
The sub-mesh data. [Size: 4*nmeshes].
Definition: Recast.h:490
int nverts
The number of vertices in verts.
Definition: Recast.h:494
int ntris
The number of triangles in tris.
Definition: Recast.h:495
rcPolyMeshDetail()
Definition: Recast.cpp:277
int nmeshes
The number of sub-meshes defined by meshes.
Definition: Recast.h:493
Represents a polygon mesh suitable for use in building a navigation mesh.
Definition: Recast.h:457
rcPolyMesh()
Definition: Recast.cpp:232
~rcPolyMesh()
Definition: Recast.cpp:251
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:472
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:470
unsigned short * polys
Polygon and neighbor data. [Length: maxpolys * 2 * nvp].
Definition: Recast.h:462
unsigned short * regs
The region id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:463
int borderSize
The AABB border size used to generate the source data from which the mesh was derived.
Definition: Recast.h:474
unsigned char * areas
The area id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:465
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:473
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:471
int nvp
The maximum number of vertices per polygon.
Definition: Recast.h:469
float maxEdgeError
The max error of the polygon edges in the mesh.
Definition: Recast.h:475
unsigned short * flags
The user defined flags for each polygon. [Length: maxpolys].
Definition: Recast.h:464
int npolys
The number of polygons.
Definition: Recast.h:467
unsigned short * verts
The mesh vertices. [Form: (x, y, z) * nverts].
Definition: Recast.h:461
int nverts
The number of vertices.
Definition: Recast.h:466
int maxpolys
The number of allocated polygons.
Definition: Recast.h:468
A memory pool used for quick allocation of spans within a heightfield.
Definition: Recast.h:305
rcSpan items[RC_SPANS_PER_POOL]
Array of spans in the pool.
Definition: Recast.h:307
rcSpanPool * next
The next span pool.
Definition: Recast.h:306
Represents a span in a heightfield.
Definition: Recast.h:295
rcSpan * next
The next span higher up in column.
Definition: Recast.h:299
unsigned int smax
The upper limit of the span. [Limit: <= RC_SPAN_MAX_HEIGHT].
Definition: Recast.h:297
unsigned int area
The area id assigned to the span.
Definition: Recast.h:298
unsigned int smin
The lower limit of the span. [Limit: < smax].
Definition: Recast.h:296