19 #ifndef DETOURNAVMESH_H
20 #define DETOURNAVMESH_H
27 #if defined(WIN32) && !defined(__MINGW32__)
34 #include <linux/types.h>
176 inline void setArea(
unsigned char a) { areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f); }
179 inline void setType(
unsigned char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
182 inline unsigned char getArea()
const {
return areaAndtype & 0x3f; }
185 inline unsigned char getType()
const {
return areaAndtype >> 6; }
373 void calcTileLoc(
const float* pos,
int* tx,
int* ty)
const;
389 dtMeshTile const** tiles,
const int maxTiles)
const;
532 it = (
unsigned int)((ref >>
m_polyBits) & tileMask);
533 ip = (
unsigned int)(ref & polyMask);
553 return (
unsigned int)((ref >>
m_polyBits) & tileMask);
563 return (
unsigned int)(ref & polyMask);
575 dtMeshTile** tiles,
const int maxTiles)
const;
579 dtMeshTile** tiles,
const int maxTiles)
const;
584 dtPolyRef* con,
float* conarea,
int maxcon)
const;
604 dtPolyRef* polys,
const int maxPolys)
const;
607 const float* extents,
float* nearestPt)
const;
637 #endif // DETOURNAVMESH_H
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
unsigned int next
Index of the next link.
Definition: DetourNavMesh.h:203
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
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
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
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
unsigned char side
If a boundary link, defines on which side the link is.
Definition: DetourNavMesh.h:205
int m_maxTiles
Max number of tiles.
Definition: DetourNavMesh.h:614
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 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
Definition: DetourNavMesh.h:213
unsigned int vertBase
The offset of the vertices in the dtMeshTile::detailVerts array.
Definition: DetourNavMesh.h:191
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
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
Add a vertex at every polygon edge crossing.
Definition: DetourNavMesh.h:119
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
unsigned char edge
Index of the polygon edge that owns this link.
Definition: DetourNavMesh.h:204
~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
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
unsigned char bmin
If a boundary link, defines the minimum sub-edge area.
Definition: DetourNavMesh.h:206
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
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
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
dtPolyRef ref
Neighbour reference. (The neighbor that is linked to.)
Definition: DetourNavMesh.h:202
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
unsigned char bmax
If a boundary link, defines the maximum sub-edge area.
Definition: DetourNavMesh.h:207
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
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 getTilesAt(const int x, const int y, dtMeshTile const **tiles, const int maxTiles) const
Definition: DetourNavMesh.cpp:1036
Definition: DetourNavMesh.h:200
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