TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Recast.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009-2010 Mikko Mononen [email protected]
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 
28 {
32 };
33 
37 {
96 };
97 
102 {
103 public:
104 
107  inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
108  virtual ~rcContext() {}
109 
112  inline void enableLog(bool state) { m_logEnabled = state; }
113 
115  inline void resetLog() { if (m_logEnabled) doResetLog(); }
116 
120  void log(const rcLogCategory category, const char* format, ...);
121 
124  inline void enableTimer(bool state) { m_timerEnabled = state; }
125 
127  inline void resetTimers() { if (m_timerEnabled) doResetTimers(); }
128 
131  inline void startTimer(const rcTimerLabel label) { if (m_timerEnabled) doStartTimer(label); }
132 
135  inline void stopTimer(const rcTimerLabel label) { if (m_timerEnabled) doStopTimer(label); }
136 
140  inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
141 
142 protected:
143 
145  virtual void doResetLog() {}
146 
151  virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/) {}
152 
154  virtual void doResetTimers() {}
155 
158  virtual void doStartTimer(const rcTimerLabel /*label*/) {}
159 
162  virtual void doStopTimer(const rcTimerLabel /*label*/) {}
163 
167  virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
168 
171 
174 };
175 
178 struct rcConfig
179 {
181  int width;
182 
184  int height;
185 
187  int tileSize;
188 
191 
193  float cs;
194 
196  float ch;
197 
199  float bmin[3];
200 
202  float bmax[3];
203 
206 
210 
213 
217 
220 
224 
227 
231 
235 
239 
243 };
244 
246 static const int RC_SPAN_HEIGHT_BITS = 16; // EDITED BY TC
248 static const int RC_SPAN_MAX_HEIGHT = (1<<RC_SPAN_HEIGHT_BITS)-1;
249 
252 static const int RC_SPANS_PER_POOL = 2048;
253 
256 struct rcSpan
257 {
258  unsigned int smin : 16;
259  unsigned int smax : 16;
260  unsigned char area;
262 };
263 
267 {
270 };
271 
275 {
276  int width;
277  int height;
278  float bmin[3];
279  float bmax[3];
280  float cs;
281  float ch;
285 };
286 
289 {
290  unsigned int index : 24;
291  unsigned int count : 8;
292 };
293 
296 {
297  unsigned short y;
298  unsigned short reg;
299  unsigned int con : 24;
300  unsigned int h : 8;
301 };
302 
306 {
307  int width;
308  int height;
309  int spanCount;
313  unsigned short maxDistance;
314  unsigned short maxRegions;
315  float bmin[3];
316  float bmax[3];
317  float cs;
318  float ch;
321  unsigned short* dist;
322  unsigned char* areas;
323 };
324 
328 {
329  float bmin[3];
330  float bmax[3];
331  float cs;
332  float ch;
333  int width;
334  int height;
335  int minx;
336  int maxx;
337  int miny;
338  int maxy;
339  int hmin;
340  int hmax;
341  unsigned char* heights;
342  unsigned char* areas;
343  unsigned char* cons;
344 };
345 
350 {
352  int nlayers;
353 };
354 
356 struct rcContour
357 {
358  int* verts;
359  int nverts;
360  int* rverts;
361  int nrverts;
362  unsigned short reg;
363  unsigned char area;
364 };
365 
369 {
371  int nconts;
372  float bmin[3];
373  float bmax[3];
374  float cs;
375  float ch;
376  int width;
377  int height;
379 };
380 
384 {
385  unsigned short* verts;
386  unsigned short* polys;
387  unsigned short* regs;
388  unsigned short* flags;
389  unsigned char* areas;
390  int nverts;
391  int npolys;
392  int maxpolys;
393  int nvp;
394  float bmin[3];
395  float bmax[3];
396  float cs;
397  float ch;
399 };
400 
405 {
406  unsigned int* meshes;
407  float* verts;
408  unsigned char* tris;
409  int nmeshes;
410  int nverts;
411  int ntris;
412 };
413 
418 
424 
430 
436 
442 
448 
454 
460 
465 void rcFreeContourSet(rcContourSet* cset);
466 
472 
477 void rcFreePolyMesh(rcPolyMesh* pmesh);
478 
484 
490 
492 
498 static const unsigned short RC_BORDER_REG = 0x8000;
499 
507 static const int RC_BORDER_VERTEX = 0x10000;
508 
514 static const int RC_AREA_BORDER = 0x20000;
515 
519 {
522 };
523 
528 static const int RC_CONTOUR_REG_MASK = 0xffff;
529 
533 static const unsigned short RC_MESH_NULL_IDX = 0xffff;
534 
538 static const unsigned char RC_NULL_AREA = 0;
539 
543 static const unsigned char RC_WALKABLE_AREA = 63;
544 
547 static const int RC_NOT_CONNECTED = 0x3f;
548 
551 
555 template<class T> void rcIgnoreUnused(const T&) { }
556 
560 template<class T> inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
561 
566 template<class T> inline T rcMin(T a, T b) { return a < b ? a : b; }
567 
572 template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
573 
577 template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
578 
582 template<class T> inline T rcSqr(T a) { return a*a; }
583 
589 template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
590 
594 float rcSqrt(float x);
595 
599 
604 inline void rcVcross(float* dest, const float* v1, const float* v2)
605 {
606  dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
607  dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
608  dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
609 }
610 
615 inline float rcVdot(const float* v1, const float* v2)
616 {
617  return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
618 }
619 
625 inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
626 {
627  dest[0] = v1[0]+v2[0]*s;
628  dest[1] = v1[1]+v2[1]*s;
629  dest[2] = v1[2]+v2[2]*s;
630 }
631 
636 inline void rcVadd(float* dest, const float* v1, const float* v2)
637 {
638  dest[0] = v1[0]+v2[0];
639  dest[1] = v1[1]+v2[1];
640  dest[2] = v1[2]+v2[2];
641 }
642 
647 inline void rcVsub(float* dest, const float* v1, const float* v2)
648 {
649  dest[0] = v1[0]-v2[0];
650  dest[1] = v1[1]-v2[1];
651  dest[2] = v1[2]-v2[2];
652 }
653 
657 inline void rcVmin(float* mn, const float* v)
658 {
659  mn[0] = rcMin(mn[0], v[0]);
660  mn[1] = rcMin(mn[1], v[1]);
661  mn[2] = rcMin(mn[2], v[2]);
662 }
663 
667 inline void rcVmax(float* mx, const float* v)
668 {
669  mx[0] = rcMax(mx[0], v[0]);
670  mx[1] = rcMax(mx[1], v[1]);
671  mx[2] = rcMax(mx[2], v[2]);
672 }
673 
677 inline void rcVcopy(float* dest, const float* v)
678 {
679  dest[0] = v[0];
680  dest[1] = v[1];
681  dest[2] = v[2];
682 }
683 
688 inline float rcVdist(const float* v1, const float* v2)
689 {
690  float dx = v2[0] - v1[0];
691  float dy = v2[1] - v1[1];
692  float dz = v2[2] - v1[2];
693  return rcSqrt(dx*dx + dy*dy + dz*dz);
694 }
695 
700 inline float rcVdistSqr(const float* v1, const float* v2)
701 {
702  float dx = v2[0] - v1[0];
703  float dy = v2[1] - v1[1];
704  float dz = v2[2] - v1[2];
705  return dx*dx + dy*dy + dz*dz;
706 }
707 
710 inline void rcVnormalize(float* v)
711 {
712  float d = 1.0f / rcSqrt(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
713  v[0] *= d;
714  v[1] *= d;
715  v[2] *= d;
716 }
717 
722 
729 void rcCalcBounds(const float* verts, int nv, float* bmin, float* bmax);
730 
738 void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int* h);
739 
750 bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
751  const float* bmin, const float* bmax,
752  float cs, float ch);
753 
765 void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
766  const int* tris, int nt, unsigned char* areas);
767 
778 void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
779  const int* tris, int nt, unsigned char* areas);
780 
793 void rcAddSpan(rcContext* ctx, rcHeightfield& hf, const int x, const int y,
794  const unsigned short smin, const unsigned short smax,
795  const unsigned char area, const int flagMergeThr);
796 
807 void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const float* v2,
808  const unsigned char area, rcHeightfield& solid,
809  const int flagMergeThr = 1);
810 
822 void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
823  const int* tris, const unsigned char* areas, const int nt,
824  rcHeightfield& solid, const int flagMergeThr = 1);
825 
837 void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
838  const unsigned short* tris, const unsigned char* areas, const int nt,
839  rcHeightfield& solid, const int flagMergeThr = 1);
840 
850 void rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
851  rcHeightfield& solid, const int flagMergeThr = 1);
852 
859 void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid);
860 
869 void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight,
870  const int walkableClimb, rcHeightfield& solid);
871 
878 void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid);
879 
886 
891 
902 bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
904 
911 bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf);
912 
919 
927 void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
928  rcCompactHeightfield& chf);
929 
939 void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
940  const float hmin, const float hmax, unsigned char areaId,
941  rcCompactHeightfield& chf);
942 
950 int rcOffsetPoly(const float* verts, const int nverts, const float offset,
951  float* outVerts, const int maxOutVerts);
952 
961 void rcMarkCylinderArea(rcContext* ctx, const float* pos,
962  const float r, const float h, unsigned char areaId,
963  rcCompactHeightfield& chf);
964 
971 
984  const int borderSize, const int minRegionArea, const int mergeRegionArea);
985 
996  const int borderSize, const int minRegionArea);
997 
1010  const int borderSize, const int minRegionArea, const int mergeRegionArea);
1011 
1016 inline void rcSetCon(rcCompactSpan& s, int dir, int i)
1017 {
1018  const unsigned int shift = (unsigned int)dir*6;
1019  unsigned int con = s.con;
1020  s.con = (con & ~(0x3f << shift)) | (((unsigned int)i & 0x3f) << shift);
1021 }
1022 
1028 inline int rcGetCon(const rcCompactSpan& s, int dir)
1029 {
1030  const unsigned int shift = (unsigned int)dir*6;
1031  return (s.con >> shift) & 0x3f;
1032 }
1033 
1038 inline int rcGetDirOffsetX(int dir)
1039 {
1040  const int offset[4] = { -1, 0, 1, 0, };
1041  return offset[dir&0x03];
1042 }
1043 
1048 inline int rcGetDirOffsetY(int dir)
1049 {
1050  const int offset[4] = { 0, 1, 0, -1 };
1051  return offset[dir&0x03];
1052 }
1053 
1058 
1070  const int borderSize, const int walkableHeight,
1071  rcHeightfieldLayerSet& lset);
1072 
1085  const float maxError, const int maxEdgeLen,
1086  rcContourSet& cset, const int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
1087 
1096 bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
1097 
1105 bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh);
1106 
1117 bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompactHeightfield& chf,
1118  const float sampleDist, const float sampleMaxError,
1119  rcPolyMeshDetail& dmesh);
1120 
1127 bool rcCopyPolyMesh(rcContext* ctx, const rcPolyMesh& src, rcPolyMesh& dst);
1128 
1136 bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int nmeshes, rcPolyMeshDetail& mesh);
1137 
1139 
1140 #endif // RECAST_H
1141 
1143 
1144 // Due to the large amount of detail documentation for this file,
1145 // the content normally located at the end of the header file has been separated
1146 // out to a file in /Docs/Extern.
float rcSqrt(float x)
Definition: Recast.cpp:30
bool rcBuildPolyMeshDetail(rcContext *ctx, const rcPolyMesh &mesh, const rcCompactHeightfield &chf, const float sampleDist, const float sampleMaxError, rcPolyMeshDetail &dmesh)
Definition: RecastMeshDetail.cpp:1117
int getAccumulatedTime(const rcTimerLabel label) const
Definition: Recast.h:140
void format(BasicFormatter< Char > &f, const Char *&format_str, const T &value)
Definition: format.h:2963
float rcVdistSqr(const float *v1, const float *v2)
Definition: Recast.h:700
unsigned char * areas
The area id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:389
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:372
The maximum number of timers. (Used for iterating timers.)
Definition: Recast.h:95
Definition: Recast.h:274
rcHeightfieldLayer * layers
The layers in the set. [Size: nlayers].
Definition: Recast.h:351
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:308
rcCompactHeightfield * rcAllocCompactHeightfield()
Definition: Recast.cpp:95
The total time to build the contours. (See: rcBuildContours)
Definition: Recast.h:47
float detailSampleMaxError
Definition: Recast.h:242
void rcFreeCompactHeightfield(rcCompactHeightfield *chf)
Definition: Recast.cpp:102
int nverts
The number of vertices.
Definition: Recast.h:390
bool m_logEnabled
True if logging is enabled.
Definition: Recast.h:170
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:276
Definition: Recast.h:349
int borderSize
The AABB border size used during the build of the field. (See: rcConfig::borderSize) ...
Definition: Recast.h:312
T rcAbs(T a)
Definition: Recast.h:577
Tessellate edges between areas during contour simplification.
Definition: Recast.h:521
int walkableRadius
Definition: Recast.h:216
unsigned short maxRegions
The maximum region id of any span within the field.
Definition: Recast.h:314
Represents a span of unobstructed space within a compact heightfield.
Definition: Recast.h:295
void rcFreeHeightfieldLayerSet(rcHeightfieldLayerSet *lset)
Definition: Recast.cpp:120
int nrverts
The number of vertices in the raw contour.
Definition: Recast.h:361
rcLogCategory
Definition: Recast.h:27
The time to build the distances of the distance field. (See: rcBuildDistanceField) ...
Definition: Recast.h:75
int hmax
The maximum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:340
Tessellate solid (impassable) edges during contour simplification.
Definition: Recast.h:520
void resetTimers()
Clears all peformance timers. (Resets all to unused.)
Definition: Recast.h:127
void enableLog(bool state)
Definition: Recast.h:112
Definition: Recast.h:101
unsigned short * dist
Array containing border distance data. [Size: spanCount].
Definition: Recast.h:321
void rcSwap(T &a, T &b)
Definition: Recast.h:560
static const int RC_NOT_CONNECTED
Definition: Recast.h:547
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:281
rcSpan items[RC_SPANS_PER_POOL]
Array of spans in the pool.
Definition: Recast.h:269
The user defined total time of the build.
Definition: Recast.h:39
float bmin[3]
The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:199
bool rcCreateHeightfield(rcContext *ctx, rcHeightfield &hf, int width, int height, const float *bmin, const float *bmax, float cs, float ch)
Definition: Recast.cpp:211
int tileSize
The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx].
Definition: Recast.h:187
unsigned short reg
The id of the region the span belongs to. (Or zero if not in a region.)
Definition: Recast.h:298
int ntris
The number of triangles in tris.
Definition: Recast.h:411
The time to rasterize the triangles. (See: rcRasterizeTriangle)
Definition: Recast.h:43
int nverts
The number of vertices in the simplified contour.
Definition: Recast.h:359
void rcVnormalize(float *v)
Definition: Recast.h:710
unsigned char * heights
The heightfield. [Size: width * height].
Definition: Recast.h:341
unsigned char area
The area id assigned to the span.
Definition: Recast.h:260
bool m_timerEnabled
True if the performance timers are enabled.
Definition: Recast.h:173
rcCompactCell * cells
Array of cells. [Size: width*height].
Definition: Recast.h:319
int rcGetHeightFieldSpanCount(rcContext *ctx, rcHeightfield &hf)
Definition: Recast.cpp:297
int rcGetDirOffsetY(int dir)
Definition: Recast.h:1048
int walkableClimb
Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]...
Definition: Recast.h:212
The time to merge polygon meshes. (See: rcMergePolyMeshes)
Definition: Recast.h:63
void rcVadd(float *dest, const float *v1, const float *v2)
Definition: Recast.h:636
unsigned short y
The lower extent of the span. (Measured from the heightfield's base.)
Definition: Recast.h:297
void rcAddSpan(rcContext *ctx, rcHeightfield &hf, const int x, const int y, const unsigned short smin, const unsigned short smax, const unsigned char area, const int flagMergeThr)
Definition: RecastRasterization.cpp:164
rcCompactSpan * spans
Array of spans. [Size: spanCount].
Definition: Recast.h:320
Definition: Recast.h:178
void resetLog()
Clears all log entries.
Definition: Recast.h:115
unsigned short * verts
The mesh vertices. [Form: (x, y, z) * nverts].
Definition: Recast.h:385
float * verts
The mesh vertices. [Size: 3*nverts].
Definition: Recast.h:407
int * rverts
Raw contour vertex and connection data. [Size: 4 * nrverts].
Definition: Recast.h:360
T rcMin(T a, T b)
Definition: Recast.h:566
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:397
unsigned int h
The height of the span. (Measured from y.)
Definition: Recast.h:300
int rcGetCon(const rcCompactSpan &s, int dir)
Definition: Recast.h:1028
unsigned int index
Index to the first span in the column.
Definition: Recast.h:290
Definition: Recast.h:256
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:395
void rcVmin(float *mn, const float *v)
Definition: Recast.h:657
rcContour * conts
An array of the contours in the set. [Size: nconts].
Definition: Recast.h:370
virtual void doStopTimer(const rcTimerLabel)
Definition: Recast.h:162
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:279
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:396
int height
The height of the set. (Along the z-axis in cell units.)
Definition: Recast.h:377
Provides information on the content of a cell column in a compact heightfield.
Definition: Recast.h:288
void rcRasterizeTriangle(rcContext *ctx, const float *v0, const float *v1, const float *v2, const unsigned char area, rcHeightfield &solid, const int flagMergeThr=1)
Definition: RecastRasterization.cpp:328
void rcSetCon(rcCompactSpan &s, int dir, int i)
Definition: Recast.h:1016
int mergeRegionArea
Definition: Recast.h:230
bool rcMergePolyMeshes(rcContext *ctx, rcPolyMesh **meshes, const int nmeshes, rcPolyMesh &mesh)
Definition: RecastMesh.cpp:1302
The time to build the polygon mesh detail. (See: rcBuildPolyMeshDetail)
Definition: Recast.h:91
void rcFreeHeightField(rcHeightfield *hf)
Definition: Recast.cpp:80
The time to trace the boundaries of the contours. (See: rcBuildContours)
Definition: Recast.h:49
int nconts
The number of contours in the set.
Definition: Recast.h:371
int * verts
Simplified contour vertex and connection data. [Size: 4 * nverts].
Definition: Recast.h:358
int nmeshes
The number of sub-meshes defined by meshes.
Definition: Recast.h:409
int borderSize
The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]...
Definition: Recast.h:190
void rcFilterLedgeSpans(rcContext *ctx, const int walkableHeight, const int walkableClimb, rcHeightfield &solid)
Definition: RecastFilter.cpp:84
float detailSampleDist
Definition: Recast.h:238
void rcCalcGridSize(const float *bmin, const float *bmax, float cs, int *w, int *h)
Definition: Recast.cpp:200
Represents a simple, non-overlapping contour in field space.
Definition: Recast.h:356
unsigned char * areas
Area ids. [Size: Same as heights].
Definition: Recast.h:342
int maxEdgeLen
The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]...
Definition: Recast.h:219
bool rcCopyPolyMesh(rcContext *ctx, const rcPolyMesh &src, rcPolyMesh &dst)
Definition: RecastMesh.cpp:1482
unsigned int count
Number of spans in the column.
Definition: Recast.h:291
An error log entry.
Definition: Recast.h:31
bool rcBuildLayerRegions(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea)
Definition: RecastRegion.cpp:1670
A progress log entry.
Definition: Recast.h:29
void rcFilterLowHangingWalkableObstacles(rcContext *ctx, const int walkableClimb, rcHeightfield &solid)
Definition: RecastFilter.cpp:36
void rcFilterWalkableLowHeightSpans(rcContext *ctx, int walkableHeight, rcHeightfield &solid)
Definition: RecastFilter.cpp:180
rcSpan * freelist
The next free span.
Definition: Recast.h:284
static const int RC_SPANS_PER_POOL
Definition: Recast.h:252
int walkableHeight
Definition: Recast.h:209
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:334
void rcMarkWalkableTriangles(rcContext *ctx, const float walkableSlopeAngle, const float *verts, int nv, const int *tris, int nt, unsigned char *areas)
Definition: Recast.cpp:247
static const int RC_SPAN_HEIGHT_BITS
Defines the number of bits allocated to rcSpan::smin and rcSpan::smax.
Definition: Recast.h:246
The time to mark a box area. (See: rcMarkBoxArea)
Definition: Recast.h:67
rcContourSet * rcAllocContourSet()
Definition: Recast.cpp:134
static const int RC_SPAN_MAX_HEIGHT
Defines the maximum value for rcSpan::smin and rcSpan::smax.
Definition: Recast.h:248
Definition: Recast.h:305
unsigned int con
Packed neighbor connection data.
Definition: Recast.h:299
The time to blur the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:77
virtual int doGetAccumulatedTime(const rcTimerLabel) const
Definition: Recast.h:167
Definition: Recast.h:368
The time to build heightfield layers. (See: rcBuildHeightfieldLayers)
Definition: Recast.h:89
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:329
unsigned char * tris
The mesh triangles. [Size: 4*ntris].
Definition: Recast.h:408
float rcVdist(const float *v1, const float *v2)
Definition: Recast.h:688
int maxx
The maximum x-bounds of usable data.
Definition: Recast.h:336
unsigned char area
The area id of the contour.
Definition: Recast.h:363
float maxSimplificationError
Definition: Recast.h:223
bool rcMedianFilterWalkableArea(rcContext *ctx, rcCompactHeightfield &chf)
Definition: RecastArea.cpp:241
int rcGetDirOffsetX(int dir)
Definition: Recast.h:1038
void rcMarkBoxArea(rcContext *ctx, const float *bmin, const float *bmax, unsigned char areaId, rcCompactHeightfield &chf)
Definition: RecastArea.cpp:320
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:280
Definition: Recast.h:266
static const unsigned short RC_MESH_NULL_IDX
Definition: Recast.h:533
float ch
The y-axis cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:196
The total time to apply the watershed algorithm. (See: rcBuildRegions)
Definition: Recast.h:81
Definition: Recast.h:383
The total time to build the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:73
rcPolyMeshDetail * rcAllocPolyMeshDetail()
Definition: Recast.cpp:171
static const int RC_BORDER_VERTEX
Definition: Recast.h:507
virtual void doStartTimer(const rcTimerLabel)
Definition: Recast.h:158
void rcCalcBounds(const float *verts, int nv, float *bmin, float *bmax)
Definition: Recast.cpp:187
rcHeightfield * rcAllocHeightfield()
Definition: Recast.cpp:73
int minx
The minimum x-bounds of usable data.
Definition: Recast.h:335
The time to filter low height spans. (See: rcFilterWalkableLowHeightSpans)
Definition: Recast.h:55
void rcVmad(float *dest, const float *v1, const float *v2, const float s)
Definition: Recast.h:625
The time to erode the walkable area. (See: rcErodeWalkableArea)
Definition: Recast.h:65
unsigned char * areas
Array containing area id data. [Size: spanCount].
Definition: Recast.h:322
static const unsigned char RC_WALKABLE_AREA
Definition: Recast.h:543
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:332
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:373
G3D::int16 y
Definition: Vector2int16.h:38
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:316
rcTimerLabel
Definition: Recast.h:36
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:307
The time to build the compact heightfield. (See: rcBuildCompactHeightfield)
Definition: Recast.h:45
unsigned int smin
The lower limit of the span. [Limit: < smax].
Definition: Recast.h:258
int maxVertsPerPoly
Definition: Recast.h:234
unsigned short reg
The region id of the contour.
Definition: Recast.h:362
static const int RC_CONTOUR_REG_MASK
Definition: Recast.h:528
virtual ~rcContext()
Definition: Recast.h:108
rcContext(bool state=true)
Definition: Recast.h:107
void rcClearUnwalkableTriangles(rcContext *ctx, const float walkableSlopeAngle, const float *verts, int nv, const int *tris, int nt, unsigned char *areas)
Definition: Recast.cpp:276
bool rcBuildHeightfieldLayers(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int walkableHeight, rcHeightfieldLayerSet &lset)
Definition: RecastLayers.cpp:84
The total time to build the regions. (See: rcBuildRegions, rcBuildRegionsMonotone) ...
Definition: Recast.h:79
void rcVcopy(float *dest, const float *v)
Definition: Recast.h:677
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:374
float bmax[3]
The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:202
void startTimer(const rcTimerLabel label)
Definition: Recast.h:131
void rcMarkCylinderArea(rcContext *ctx, const float *pos, const float r, const float h, unsigned char areaId, rcCompactHeightfield &chf)
Definition: RecastArea.cpp:538
void rcVsub(float *dest, const float *v1, const float *v2)
Definition: Recast.h:647
float walkableSlopeAngle
The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees].
Definition: Recast.h:205
rcPolyMesh * rcAllocPolyMesh()
Definition: Recast.cpp:153
int spanCount
The number of spans in the heightfield.
Definition: Recast.h:309
int walkableHeight
The walkable height used during the build of the field. (See: rcConfig::walkableHeight) ...
Definition: Recast.h:310
bool rcErodeWalkableArea(rcContext *ctx, int radius, rcCompactHeightfield &chf)
Definition: RecastArea.cpp:37
unsigned char * cons
Packed neighbor connection information. [Size: Same as heights].
Definition: Recast.h:343
virtual void doResetTimers()
Clears all timers. (Resets all to unused.)
Definition: Recast.h:154
T rcSqr(T a)
Definition: Recast.h:582
int maxy
The maximum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:338
T rcClamp(T v, T mn, T mx)
Definition: Recast.h:589
unsigned int smax
The upper limit of the span. [Limit: <= RC_SPAN_MAX_HEIGHT].
Definition: Recast.h:259
int rcOffsetPoly(const float *verts, const int nverts, const float offset, float *outVerts, const int maxOutVerts)
Definition: RecastArea.cpp:455
rcHeightfieldLayerSet * rcAllocHeightfieldLayerSet()
Definition: Recast.cpp:113
The time to flood regions while applying the watershed algorithm. (See: rcBuildRegions) ...
Definition: Recast.h:85
A user defined build time.
Definition: Recast.h:41
The time to expand regions while applying the watershed algorithm. (See: rcBuildRegions) ...
Definition: Recast.h:83
void rcFreePolyMeshDetail(rcPolyMeshDetail *dmesh)
Definition: Recast.cpp:178
unsigned short * flags
The user defined flags for each polygon. [Length: maxpolys].
Definition: Recast.h:388
virtual void doResetLog()
Clears all log entries.
Definition: Recast.h:145
void enableTimer(bool state)
Definition: Recast.h:124
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:317
The time to merge polygon mesh details. (See: rcMergePolyMeshDetails)
Definition: Recast.h:93
unsigned short maxDistance
The maximum distance value of any span within the field.
Definition: Recast.h:313
int height
The height of the field along the z-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:184
static const int RC_AREA_BORDER
Definition: Recast.h:514
static const float RC_PI
The value of PI used by Recast.
Definition: Recast.h:23
int width
The width of the set. (Along the x-axis in cell units.)
Definition: Recast.h:376
float cs
The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:193
The time to build the polygon mesh. (See: rcBuildPolyMesh)
Definition: Recast.h:61
bool rcBuildDistanceField(rcContext *ctx, rcCompactHeightfield &chf)
Definition: RecastRegion.cpp:1256
bool rcBuildRegions(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
Definition: RecastRegion.cpp:1532
void rcRasterizeTriangles(rcContext *ctx, const float *verts, const int nv, const int *tris, const unsigned char *areas, const int nt, rcHeightfield &solid, const int flagMergeThr=1)
Definition: RecastRasterization.cpp:348
rcSpan * next
The next span higher up in column.
Definition: Recast.h:261
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:278
int borderSize
The AABB border size used to generate the source data from which the mesh was derived.
Definition: Recast.h:398
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:318
static const unsigned char RC_NULL_AREA
Definition: Recast.h:538
void rcVcross(float *dest, const float *v1, const float *v2)
Definition: Recast.h:604
int nlayers
The number of layers in the set.
Definition: Recast.h:352
T rcMax(T a, T b)
Definition: Recast.h:572
rcSpanPool * next
The next span pool.
Definition: Recast.h:268
void log(const rcLogCategory category, const char *format,...)
Definition: Recast.cpp:55
int borderSize
The AABB border size used to generate the source data from which the contours were derived...
Definition: Recast.h:378
The time to apply the median filter. (See: rcMedianFilterWalkableArea)
Definition: Recast.h:57
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:375
unsigned int * meshes
The sub-mesh data. [Size: 4*nmeshes].
Definition: Recast.h:406
G3D::int16 x
Definition: Vector2int16.h:37
int npolys
The number of polygons.
Definition: Recast.h:391
bool rcBuildRegionsMonotone(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
Definition: RecastRegion.cpp:1357
bool rcBuildContours(rcContext *ctx, rcCompactHeightfield &chf, const float maxError, const int maxEdgeLen, rcContourSet &cset, const int buildFlags=RC_CONTOUR_TESS_WALL_EDGES)
Definition: RecastContour.cpp:824
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:277
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:333
virtual void doLog(const rcLogCategory, const char *, const int)
Definition: Recast.h:151
float rcVdot(const float *v1, const float *v2)
Definition: Recast.h:615
The time to mark a cylinder area. (See: rcMarkCylinderArea)
Definition: Recast.h:69
void stopTimer(const rcTimerLabel label)
Definition: Recast.h:135
int walkableClimb
The walkable climb used during the build of the field. (See: rcConfig::walkableClimb) ...
Definition: Recast.h:311
int minRegionArea
The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]...
Definition: Recast.h:226
int maxpolys
The number of allocated polygons.
Definition: Recast.h:392
rcBuildContoursFlags
Definition: Recast.h:518
unsigned short * regs
The region id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:387
rcSpanPool * pools
Linked list of span pools.
Definition: Recast.h:283
The time to filter ledge spans. (See: rcFilterLedgeSpans)
Definition: Recast.h:53
The time to mark a convex polygon area. (See: rcMarkConvexPolyArea)
Definition: Recast.h:71
int nverts
The number of vertices in verts.
Definition: Recast.h:410
void rcFreePolyMesh(rcPolyMesh *pmesh)
Definition: Recast.cpp:160
static const unsigned short RC_BORDER_REG
Definition: Recast.h:498
A warning log entry.
Definition: Recast.h:30
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:394
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:330
bool rcBuildPolyMesh(rcContext *ctx, rcContourSet &cset, const int nvp, rcPolyMesh &mesh)
Definition: RecastMesh.cpp:982
void rcIgnoreUnused(const T &)
Definition: Recast.h:555
int width
The width of the field along the x-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:181
int hmin
The minimum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:339
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:331
Definition: Recast.h:404
The time to filter out small regions. (See: rcBuildRegions, rcBuildRegionsMonotone) ...
Definition: Recast.h:87
rcSpan ** spans
Heightfield of spans (width*height).
Definition: Recast.h:282
int nvp
The maximum number of vertices per polygon.
Definition: Recast.h:393
The time to simplify the contours. (See: rcBuildContours)
Definition: Recast.h:51
void rcMarkConvexPolyArea(rcContext *ctx, const float *verts, const int nverts, const float hmin, const float hmax, unsigned char areaId, rcCompactHeightfield &chf)
Definition: RecastArea.cpp:388
bool rcMergePolyMeshDetails(rcContext *ctx, rcPolyMeshDetail **meshes, const int nmeshes, rcPolyMeshDetail &mesh)
Definition: RecastMeshDetail.cpp:1336
void rcVmax(float *mx, const float *v)
Definition: Recast.h:667
unsigned short * polys
Polygon and neighbor data. [Length: maxpolys * 2 * nvp].
Definition: Recast.h:386
Definition: Recast.h:327
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:315
The time to filter low obstacles. (See: rcFilterLowHangingWalkableObstacles)
Definition: Recast.h:59
void rcFreeContourSet(rcContourSet *cset)
Definition: Recast.cpp:141
bool rcBuildCompactHeightfield(rcContext *ctx, const int walkableHeight, const int walkableClimb, rcHeightfield &hf, rcCompactHeightfield &chf)
Definition: Recast.cpp:327
int miny
The minimum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:337