Recast Navigation  1.0.35
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 
22 #include "SharedConfig.h"
23 
25 static const float RC_PI = 3.14159265f;
26 
30 {
34 };
35 
39 {
98 };
99 
104 {
105 public:
106 
109  inline rcContext(bool logAndProfile = true) : m_logEnabled(logAndProfile), m_timerEnabled(logAndProfile) {}
110  virtual ~rcContext() {}
111 
114  inline void enableLog(bool state) { m_logEnabled = state; }
115 
117  inline void resetLog() { if (m_logEnabled) doResetLog(); }
118 
122  void log(const rcLogCategory category, const char* format, ...);
123 
126  inline void enableTimer(bool state) { m_timerEnabled = state; }
127 
129  inline void resetTimers() { if (m_timerEnabled) doResetTimers(); }
130 
133  inline void startTimer(const rcTimerLabel label) { if (m_timerEnabled) doStartTimer(label); }
134 
137  inline void stopTimer(const rcTimerLabel label) { if (m_timerEnabled) doStopTimer(label); }
138 
142  inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
143 
144 protected:
145 
147  virtual void doResetLog() {}
148 
153  virtual void doLog(const rcLogCategory category, const char* msg, const int len) {}
154 
156  virtual void doResetTimers() {}
157 
160  virtual void doStartTimer(const rcTimerLabel label) {}
161 
164  virtual void doStopTimer(const rcTimerLabel label) {}
165 
169  virtual int doGetAccumulatedTime(const rcTimerLabel label) const { return -1; }
170 
173 
176 };
177 
180 struct rcConfig
181 {
183  int width;
184 
186  int height;
187 
189  int tileSize;
190 
193 
195  float cellSizeXZ;
196 
198  float cellSizeY;
199 
201  float bmin[3];
202 
204  float bmax[3];
205 
208 
212 
215 
219 
222 
226 
229 
233 
237 
241 
245 };
246 
247 
250 struct rcSpan
251 {
252  static const int RC_SPAN_HEIGHT_BITS = 16;
253  static const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1;
254 
255  unsigned int smin : RC_SPAN_HEIGHT_BITS;
256  unsigned int smax : RC_SPAN_HEIGHT_BITS;
257  navAreaMask areaMask;
258 
260 };
261 
265 {
267  static const int RC_SPANS_PER_POOL = 2048;
268 
271 };
272 
276 {
277  int width;
278  int height;
279  float bmin[3];
280  float bmax[3];
281  float cs;
282  float ch;
286 };
287 
290 {
291  unsigned int index : 24;
292  unsigned int count : 8;
293 };
294 
297 {
298  unsigned short minY;
299  unsigned short regionID;
300  unsigned int connectionData : 24;
301  unsigned int height : 8;
302 };
303 
307 {
308  int width;
309  int height;
310  int spanCount;
314  unsigned short maxDistance;
315  unsigned short maxRegions;
316  float bmin[3];
317  float bmax[3];
318  float cs;
319  float ch;
322  unsigned short* dist;
323  navAreaMask* areaMasks;
324 };
325 
329 {
330  float bmin[3];
331  float bmax[3];
332  float cellSizeXZ;
333  float cellSizeY;
334  int width;
335  int height;
336  int minx;
337  int maxx;
338  int miny;
339  int maxy;
340  int hmin;
341  int hmax;
342  unsigned char* heights;
343  navAreaMask* areaMasks;
344  unsigned char* cons;
345 };
346 
351 {
353  int nlayers;
354 };
355 
357 struct rcContour
358 {
359  int* verts;
360  int nverts;
361  int* rverts;
362  int nrverts;
363  unsigned short reg;
364  navAreaMask areaMask;
365 };
366 
370 {
372  int nconts;
373  float bmin[3];
374  float bmax[3];
375  float cellSizeXZ;
376  float cellSizeY;
377  int width;
378  int height;
380 };
381 
385 {
386  unsigned short* verts;
387  unsigned short* polys;
388  unsigned short* regs;
389  navAreaMask* areaMasks;
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 navAreaMask RC_NULL_AREA = 0;
539 
543 static const navAreaMask RC_WALKABLE_AREA = 0x1;
544 
547 static const int RC_NOT_CONNECTED = 0x3f;
548 
549 #include "Util.h"
550 #include "Vector.h"
551 #include "Heightfield.h"
552 #include "CompactHeightfield.h"
553 
555 {
556  int height;
557  unsigned int flag;
558 };
559 void rcFilterHeightThresholds(rcContext* ctx, const rcHeightThreshold *heights, int numHeights, rcHeightfield& solid);
560 
561 
568 bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf);
569 
576 
584 void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, navAreaMask areaId,
585  rcCompactHeightfield& chf);
586 
596 void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
597  const float hmin, const float hmax, navAreaMask areaId,
598  rcCompactHeightfield& chf);
599 
608 int rcOffsetPoly(const float* verts, const int nverts, const float offset,
609  float* outVerts, const int maxOutVerts);
610 
619 void rcMarkCylinderArea(rcContext* ctx, const float* pos,
620  const float r, const float h, navAreaMask areaMask,
621  rcCompactHeightfield& chf);
622 
635  const int borderSize, const int minRegionArea, const int mergeRegionArea);
636 
647  const int borderSize, const int minRegionArea);
648 
661  const int borderSize, const int minRegionArea, const int mergeRegionArea);
662 
663 
674 bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, const int borderSize, const int walkableHeight, rcHeightfieldLayerSet& lset);
675 
687 bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf, const float maxError, const int maxEdgeLen, rcContourSet& cset, const int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
688 
697 bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
698 
706 bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh);
707 
718 bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompactHeightfield& chf, const float sampleDist, const float sampleMaxError, rcPolyMeshDetail& dmesh);
719 
726 bool rcCopyPolyMesh(rcContext* ctx, const rcPolyMesh& src, rcPolyMesh& dst);
727 
735 bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int nmeshes, rcPolyMeshDetail& mesh);
736 
738 
739 int rcConvexhull(const float* pts, int npts, int* out);
740 
741 #endif // RECAST_H
742 
744 
745 // Due to the large amount of detail documentation for this file,
746 // the content normally located at the end of the header file has been separated
747 // out to a file in /Docs/Extern.
static const int RC_SPAN_MAX_HEIGHT
Defines the maximum value for rcSpan::smin and rcSpan::smax.
Definition: Recast.h:253
int getAccumulatedTime(const rcTimerLabel label) const
Returns the total accumulated time of the specified performance timer.
Definition: Recast.h:142
static const navAreaMask RC_NULL_AREA
Represents the null area.
Definition: Recast.h:538
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:373
The maximum number of timers. (Used for iterating timers.)
Definition: Recast.h:97
unsigned short * polys
Polygon and neighbor data. [Length: maxpolys * 2 * nvp].
Definition: Recast.h:387
A dynamic heightfield representing obstructed space.
Definition: Recast.h:275
rcHeightfieldLayer * layers
The layers in the set. [Size: nlayers].
Definition: Recast.h:352
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:309
The total time to build the contours. (See: rcBuildContours)
Definition: Recast.h:49
void rcFreeHeightfieldLayerSet(rcHeightfieldLayerSet *lset)
Frees the specified heightfield layer set using the Recast allocator.
Definition: Recast.cpp:120
bool rcBuildPolyMesh(rcContext *ctx, rcContourSet &cset, const int nvp, rcPolyMesh &mesh)
Builds a polygon mesh from the provided contours.
Definition: RecastMesh.cpp:983
float detailSampleMaxError
The maximum distance the detail mesh surface should deviate from heightfield data.
Definition: Recast.h:244
int walkableRadius
The distance to erode/shrink the walkable area of the heightfield away from obstructions.
Definition: Recast.h:218
void rcFreePolyMesh(rcPolyMesh *pmesh)
Frees the specified polygon mesh using the Recast allocator.
Definition: Recast.cpp:160
int nverts
The number of vertices.
Definition: Recast.h:390
bool m_logEnabled
True if logging is enabled.
Definition: Recast.h:172
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:277
Represents a set of heightfield layers.
Definition: Recast.h:350
navAreaMask areaMask
The area assigned to the span.
Definition: Recast.h:257
int borderSize
The AABB border size used during the build of the field. (See: rcConfig::borderSize) ...
Definition: Recast.h:313
void rcMarkCylinderArea(rcContext *ctx, const float *pos, const float r, const float h, navAreaMask areaMask, rcCompactHeightfield &chf)
Applies the area id to all spans within the specified cylinder.
Definition: RecastArea.cpp:540
bool rcErodeWalkableArea(rcContext *ctx, int radius, rcCompactHeightfield &chf)
Erodes the walkable area within the heightfield by the specified radius.
Definition: RecastArea.cpp:37
Tessellate edges between areas during contour simplification.
Definition: Recast.h:521
float cellSizeY
The y-axis cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:198
int * rverts
Raw contour vertex and connection data. [Size: 4 * nrverts].
Definition: Recast.h:361
navAreaMask * areaMasks
Area mask. [Size: Same as heights].
Definition: Recast.h:343
unsigned short maxRegions
The maximum region id of any span within the field.
Definition: Recast.h:315
Represents a span of unobstructed space within a compact heightfield.
Definition: Recast.h:296
int nrverts
The number of vertices in the raw contour.
Definition: Recast.h:362
rcLogCategory
Recast log categories.
Definition: Recast.h:29
The time to build the distances of the distance field. (See: rcBuildDistanceField) ...
Definition: Recast.h:77
rcHeightfield * rcAllocHeightfield()
Allocates a heightfield object using the Recast allocator.
Definition: Recast.cpp:73
int hmax
The maximum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:341
Tessellate solid (impassable) edges during contour simplification.
Definition: Recast.h:520
void resetTimers()
Clears all peformance timers. (Resets all to unused.)
Definition: Recast.h:129
void enableLog(bool state)
Enables or disables logging.
Definition: Recast.h:114
Provides an interface for optional logging and performance tracking of the Recast build process...
Definition: Recast.h:103
unsigned short * dist
Array containing border distance data. [Size: spanCount].
Definition: Recast.h:322
Definition: Recast.h:554
float cellSizeXZ
The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu].
Definition: Recast.h:195
static const int RC_NOT_CONNECTED
The value returned by rcGetCon if the specified direction is not connected to another span...
Definition: Recast.h:547
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:282
bool rcBuildPolyMeshDetail(rcContext *ctx, const rcPolyMesh &mesh, const rcCompactHeightfield &chf, const float sampleDist, const float sampleMaxError, rcPolyMeshDetail &dmesh)
Builds a detail mesh from the provided polygon mesh.
Definition: RecastMeshDetail.cpp:1117
rcSpan items[RC_SPANS_PER_POOL]
Array of spans in the pool.
Definition: Recast.h:270
float cellSizeY
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:333
The user defined total time of the build.
Definition: Recast.h:41
void rcFilterHeightThresholds(rcContext *ctx, const rcHeightThreshold *heights, int numHeights, rcHeightfield &solid)
Definition: RecastFilter.cpp:209
rcPolyMesh * rcAllocPolyMesh()
Allocates a polygon mesh object using the Recast allocator.
Definition: Recast.cpp:153
float bmin[3]
The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:201
virtual void doStartTimer(const rcTimerLabel label)
Starts the specified performance timer.
Definition: Recast.h:160
float walkableSlopeAngle
The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees].
Definition: Recast.h:207
int ntris
The number of triangles in tris.
Definition: Recast.h:411
The time to rasterize the triangles. (See: rcRasterizeTriangle)
Definition: Recast.h:45
int nverts
The number of vertices in the simplified contour.
Definition: Recast.h:360
unsigned char * heights
The heightfield. [Size: (width - borderSize*2) * (h - borderSize*2)].
Definition: Recast.h:342
float maxSimplificationError
The maximum distance a simplfied contour's border edges should deviate the original raw contour...
Definition: Recast.h:225
void rcFreeContourSet(rcContourSet *cset)
Frees the specified contour set using the Recast allocator.
Definition: Recast.cpp:141
bool m_timerEnabled
True if the performance timers are enabled.
Definition: Recast.h:175
rcCompactCell * cells
Array of cells. [Size: width*height].
Definition: Recast.h:320
The time to merge polygon meshes. (See: rcMergePolyMeshes)
Definition: Recast.h:65
float cellSizeY
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:376
rcCompactSpan * spans
Array of spans. [Size: spanCount].
Definition: Recast.h:321
Specifies a configuration to use when performing Recast builds.
Definition: Recast.h:180
void resetLog()
Clears all log entries.
Definition: Recast.h:117
virtual void doStopTimer(const rcTimerLabel label)
Stops the specified performance timer.
Definition: Recast.h:164
void rcMarkConvexPolyArea(rcContext *ctx, const float *verts, const int nverts, const float hmin, const float hmax, navAreaMask areaId, rcCompactHeightfield &chf)
Applies the area id to the all spans within the specified convex polygon.
Definition: RecastArea.cpp:390
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:397
unsigned int index
Index to the first span in the column.
Definition: Recast.h:291
Represents a span in a heightfield.
Definition: Recast.h:250
rcContext(bool logAndProfile=true)
Contructor.
Definition: Recast.h:109
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:395
rcContour * conts
An array of the contours in the set. [Size: nconts].
Definition: Recast.h:371
int borderSize
The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]...
Definition: Recast.h:192
unsigned short minY
The lower extent of the span. (Measured from the heightfield's base.)
Definition: Recast.h:298
rcContourSet * rcAllocContourSet()
Allocates a contour set object using the Recast allocator.
Definition: Recast.cpp:134
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:280
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:378
Provides information on the content of a cell column in a compact heightfield.
Definition: Recast.h:289
int mergeRegionArea
Any regions with a span count smaller than this value will, if possible, be merged with larger region...
Definition: Recast.h:232
The time to build the polygon mesh detail. (See: rcBuildPolyMeshDetail)
Definition: Recast.h:93
The time to trace the boundaries of the contours. (See: rcBuildContours)
Definition: Recast.h:51
int nconts
The number of contours in the set.
Definition: Recast.h:372
int * verts
Simplified contour vertex and connection data. [Size: 4 * nverts].
Definition: Recast.h:359
int nmeshes
The number of sub-meshes defined by meshes.
Definition: Recast.h:409
unsigned int flag
Definition: Recast.h:557
bool rcBuildRegionsMonotone(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
Builds region data for the heightfield using simple monotone partitioning.
Definition: RecastRegion.cpp:1292
rcPolyMeshDetail * rcAllocPolyMeshDetail()
Allocates a detail mesh object using the Recast allocator.
Definition: Recast.cpp:170
float detailSampleDist
Sets the sampling distance to use when generating the detail mesh.
Definition: Recast.h:240
Represents a simple, non-overlapping contour in field space.
Definition: Recast.h:357
unsigned int count
Number of spans in the column.
Definition: Recast.h:292
bool rcBuildLayerRegions(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea)
Builds region data for the heightfield by partitioning the heightfield in non-overlapping layers...
Definition: RecastRegion.cpp:1604
An error log entry.
Definition: Recast.h:33
virtual void doLog(const rcLogCategory category, const char *msg, const int len)
Logs a message.
Definition: Recast.h:153
A progress log entry.
Definition: Recast.h:31
rcSpan * freelist
The next free span.
Definition: Recast.h:285
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:335
bool rcBuildRegions(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
Builds region data for the heightfield using watershed partitioning.
Definition: RecastRegion.cpp:1466
static const int RC_SPANS_PER_POOL
The number of spans allocated per span spool.
Definition: Recast.h:267
The time to mark a box area. (See: rcMarkBoxArea)
Definition: Recast.h:69
navAreaMask * areaMasks
The area mask assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:389
A compact, static heightfield representing unobstructed space.
Definition: Recast.h:306
The time to blur the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:79
Represents a group of related contours.
Definition: Recast.h:369
The time to build heightfield layers. (See: rcBuildHeightfieldLayers)
Definition: Recast.h:91
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:330
bool rcMergePolyMeshDetails(rcContext *ctx, rcPolyMeshDetail **meshes, const int nmeshes, rcPolyMeshDetail &mesh)
Merges multiple detail meshes into a single detail mesh.
Definition: RecastMeshDetail.cpp:1336
int maxx
The maximum x-bounds of usable data.
Definition: Recast.h:337
unsigned char * tris
The mesh triangles. [Size: 4*ntris].
Definition: Recast.h:408
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:281
A memory pool used for quick allocation of spans within a heightfield.
Definition: Recast.h:264
unsigned short * verts
The mesh vertices. [Form: (x, y, z) * nverts].
Definition: Recast.h:386
static const unsigned short RC_MESH_NULL_IDX
An value which indicates an invalid index within a mesh.
Definition: Recast.h:533
navAreaMask * areaMasks
Array containing area id data. [Size: spanCount].
Definition: Recast.h:323
The total time to apply the watershed algorithm. (See: rcBuildRegions)
Definition: Recast.h:83
bool rcBuildContours(rcContext *ctx, rcCompactHeightfield &chf, const float maxError, const int maxEdgeLen, rcContourSet &cset, const int buildFlags=RC_CONTOUR_TESS_WALL_EDGES)
Builds a contour set from the region outlines in the provided compact heightfield.
Definition: RecastContour.cpp:840
Represents a polygon mesh suitable for use in building a navigation mesh.
Definition: Recast.h:384
The total time to build the distance field. (See: rcBuildDistanceField)
Definition: Recast.h:75
static const int RC_BORDER_VERTEX
Border vertex flag.
Definition: Recast.h:507
bool rcCopyPolyMesh(rcContext *ctx, const rcPolyMesh &src, rcPolyMesh &dst)
Copies the poly mesh data from src to dst.
Definition: RecastMesh.cpp:1465
int minx
The minimum x-bounds of usable data.
Definition: Recast.h:336
rcHeightfieldLayerSet * rcAllocHeightfieldLayerSet()
Allocates a heightfield layer set using the Recast allocator.
Definition: Recast.cpp:113
int rcConvexhull(const float *pts, int npts, int *out)
The time to filter low height spans. (See: rcFilterWalkableLowHeightSpans)
Definition: Recast.h:57
The time to erode the walkable area. (See: rcErodeWalkableArea)
Definition: Recast.h:67
bool rcMergePolyMeshes(rcContext *ctx, rcPolyMesh **meshes, const int nmeshes, rcPolyMesh &mesh)
Merges multiple polygon meshes into a single mesh.
Definition: RecastMesh.cpp:1294
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:374
float bmax[3]
The maximum bounds in world space. [(x, y, z)].
Definition: Recast.h:317
rcTimerLabel
Recast performance timer categories.
Definition: Recast.h:38
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:308
The time to build the compact heightfield. (See: rcBuildCompactHeightfield)
Definition: Recast.h:47
unsigned int smin
The lower limit of the span. [Limit: < smax].
Definition: Recast.h:255
unsigned short reg
The region id of the contour.
Definition: Recast.h:363
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:528
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:457
virtual ~rcContext()
Definition: Recast.h:110
float * verts
The mesh vertices. [Size: 3*nverts].
Definition: Recast.h:407
void rcFreeHeightField(rcHeightfield *hf)
Frees the specified heightfield object using the Recast allocator.
Definition: Recast.cpp:80
The total time to build the regions. (See: rcBuildRegions, rcBuildRegionsMonotone) ...
Definition: Recast.h:81
bool rcBuildHeightfieldLayers(rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int walkableHeight, rcHeightfieldLayerSet &lset)
Builds a layer set from the specified compact heightfield.
Definition: RecastLayers.cpp:84
float bmax[3]
The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu].
Definition: Recast.h:204
void startTimer(const rcTimerLabel label)
Starts the specified performance timer.
Definition: Recast.h:133
int spanCount
The number of spans in the heightfield.
Definition: Recast.h:310
int walkableHeight
The walkable height used during the build of the field. (See: rcConfig::walkableHeight) ...
Definition: Recast.h:311
unsigned char * cons
Packed neighbor connection information. [Size: Same as heights].
Definition: Recast.h:344
virtual void doResetTimers()
Clears all timers. (Resets all to unused.)
Definition: Recast.h:156
int maxy
The maximum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:339
unsigned int smax
The upper limit of the span. [Limit: <= RC_SPAN_MAX_HEIGHT].
Definition: Recast.h:256
int walkableClimb
Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]...
Definition: Recast.h:214
The time to flood regions while applying the watershed algorithm. (See: rcBuildRegions) ...
Definition: Recast.h:87
unsigned int * meshes
The sub-mesh data. [Size: 4*nmeshes].
Definition: Recast.h:406
A user defined build time.
Definition: Recast.h:43
The time to expand regions while applying the watershed algorithm. (See: rcBuildRegions) ...
Definition: Recast.h:85
virtual void doResetLog()
Clears all log entries.
Definition: Recast.h:147
int walkableHeight
Minimum floor to 'ceiling' height that will still allow the floor area to be considered walkable...
Definition: Recast.h:211
void rcFreePolyMeshDetail(rcPolyMeshDetail *dmesh)
Frees the specified detail mesh using the Recast allocator.
Definition: Recast.cpp:177
void enableTimer(bool state)
Enables or disables the performance timers.
Definition: Recast.h:126
bool rcMedianFilterWalkableArea(rcContext *ctx, rcCompactHeightfield &chf)
Applies a median filter to walkable area types (based on area id), removing noise.
Definition: RecastArea.cpp:243
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:318
The time to merge polygon mesh details. (See: rcMergePolyMeshDetails)
Definition: Recast.h:95
int maxVertsPerPoly
The maximum number of vertices allowed for polygons generated during the contour to polygon conversio...
Definition: Recast.h:236
unsigned short maxDistance
The maximum distance value of any span within the field.
Definition: Recast.h:314
int height
The height of the field along the z-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:186
navAreaMask areaMask
The area id of the contour.
Definition: Recast.h:364
static const int RC_AREA_BORDER
Area border flag.
Definition: Recast.h:514
static const float RC_PI
The value of PI used by Recast.
Definition: Recast.h:25
float cellSizeXZ
The size of each cell. (On the xz-plane.)
Definition: Recast.h:332
int width
The width of the set. (Along the x-axis in cell units.)
Definition: Recast.h:377
The time to build the polygon mesh. (See: rcBuildPolyMesh)
Definition: Recast.h:63
int tileSize
The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx].
Definition: Recast.h:189
rcSpan * next
The next span higher up in column.
Definition: Recast.h:259
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:279
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:319
int height
Definition: Recast.h:556
float cellSizeXZ
The size of each cell. (On the xz-plane.)
Definition: Recast.h:375
int nlayers
The number of layers in the set.
Definition: Recast.h:353
rcCompactHeightfield * rcAllocCompactHeightfield()
Allocates a compact heightfield object using the Recast allocator.
Definition: Recast.cpp:95
rcSpanPool * next
The next span pool.
Definition: Recast.h:269
void log(const rcLogCategory category, const char *format,...)
Logs a message.
Definition: Recast.cpp:55
unsigned int height
The height of the span. (Measured from minY.)
Definition: Recast.h:301
static const int RC_SPAN_HEIGHT_BITS
Defines the number of bits allocated to rcSpan::smin and rcSpan::smax.
Definition: Recast.h:252
static const navAreaMask RC_WALKABLE_AREA
The default area id used to indicate a walkable polygon.
Definition: Recast.h:543
void rcFreeCompactHeightfield(rcCompactHeightfield *chf)
Frees the specified compact heightfield object using the Recast allocator.
Definition: Recast.cpp:102
int borderSize
The AABB border size used to generate the source data from which the contours were derived...
Definition: Recast.h:379
The time to apply the median filter. (See: rcMedianFilterWalkableArea)
Definition: Recast.h:59
int npolys
The number of polygons.
Definition: Recast.h:391
virtual int doGetAccumulatedTime(const rcTimerLabel label) const
Returns the total accumulated time of the specified performance timer.
Definition: Recast.h:169
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:278
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:334
The time to mark a cylinder area. (See: rcMarkCylinderArea)
Definition: Recast.h:71
void rcMarkBoxArea(rcContext *ctx, const float *bmin, const float *bmax, navAreaMask areaId, rcCompactHeightfield &chf)
Applies an area id to all spans within the specified bounding box.
Definition: RecastArea.cpp:322
void stopTimer(const rcTimerLabel label)
Stops the specified performance timer.
Definition: Recast.h:137
int walkableClimb
The walkable climb used during the build of the field. (See: rcConfig::walkableClimb) ...
Definition: Recast.h:312
int maxpolys
The number of allocated polygons.
Definition: Recast.h:392
int maxEdgeLen
The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]...
Definition: Recast.h:221
rcBuildContoursFlags
Contour build flags.
Definition: Recast.h:518
unsigned short * regs
The region id assigned to each polygon. [Length: maxpolys].
Definition: Recast.h:388
rcSpanPool * pools
Linked list of span pools.
Definition: Recast.h:284
The time to filter ledge spans. (See: rcFilterLedgeSpans)
Definition: Recast.h:55
The time to mark a convex polygon area. (See: rcMarkConvexPolyArea)
Definition: Recast.h:73
int nverts
The number of vertices in verts.
Definition: Recast.h:410
static const unsigned short RC_BORDER_REG
Heighfield border flag.
Definition: Recast.h:498
A warning log entry.
Definition: Recast.h:32
int minRegionArea
The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]...
Definition: Recast.h:228
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:331
unsigned int connectionData
Packed neighbor connection data.
Definition: Recast.h:300
int width
The width of the field along the x-axis. [Limit: >= 0] [Units: vx].
Definition: Recast.h:183
int hmin
The minimum height bounds of usable data. (Along the y-axis.)
Definition: Recast.h:340
unsigned short regionID
The id of the region the span belongs to. (Or zero if not in a region.)
Definition: Recast.h:299
Contains triangle meshes that represent detailed height data associated with the polygons in its asso...
Definition: Recast.h:404
The time to filter out small regions. (See: rcBuildRegions, rcBuildRegionsMonotone) ...
Definition: Recast.h:89
rcSpan ** spans
Heightfield of spans (width*height).
Definition: Recast.h:283
int nvp
The maximum number of vertices per polygon.
Definition: Recast.h:393
The time to simplify the contours. (See: rcBuildContours)
Definition: Recast.h:53
Represents a heightfield layer within a layer set.
Definition: Recast.h:328
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:316
The time to filter low obstacles. (See: rcFilterLowHangingWalkableObstacles)
Definition: Recast.h:61
int miny
The minimum y-bounds of usable data. (Along the z-axis.)
Definition: Recast.h:338