Recast Navigation
Navigation-mesh Toolset for Games
DetourNavMesh.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 DETOURNAVMESH_H
20 #define DETOURNAVMESH_H
21 
22 #include "DetourAlloc.h"
23 #include "DetourStatus.h"
24 
25 // Undefine (or define in a build config) the following line to use 64bit polyref.
26 // Generally not needed, useful for very large worlds.
27 // Note: tiles build using 32bit refs are not compatible with 64bit refs!
28 //#define DT_POLYREF64 1
29 
30 #ifdef DT_POLYREF64
31 // TODO: figure out a multiplatform version of uint64_t
32 // - maybe: https://code.google.com/p/msinttypes/
33 // - or: http://www.azillionmonkeys.com/qed/pstdint.h
34 #include <stdint.h>
35 #endif
36 
37 // Note: If you want to use 64-bit refs, change the types of both dtPolyRef & dtTileRef.
38 // It is also recommended that you change dtHashRef() to a proper 64-bit hash.
39 
42 #ifdef DT_POLYREF64
43 static const unsigned int DT_SALT_BITS = 16;
44 static const unsigned int DT_TILE_BITS = 28;
45 static const unsigned int DT_POLY_BITS = 20;
46 typedef uint64_t dtPolyRef;
47 #else
48 typedef unsigned int dtPolyRef;
49 #endif
50 
53 #ifdef DT_POLYREF64
54 typedef uint64_t dtTileRef;
55 #else
56 typedef unsigned int dtTileRef;
57 #endif
58 
61 static const int DT_VERTS_PER_POLYGON = 6;
62 
68 
70 static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V';
71 
73 static const int DT_NAVMESH_VERSION = 7;
74 
76 static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S';
77 
79 static const int DT_NAVMESH_STATE_VERSION = 1;
80 
82 
85 static const unsigned short DT_EXT_LINK = 0x8000;
86 
88 static const unsigned int DT_NULL_LINK = 0xffffffff;
89 
91 static const unsigned int DT_OFFMESH_CON_BIDIR = 1;
92 
95 static const int DT_MAX_AREAS = 64;
96 
100 {
102  DT_TILE_FREE_DATA = 0x01
103 };
104 
107 {
111 };
112 
115 {
118 };
119 
120 
123 {
124  DT_FINDPATH_ANY_ANGLE = 0x02
125 };
126 
129 {
130  DT_RAYCAST_USE_COSTS = 0x01
131 };
132 
134 {
136 };
137 
138 
141 static const float DT_RAY_CAST_LIMIT_PROPORTIONS = 50.0f;
142 
145 {
150 };
151 
152 
155 struct dtPoly
156 {
158  unsigned int firstLink;
159 
162  unsigned short verts[DT_VERTS_PER_POLYGON];
163 
165  unsigned short neis[DT_VERTS_PER_POLYGON];
166 
168  unsigned short flags;
169 
171  unsigned char vertCount;
172 
175  unsigned char areaAndtype;
176 
178  inline void setArea(unsigned char a) { areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f); }
179 
181  inline void setType(unsigned char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
182 
184  inline unsigned char getArea() const { return areaAndtype & 0x3f; }
185 
187  inline unsigned char getType() const { return areaAndtype >> 6; }
188 };
189 
192 {
193  unsigned int vertBase;
194  unsigned int triBase;
195  unsigned char vertCount;
196  unsigned char triCount;
197 };
198 
202 struct dtLink
203 {
205  unsigned int next;
206  unsigned char edge;
207  unsigned char side;
208  unsigned char bmin;
209  unsigned char bmax;
210 };
211 
215 struct dtBVNode
216 {
217  unsigned short bmin[3];
218  unsigned short bmax[3];
219  int i;
220 };
221 
225 {
227  float pos[6];
228 
230  float rad;
231 
233  unsigned short poly;
234 
238  unsigned char flags;
239 
241  unsigned char side;
242 
244  unsigned int userId;
245 };
246 
250 {
251  int magic;
252  int version;
253  int x;
254  int y;
255  int layer;
256  unsigned int userId;
257  int polyCount;
258  int vertCount;
261 
264 
272  float bmin[3];
273  float bmax[3];
274 
277 };
278 
282 {
283  unsigned int salt;
284 
285  unsigned int linksFreeList;
288  float* verts;
291 
293  float* detailVerts;
294 
297  unsigned char* detailTris;
298 
302 
304 
305  unsigned char* data;
306  int dataSize;
307  int flags;
309 private:
310  dtMeshTile(const dtMeshTile&);
311  dtMeshTile& operator=(const dtMeshTile&);
312 };
313 
318 inline int dtGetDetailTriEdgeFlags(unsigned char triFlags, int edgeIndex)
319 {
320  return (triFlags >> (edgeIndex * 2)) & 0x3;
321 }
322 
328 {
329  float orig[3];
330  float tileWidth;
331  float tileHeight;
332  int maxTiles;
333  int maxPolys;
334 };
335 
339 {
340 public:
341  dtNavMesh();
342  ~dtNavMesh();
343 
346 
350  dtStatus init(const dtNavMeshParams* params);
351 
358  dtStatus init(unsigned char* data, const int dataSize, const int flags);
359 
361  const dtNavMeshParams* getParams() const;
362 
370  dtStatus addTile(unsigned char* data, int dataSize, int flags, dtTileRef lastRef, dtTileRef* result);
371 
377  dtStatus removeTile(dtTileRef ref, unsigned char** data, int* dataSize);
378 
380 
383 
388  void calcTileLoc(const float* pos, int* tx, int* ty) const;
389 
395  const dtMeshTile* getTileAt(const int x, const int y, const int layer) const;
396 
403  int getTilesAt(const int x, const int y,
404  dtMeshTile const** tiles, const int maxTiles) const;
405 
411  dtTileRef getTileRefAt(int x, int y, int layer) const;
412 
416  dtTileRef getTileRef(const dtMeshTile* tile) const;
417 
422  const dtMeshTile* getTileByRef(dtTileRef ref) const;
423 
426  int getMaxTiles() const;
427 
431  const dtMeshTile* getTile(int i) const;
432 
438  dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
439 
444  void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
445 
449  bool isValidPolyRef(dtPolyRef ref) const;
450 
454  dtPolyRef getPolyRefBase(const dtMeshTile* tile) const;
455 
462  dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
463 
468 
470 
474 
479  dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags);
480 
485  dtStatus getPolyFlags(dtPolyRef ref, unsigned short* resultFlags) const;
486 
491  dtStatus setPolyArea(dtPolyRef ref, unsigned char area);
492 
497  dtStatus getPolyArea(dtPolyRef ref, unsigned char* resultArea) const;
498 
502  int getTileStateSize(const dtMeshTile* tile) const;
503 
509  dtStatus storeTileState(const dtMeshTile* tile, unsigned char* data, const int maxDataSize) const;
510 
516  dtStatus restoreTileState(dtMeshTile* tile, const unsigned char* data, const int maxDataSize);
517 
519 
523 
529  inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
530  {
531 #ifdef DT_POLYREF64
532  return ((dtPolyRef)salt << (DT_POLY_BITS+DT_TILE_BITS)) | ((dtPolyRef)it << DT_POLY_BITS) | (dtPolyRef)ip;
533 #else
534  return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
535 #endif
536  }
537 
545  inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
546  {
547 #ifdef DT_POLYREF64
548  const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
549  const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
550  const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
551  salt = (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
552  it = (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
553  ip = (unsigned int)(ref & polyMask);
554 #else
555  const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
556  const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
557  const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
558  salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
559  it = (unsigned int)((ref >> m_polyBits) & tileMask);
560  ip = (unsigned int)(ref & polyMask);
561 #endif
562  }
563 
568  inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
569  {
570 #ifdef DT_POLYREF64
571  const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
572  return (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
573 #else
574  const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
575  return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
576 #endif
577  }
578 
583  inline unsigned int decodePolyIdTile(dtPolyRef ref) const
584  {
585 #ifdef DT_POLYREF64
586  const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
587  return (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
588 #else
589  const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
590  return (unsigned int)((ref >> m_polyBits) & tileMask);
591 #endif
592  }
593 
598  inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
599  {
600 #ifdef DT_POLYREF64
601  const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
602  return (unsigned int)(ref & polyMask);
603 #else
604  const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
605  return (unsigned int)(ref & polyMask);
606 #endif
607  }
608 
610 
611 private:
612  // Explicitly disabled copy constructor and copy assignment operator.
613  dtNavMesh(const dtNavMesh&);
614  dtNavMesh& operator=(const dtNavMesh&);
615 
617  dtMeshTile* getTile(int i);
618 
620  int getTilesAt(const int x, const int y,
621  dtMeshTile** tiles, const int maxTiles) const;
622 
624  int getNeighbourTilesAt(const int x, const int y, const int side,
625  dtMeshTile** tiles, const int maxTiles) const;
626 
628  int findConnectingPolys(const float* va, const float* vb,
629  const dtMeshTile* tile, int side,
630  dtPolyRef* con, float* conarea, int maxcon) const;
631 
633  void connectIntLinks(dtMeshTile* tile);
635  void baseOffMeshLinks(dtMeshTile* tile);
636 
638  void connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side);
640  void connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side);
641 
643  void unconnectLinks(dtMeshTile* tile, dtMeshTile* target);
644 
645 
646  // TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding.
647 
649  int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax,
650  dtPolyRef* polys, const int maxPolys) const;
652  dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center,
653  const float* halfExtents, float* nearestPt) const;
655  bool getPolyHeight(const dtMeshTile* tile, const dtPoly* poly, const float* pos, float* height) const;
657  void closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const;
658 
659  dtNavMeshParams m_params;
660  float m_orig[3];
661  float m_tileWidth, m_tileHeight;
662  int m_maxTiles;
663  int m_tileLutSize;
664  int m_tileLutMask;
665 
666  dtMeshTile** m_posLookup;
667  dtMeshTile* m_nextFree;
668  dtMeshTile* m_tiles;
669 
670 #ifndef DT_POLYREF64
671  unsigned int m_saltBits;
672  unsigned int m_tileBits;
673  unsigned int m_polyBits;
674 #endif
675 
676  friend class dtNavMeshQuery;
677 };
678 
683 
687 void dtFreeNavMesh(dtNavMesh* navmesh);
688 
689 #endif // DETOURNAVMESH_H
690 
692 
693 // This section contains detailed documentation for members that don't have
694 // a source file. It reduces clutter in the main section of the header.
695 
dtPolyTypes
Flags representing the type of a navigation mesh polygon.
Definition: DetourNavMesh.h:145
@ DT_POLYTYPE_GROUND
The polygon is a standard convex polygon that is part of the surface of the mesh.
Definition: DetourNavMesh.h:147
@ DT_POLYTYPE_OFFMESH_CONNECTION
The polygon is an off-mesh connection consisting of two vertices.
Definition: DetourNavMesh.h:149
dtStraightPathOptions
Options for dtNavMeshQuery::findStraightPath.
Definition: DetourNavMesh.h:115
@ DT_STRAIGHTPATH_AREA_CROSSINGS
Add a vertex at every polygon edge crossing where area changes.
Definition: DetourNavMesh.h:116
@ DT_STRAIGHTPATH_ALL_CROSSINGS
Add a vertex at every polygon edge crossing.
Definition: DetourNavMesh.h:117
dtDetailTriEdgeFlags
Definition: DetourNavMesh.h:134
@ DT_DETAIL_EDGE_BOUNDARY
Detail triangle edge is part of the poly boundary.
Definition: DetourNavMesh.h:135
static const float DT_RAY_CAST_LIMIT_PROPORTIONS
Limit raycasting during any angle pahfinding The limit is given as a multiple of the character radius...
Definition: DetourNavMesh.h:141
int dtGetDetailTriEdgeFlags(unsigned char triFlags, int edgeIndex)
Get flags for edge in detail triangle.
Definition: DetourNavMesh.h:318
static const int DT_NAVMESH_VERSION
A version number used to detect compatibility of navigation tile data.
Definition: DetourNavMesh.h:73
dtRaycastOptions
Options for dtNavMeshQuery::raycast.
Definition: DetourNavMesh.h:129
@ DT_RAYCAST_USE_COSTS
Raycast should calculate movement cost along the ray and fill RaycastHit::cost.
Definition: DetourNavMesh.h:130
static const unsigned short DT_EXT_LINK
A flag that indicates that an entity links to an external entity.
Definition: DetourNavMesh.h:85
dtFindPathOptions
Options for dtNavMeshQuery::initSlicedFindPath and updateSlicedFindPath.
Definition: DetourNavMesh.h:123
@ DT_FINDPATH_ANY_ANGLE
use raycasts during pathfind to "shortcut" (raycast still consider costs)
Definition: DetourNavMesh.h:124
static const int DT_NAVMESH_MAGIC
A magic number used to detect compatibility of navigation tile data.
Definition: DetourNavMesh.h:70
dtStraightPathFlags
Vertex flags returned by dtNavMeshQuery::findStraightPath.
Definition: DetourNavMesh.h:107
@ DT_STRAIGHTPATH_END
The vertex is the end position in the path.
Definition: DetourNavMesh.h:109
@ DT_STRAIGHTPATH_START
The vertex is the start position in the path.
Definition: DetourNavMesh.h:108
@ DT_STRAIGHTPATH_OFFMESH_CONNECTION
The vertex is the start of an off-mesh connection.
Definition: DetourNavMesh.h:110
static const unsigned int DT_NULL_LINK
A value that indicates the entity does not link to anything.
Definition: DetourNavMesh.h:88
dtTileFlags
Tile flags used for various functions and fields.
Definition: DetourNavMesh.h:100
@ DT_TILE_FREE_DATA
The navigation mesh owns the tile memory and is responsible for freeing it.
Definition: DetourNavMesh.h:102
static const int DT_NAVMESH_STATE_VERSION
A version number used to detect compatibility of navigation tile states.
Definition: DetourNavMesh.h:79
static const unsigned int DT_OFFMESH_CON_BIDIR
A flag that indicates that an off-mesh connection can be traversed in both directions....
Definition: DetourNavMesh.h:91
static const int DT_NAVMESH_STATE_MAGIC
A magic number used to detect the compatibility of navigation tile states.
Definition: DetourNavMesh.h:76
unsigned int dtStatus
Definition: DetourStatus.h:22
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:166
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:339
dtStatus init(const dtNavMeshParams *params)
Initializes the navigation mesh for tiled use.
Definition: DetourNavMesh.cpp:224
dtPolyRef getPolyRefBase(const dtMeshTile *tile) const
Gets the polygon reference for the tile's base polygon.
Definition: DetourNavMesh.cpp:1356
~dtNavMesh()
Definition: DetourNavMesh.cpp:209
dtStatus storeTileState(const dtMeshTile *tile, unsigned char *data, const int maxDataSize) const
Stores the non-structural state of the tile in the specified buffer.
Definition: DetourNavMesh.cpp:1390
dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
Derives a standard polygon reference.
Definition: DetourNavMesh.h:529
int getMaxTiles() const
The maximum number of tiles supported by the navigation mesh.
Definition: DetourNavMesh.cpp:1176
int getTilesAt(const int x, const int y, dtMeshTile const **tiles, const int maxTiles) const
Gets all tiles at the specified grid location.
Definition: DetourNavMesh.cpp:1120
const dtOffMeshConnection * getOffMeshConnectionByRef(dtPolyRef ref) const
Gets the specified off-mesh connection.
Definition: DetourNavMesh.cpp:1502
dtNavMesh()
Definition: DetourNavMesh.cpp:188
dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
Gets the tile and polygon for the specified polygon reference.
Definition: DetourNavMesh.cpp:1197
const dtMeshTile * getTile(int i) const
Gets the tile at the specified index.
Definition: DetourNavMesh.cpp:1186
unsigned int decodePolyIdSalt(dtPolyRef ref) const
Extracts a tile's salt value from the specified polygon reference.
Definition: DetourNavMesh.h:568
dtStatus addTile(unsigned char *data, int dataSize, int flags, dtTileRef lastRef, dtTileRef *result)
Adds a tile to the navigation mesh.
Definition: DetourNavMesh.cpp:908
dtStatus removeTile(dtTileRef ref, unsigned char **data, int *dataSize)
Removes the specified tile from the navigation mesh.
Definition: DetourNavMesh.cpp:1240
dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float *startPos, float *endPos) const
Gets the endpoints for an off-mesh connection, ordered by "direction of travel".
Definition: DetourNavMesh.cpp:1459
dtTileRef getTileRef(const dtMeshTile *tile) const
Gets the tile reference for the specified tile.
Definition: DetourNavMesh.cpp:1335
void calcTileLoc(const float *pos, int *tx, int *ty) const
Calculates the tile grid location for the specified world position.
Definition: DetourNavMesh.cpp:1191
dtStatus setPolyArea(dtPolyRef ref, unsigned char area)
Sets the user defined area for the specified polygon.
Definition: DetourNavMesh.cpp:1560
bool isValidPolyRef(dtPolyRef ref) const
Checks the validity of a polygon reference.
Definition: DetourNavMesh.cpp:1223
dtTileRef getTileRefAt(int x, int y, int layer) const
Gets the tile reference for the tile at specified grid location.
Definition: DetourNavMesh.cpp:1143
dtStatus getPolyFlags(dtPolyRef ref, unsigned short *resultFlags) const
Gets the user defined flags for the specified polygon.
Definition: DetourNavMesh.cpp:1544
const dtNavMeshParams * getParams() const
The navigation mesh initialization params.
Definition: DetourNavMesh.cpp:294
unsigned int decodePolyIdPoly(dtPolyRef ref) const
Extracts the polygon's index (within its tile) from the specified polygon reference.
Definition: DetourNavMesh.h:598
unsigned int decodePolyIdTile(dtPolyRef ref) const
Extracts the tile's index from the specified polygon reference.
Definition: DetourNavMesh.h:583
dtStatus getPolyArea(dtPolyRef ref, unsigned char *resultArea) const
Gets the user defined area for the specified polygon.
Definition: DetourNavMesh.cpp:1576
int getTileStateSize(const dtMeshTile *tile) const
Gets the size of the buffer required by storeTileState to store the specified tile's state.
Definition: DetourNavMesh.cpp:1377
void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
Returns the tile and polygon for the specified polygon reference.
Definition: DetourNavMesh.cpp:1215
const dtMeshTile * getTileByRef(dtTileRef ref) const
Gets the tile for the specified tile reference.
Definition: DetourNavMesh.cpp:1162
const dtMeshTile * getTileAt(const int x, const int y, const int layer) const
Gets the tile at the specified grid location.
Definition: DetourNavMesh.cpp:1057
dtStatus restoreTileState(dtMeshTile *tile, const unsigned char *data, const int maxDataSize)
Restores the state of the tile.
Definition: DetourNavMesh.cpp:1422
dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags)
Sets the user defined flags for the specified polygon.
Definition: DetourNavMesh.cpp:1527
void decodePolyId(dtPolyRef ref, unsigned int &salt, unsigned int &it, unsigned int &ip) const
Decodes a standard polygon reference.
Definition: DetourNavMesh.h:545
dtNavMesh * dtAllocNavMesh()
Allocates a navigation mesh object using the Detour allocator.
Definition: DetourNavMesh.cpp:138
unsigned int dtTileRef
A handle to a tile within a navigation mesh.
Definition: DetourNavMesh.h:56
static const int DT_VERTS_PER_POLYGON
The maximum number of vertices per navigation polygon.
Definition: DetourNavMesh.h:61
static const int DT_MAX_AREAS
The maximum number of user defined area ids.
Definition: DetourNavMesh.h:95
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:48
void dtFreeNavMesh(dtNavMesh *navmesh)
Frees the specified navigation mesh object using the Detour allocator.
Definition: DetourNavMesh.cpp:149
Bounding volume node.
Definition: DetourNavMesh.h:216
unsigned short bmin[3]
Minimum bounds of the node's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:217
int i
The node's index. (Negative for escape sequence.)
Definition: DetourNavMesh.h:219
unsigned short bmax[3]
Maximum bounds of the node's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:218
Provides high level information related to a dtMeshTile object.
Definition: DetourNavMesh.h:250
int detailTriCount
The number of triangles in the detail mesh.
Definition: DetourNavMesh.h:265
unsigned int userId
The user defined id of the tile.
Definition: DetourNavMesh.h:256
int version
Tile data format version number.
Definition: DetourNavMesh.h:252
int bvNodeCount
The number of bounding volume nodes. (Zero if bounding volumes are disabled.)
Definition: DetourNavMesh.h:266
int magic
Tile magic number. (Used to identify the data format.)
Definition: DetourNavMesh.h:251
int detailMeshCount
The number of sub-meshes in the detail mesh.
Definition: DetourNavMesh.h:260
float bmax[3]
The maximum bounds of the tile's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:273
float walkableHeight
The height of the agents using the tile.
Definition: DetourNavMesh.h:269
int y
The y-position of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:254
int vertCount
The number of vertices in the tile.
Definition: DetourNavMesh.h:258
int polyCount
The number of polygons in the tile.
Definition: DetourNavMesh.h:257
float bvQuantFactor
The bounding volume quantization factor.
Definition: DetourNavMesh.h:276
int maxLinkCount
The number of allocated links.
Definition: DetourNavMesh.h:259
float walkableClimb
The maximum climb height of the agents using the tile.
Definition: DetourNavMesh.h:271
int detailVertCount
The number of unique vertices in the detail mesh. (In addition to the polygon vertices....
Definition: DetourNavMesh.h:263
float bmin[3]
The minimum bounds of the tile's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:272
int offMeshBase
The index of the first polygon which is an off-mesh connection.
Definition: DetourNavMesh.h:268
int layer
The layer of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:255
int x
The x-position of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:253
float walkableRadius
The radius of the agents using the tile.
Definition: DetourNavMesh.h:270
int offMeshConCount
The number of off-mesh connections.
Definition: DetourNavMesh.h:267
Defines a navigation mesh tile.
Definition: DetourNavMesh.h:282
dtLink * links
The tile links. [Size: dtMeshHeader::maxLinkCount].
Definition: DetourNavMesh.h:289
int dataSize
Size of the tile data.
Definition: DetourNavMesh.h:306
dtBVNode * bvTree
The tile bounding volume nodes.
Definition: DetourNavMesh.h:301
unsigned int salt
Counter describing modifications to the tile.
Definition: DetourNavMesh.h:283
unsigned char * detailTris
The detail mesh's triangles.
Definition: DetourNavMesh.h:297
dtMeshTile * next
The next free tile, or the next tile in the spatial grid.
Definition: DetourNavMesh.h:308
dtMeshHeader * header
The tile header.
Definition: DetourNavMesh.h:286
float * detailVerts
The detail mesh's unique vertices. [(x, y, z) * dtMeshHeader::detailVertCount].
Definition: DetourNavMesh.h:293
int flags
Tile flags. (See: dtTileFlags)
Definition: DetourNavMesh.h:307
dtPolyDetail * detailMeshes
The tile's detail sub-meshes. [Size: dtMeshHeader::detailMeshCount].
Definition: DetourNavMesh.h:290
dtOffMeshConnection * offMeshCons
The tile off-mesh connections. [Size: dtMeshHeader::offMeshConCount].
Definition: DetourNavMesh.h:303
dtPoly * polys
The tile polygons. [Size: dtMeshHeader::polyCount].
Definition: DetourNavMesh.h:287
float * verts
The tile vertices. [(x, y, z) * dtMeshHeader::vertCount].
Definition: DetourNavMesh.h:288
unsigned int linksFreeList
Index to the next free link.
Definition: DetourNavMesh.h:285
unsigned char * data
The tile data. (Not directly accessed under normal situations.)
Definition: DetourNavMesh.h:305
Configuration parameters used to define multi-tile navigation meshes.
Definition: DetourNavMesh.h:328
float orig[3]
The world space origin of the navigation mesh's tile space. [(x, y, z)].
Definition: DetourNavMesh.h:329
int maxPolys
The maximum number of polygons each tile can contain. This and maxTiles are used to calculate how man...
Definition: DetourNavMesh.h:333
float tileWidth
The width of each tile. (Along the x-axis.)
Definition: DetourNavMesh.h:330
float tileHeight
The height of each tile. (Along the z-axis.)
Definition: DetourNavMesh.h:331
int maxTiles
The maximum number of tiles the navigation mesh can contain. This and maxPolys are used to calculate ...
Definition: DetourNavMesh.h:332
Defines an navigation mesh off-mesh connection within a dtMeshTile object.
Definition: DetourNavMesh.h:225
unsigned int userId
The id of the offmesh connection. (User assigned when the navigation mesh is built....
Definition: DetourNavMesh.h:244
float pos[6]
The endpoints of the connection. [(ax, ay, az, bx, by, bz)].
Definition: DetourNavMesh.h:227
unsigned short poly
The polygon reference of the connection within the tile.
Definition: DetourNavMesh.h:233
unsigned char side
End point side.
Definition: DetourNavMesh.h:241
unsigned char flags
Link flags.
Definition: DetourNavMesh.h:238
float rad
The radius of the endpoints. [Limit: >= 0].
Definition: DetourNavMesh.h:230
Defines the location of detail sub-mesh data within a dtMeshTile.
Definition: DetourNavMesh.h:192
unsigned char vertCount
The number of vertices in the sub-mesh.
Definition: DetourNavMesh.h:195
unsigned int triBase
The offset of the triangles in the dtMeshTile::detailTris array.
Definition: DetourNavMesh.h:194
unsigned int vertBase
The offset of the vertices in the dtMeshTile::detailVerts array.
Definition: DetourNavMesh.h:193
unsigned char triCount
The number of triangles in the sub-mesh.
Definition: DetourNavMesh.h:196
Defines a polygon within a dtMeshTile object.
Definition: DetourNavMesh.h:156
unsigned char getType() const
Gets the polygon type. (See: dtPolyTypes)
Definition: DetourNavMesh.h:187
unsigned short flags
The user defined polygon flags.
Definition: DetourNavMesh.h:168
unsigned int firstLink
Index to first link in linked list. (Or DT_NULL_LINK if there is no link.)
Definition: DetourNavMesh.h:158
void setArea(unsigned char a)
Sets the user defined area id. [Limit: < DT_MAX_AREAS].
Definition: DetourNavMesh.h:178
unsigned char getArea() const
Gets the user defined area id.
Definition: DetourNavMesh.h:184
unsigned short neis[DT_VERTS_PER_POLYGON]
Packed data representing neighbor polygons references and flags for each edge.
Definition: DetourNavMesh.h:165
void setType(unsigned char t)
Sets the polygon type. (See: dtPolyTypes.)
Definition: DetourNavMesh.h:181
unsigned short verts[DT_VERTS_PER_POLYGON]
The indices of the polygon's vertices.
Definition: DetourNavMesh.h:162
unsigned char areaAndtype
The bit packed area id and polygon type.
Definition: DetourNavMesh.h:175
unsigned char vertCount
The number of vertices in the polygon.
Definition: DetourNavMesh.h:171