TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DetourNavMesh.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 DETOURNAVMESH_H
20 #define DETOURNAVMESH_H
21 
22 #include "DetourAlloc.h"
23 #include "DetourStatus.h"
24 
25 
26 // Edited by TC
27 #if defined(WIN32) && !defined(__MINGW32__)
28 typedef unsigned __int64 uint64_d;
30 #else
31 #include <stdint.h>
32 #ifndef uint64_t
33 #ifdef __linux__
34 #include <linux/types.h>
35 #endif
36 #endif
37 typedef uint64_t uint64_d;
39 #endif
40 
41 // Note: If you want to use 64-bit refs, change the types of both dtPolyRef & dtTileRef.
42 // It is also recommended that you change dtHashRef() to a proper 64-bit hash.
43 
44 // Edited by TC
45 // We cannot have over 31 bits for either tile nor poly
46 // without changing polyCount to use 64bits too.
49 typedef uint64_d dtPolyRef; // Edited by TC
50 
53 typedef uint64_d dtTileRef; // Edited by TC
54 
57 static const int DT_VERTS_PER_POLYGON = 6;
58 
64 
66 static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V';
67 
69 static const int DT_NAVMESH_VERSION = 7;
70 
72 static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S';
73 
75 static const int DT_NAVMESH_STATE_VERSION = 1;
76 
78 
81 static const unsigned short DT_EXT_LINK = 0x8000;
82 
84 static const unsigned int DT_NULL_LINK = 0xffffffff;
85 
87 static const unsigned int DT_OFFMESH_CON_BIDIR = 1;
88 
91 static const int DT_MAX_AREAS = 64;
92 
93 static const int STATIC_SALT_BITS = 12;
94 static const int STATIC_TILE_BITS = 21;
95 static const int STATIC_POLY_BITS = 31;
96 // we cannot have over 31 bits for either tile nor poly
97 // without changing polyCount to use 64bits too.
98 
102 {
105 };
106 
109 {
113 };
114 
117 {
120 };
121 
122 
125 {
128 };
129 
132 {
134 };
135 
136 
139 static const float DT_RAY_CAST_LIMIT_PROPORTIONS = 50.0f;
140 
143 {
148 };
149 
150 
153 struct dtPoly
154 {
156  unsigned int firstLink;
157 
160  unsigned short verts[DT_VERTS_PER_POLYGON];
161 
163  unsigned short neis[DT_VERTS_PER_POLYGON];
164 
166  unsigned short flags;
167 
169  unsigned char vertCount;
170 
173  unsigned char areaAndtype;
174 
176  inline void setArea(unsigned char a) { areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f); }
177 
179  inline void setType(unsigned char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
180 
182  inline unsigned char getArea() const { return areaAndtype & 0x3f; }
183 
185  inline unsigned char getType() const { return areaAndtype >> 6; }
186 };
187 
190 {
191  unsigned int vertBase;
192  unsigned int triBase;
193  unsigned char vertCount;
194  unsigned char triCount;
195 };
196 
200 struct dtLink
201 {
203  unsigned int next;
204  unsigned char edge;
205  unsigned char side;
206  unsigned char bmin;
207  unsigned char bmax;
208 };
209 
213 struct dtBVNode
214 {
215  unsigned short bmin[3];
216  unsigned short bmax[3];
217  int i;
218 };
219 
223 {
225  float pos[6];
226 
228  float rad;
229 
231  unsigned short poly;
232 
236  unsigned char flags;
237 
239  unsigned char side;
240 
242  unsigned int userId;
243 };
244 
248 {
249  int magic;
250  int version;
251  int x;
252  int y;
253  int layer;
254  unsigned int userId;
255  int polyCount;
256  int vertCount;
259 
262 
270  float bmin[3];
271  float bmax[3];
272 
275 };
276 
280 {
281  unsigned int salt;
282 
283  unsigned int linksFreeList;
286  float* verts;
289 
291  float* detailVerts;
292 
294  unsigned char* detailTris;
295 
299 
301 
302  unsigned char* data;
303  int dataSize;
304  int flags;
306 };
307 
313 {
314  float orig[3];
315  float tileWidth;
316  float tileHeight;
317  int maxTiles;
318  int maxPolys;
319 };
320 
324 {
325 public:
326  dtNavMesh();
327  ~dtNavMesh();
328 
331 
336 
343  dtStatus init(unsigned char* data, const int dataSize, const int flags);
344 
346  const dtNavMeshParams* getParams() const;
347 
355  dtStatus addTile(unsigned char* data, int dataSize, int flags, dtTileRef lastRef, dtTileRef* result);
356 
362  dtStatus removeTile(dtTileRef ref, unsigned char** data, int* dataSize);
363 
365 
368 
373  void calcTileLoc(const float* pos, int* tx, int* ty) const;
374 
380  const dtMeshTile* getTileAt(const int x, const int y, const int layer) const;
381 
388  int getTilesAt(const int x, const int y,
389  dtMeshTile const** tiles, const int maxTiles) const;
390 
396  dtTileRef getTileRefAt(int x, int y, int layer) const;
397 
401  dtTileRef getTileRef(const dtMeshTile* tile) const;
402 
407  const dtMeshTile* getTileByRef(dtTileRef ref) const;
408 
411  int getMaxTiles() const;
412 
416  const dtMeshTile* getTile(int i) const;
417 
423  dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
424 
429  void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
430 
434  bool isValidPolyRef(dtPolyRef ref) const;
435 
439  dtPolyRef getPolyRefBase(const dtMeshTile* tile) const;
440 
447  dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
448 
453 
455 
459 
464  dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags);
465 
470  dtStatus getPolyFlags(dtPolyRef ref, unsigned short* resultFlags) const;
471 
476  dtStatus setPolyArea(dtPolyRef ref, unsigned char area);
477 
482  dtStatus getPolyArea(dtPolyRef ref, unsigned char* resultArea) const;
483 
487  int getTileStateSize(const dtMeshTile* tile) const;
488 
494  dtStatus storeTileState(const dtMeshTile* tile, unsigned char* data, const int maxDataSize) const;
495 
501  dtStatus restoreTileState(dtMeshTile* tile, const unsigned char* data, const int maxDataSize);
502 
504 
508 
514  inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
515  {
516  return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
517  }
518 
526  inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
527  {
528  const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
529  const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
530  const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
531  salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
532  it = (unsigned int)((ref >> m_polyBits) & tileMask);
533  ip = (unsigned int)(ref & polyMask);
534  }
535 
540  inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
541  {
542  const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
543  return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
544  }
545 
550  inline unsigned int decodePolyIdTile(dtPolyRef ref) const
551  {
552  const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
553  return (unsigned int)((ref >> m_polyBits) & tileMask);
554  }
555 
560  inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
561  {
562  const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
563  return (unsigned int)(ref & polyMask);
564  }
565 
567 
568 private:
569 
571  dtMeshTile* getTile(int i);
572 
574  int getTilesAt(const int x, const int y,
575  dtMeshTile** tiles, const int maxTiles) const;
576 
578  int getNeighbourTilesAt(const int x, const int y, const int side,
579  dtMeshTile** tiles, const int maxTiles) const;
580 
582  int findConnectingPolys(const float* va, const float* vb,
583  const dtMeshTile* tile, int side,
584  dtPolyRef* con, float* conarea, int maxcon) const;
585 
587  void connectIntLinks(dtMeshTile* tile);
589  void baseOffMeshLinks(dtMeshTile* tile);
590 
592  void connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side);
594  void connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side);
595 
597  void unconnectExtLinks(dtMeshTile* tile, dtMeshTile* target);
598 
599 
600  // TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding.
601 
603  int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax,
604  dtPolyRef* polys, const int maxPolys) const;
606  dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center,
607  const float* extents, float* nearestPt) const;
609  void closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const;
610 
612  float m_orig[3];
617 
621 
622  unsigned int m_saltBits;
623  unsigned int m_tileBits;
624  unsigned int m_polyBits;
625 };
626 
631 
635 void dtFreeNavMesh(dtNavMesh* navmesh);
636 
637 #endif // DETOURNAVMESH_H
638 
640 
641 // This section contains detailed documentation for members that don't have
642 // a source file. It reduces clutter in the main section of the header.
643 
unsigned int decodePolyIdTile(dtPolyRef ref) const
Definition: DetourNavMesh.h:550
The navigation mesh owns the tile memory and is responsible for freeing it.
Definition: DetourNavMesh.h:104
dtTileRef getTileRef(const dtMeshTile *tile) const
Definition: DetourNavMesh.cpp:1248
uint64_d dtPolyRef
Definition: DetourNavMesh.h:49
unsigned char areaAndtype
Definition: DetourNavMesh.h:173
dtMeshHeader * header
The tile header.
Definition: DetourNavMesh.h:284
unsigned short poly
The polygon reference of the connection within the tile.
Definition: DetourNavMesh.h:231
dtStraightPathOptions
Options for dtNavMeshQuery::findStraightPath.
Definition: DetourNavMesh.h:116
dtStraightPathFlags
Vertex flags returned by dtNavMeshQuery::findStraightPath.
Definition: DetourNavMesh.h:108
uint64_d dtTileRef
Definition: DetourNavMesh.h:53
unsigned short bmax[3]
Maximum bounds of the node's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:216
void closestPointOnPoly(dtPolyRef ref, const float *pos, float *closest, bool *posOverPoly) const
Returns closest point on polygon.
Definition: DetourNavMesh.cpp:612
dtMeshTile ** m_posLookup
Tile hash lookup.
Definition: DetourNavMesh.h:618
static const float DT_RAY_CAST_LIMIT_PROPORTIONS
Definition: DetourNavMesh.h:139
void connectIntLinks(dtMeshTile *tile)
Builds internal polygons links for a tile.
Definition: DetourNavMesh.cpp:517
[provisional] trade quality for performance far from the origin. The idea is that by then a new query...
Definition: DetourNavMesh.h:126
dtStatus getPolyFlags(dtPolyRef ref, unsigned short *resultFlags) const
Definition: DetourNavMesh.cpp:1457
unsigned char side
End point side.
Definition: DetourNavMesh.h:239
Defines the location of detail sub-mesh data within a dtMeshTile.
Definition: DetourNavMesh.h:189
float walkableHeight
The height of the agents using the tile.
Definition: DetourNavMesh.h:267
float walkableClimb
The maximum climb height of the agents using the tile.
Definition: DetourNavMesh.h:269
unsigned int decodePolyIdSalt(dtPolyRef ref) const
Definition: DetourNavMesh.h:540
dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float *startPos, float *endPos) const
Definition: DetourNavMesh.cpp:1372
unsigned short flags
The user defined polygon flags.
Definition: DetourNavMesh.h:166
dtStatus init(const dtNavMeshParams *params)
Definition: DetourNavMesh.cpp:222
static const int DT_NAVMESH_STATE_VERSION
A version number used to detect compatibility of navigation tile states.
Definition: DetourNavMesh.h:75
float orig[3]
The world space origin of the navigation mesh's tile space. [(x, y, z)].
Definition: DetourNavMesh.h:314
dtNavMeshParams m_params
Current initialization params. TODO: do not store this info twice.
Definition: DetourNavMesh.h:611
unsigned char triCount
The number of triangles in the sub-mesh.
Definition: DetourNavMesh.h:194
float m_tileHeight
Dimensions of each tile.
Definition: DetourNavMesh.h:613
dtOffMeshConnection * offMeshCons
The tile off-mesh connections. [Size: dtMeshHeader::offMeshConCount].
Definition: DetourNavMesh.h:300
float walkableRadius
The radius of the agents using the tile.
Definition: DetourNavMesh.h:268
bool isValidPolyRef(dtPolyRef ref) const
Definition: DetourNavMesh.cpp:1139
void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
Definition: DetourNavMesh.cpp:1131
static const int STATIC_POLY_BITS
Definition: DetourNavMesh.h:95
static const int STATIC_TILE_BITS
Definition: DetourNavMesh.h:94
void baseOffMeshLinks(dtMeshTile *tile)
Builds internal polygons links for a tile.
Definition: DetourNavMesh.cpp:554
unsigned char getArea() const
Gets the user defined area id.
Definition: DetourNavMesh.h:182
const dtNavMeshParams * getParams() const
The navigation mesh initialization params.
Definition: DetourNavMesh.cpp:286
float bvQuantFactor
The bounding volume quantization factor.
Definition: DetourNavMesh.h:274
void decodePolyId(dtPolyRef ref, unsigned int &salt, unsigned int &it, unsigned int &ip) const
Definition: DetourNavMesh.h:526
unsigned char flags
Definition: DetourNavMesh.h:236
dtStatus addTile(unsigned char *data, int dataSize, int flags, dtTileRef lastRef, dtTileRef *result)
Definition: DetourNavMesh.cpp:834
void setArea(unsigned char a)
Sets the user defined area id. [Limit: < DT_MAX_AREAS].
Definition: DetourNavMesh.h:176
Raycast should calculate movement cost along the ray and fill RaycastHit::cost.
Definition: DetourNavMesh.h:133
int m_maxTiles
Max number of tiles.
Definition: DetourNavMesh.h:614
int offMeshConCount
The number of off-mesh connections.
Definition: DetourNavMesh.h:265
const dtMeshTile * getTileByRef(dtTileRef ref) const
Definition: DetourNavMesh.cpp:1078
dtBVNode * bvTree
Definition: DetourNavMesh.h:298
static const unsigned int DT_OFFMESH_CON_BIDIR
A flag that indicates that an off-mesh connection can be traversed in both directions. (Is bidirectional.)
Definition: DetourNavMesh.h:87
float bmax[3]
The maximum bounds of the tile's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:271
int detailMeshCount
The number of sub-meshes in the detail mesh.
Definition: DetourNavMesh.h:258
float m_orig[3]
Origin of the tile (0,0)
Definition: DetourNavMesh.h:612
float m_tileWidth
Definition: DetourNavMesh.h:613
dtStatus storeTileState(const dtMeshTile *tile, unsigned char *data, const int maxDataSize) const
Definition: DetourNavMesh.cpp:1303
unsigned int m_tileBits
Number of tile bits in the tile ID.
Definition: DetourNavMesh.h:623
unsigned short verts[DT_VERTS_PER_POLYGON]
Definition: DetourNavMesh.h:160
const dtOffMeshConnection * getOffMeshConnectionByRef(dtPolyRef ref) const
Definition: DetourNavMesh.cpp:1415
unsigned int dtStatus
Definition: DetourStatus.h:22
void dtFreeNavMesh(dtNavMesh *navmesh)
Definition: DetourNavMesh.cpp:149
unsigned char vertCount
The number of vertices in the sub-mesh.
Definition: DetourNavMesh.h:193
dtPolyTypes
Flags representing the type of a navigation mesh polygon.
Definition: DetourNavMesh.h:142
dtNavMesh()
Definition: DetourNavMesh.cpp:188
The vertex is the start position in the path.
Definition: DetourNavMesh.h:110
unsigned int userId
The id of the offmesh connection. (User assigned when the navigation mesh is built.)
Definition: DetourNavMesh.h:242
Definition: DetourNavMesh.h:323
int i
The node's index. (Negative for escape sequence.)
Definition: DetourNavMesh.h:217
int m_tileLutMask
Tile hash lookup mask.
Definition: DetourNavMesh.h:616
int offMeshBase
The index of the first polygon which is an off-mesh connection.
Definition: DetourNavMesh.h:266
Definition: DetourNavMesh.h:213
unsigned int vertBase
The offset of the vertices in the dtMeshTile::detailVerts array.
Definition: DetourNavMesh.h:191
int layer
The layer of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:253
int flags
Tile flags. (See: dtTileFlags)
Definition: DetourNavMesh.h:304
dtStatus getPolyArea(dtPolyRef ref, unsigned char *resultArea) const
Definition: DetourNavMesh.cpp:1489
unsigned char getType() const
Gets the polygon type. (See: dtPolyTypes)
Definition: DetourNavMesh.h:185
unsigned short bmin[3]
Minimum bounds of the node's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:215
Definition: DetourNavMesh.h:247
dtMeshTile * m_tiles
List of tiles.
Definition: DetourNavMesh.h:620
unsigned short neis[DT_VERTS_PER_POLYGON]
Packed data representing neighbor polygons references and flags for each edge.
Definition: DetourNavMesh.h:163
static const int DT_MAX_AREAS
Definition: DetourNavMesh.h:91
dtMeshTile * next
The next free tile, or the next tile in the spatial grid.
Definition: DetourNavMesh.h:305
The vertex is the end position in the path.
Definition: DetourNavMesh.h:111
dtStatus restoreTileState(dtMeshTile *tile, const unsigned char *data, const int maxDataSize)
Definition: DetourNavMesh.cpp:1335
Definition: DetourNavMesh.h:153
float rad
The radius of the endpoints. [Limit: >= 0].
Definition: DetourNavMesh.h:228
dtTileFlags
Definition: DetourNavMesh.h:101
int polyCount
The number of polygons in the tile.
Definition: DetourNavMesh.h:255
int bvNodeCount
The number of bounding volume nodes. (Zero if bounding volumes are disabled.)
Definition: DetourNavMesh.h:264
Add a vertex at every polygon edge crossing.
Definition: DetourNavMesh.h:119
int x
The x-position of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:251
unsigned __int64 uint64_t
Definition: stdint.h:90
void unconnectExtLinks(dtMeshTile *tile, dtMeshTile *target)
Removes external links at specified side.
Definition: DetourNavMesh.cpp:345
unsigned int linksFreeList
Index to the next free link.
Definition: DetourNavMesh.h:283
unsigned int salt
Counter describing modifications to the tile.
Definition: DetourNavMesh.h:281
unsigned int m_polyBits
Number of poly bits in the tile ID.
Definition: DetourNavMesh.h:624
unsigned int m_saltBits
Number of salt bits in the tile ID.
Definition: DetourNavMesh.h:622
dtFindPathOptions
Options for dtNavMeshQuery::findPath.
Definition: DetourNavMesh.h:124
float bmin[3]
The minimum bounds of the tile's AABB. [(x, y, z)].
Definition: DetourNavMesh.h:270
int version
Tile data format version number.
Definition: DetourNavMesh.h:250
int detailVertCount
The number of unique vertices in the detail mesh. (In addition to the polygon vertices.)
Definition: DetourNavMesh.h:261
int maxLinkCount
The number of allocated links.
Definition: DetourNavMesh.h:257
~dtNavMesh()
Definition: DetourNavMesh.cpp:207
dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags)
Definition: DetourNavMesh.cpp:1440
dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
Definition: DetourNavMesh.cpp:1113
G3D::int16 y
Definition: Vector2int16.h:38
float * verts
The tile vertices. [Size: dtMeshHeader::vertCount].
Definition: DetourNavMesh.h:286
unsigned int userId
The user defined id of the tile.
Definition: DetourNavMesh.h:254
dtLink * links
The tile links. [Size: dtMeshHeader::maxLinkCount].
Definition: DetourNavMesh.h:287
int dataSize
Size of the tile data.
Definition: DetourNavMesh.h:303
int findConnectingPolys(const float *va, const float *vb, const dtMeshTile *tile, int side, dtPolyRef *con, float *conarea, int maxcon) const
Returns all polygons in neighbour tile based on portal defined by the segment.
Definition: DetourNavMesh.cpp:292
dtPolyRef findNearestPolyInTile(const dtMeshTile *tile, const float *center, const float *extents, float *nearestPt) const
Find nearest polygon within a tile.
Definition: DetourNavMesh.cpp:691
int m_tileLutSize
Tile hash lookup size (must be pot).
Definition: DetourNavMesh.h:615
float * detailVerts
The detail mesh's unique vertices. [(x, y, z) * dtMeshHeader::detailVertCount].
Definition: DetourNavMesh.h:291
void connectExtOffMeshLinks(dtMeshTile *tile, dtMeshTile *target, int side)
Builds external polygon links for a tile.
Definition: DetourNavMesh.cpp:447
unsigned char * detailTris
The detail mesh's triangles. [(vertA, vertB, vertC) * dtMeshHeader::detailTriCount].
Definition: DetourNavMesh.h:294
static const unsigned short DT_EXT_LINK
Definition: DetourNavMesh.h:81
unsigned int decodePolyIdPoly(dtPolyRef ref) const
Definition: DetourNavMesh.h:560
int getTileStateSize(const dtMeshTile *tile) const
Definition: DetourNavMesh.cpp:1290
dtMeshTile * m_nextFree
Freelist of tiles.
Definition: DetourNavMesh.h:619
dtPolyDetail * detailMeshes
The tile's detail sub-meshes. [Size: dtMeshHeader::detailMeshCount].
Definition: DetourNavMesh.h:288
int maxPolys
The maximum number of polygons each tile can contain.
Definition: DetourNavMesh.h:318
void connectExtLinks(dtMeshTile *tile, dtMeshTile *target, int side)
Builds external polygon links for a tile.
Definition: DetourNavMesh.cpp:380
Add a vertex at every polygon edge crossing where area changes.
Definition: DetourNavMesh.h:118
int queryPolygonsInTile(const dtMeshTile *tile, const float *qmin, const float *qmax, dtPolyRef *polys, const int maxPolys) const
Queries polygons within a tile.
Definition: DetourNavMesh.cpp:739
int magic
Tile magic number. (Used to identify the data format.)
Definition: DetourNavMesh.h:249
const dtMeshTile * getTile(int i) const
Definition: DetourNavMesh.cpp:1102
uint64_t uint64_d
Do not rename back to uint64. Otherwise mac complains about typedef redefinition. ...
Definition: DetourNavMesh.h:38
use raycasts during pathfind to "shortcut" (raycast still consider costs)
Definition: DetourNavMesh.h:127
void calcTileLoc(const float *pos, int *tx, int *ty) const
Definition: DetourNavMesh.cpp:1107
int detailTriCount
The number of triangles in the detail mesh.
Definition: DetourNavMesh.h:263
unsigned char * data
The tile data. (Not directly accessed under normal situations.)
Definition: DetourNavMesh.h:302
float tileWidth
The width of each tile. (Along the x-axis.)
Definition: DetourNavMesh.h:315
The polygon is an off-mesh connection consisting of two vertices.
Definition: DetourNavMesh.h:147
unsigned int firstLink
Index to first link in linked list. (Or DT_NULL_LINK if there is no link.)
Definition: DetourNavMesh.h:156
dtPolyRef getPolyRefBase(const dtMeshTile *tile) const
Definition: DetourNavMesh.cpp:1269
static const int DT_NAVMESH_STATE_MAGIC
A magic number used to detect the compatibility of navigation tile states.
Definition: DetourNavMesh.h:72
Definition: DetourNavMesh.h:312
unsigned char vertCount
The number of vertices in the polygon.
Definition: DetourNavMesh.h:169
dtNavMesh * dtAllocNavMesh()
Definition: DetourNavMesh.cpp:138
dtPoly * polys
The tile polygons. [Size: dtMeshHeader::polyCount].
Definition: DetourNavMesh.h:285
float tileHeight
The height of each tile. (Along the z-axis.)
Definition: DetourNavMesh.h:316
unsigned int triBase
The offset of the triangles in the dtMeshTile::detailTris array.
Definition: DetourNavMesh.h:192
int getNeighbourTilesAt(const int x, const int y, const int side, dtMeshTile **tiles, const int maxTiles) const
Returns neighbour tile based on side.
Definition: DetourNavMesh.cpp:992
dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
Definition: DetourNavMesh.h:514
static const int DT_NAVMESH_MAGIC
A magic number used to detect compatibility of navigation tile data.
Definition: DetourNavMesh.h:66
uint8 flags
Definition: DisableMgr.cpp:44
dtRaycastOptions
Options for dtNavMeshQuery::raycast.
Definition: DetourNavMesh.h:131
G3D::int16 x
Definition: Vector2int16.h:37
Definition: DetourNavMesh.h:279
int maxTiles
The maximum number of tiles the navigation mesh can contain.
Definition: DetourNavMesh.h:317
int y
The y-position of the tile within the dtNavMesh tile grid. (x, y, layer)
Definition: DetourNavMesh.h:252
float pos[6]
The endpoints of the connection. [(ax, ay, az, bx, by, bz)].
Definition: DetourNavMesh.h:225
std::set< uint32 > params[2]
Definition: DisableMgr.cpp:45
dtStatus removeTile(dtTileRef ref, unsigned char **data, int *dataSize)
Definition: DetourNavMesh.cpp:1156
The vertex is the start of an off-mesh connection.
Definition: DetourNavMesh.h:112
dtTileRef getTileRefAt(int x, int y, int layer) const
Definition: DetourNavMesh.cpp:1059
static const int STATIC_SALT_BITS
Definition: DetourNavMesh.h:93
void setType(unsigned char t)
Sets the polygon type. (See: dtPolyTypes.)
Definition: DetourNavMesh.h:179
static const int DT_NAVMESH_VERSION
A version number used to detect compatibility of navigation tile data.
Definition: DetourNavMesh.h:69
const dtMeshTile * getTileAt(const int x, const int y, const int layer) const
Definition: DetourNavMesh.cpp:973
The polygon is a standard convex polygon that is part of the surface of the mesh. ...
Definition: DetourNavMesh.h:145
int vertCount
The number of vertices in the tile.
Definition: DetourNavMesh.h:256
int getTilesAt(const int x, const int y, dtMeshTile const **tiles, const int maxTiles) const
Definition: DetourNavMesh.cpp:1036
Definition: DetourNavMesh.h:222
int getMaxTiles() const
Definition: DetourNavMesh.cpp:1092
static const int DT_VERTS_PER_POLYGON
Definition: DetourNavMesh.h:57
static const unsigned int DT_NULL_LINK
A value that indicates the entity does not link to anything.
Definition: DetourNavMesh.h:84
dtStatus setPolyArea(dtPolyRef ref, unsigned char area)
Definition: DetourNavMesh.cpp:1473