Recast Navigation
Navigation-mesh Toolset for Games
Recast.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 // Permission is granted to anyone to use this software for any purpose,
8 // including commercial applications, and to alter it and redistribute it
9 // freely, subject to the following restrictions:
10 // 1. The origin of this software must not be misrepresented; you must not
11 // claim that you wrote the original software. If you use this software
12 // in a product, an acknowledgment in the product documentation would be
13 // appreciated but is not required.
14 // 2. Altered source versions must be plainly marked as such, and must not be
15 // misrepresented as being the original software.
16 // 3. This notice may not be removed or altered from any source distribution.
17 //
18 
19 #ifndef RECAST_H
20 #define RECAST_H
21 
23 static const float RC_PI = 3.14159265f;
24 
26 template<class T> void rcIgnoreUnused(const T&) { }
27 
31 {
35 };
36 
40 {
99 };
100 
115 {
116 public:
119  inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
120  virtual ~rcContext() {}
121 
124  inline void enableLog(bool state) { m_logEnabled = state; }
125 
127  inline void resetLog() { if (m_logEnabled) doResetLog(); }
128 
139  void log(const rcLogCategory category, const char* format, ...);
140 
143  inline void enableTimer(bool state) { m_timerEnabled = state; }
144 
146  inline void resetTimers() { if (m_timerEnabled) doResetTimers(); }
147 
150  inline void startTimer(const rcTimerLabel label) { if (m_timerEnabled) doStartTimer(label); }
151 
154  inline void stopTimer(const rcTimerLabel label) { if (m_timerEnabled) doStopTimer(label); }
155 
159  inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
160 
161 protected:
163  virtual void doResetLog();
164 
169  virtual void doLog(const rcLogCategory category, const char* msg, const int len) { rcIgnoreUnused(category); rcIgnoreUnused(msg); rcIgnoreUnused(len); }
170 
172  virtual void doResetTimers() {}
173 
176  virtual void doStartTimer(const rcTimerLabel label) { rcIgnoreUnused(label); }
177 
180  virtual void doStopTimer(const rcTimerLabel label) { rcIgnoreUnused(label); }
181 
185  virtual int doGetAccumulatedTime(const rcTimerLabel label) const { rcIgnoreUnused(label); return -1; }
186 
189 
192 };
193 
197 {
198 public:
202  inline rcScopedTimer(rcContext* ctx, const rcTimerLabel label) : m_ctx(ctx), m_label(label) { m_ctx->startTimer(m_label); }
203  inline ~rcScopedTimer() { m_ctx->stopTimer(m_label); }
204 
205 private:
206  // Explicitly disabled copy constructor and copy assignment operator.
208  rcScopedTimer& operator=(const rcScopedTimer&);
209 
210  rcContext* const m_ctx;
211  const rcTimerLabel m_label;
212 };
213 
216 struct rcConfig
217 {
219  int width;
220 
222  int height;
223 
225  int tileSize;
226 
229 
231  float cs;
232 
234  float ch;
235 
237  float bmin[3];
238 
240  float bmax[3];
241 
244 
248 
251 
255 
258 
262 
265 
269 
273 
277 
281 };
282 
284 static const int RC_SPAN_HEIGHT_BITS = 13;
286 static const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1;
287 
290 static const int RC_SPANS_PER_POOL = 2048;
291 
294 struct rcSpan
295 {
296  unsigned int smin : RC_SPAN_HEIGHT_BITS;
297  unsigned int smax : RC_SPAN_HEIGHT_BITS;
298  unsigned int area : 6;
300 };
301 
305 {
308 };
309 
313 {
314  rcHeightfield();
315  ~rcHeightfield();
316 
317  int width;
318  int height;
319  float bmin[3];
320  float bmax[3];
321  float cs;
322  float ch;
326 
327 private:
328  // Explicitly-disabled copy constructor and copy assignment operator.
330  rcHeightfield& operator=(const rcHeightfield&);
331 };
332 
335 {
336  unsigned int index : 24;
337  unsigned int count : 8;
338 };
339 
342 {
343  unsigned short y;
344  unsigned short reg;
345  unsigned int con : 24;
346  unsigned int h : 8;
347 };
348 
352 {
355 
356  int width;
357  int height;
358  int spanCount;
362  unsigned short maxDistance;
363  unsigned short maxRegions;
364  float bmin[3];
365  float bmax[3];
366  float cs;
367  float ch;
370  unsigned short* dist;
371  unsigned char* areas;
372 
373 private:
374  // Explicitly-disabled copy constructor and copy assignment operator.
376  rcCompactHeightfield& operator=(const rcCompactHeightfield&);
377 };
378 
382 {
383  float bmin[3];
384  float bmax[3];
385  float cs;
386  float ch;
387  int width;
388  int height;
389  int minx;
390  int maxx;
391  int miny;
392  int maxy;
393  int hmin;
394  int hmax;
395  unsigned char* heights;
396  unsigned char* areas;
397  unsigned char* cons;
398 };
399 
404 {
407 
409  int nlayers;
410 
411 private:
412  // Explicitly-disabled copy constructor and copy assignment operator.
414  rcHeightfieldLayerSet& operator=(const rcHeightfieldLayerSet&);
415 };
416 
418 struct rcContour
419 {
420  int* verts;
421  int nverts;
422  int* rverts;
423  int nrverts;
424  unsigned short reg;
425  unsigned char area;
426 };
427 
431 {
432  rcContourSet();
433  ~rcContourSet();
434 
436  int nconts;
437  float bmin[3];
438  float bmax[3];
439  float cs;
440  float ch;
441  int width;
442  int height;
444  float maxError;
445 
446 private:
447  // Explicitly-disabled copy constructor and copy assignment operator.
448  rcContourSet(const rcContourSet&);
449  rcContourSet& operator=(const rcContourSet&);
450 };
451 
455 {
456  rcPolyMesh();
457  ~rcPolyMesh();
458 
459  unsigned short* verts;
460  unsigned short* polys;
461  unsigned short* regs;
462  unsigned short* flags;
463  unsigned char* areas;
464  int nverts;
465  int npolys;
466  int maxpolys;
467  int nvp;
468  float bmin[3];
469  float bmax[3];
470  float cs;
471  float ch;
473  float maxEdgeError;
474 
475 private:
476  // Explicitly-disabled copy constructor and copy assignment operator.
477  rcPolyMesh(const rcPolyMesh&);
478  rcPolyMesh& operator=(const rcPolyMesh&);
479 };
480 
485 {
487 
488  unsigned int* meshes;
489  float* verts;
490  unsigned char* tris;
491  int nmeshes;
492  int nverts;
493  int ntris;
494 
495 private:
496  // Explicitly-disabled copy constructor and copy assignment operator.
498  rcPolyMeshDetail& operator=(const rcPolyMeshDetail&);
499 };
500 
505 
511 
516 void rcFreeHeightField(rcHeightfield* heightfield);
517 
523 
528 void rcFreeCompactHeightfield(rcCompactHeightfield* compactHeightfield);
529 
535 
541 
547 
552 void rcFreeContourSet(rcContourSet* contourSet);
553 
559 
564 void rcFreePolyMesh(rcPolyMesh* polyMesh);
565 
571 
576 void rcFreePolyMeshDetail(rcPolyMeshDetail* detailMesh);
577 
579 
585 static const unsigned short RC_BORDER_REG = 0x8000;
586 
593 static const unsigned short RC_MULTIPLE_REGS = 0;
594 
602 static const int RC_BORDER_VERTEX = 0x10000;
603 
609 static const int RC_AREA_BORDER = 0x20000;
610 
614 {
617 };
618 
623 static const int RC_CONTOUR_REG_MASK = 0xffff;
624 
628 static const unsigned short RC_MESH_NULL_IDX = 0xffff;
629 
633 static const unsigned char RC_NULL_AREA = 0;
634 
638 static const unsigned char RC_WALKABLE_AREA = 63;
639 
642 static const int RC_NOT_CONNECTED = 0x3f;
643 
646 
650 template<class T> inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
651 
656 template<class T> inline T rcMin(T a, T b) { return a < b ? a : b; }
657 
662 template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
663 
667 template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
668 
672 template<class T> inline T rcSqr(T a) { return a*a; }
673 
679 template<class T> inline T rcClamp(T value, T minInclusive, T maxInclusive)
680 {
681  return value < minInclusive ? minInclusive: (value > maxInclusive ? maxInclusive : value);
682 }
683 
687 float rcSqrt(float x);
688 
692 
697 inline void rcVcross(float* dest, const float* v1, const float* v2)
698 {
699  dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
700  dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
701  dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
702 }
703 
708 inline float rcVdot(const float* v1, const float* v2)
709 {
710  return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
711 }
712 
718 inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
719 {
720  dest[0] = v1[0]+v2[0]*s;
721  dest[1] = v1[1]+v2[1]*s;
722  dest[2] = v1[2]+v2[2]*s;
723 }
724 
729 inline void rcVadd(float* dest, const float* v1, const float* v2)
730 {
731  dest[0] = v1[0]+v2[0];
732  dest[1] = v1[1]+v2[1];
733  dest[2] = v1[2]+v2[2];
734 }
735 
740 inline void rcVsub(float* dest, const float* v1, const float* v2)
741 {
742  dest[0] = v1[0]-v2[0];
743  dest[1] = v1[1]-v2[1];
744  dest[2] = v1[2]-v2[2];
745 }
746 
750 inline void rcVmin(float* mn, const float* v)
751 {
752  mn[0] = rcMin(mn[0], v[0]);
753  mn[1] = rcMin(mn[1], v[1]);
754  mn[2] = rcMin(mn[2], v[2]);
755 }
756 
760 inline void rcVmax(float* mx, const float* v)
761 {
762  mx[0] = rcMax(mx[0], v[0]);
763  mx[1] = rcMax(mx[1], v[1]);
764  mx[2] = rcMax(mx[2], v[2]);
765 }
766 
770 inline void rcVcopy(float* dest, const float* v)
771 {
772  dest[0] = v[0];
773  dest[1] = v[1];
774  dest[2] = v[2];
775 }
776 
781 inline float rcVdist(const float* v1, const float* v2)
782 {
783  float dx = v2[0] - v1[0];
784  float dy = v2[1] - v1[1];
785  float dz = v2[2] - v1[2];
786  return rcSqrt(dx*dx + dy*dy + dz*dz);
787 }
788 
793 inline float rcVdistSqr(const float* v1, const float* v2)
794 {
795  float dx = v2[0] - v1[0];
796  float dy = v2[1] - v1[1];
797  float dz = v2[2] - v1[2];
798  return dx*dx + dy*dy + dz*dz;
799 }
800 
803 inline void rcVnormalize(float* v)
804 {
805  float d = 1.0f / rcSqrt(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
806  v[0] *= d;
807  v[1] *= d;
808  v[2] *= d;
809 }
810 
815 
822 void rcCalcBounds(const float* verts, int numVerts, float* minBounds, float* maxBounds);
823 
831 void rcCalcGridSize(const float* minBounds, const float* maxBounds, float cellSize, int* sizeX, int* sizeZ);
832 
848 bool rcCreateHeightfield(rcContext* context, rcHeightfield& heightfield, int sizeX, int sizeZ,
849  const float* minBounds, const float* maxBounds,
850  float cellSize, float cellHeight);
851 
871 void rcMarkWalkableTriangles(rcContext* context, float walkableSlopeAngle, const float* verts, int numVerts,
872  const int* tris, int numTris, unsigned char* triAreaIDs);
873 
892 void rcClearUnwalkableTriangles(rcContext* context, float walkableSlopeAngle, const float* verts, int numVerts,
893  const int* tris, int numTris, unsigned char* triAreaIDs);
894 
913 bool rcAddSpan(rcContext* context, rcHeightfield& heightfield,
914  int x, int z,
915  unsigned short spanMin, unsigned short spanMax,
916  unsigned char areaID, int flagMergeThreshold);
917 
935 bool rcRasterizeTriangle(rcContext* context,
936  const float* v0, const float* v1, const float* v2,
937  unsigned char areaID, rcHeightfield& heightfield, int flagMergeThreshold = 1);
938 
955 bool rcRasterizeTriangles(rcContext* context,
956  const float* verts, int numVerts,
957  const int* tris, const unsigned char* triAreaIDs, int numTris,
958  rcHeightfield& heightfield, int flagMergeThreshold = 1);
959 
976 bool rcRasterizeTriangles(rcContext* context,
977  const float* verts, int numVerts,
978  const unsigned short* tris, const unsigned char* triAreaIDs, int numTris,
979  rcHeightfield& heightfield, int flagMergeThreshold = 1);
980 
997 bool rcRasterizeTriangles(rcContext* context,
998  const float* verts, const unsigned char* triAreaIDs, int numTris,
999  rcHeightfield& heightfield, int flagMergeThreshold = 1);
1000 
1018 void rcFilterLowHangingWalkableObstacles(rcContext* context, int walkableClimb, rcHeightfield& heightfield);
1019 
1038 void rcFilterLedgeSpans(rcContext* context, int walkableHeight, int walkableClimb, rcHeightfield& heightfield);
1039 
1052 void rcFilterWalkableLowHeightSpans(rcContext* context, int walkableHeight, rcHeightfield& heightfield);
1053 
1059 int rcGetHeightFieldSpanCount(rcContext* context, const rcHeightfield& heightfield);
1060 
1065 
1085 bool rcBuildCompactHeightfield(rcContext* context, int walkableHeight, int walkableClimb,
1086  rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield);
1087 
1094 bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf);
1095 
1102 
1110 void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
1111  rcCompactHeightfield& chf);
1112 
1122 void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
1123  const float hmin, const float hmax, unsigned char areaId,
1124  rcCompactHeightfield& chf);
1125 
1134 int rcOffsetPoly(const float* verts, const int nverts, const float offset,
1135  float* outVerts, const int maxOutVerts);
1136 
1145 void rcMarkCylinderArea(rcContext* ctx, const float* pos,
1146  const float r, const float h, unsigned char areaId,
1147  rcCompactHeightfield& chf);
1148 
1155 
1167 bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, int borderSize, int minRegionArea, int mergeRegionArea);
1168 
1178 bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, int borderSize, int minRegionArea);
1179 
1192  int borderSize, int minRegionArea, int mergeRegionArea);
1193 
1198 inline void rcSetCon(rcCompactSpan& span, int direction, int neighborIndex)
1199 {
1200  const unsigned int shift = (unsigned int)direction * 6;
1201  const unsigned int con = span.con;
1202  span.con = (con & ~(0x3f << shift)) | (((unsigned int)neighborIndex & 0x3f) << shift);
1203 }
1204 
1209 inline int rcGetCon(const rcCompactSpan& span, int direction)
1210 {
1211  const unsigned int shift = (unsigned int)direction * 6;
1212  return (span.con >> shift) & 0x3f;
1213 }
1214 
1218 inline int rcGetDirOffsetX(int direction)
1219 {
1220  static const int offset[4] = { -1, 0, 1, 0, };
1221  return offset[direction & 0x03];
1222 }
1223 
1224 // TODO (graham): Rename this to rcGetDirOffsetZ
1228 inline int rcGetDirOffsetY(int direction)
1229 {
1230  static const int offset[4] = { 0, 1, 0, -1 };
1231  return offset[direction & 0x03];
1232 }
1233 
1238 inline int rcGetDirForOffset(int offsetX, int offsetZ)
1239 {
1240  static const int dirs[5] = { 3, 0, -1, 2, 1 };
1241  return dirs[((offsetZ + 1) << 1) + offsetX];
1242 }
1243 
1248 
1260  int borderSize, int walkableHeight,
1261  rcHeightfieldLayerSet& lset);
1262 
1275  float maxError, int maxEdgeLen,
1276  rcContourSet& cset, int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
1277 
1286 bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
1287 
1295 bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh);
1296 
1307 bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompactHeightfield& chf,
1308  float sampleDist, float sampleMaxError,
1309  rcPolyMeshDetail& dmesh);
1310 
1317 bool rcCopyPolyMesh(rcContext* ctx, const rcPolyMesh& src, rcPolyMesh& dst);
1318 
1326 bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int nmeshes, rcPolyMeshDetail& mesh);
1327 
1329 
1330 #endif // RECAST_H
1331 
1333 
1334 // Due to the large amount of detail documentation for this file,
1335 // the content normally located at the end of the header file has been separated
1336 // out to a file in /Docs/Extern.
float rcVdot(const float *v1, const float *v2)
Derives the dot product of two vectors.
Definition: Recast.h:708
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:781
void rcVmad(float *dest, const float *v1, const float *v2, const float s)
Performs a scaled vector addition.
Definition: Recast.h:718
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:650
void rcVcross(float *dest, const float *v1, const float *v2)
Derives the cross product of two vectors.
Definition: Recast.h:697
void rcVmax(float *mx, const float *v)
Selects the maximum value of each element from the specified vectors.
Definition: Recast.h:760
static const unsigned char RC_NULL_AREA
Represents the null area.
Definition: Recast.h:633
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:609
static const unsigned char RC_WALKABLE_AREA
The default area id used to indicate a walkable polygon.
Definition: Recast.h:638
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:740
rcBuildContoursFlags
Contour build flags.
Definition: Recast.h:614
@ RC_CONTOUR_TESS_WALL_EDGES
Tessellate solid (impassable) edges during contour simplification.
Definition: Recast.h:615
@ RC_CONTOUR_TESS_AREA_EDGES
Tessellate edges between areas during contour simplification.
Definition: Recast.h:616
static const int RC_NOT_CONNECTED
The value returned by rcGetCon if the specified direction is not connected to another span.
Definition: Recast.h:642
static const unsigned short RC_MESH_NULL_IDX
An value which indicates an invalid index within a mesh.
Definition: Recast.h:628
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:623
static const int RC_BORDER_VERTEX
Border vertex flag.
Definition: Recast.h:602
T rcSqr(T a)
Returns the square of the value.
Definition: Recast.h:672
void rcVcopy(float *dest, const float *v)
Performs a vector copy.
Definition: Recast.h:770
float rcVdistSqr(const float *v1, const float *v2)
Returns the square of the distance between two points.
Definition: Recast.h:793
T rcMin(T a, T b)
Returns the minimum of two values.
Definition: Recast.h:656
void rcVmin(float *mn, const float *v)
Selects the minimum value of each element from the specified vectors.
Definition: Recast.h:750
static const unsigned short RC_MULTIPLE_REGS
Polygon touches multiple regions.
Definition: Recast.h:593
void rcVadd(float *dest, const float *v1, const float *v2)
Performs a vector addition.
Definition: Recast.h:729
static const unsigned short RC_BORDER_REG
Heightfield border flag.
Definition: Recast.h:585
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:662
void rcVnormalize(float *v)
Normalizes the vector.
Definition: Recast.h:803
T rcClamp(T value, T minInclusive, T maxInclusive)
Clamps the value to the specified range.
Definition: Recast.h:679
T rcAbs(T a)
Returns the absolute value.
Definition: Recast.h:667
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 a walkable neighbor.
Definition: RecastFilter.cpp:24
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 heigh...
Definition: RecastFilter.cpp:157
rcPolyMesh * rcAllocPolyMesh()
Allocates a polygon mesh object using the Recast allocator.
Definition: Recast.cpp:222
void rcMarkConvexPolyArea(rcContext *ctx, const float *verts, const int nverts, const float hmin, const float hmax, unsigned char areaId, rcCompactHeightfield &chf)
Applies the area id to the all spans within the specified convex polygon.
Definition: RecastArea.cpp:380
bool rcBuildHeightfieldLayers(rcContext *ctx, rcCompactHeightfield &chf, int borderSize, int walkableHeight, rcHeightfieldLayerSet &lset)
Builds a layer set from the specified compact heightfield.
Definition: RecastLayers.cpp:91
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:458
bool rcBuildDistanceField(rcContext *ctx, rcCompactHeightfield &chf)
Builds the distance field for the specified compact heightfield.
Definition: RecastRegion.cpp:1253
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:1170
rcContourSet * rcAllocContourSet()
Allocates a contour set object using the Recast allocator.
Definition: Recast.cpp:188
void rcFreePolyMesh(rcPolyMesh *polyMesh)
Frees the specified polygon mesh using the Recast allocator.
Definition: Recast.cpp:227
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:1661
bool rcErodeWalkableArea(rcContext *ctx, int radius, rcCompactHeightfield &chf)
Erodes the walkable area within the heightfield by the specified radius.
Definition: RecastArea.cpp:36
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
void rcMarkBoxArea(rcContext *ctx, const float *bmin, const float *bmax, unsigned char areaId, rcCompactHeightfield &chf)
Applies an area id to all spans within the specified bounding box.
Definition: RecastArea.cpp:315
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 rcBuildPolyMesh(rcContext *ctx, rcContourSet &cset, const int nvp, rcPolyMesh &mesh)
Builds a polygon mesh from the provided contours.
Definition: RecastMesh.cpp:989
bool rcMergePolyMeshDetails(rcContext *ctx, rcPolyMeshDetail **meshes, const int nmeshes, rcPolyMeshDetail &mesh)
Merges multiple detail meshes into a single detail mesh.
Definition: RecastMeshDetail.cpp:1389
bool rcMedianFilterWalkableArea(rcContext *ctx, rcCompactHeightfield &chf)
Applies a median filter to walkable area types (based on area id), removing noise.
Definition: RecastArea.cpp:238
int rcGetDirOffsetY(int direction)
Gets the standard height (z-axis) offset for the specified direction.
Definition: Recast.h:1228
int rcGetDirOffsetX(int direction)
Gets the standard width (x-axis) offset for the specified direction.
Definition: Recast.h:1218
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:192
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:1198
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 rcBuildContours(rcContext *ctx, 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
bool rcMergePolyMeshes(rcContext *ctx, rcPolyMesh **meshes, const int nmeshes, rcPolyMesh &mesh)
Merges multiple polygon meshes into a single mesh.
Definition: RecastMesh.cpp:1308
int rcGetHeightFieldSpanCount(rcContext *context, const rcHeightfield &heightfield)
Returns the number of spans contained in the specified heightfield.
Definition: Recast.cpp:384
void rcMarkCylinderArea(rcContext *ctx, const float *pos, const float r, const float h, unsigned char areaId, rcCompactHeightfield &chf)
Applies the area id to all spans within the specified cylinder.
Definition: RecastArea.cpp:528
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:1352
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:1209
void rcFilterLedgeSpans(rcContext *context, int walkableHeight, int walkableClimb, rcHeightfield &heightfield)
Marks spans that are ledges as not-walkable.
Definition: RecastFilter.cpp:62
int rcOffsetPoly(const float *verts, const int nverts, const float offset, float *outVerts, const int maxOutVerts)
Helper function to offset voncex polygons for rcMarkConvexPolyArea.
Definition: RecastArea.cpp:445
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:478
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:1486
void rcFreeContourSet(rcContourSet *contourSet)
Frees the specified contour set using the Recast allocator.
Definition: Recast.cpp:193
bool rcBuildCompactHeightfield(rcContext *context, int walkableHeight, int walkableClimb, rcHeightfield &heightfield, rcCompactHeightfield &compactHeightfield)
Builds a compact heightfield representing open space, from a heightfield representing solid space.
Definition: Recast.cpp:403
int rcGetDirForOffset(int offsetX, int offsetZ)
Gets the direction for the specified offset.
Definition: Recast.h:1238
bool rcBuildRegions(rcContext *ctx, rcCompactHeightfield &chf, int borderSize, int minRegionArea, int mergeRegionArea)
Builds region data for the heightfield using watershed partitioning.
Definition: RecastRegion.cpp:1525
Provides information on the content of a cell column in a compact heightfield.
Definition: Recast.h:335
unsigned int count
Number of spans in the column.
Definition: Recast.h:337
unsigned int index
Index to the first span in the column.
Definition: Recast.h:336
A compact, static heightfield representing unobstructed space.
Definition: Recast.h:352
int walkableHeight
The walkable height used during the build of the field. (See: rcConfig::walkableHeight)
Definition: Recast.h:359
rcCompactSpan * spans
Array of spans. [Size: spanCount].
Definition: Recast.h:369
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:357
rcCompactHeightfield()
Definition: Recast.cpp:132
unsigned short maxDistance
The maximum distance value of any span within the field.
Definition: Recast.h:362
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:367
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:365
int borderSize
The AABB border size used during the build of the field. (See: rcConfig::borderSize)
Definition: Recast.h:361
unsigned short maxRegions
The maximum region id of any span within the field.
Definition: Recast.h:363
int spanCount
The number of spans in the heightfield.
Definition: Recast.h:358
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:366
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:356
rcCompactCell * cells
Array of cells. [Size: width*height].
Definition: Recast.h:368
unsigned char * areas
Array containing area id data. [Size: spanCount].
Definition: Recast.h:371
int walkableClimb
The walkable climb used during the build of the field. (See: rcConfig::walkableClimb)
Definition: Recast.h:360
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:364
~rcCompactHeightfield()
Definition: Recast.cpp:152
unsigned short * dist
Array containing border distance data. [Size: spanCount].
Definition: Recast.h:370
Represents a span of unobstructed space within a compact heightfield.
Definition: Recast.h:342
unsigned short y
The lower extent of the span. (Measured from the heightfield's base.)
Definition: Recast.h:343
unsigned int h
The height of the span. (Measured from y.)
Definition: Recast.h:346
unsigned int con
Packed neighbor connection data.
Definition: Recast.h:345
unsigned short reg
The id of the region the span belongs to. (Or zero if not in a region.)
Definition: Recast.h:344
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:431
rcContourSet()
Definition: Recast.cpp:198
int height
The height of the set. (Along the z-axis in cell units.)
Definition: Recast.h:442
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:439
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:437
int nconts
The number of contours in the set.
Definition: Recast.h:436
~rcContourSet()
Definition: Recast.cpp:212
rcContour * conts
An array of the contours in the set. [Size: nconts].
Definition: Recast.h:435
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:440
int borderSize
The AABB border size used to generate the source data from which the contours were derived.
Definition: Recast.h:443
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:438
int width
The width of the set. (Along the x-axis in cell units.)
Definition: Recast.h:441
float maxError
The max edge error that this contour set was simplified with.
Definition: Recast.h:444
Represents a simple, non-overlapping contour in field space.
Definition: Recast.h:419
int nrverts
The number of vertices in the raw contour.
Definition: Recast.h:423
unsigned char area
The area id of the contour.
Definition: Recast.h:425
int * rverts
Raw contour vertex and connection data. [Size: 4 * nrverts].
Definition: Recast.h:422
int * verts
Simplified contour vertex and connection data. [Size: 4 * nverts].
Definition: Recast.h:420
unsigned short reg
The region id of the contour.
Definition: Recast.h:424
int nverts
The number of vertices in the simplified contour.
Definition: Recast.h:421
Represents a set of heightfield layers.
Definition: Recast.h:404
rcHeightfieldLayerSet()
Definition: Recast.cpp:170
rcHeightfieldLayer * layers
The layers in the set. [Size: nlayers].
Definition: Recast.h:408
~rcHeightfieldLayerSet()
Definition: Recast.cpp:176
int nlayers
The number of layers in the set.
Definition: Recast.h:409
Represents a heightfield layer within a layer set.
Definition: Recast.h:382
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:384
unsigned char * cons
Packed neighbor connection information. [Size: Same as heights].
Definition: Recast.h:397
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:386
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:388
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:387
int hmin
The minimum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:393
unsigned char * areas
Area ids. [Size: Same as heights].
Definition: Recast.h:396
int hmax
The maximum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:394
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:383
int maxx
The maximum x-bounds of usable data.
Definition: Recast.h:390
unsigned char * heights
The heightfield. [Size: width * height].
Definition: Recast.h:395
int maxy
The maximum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:392
int minx
The minimum x-bounds of usable data.
Definition: Recast.h:389
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:385
int miny
The minimum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:391
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:325
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:324
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:485
unsigned char * tris
The mesh triangles. [Size: 4*ntris].
Definition: Recast.h:490
float * verts
The mesh vertices. [Size: 3*nverts].
Definition: Recast.h:489
unsigned int * meshes
The sub-mesh data. [Size: 4*nmeshes].
Definition: Recast.h:488
int nverts
The number of vertices in verts.
Definition: Recast.h:492
int ntris
The number of triangles in tris.
Definition: Recast.h:493
rcPolyMeshDetail()
Definition: Recast.cpp:277
int nmeshes
The number of sub-meshes defined by meshes.
Definition: Recast.h:491
Represents a polygon mesh suitable for use in building a navigation mesh.
Definition: Recast.h:455
rcPolyMesh()
Definition: Recast.cpp:232
~rcPolyMesh()
Definition: Recast.cpp:251
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:470
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:468
unsigned short * polys
Polygon and neighbor data. [Length: maxpolys * 2 * nvp].
Definition: Recast.h:460
unsigned short * regs
The region id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:461
int borderSize
The AABB border size used to generate the source data from which the mesh was derived.
Definition: Recast.h:472
unsigned char * areas
The area id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:463
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:471
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:469
int nvp
The maximum number of vertices per polygon.
Definition: Recast.h:467
float maxEdgeError
The max error of the polygon edges in the mesh.
Definition: Recast.h:473
unsigned short * flags
The user defined flags for each polygon. [Length: maxpolys].
Definition: Recast.h:462
int npolys
The number of polygons.
Definition: Recast.h:465
unsigned short * verts
The mesh vertices. [Form: (x, y, z) * nverts].
Definition: Recast.h:459
int nverts
The number of vertices.
Definition: Recast.h:464
int maxpolys
The number of allocated polygons.
Definition: Recast.h:466
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