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;
324 
325  // memory pool for rcSpan instances.
328 
329 private:
330  // Explicitly-disabled copy constructor and copy assignment operator.
332  rcHeightfield& operator=(const rcHeightfield&);
333 };
334 
337 {
338  unsigned int index : 24;
339  unsigned int count : 8;
340 };
341 
344 {
345  unsigned short y;
346  unsigned short reg;
347  unsigned int con : 24;
348  unsigned int h : 8;
349 };
350 
354 {
357 
358  int width;
359  int height;
360  int spanCount;
364  unsigned short maxDistance;
365  unsigned short maxRegions;
366  float bmin[3];
367  float bmax[3];
368  float cs;
369  float ch;
372  unsigned short* dist;
373  unsigned char* areas;
374 
375 private:
376  // Explicitly-disabled copy constructor and copy assignment operator.
378  rcCompactHeightfield& operator=(const rcCompactHeightfield&);
379 };
380 
384 {
385  float bmin[3];
386  float bmax[3];
387  float cs;
388  float ch;
389  int width;
390  int height;
391  int minx;
392  int maxx;
393  int miny;
394  int maxy;
395  int hmin;
396  int hmax;
397  unsigned char* heights;
398  unsigned char* areas;
399  unsigned char* cons;
400 };
401 
406 {
409 
411  int nlayers;
412 
413 private:
414  // Explicitly-disabled copy constructor and copy assignment operator.
416  rcHeightfieldLayerSet& operator=(const rcHeightfieldLayerSet&);
417 };
418 
420 struct rcContour
421 {
422  int* verts;
423  int nverts;
424  int* rverts;
425  int nrverts;
426  unsigned short reg;
427  unsigned char area;
428 };
429 
433 {
434  rcContourSet();
435  ~rcContourSet();
436 
438  int nconts;
439  float bmin[3];
440  float bmax[3];
441  float cs;
442  float ch;
443  int width;
444  int height;
446  float maxError;
447 
448 private:
449  // Explicitly-disabled copy constructor and copy assignment operator.
450  rcContourSet(const rcContourSet&);
451  rcContourSet& operator=(const rcContourSet&);
452 };
453 
457 {
458  rcPolyMesh();
459  ~rcPolyMesh();
460 
461  unsigned short* verts;
462  unsigned short* polys;
463  unsigned short* regs;
464  unsigned short* flags;
465  unsigned char* areas;
466  int nverts;
467  int npolys;
468  int maxpolys;
469  int nvp;
470  float bmin[3];
471  float bmax[3];
472  float cs;
473  float ch;
475  float maxEdgeError;
476 
477 private:
478  // Explicitly-disabled copy constructor and copy assignment operator.
479  rcPolyMesh(const rcPolyMesh&);
480  rcPolyMesh& operator=(const rcPolyMesh&);
481 };
482 
487 {
489 
490  unsigned int* meshes;
491  float* verts;
492  unsigned char* tris;
493  int nmeshes;
494  int nverts;
495  int ntris;
496 
497 private:
498  // Explicitly-disabled copy constructor and copy assignment operator.
500  rcPolyMeshDetail& operator=(const rcPolyMeshDetail&);
501 };
502 
507 
513 
518 void rcFreeHeightField(rcHeightfield* heightfield);
519 
525 
530 void rcFreeCompactHeightfield(rcCompactHeightfield* compactHeightfield);
531 
537 
543 
549 
554 void rcFreeContourSet(rcContourSet* contourSet);
555 
561 
566 void rcFreePolyMesh(rcPolyMesh* polyMesh);
567 
573 
578 void rcFreePolyMeshDetail(rcPolyMeshDetail* detailMesh);
579 
581 
587 static const unsigned short RC_BORDER_REG = 0x8000;
588 
595 static const unsigned short RC_MULTIPLE_REGS = 0;
596 
604 static const int RC_BORDER_VERTEX = 0x10000;
605 
611 static const int RC_AREA_BORDER = 0x20000;
612 
616 {
619 };
620 
625 static const int RC_CONTOUR_REG_MASK = 0xffff;
626 
630 static const unsigned short RC_MESH_NULL_IDX = 0xffff;
631 
635 static const unsigned char RC_NULL_AREA = 0;
636 
640 static const unsigned char RC_WALKABLE_AREA = 63;
641 
644 static const int RC_NOT_CONNECTED = 0x3f;
645 
648 
652 template<class T> inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
653 
658 template<class T> inline T rcMin(T a, T b) { return a < b ? a : b; }
659 
664 template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
665 
669 template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
670 
674 template<class T> inline T rcSqr(T a) { return a * a; }
675 
681 template<class T> inline T rcClamp(T value, T minInclusive, T maxInclusive)
682 {
683  return value < minInclusive ? minInclusive: (value > maxInclusive ? maxInclusive : value);
684 }
685 
689 float rcSqrt(float x);
690 
694 
699 inline void rcVcross(float* dest, const float* v1, const float* v2)
700 {
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];
704 }
705 
710 inline float rcVdot(const float* v1, const float* v2)
711 {
712  return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
713 }
714 
720 inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
721 {
722  dest[0] = v1[0]+v2[0]*s;
723  dest[1] = v1[1]+v2[1]*s;
724  dest[2] = v1[2]+v2[2]*s;
725 }
726 
731 inline void rcVadd(float* dest, const float* v1, const float* v2)
732 {
733  dest[0] = v1[0]+v2[0];
734  dest[1] = v1[1]+v2[1];
735  dest[2] = v1[2]+v2[2];
736 }
737 
742 inline void rcVsub(float* dest, const float* v1, const float* v2)
743 {
744  dest[0] = v1[0]-v2[0];
745  dest[1] = v1[1]-v2[1];
746  dest[2] = v1[2]-v2[2];
747 }
748 
752 inline void rcVmin(float* mn, const float* v)
753 {
754  mn[0] = rcMin(mn[0], v[0]);
755  mn[1] = rcMin(mn[1], v[1]);
756  mn[2] = rcMin(mn[2], v[2]);
757 }
758 
762 inline void rcVmax(float* mx, const float* v)
763 {
764  mx[0] = rcMax(mx[0], v[0]);
765  mx[1] = rcMax(mx[1], v[1]);
766  mx[2] = rcMax(mx[2], v[2]);
767 }
768 
772 inline void rcVcopy(float* dest, const float* v)
773 {
774  dest[0] = v[0];
775  dest[1] = v[1];
776  dest[2] = v[2];
777 }
778 
783 inline float rcVdist(const float* v1, const float* v2)
784 {
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);
789 }
790 
795 inline float rcVdistSqr(const float* v1, const float* v2)
796 {
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;
801 }
802 
805 inline void rcVnormalize(float* v)
806 {
807  float d = 1.0f / rcSqrt(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
808  v[0] *= d;
809  v[1] *= d;
810  v[2] *= d;
811 }
812 
817 
824 void rcCalcBounds(const float* verts, int numVerts, float* minBounds, float* maxBounds);
825 
833 void rcCalcGridSize(const float* minBounds, const float* maxBounds, float cellSize, int* sizeX, int* sizeZ);
834 
850 bool rcCreateHeightfield(rcContext* context, rcHeightfield& heightfield, int sizeX, int sizeZ,
851  const float* minBounds, const float* maxBounds,
852  float cellSize, float cellHeight);
853 
873 void rcMarkWalkableTriangles(rcContext* context, float walkableSlopeAngle, const float* verts, int numVerts,
874  const int* tris, int numTris, unsigned char* triAreaIDs);
875 
894 void rcClearUnwalkableTriangles(rcContext* context, float walkableSlopeAngle, const float* verts, int numVerts,
895  const int* tris, int numTris, unsigned char* triAreaIDs);
896 
915 bool rcAddSpan(rcContext* context, rcHeightfield& heightfield,
916  int x, int z,
917  unsigned short spanMin, unsigned short spanMax,
918  unsigned char areaID, int flagMergeThreshold);
919 
937 bool rcRasterizeTriangle(rcContext* context,
938  const float* v0, const float* v1, const float* v2,
939  unsigned char areaID, rcHeightfield& heightfield, int flagMergeThreshold = 1);
940 
957 bool rcRasterizeTriangles(rcContext* context,
958  const float* verts, int numVerts,
959  const int* tris, const unsigned char* triAreaIDs, int numTris,
960  rcHeightfield& heightfield, int flagMergeThreshold = 1);
961 
978 bool rcRasterizeTriangles(rcContext* context,
979  const float* verts, int numVerts,
980  const unsigned short* tris, const unsigned char* triAreaIDs, int numTris,
981  rcHeightfield& heightfield, int flagMergeThreshold = 1);
982 
999 bool rcRasterizeTriangles(rcContext* context,
1000  const float* verts, const unsigned char* triAreaIDs, int numTris,
1001  rcHeightfield& heightfield, int flagMergeThreshold = 1);
1002 
1019 void rcFilterLowHangingWalkableObstacles(rcContext* context, int walkableClimb, rcHeightfield& heightfield);
1020 
1039 void rcFilterLedgeSpans(rcContext* context, int walkableHeight, int walkableClimb, rcHeightfield& heightfield);
1040 
1055 void rcFilterWalkableLowHeightSpans(rcContext* context, int walkableHeight, rcHeightfield& heightfield);
1056 
1062 int rcGetHeightFieldSpanCount(rcContext* context, const rcHeightfield& heightfield);
1063 
1068 
1088 bool rcBuildCompactHeightfield(rcContext* context, int walkableHeight, int walkableClimb,
1089  const rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield);
1090 
1105 bool rcErodeWalkableArea(rcContext* context, int erosionRadius, rcCompactHeightfield& compactHeightfield);
1106 
1118 bool rcMedianFilterWalkableArea(rcContext* context, rcCompactHeightfield& compactHeightfield);
1119 
1130 void rcMarkBoxArea(rcContext* context, const float* boxMinBounds, const float* boxMaxBounds, unsigned char areaId,
1131  rcCompactHeightfield& compactHeightfield);
1132 
1150 void rcMarkConvexPolyArea(rcContext* context, const float* verts, int numVerts,
1151  float minY, float maxY, unsigned char areaId,
1152  rcCompactHeightfield& compactHeightfield);
1153 
1167 int rcOffsetPoly(const float* verts, int numVerts, float offset, float* outVerts, int maxOutVerts);
1168 
1181 void rcMarkCylinderArea(rcContext* context, const float* position, float radius, float height,
1182  unsigned char areaId, rcCompactHeightfield& compactHeightfield);
1183 
1190 
1202 bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, int borderSize, int minRegionArea, int mergeRegionArea);
1203 
1213 bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, int borderSize, int minRegionArea);
1214 
1227  int borderSize, int minRegionArea, int mergeRegionArea);
1228 
1233 inline void rcSetCon(rcCompactSpan& span, int direction, int neighborIndex)
1234 {
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);
1238 }
1239 
1244 inline int rcGetCon(const rcCompactSpan& span, int direction)
1245 {
1246  const unsigned int shift = (unsigned int)direction * 6;
1247  return (span.con >> shift) & 0x3f;
1248 }
1249 
1253 inline int rcGetDirOffsetX(int direction)
1254 {
1255  static const int offset[4] = { -1, 0, 1, 0, };
1256  return offset[direction & 0x03];
1257 }
1258 
1259 // TODO (graham): Rename this to rcGetDirOffsetZ
1263 inline int rcGetDirOffsetY(int direction)
1264 {
1265  static const int offset[4] = { 0, 1, 0, -1 };
1266  return offset[direction & 0x03];
1267 }
1268 
1273 inline int rcGetDirForOffset(int offsetX, int offsetZ)
1274 {
1275  static const int dirs[5] = { 3, 0, -1, 2, 1 };
1276  return dirs[((offsetZ + 1) << 1) + offsetX];
1277 }
1278 
1283 
1295  int borderSize, int walkableHeight,
1296  rcHeightfieldLayerSet& lset);
1297 
1309 bool rcBuildContours(rcContext* ctx, const rcCompactHeightfield& chf,
1310  float maxError, int maxEdgeLen,
1311  rcContourSet& cset, int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
1312 
1321 bool rcBuildPolyMesh(rcContext* ctx, const rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
1322 
1330 bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh);
1331 
1342 bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompactHeightfield& chf,
1343  float sampleDist, float sampleMaxError,
1344  rcPolyMeshDetail& dmesh);
1345 
1352 bool rcCopyPolyMesh(rcContext* ctx, const rcPolyMesh& src, rcPolyMesh& dst);
1353 
1361 bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int nmeshes, rcPolyMeshDetail& mesh);
1362 
1364 
1365 #endif // RECAST_H
1366 
1368 
1369 // Due to the large amount of detail documentation for this file,
1370 // the content normally located at the end of the header file has been separated
1371 // 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: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