Recast Navigation
Navigation-mesh Toolset for Games
Loading...
Searching...
No Matches
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
43static const unsigned int DT_SALT_BITS = 16;
44static const unsigned int DT_TILE_BITS = 28;
45static const unsigned int DT_POLY_BITS = 20;
46typedef uint64_t dtPolyRef;
47#else
48typedef unsigned int dtPolyRef;
49#endif
50
53#ifdef DT_POLYREF64
54typedef uint64_t dtTileRef;
55#else
56typedef unsigned int dtTileRef;
57#endif
58
61static const int DT_VERTS_PER_POLYGON = 6;
62
68
70static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V';
71
73static const int DT_NAVMESH_VERSION = 7;
74
76static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S';
77
79static const int DT_NAVMESH_STATE_VERSION = 1;
80
82
85static const unsigned short DT_EXT_LINK = 0x8000;
86
88static const unsigned int DT_NULL_LINK = 0xffffffff;
89
91static const unsigned int DT_OFFMESH_CON_BIDIR = 1;
92
95static const int DT_MAX_AREAS = 64;
96
100{
102 DT_TILE_FREE_DATA = 0x01
104
112
119
120
126
132
137
138
141static const float DT_RAY_CAST_LIMIT_PROPORTIONS = 50.0f;
142
151
152
155struct dtPoly
156{
158 unsigned int firstLink;
159
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
202struct dtLink
203{
205 unsigned int next;
206 unsigned char edge;
207 unsigned char side;
208 unsigned char bmin;
209 unsigned char bmax;
210};
211
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
278
310
315inline int dtGetDetailTriEdgeFlags(unsigned char triFlags, int edgeIndex)
316{
317 return (triFlags >> (edgeIndex * 2)) & 0x3;
318}
319
325{
326 float orig[3];
327 float tileWidth;
331};
332
336{
337public:
338 dtNavMesh();
339 ~dtNavMesh();
340
343
347 dtStatus init(const dtNavMeshParams* params);
348
355 dtStatus init(unsigned char* data, const int dataSize, const int flags);
356
358 const dtNavMeshParams* getParams() const;
359
367 dtStatus addTile(unsigned char* data, int dataSize, int flags, dtTileRef lastRef, dtTileRef* result);
368
374 dtStatus removeTile(dtTileRef ref, unsigned char** data, int* dataSize);
375
377
380
385 void calcTileLoc(const float* pos, int* tx, int* ty) const;
386
392 const dtMeshTile* getTileAt(const int x, const int y, const int layer) const;
393
400 int getTilesAt(const int x, const int y,
401 dtMeshTile const** tiles, const int maxTiles) const;
402
408 dtTileRef getTileRefAt(int x, int y, int layer) const;
409
413 dtTileRef getTileRef(const dtMeshTile* tile) const;
414
419 const dtMeshTile* getTileByRef(dtTileRef ref) const;
420
423 int getMaxTiles() const;
424
428 const dtMeshTile* getTile(int i) const;
429
435 dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
436
441 void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
442
446 bool isValidPolyRef(dtPolyRef ref) const;
447
451 dtPolyRef getPolyRefBase(const dtMeshTile* tile) const;
452
459 dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
460
465
467
471
476 dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags);
477
482 dtStatus getPolyFlags(dtPolyRef ref, unsigned short* resultFlags) const;
483
488 dtStatus setPolyArea(dtPolyRef ref, unsigned char area);
489
494 dtStatus getPolyArea(dtPolyRef ref, unsigned char* resultArea) const;
495
499 int getTileStateSize(const dtMeshTile* tile) const;
500
506 dtStatus storeTileState(const dtMeshTile* tile, unsigned char* data, const int maxDataSize) const;
507
513 dtStatus restoreTileState(dtMeshTile* tile, const unsigned char* data, const int maxDataSize);
514
516
520
526 inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
527 {
528#ifdef DT_POLYREF64
529 return ((dtPolyRef)salt << (DT_POLY_BITS+DT_TILE_BITS)) | ((dtPolyRef)it << DT_POLY_BITS) | (dtPolyRef)ip;
530#else
531 return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
532#endif
533 }
534
542 inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
543 {
544#ifdef DT_POLYREF64
545 const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
546 const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
547 const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
548 salt = (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
549 it = (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
550 ip = (unsigned int)(ref & polyMask);
551#else
552 const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
553 const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
554 const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
555 salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
556 it = (unsigned int)((ref >> m_polyBits) & tileMask);
557 ip = (unsigned int)(ref & polyMask);
558#endif
559 }
560
565 inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
566 {
567#ifdef DT_POLYREF64
568 const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
569 return (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
570#else
571 const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
572 return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
573#endif
574 }
575
580 inline unsigned int decodePolyIdTile(dtPolyRef ref) const
581 {
582#ifdef DT_POLYREF64
583 const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
584 return (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
585#else
586 const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
587 return (unsigned int)((ref >> m_polyBits) & tileMask);
588#endif
589 }
590
595 inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
596 {
597#ifdef DT_POLYREF64
598 const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
599 return (unsigned int)(ref & polyMask);
600#else
601 const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
602 return (unsigned int)(ref & polyMask);
603#endif
604 }
605
607
608private:
609 // Explicitly disabled copy constructor and copy assignment operator.
610 dtNavMesh(const dtNavMesh&);
611 dtNavMesh& operator=(const dtNavMesh&);
612
614 dtMeshTile* getTile(int i);
615
617 int getTilesAt(const int x, const int y,
618 dtMeshTile** tiles, const int maxTiles) const;
619
621 int getNeighbourTilesAt(const int x, const int y, const int side,
622 dtMeshTile** tiles, const int maxTiles) const;
623
625 int findConnectingPolys(const float* va, const float* vb,
626 const dtMeshTile* tile, int side,
627 dtPolyRef* con, float* conarea, int maxcon) const;
628
630 void connectIntLinks(dtMeshTile* tile);
632 void baseOffMeshLinks(dtMeshTile* tile);
633
635 void connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side);
637 void connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side);
638
640 void unconnectLinks(dtMeshTile* tile, dtMeshTile* target);
641
642
643 // TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding.
644
646 int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax,
647 dtPolyRef* polys, const int maxPolys) const;
649 dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center,
650 const float* halfExtents, float* nearestPt) const;
652 bool getPolyHeight(const dtMeshTile* tile, const dtPoly* poly, const float* pos, float* height) const;
654 void closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const;
655
656 dtNavMeshParams m_params;
657 float m_orig[3];
658 float m_tileWidth, m_tileHeight;
659 int m_maxTiles;
660 int m_tileLutSize;
661 int m_tileLutMask;
662
663 dtMeshTile** m_posLookup;
664 dtMeshTile* m_nextFree;
665 dtMeshTile* m_tiles;
666
667#ifndef DT_POLYREF64
668 unsigned int m_saltBits;
669 unsigned int m_tileBits;
670 unsigned int m_polyBits;
671#endif
672
673 friend class dtNavMeshQuery;
674};
675
680
684void dtFreeNavMesh(dtNavMesh* navmesh);
685
686#endif // DETOURNAVMESH_H
687
689
690// This section contains detailed documentation for members that don't have
691// a source file. It reduces clutter in the main section of the header.
692
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:315
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:336
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:1360
~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:1394
dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
Derives a standard polygon reference.
Definition DetourNavMesh.h:526
int getMaxTiles() const
The maximum number of tiles supported by the navigation mesh.
Definition DetourNavMesh.cpp:1180
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:1124
const dtOffMeshConnection * getOffMeshConnectionByRef(dtPolyRef ref) const
Gets the specified off-mesh connection.
Definition DetourNavMesh.cpp:1506
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:1201
const dtMeshTile * getTile(int i) const
Gets the tile at the specified index.
Definition DetourNavMesh.cpp:1190
unsigned int decodePolyIdSalt(dtPolyRef ref) const
Extracts a tile's salt value from the specified polygon reference.
Definition DetourNavMesh.h:565
dtStatus addTile(unsigned char *data, int dataSize, int flags, dtTileRef lastRef, dtTileRef *result)
Adds a tile to the navigation mesh.
Definition DetourNavMesh.cpp:912
dtStatus removeTile(dtTileRef ref, unsigned char **data, int *dataSize)
Removes the specified tile from the navigation mesh.
Definition DetourNavMesh.cpp:1244
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:1463
dtTileRef getTileRef(const dtMeshTile *tile) const
Gets the tile reference for the specified tile.
Definition DetourNavMesh.cpp:1339
void calcTileLoc(const float *pos, int *tx, int *ty) const
Calculates the tile grid location for the specified world position.
Definition DetourNavMesh.cpp:1195
dtStatus setPolyArea(dtPolyRef ref, unsigned char area)
Sets the user defined area for the specified polygon.
Definition DetourNavMesh.cpp:1564
bool isValidPolyRef(dtPolyRef ref) const
Checks the validity of a polygon reference.
Definition DetourNavMesh.cpp:1227
dtTileRef getTileRefAt(int x, int y, int layer) const
Gets the tile reference for the tile at specified grid location.
Definition DetourNavMesh.cpp:1147
dtStatus getPolyFlags(dtPolyRef ref, unsigned short *resultFlags) const
Gets the user defined flags for the specified polygon.
Definition DetourNavMesh.cpp:1548
const dtNavMeshParams * getParams() const
The navigation mesh initialization params.
Definition DetourNavMesh.cpp:298
unsigned int decodePolyIdPoly(dtPolyRef ref) const
Extracts the polygon's index (within its tile) from the specified polygon reference.
Definition DetourNavMesh.h:595
unsigned int decodePolyIdTile(dtPolyRef ref) const
Extracts the tile's index from the specified polygon reference.
Definition DetourNavMesh.h:580
dtStatus getPolyArea(dtPolyRef ref, unsigned char *resultArea) const
Gets the user defined area for the specified polygon.
Definition DetourNavMesh.cpp:1580
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:1381
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:1219
const dtMeshTile * getTileByRef(dtTileRef ref) const
Gets the tile for the specified tile reference.
Definition DetourNavMesh.cpp:1166
const dtMeshTile * getTileAt(const int x, const int y, const int layer) const
Gets the tile at the specified grid location.
Definition DetourNavMesh.cpp:1061
dtStatus restoreTileState(dtMeshTile *tile, const unsigned char *data, const int maxDataSize)
Restores the state of the tile.
Definition DetourNavMesh.cpp:1426
dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags)
Sets the user defined flags for the specified polygon.
Definition DetourNavMesh.cpp:1531
void decodePolyId(dtPolyRef ref, unsigned int &salt, unsigned int &it, unsigned int &ip) const
Decodes a standard polygon reference.
Definition DetourNavMesh.h:542
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:325
float orig[3]
The world space origin of the navigation mesh's tile space. [(x, y, z)].
Definition DetourNavMesh.h:326
int maxPolys
The maximum number of polygons each tile can contain. This and maxTiles are used to calculate how man...
Definition DetourNavMesh.h:330
float tileWidth
The width of each tile. (Along the x-axis.)
Definition DetourNavMesh.h:327
float tileHeight
The height of each tile. (Along the z-axis.)
Definition DetourNavMesh.h:328
int maxTiles
The maximum number of tiles the navigation mesh can contain. This and maxPolys are used to calculate ...
Definition DetourNavMesh.h:329
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