1 #ifndef DETOURTILECACHE_H
2 #define DETOURTILECACHE_H
177 return (
unsigned int)((ref >> m_tileBits) & saltMask);
184 return (
unsigned int)(ref & tileMask);
197 return (
unsigned int)((ref >> 16) & saltMask);
204 return (
unsigned int)(ref & tileMask);
213 enum ObstacleRequestAction
219 struct ObstacleRequest
232 unsigned int m_saltBits;
233 unsigned int m_tileBits;
244 static const int MAX_REQUESTS = 64;
245 ObstacleRequest m_reqs[MAX_REQUESTS];
248 static const int MAX_UPDATE = 64;
unsigned int dtStatus
Definition: DetourStatus.h:22
static const int DT_MAX_TOUCHED_TILES
Definition: DetourTileCache.h:62
ObstacleType
Definition: DetourTileCache.h:36
@ DT_OBSTACLE_CYLINDER
Definition: DetourTileCache.h:37
@ DT_OBSTACLE_ORIENTED_BOX
Definition: DetourTileCache.h:39
@ DT_OBSTACLE_BOX
Definition: DetourTileCache.h:38
unsigned int dtObstacleRef
Definition: DetourTileCache.h:6
ObstacleState
Definition: DetourTileCache.h:28
@ DT_OBSTACLE_EMPTY
Definition: DetourTileCache.h:29
@ DT_OBSTACLE_PROCESSED
Definition: DetourTileCache.h:31
@ DT_OBSTACLE_REMOVING
Definition: DetourTileCache.h:32
@ DT_OBSTACLE_PROCESSING
Definition: DetourTileCache.h:30
dtTileCache * dtAllocTileCache()
Definition: DetourTileCache.cpp:12
void dtFreeTileCache(dtTileCache *tc)
Definition: DetourTileCache.cpp:19
unsigned int dtCompressedTileRef
Definition: DetourTileCache.h:7
dtCompressedTileFlags
Flags for addTile.
Definition: DetourTileCache.h:11
@ DT_COMPRESSEDTILE_FREE_DATA
Navmesh owns the tile memory and should free it.
Definition: DetourTileCache.h:12
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:339
Definition: DetourTileCache.h:102
dtObstacleRef encodeObstacleId(unsigned int salt, unsigned int it) const
Encodes an obstacle id.
Definition: DetourTileCache.h:188
struct dtTileCacheCompressor * getCompressor()
Definition: DetourTileCache.h:108
unsigned int decodeTileIdSalt(dtCompressedTileRef ref) const
Decodes a tile salt.
Definition: DetourTileCache.h:174
dtCompressedTileRef getTileRef(const dtCompressedTile *tile) const
Definition: DetourTileCache.cpp:214
unsigned int decodeObstacleIdObstacle(dtObstacleRef ref) const
Decodes an obstacle id.
Definition: DetourTileCache.h:201
int getTilesAt(const int tx, const int ty, dtCompressedTileRef *tiles, const int maxTiles) const
Definition: DetourTileCache.cpp:173
dtStatus addObstacle(const float *pos, const float radius, const float height, dtObstacleRef *result)
Definition: DetourTileCache.cpp:359
dtStatus buildNavMeshTile(const dtCompressedTileRef ref, class dtNavMesh *navmesh)
Definition: DetourTileCache.cpp:657
const dtTileCacheObstacle * getObstacle(const int i) const
Definition: DetourTileCache.h:115
const dtTileCacheObstacle * getObstacleByRef(dtObstacleRef ref)
Definition: DetourTileCache.cpp:228
const dtCompressedTile * getTileByRef(dtCompressedTileRef ref) const
Definition: DetourTileCache.cpp:103
void getObstacleBounds(const struct dtTileCacheObstacle *ob, float *bmin, float *bmax) const
Definition: DetourTileCache.cpp:795
dtStatus addBoxObstacle(const float *bmin, const float *bmax, dtObstacleRef *result)
Definition: DetourTileCache.cpp:394
int getObstacleCount() const
Definition: DetourTileCache.h:114
dtCompressedTileRef encodeTileId(unsigned int salt, unsigned int it) const
Encodes a tile id.
Definition: DetourTileCache.h:168
dtStatus removeTile(dtCompressedTileRef ref, unsigned char **data, int *dataSize)
Definition: DetourTileCache.cpp:293
dtStatus update(const float dt, class dtNavMesh *navmesh, bool *upToDate=0)
Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests.
Definition: DetourTileCache.cpp:523
unsigned int decodeTileIdTile(dtCompressedTileRef ref) const
Decodes a tile id.
Definition: DetourTileCache.h:181
dtStatus init(const dtTileCacheParams *params, struct dtTileCacheAlloc *talloc, struct dtTileCacheCompressor *tcomp, struct dtTileCacheMeshProcess *tmproc)
Definition: DetourTileCache.cpp:118
dtObstacleRef getObstacleRef(const dtTileCacheObstacle *obmin) const
Definition: DetourTileCache.cpp:221
~dtTileCache()
Definition: DetourTileCache.cpp:83
const dtCompressedTile * getTile(const int i) const
Definition: DetourTileCache.h:112
void calcTightTileBounds(const struct dtTileCacheLayerHeader *header, float *bmin, float *bmax) const
Definition: DetourTileCache.cpp:784
dtStatus addTile(unsigned char *data, const int dataSize, unsigned char flags, dtCompressedTileRef *result)
Definition: DetourTileCache.cpp:247
unsigned int decodeObstacleIdSalt(dtObstacleRef ref) const
Decodes an obstacle salt.
Definition: DetourTileCache.h:194
struct dtTileCacheAlloc * getAlloc()
Definition: DetourTileCache.h:107
const dtTileCacheParams * getParams() const
Definition: DetourTileCache.h:109
dtTileCache()
Definition: DetourTileCache.cpp:63
dtCompressedTile * getTileAt(const int tx, const int ty, const int tlayer)
Definition: DetourTileCache.cpp:195
dtStatus buildNavMeshTilesAt(const int tx, const int ty, class dtNavMesh *navmesh)
Definition: DetourTileCache.cpp:641
int getTileCount() const
Definition: DetourTileCache.h:111
dtStatus queryTiles(const float *bmin, const float *bmax, dtCompressedTileRef *results, int *resultCount, const int maxResults) const
Definition: DetourTileCache.cpp:482
dtStatus removeObstacle(const dtObstacleRef ref)
Definition: DetourTileCache.cpp:467
Definition: DetourTileCache.h:16
unsigned char * data
Definition: DetourTileCache.h:21
dtCompressedTile * next
Definition: DetourTileCache.h:24
unsigned int flags
Definition: DetourTileCache.h:23
unsigned char * compressed
Definition: DetourTileCache.h:19
int compressedSize
Definition: DetourTileCache.h:20
struct dtTileCacheLayerHeader * header
Definition: DetourTileCache.h:18
int dataSize
Definition: DetourTileCache.h:22
unsigned int salt
Counter describing modifications to the tile.
Definition: DetourTileCache.h:17
Represents the source data used to build an navigation mesh tile.
Definition: DetourNavMeshBuilder.h:27
Definition: DetourTileCache.h:50
float bmax[3]
Definition: DetourTileCache.h:52
float bmin[3]
Definition: DetourTileCache.h:51
Definition: DetourTileCache.h:43
float pos[3]
Definition: DetourTileCache.h:44
float height
Definition: DetourTileCache.h:46
float radius
Definition: DetourTileCache.h:45
Definition: DetourTileCache.h:56
float rotAux[2]
Definition: DetourTileCache.h:59
float center[3]
Definition: DetourTileCache.h:57
float halfExtents[3]
Definition: DetourTileCache.h:58
Definition: DetourTileCacheBuilder.h:80
Definition: DetourTileCacheBuilder.h:97
Definition: DetourTileCache.h:96
virtual void process(struct dtNavMeshCreateParams *params, unsigned char *polyAreas, unsigned short *polyFlags)=0
virtual ~dtTileCacheMeshProcess()
Definition: DetourTileCache.cpp:242
Definition: DetourTileCache.h:64
dtObstacleBox box
Definition: DetourTileCache.h:68
unsigned char ntouched
Definition: DetourTileCache.h:77
dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES]
Definition: DetourTileCache.h:72
unsigned char state
Definition: DetourTileCache.h:76
unsigned char npending
Definition: DetourTileCache.h:78
dtObstacleCylinder cylinder
Definition: DetourTileCache.h:67
dtTileCacheObstacle * next
Definition: DetourTileCache.h:79
unsigned short salt
Definition: DetourTileCache.h:74
dtObstacleOrientedBox orientedBox
Definition: DetourTileCache.h:69
unsigned char type
Definition: DetourTileCache.h:75
dtCompressedTileRef pending[DT_MAX_TOUCHED_TILES]
Definition: DetourTileCache.h:73
Definition: DetourTileCache.h:83
int width
Definition: DetourTileCache.h:86
int height
Definition: DetourTileCache.h:86
int maxTiles
Definition: DetourTileCache.h:91
int maxObstacles
Definition: DetourTileCache.h:92
float ch
Definition: DetourTileCache.h:85
float maxSimplificationError
Definition: DetourTileCache.h:90
float walkableClimb
Definition: DetourTileCache.h:89
float cs
Definition: DetourTileCache.h:85
float walkableHeight
Definition: DetourTileCache.h:87
float walkableRadius
Definition: DetourTileCache.h:88
float orig[3]
Definition: DetourTileCache.h:84