Atoms Crowd
7.0.0
|
#include <DetourNavMesh.h>
Classes | |
struct | FConnectingPolyData |
Public Member Functions | |
void | applyWorldOffset (const float *offset) |
Shift navigation mesh by provided offset. | |
dtLink & | getLink (dtMeshTile *tile, unsigned int linkIdx) |
Helper for accessing links. | |
const dtLink & | getLink (const dtMeshTile *tile, unsigned int linkIdx) const |
dtClusterLink & | getClusterLink (dtMeshTile *tile, unsigned int linkIdx) |
Helper for accessing cluster links. | |
const dtClusterLink & | getClusterLink (const dtMeshTile *tile, unsigned int linkIdx) const |
void | linkOffMeshHelper (dtMeshTile *tile0, unsigned int polyIdx0, dtMeshTile *tile1, unsigned int polyIdx1, unsigned char side, unsigned char edge) |
Helper for creating links in off-mesh connections. | |
bool | isEmpty () const |
unsigned int | getSaltBits () const |
void | applyAreaCostOrder (unsigned char *costOrder) |
int | getNeighbourTilesCountAt (const int x, const int y, const int side) const |
Returns neighbour tile count based on side of given tile. | |
bool | getNeighbourCoords (const int x, const int y, const int side, int &outX, int &outY) const |
unsigned int | getTileIndex (const dtMeshTile *tile) const |
dtMeshTile * | getTile (int i) |
Returns pointer to tile in the tile array. | |
int | getTilesAt (const int x, const int y, dtMeshTile **tiles, const int maxTiles) const |
Returns neighbour tile based on side. | |
int | getNeighbourTilesAt (const int x, const int y, const int side, dtMeshTile **tiles, const int maxTiles) const |
Returns neighbour tile based on side. | |
int | findConnectingPolys (const float *va, const float *vb, const dtMeshTile *fromTile, int fromPolyIdx, const dtMeshTile *tile, int side, dtChunkArray< FConnectingPolyData > &cons) const |
Returns all polygons in neighbour tile based on portal defined by the segment. | |
void | connectIntLinks (dtMeshTile *tile) |
Builds internal polygons links for a tile. | |
void | baseOffMeshLinks (dtMeshTile *tile) |
Builds internal polygons links for a tile. | |
void | connectExtLinks (dtMeshTile *tile, dtMeshTile *target, int side, bool updateCLinks) |
Builds external polygon links for a tile. | |
void | connectExtOffMeshLinks (dtMeshTile *tile, dtMeshTile *target, int side, bool updateCLinks) |
Builds external polygon links for a tile. | |
void | unconnectExtLinks (dtMeshTile *tile, dtMeshTile *target) |
Removes external links at specified side. | |
void | connectClusterLink (dtMeshTile *tile0, unsigned int cluster0, dtMeshTile *tile1, unsigned int cluster1, unsigned char flags, bool bCheckExisting=true) |
Try to connect clusters. | |
void | unconnectClusterLinks (dtMeshTile *tile, dtMeshTile *target) |
Removes cluster links at specified side. | |
int | queryPolygonsInTile (const dtMeshTile *tile, const float *qmin, const float *qmax, dtPolyRef *polys, const int maxPolys, bool bExcludeUnwalkable=false) const |
Queries polygons within a tile. | |
dtPolyRef | findNearestPolyInTile (const dtMeshTile *tile, const float *center, const float *extents, float *nearestPt, bool bExcludeUnwalkable=false) const |
Find nearest polygon within a tile. | |
dtPolyRef | findCheapestNearPolyInTile (const dtMeshTile *tile, const float *center, const float *extents, float *nearestPt) const |
void | closestPointOnPolyInTile (const dtMeshTile *tile, unsigned int ip, const float *pos, float *closest) const |
Returns closest point on polygon. | |
Initialization and Tile Management | |
dtStatus | init (const dtNavMeshParams *params) |
dtStatus | init (unsigned char *data, const int dataSize, const int flags) |
const dtNavMeshParams * | getParams () const |
The navigation mesh initialization params. | |
dtStatus | addTile (unsigned char *data, int dataSize, int flags, dtTileRef lastRef, dtTileRef *result) |
dtStatus | removeTile (dtTileRef ref, unsigned char **data, int *dataSize) |
Query Functions | |
void | calcTileLoc (const float *pos, int *tx, int *ty) const |
const dtMeshTile * | getTileAt (const int x, const int y, const int layer) const |
int | getTileCountAt (const int x, const int y) const |
int | getTilesAt (const int x, const int y, dtMeshTile const **tiles, const int maxTiles) const |
dtTileRef | getTileRefAt (int x, int y, int layer) const |
dtTileRef | getTileRef (const dtMeshTile *tile) const |
const dtMeshTile * | getTileByRef (dtTileRef ref) const |
int | getMaxTiles () const |
const dtMeshTile * | getTile (int i) const |
dtStatus | getTileAndPolyByRef (const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const |
void | getTileAndPolyByRefUnsafe (const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const |
bool | isValidPolyRef (dtPolyRef ref) const |
dtPolyRef | getPolyRefBase (const dtMeshTile *tile) const |
dtClusterRef | getClusterRefBase (const dtMeshTile *tile) const |
dtStatus | getOffMeshConnectionPolyEndPoints (dtPolyRef prevRef, dtPolyRef polyRef, const float *currentPos, float *startPos, float *endPos) const |
const dtOffMeshConnection * | getOffMeshConnectionByRef (dtPolyRef ref) const |
const dtOffMeshSegmentConnection * | getOffMeshSegmentConnectionByRef (dtPolyRef ref) const |
void | updateOffMeshConnectionByUserId (unsigned int userId, unsigned char newArea, unsigned short newFlags) |
void | updateOffMeshSegmentConnectionByUserId (unsigned int userId, unsigned char newArea, unsigned short newFlags) |
State Management | |
dtStatus | setPolyFlags (dtPolyRef ref, unsigned short flags) |
dtStatus | getPolyFlags (dtPolyRef ref, unsigned short *resultFlags) const |
dtStatus | setPolyArea (dtPolyRef ref, unsigned char area) |
dtStatus | getPolyArea (dtPolyRef ref, unsigned char *resultArea) const |
int | getTileStateSize (const dtMeshTile *tile) const |
dtStatus | storeTileState (const dtMeshTile *tile, unsigned char *data, const int maxDataSize) const |
dtStatus | restoreTileState (dtMeshTile *tile, const unsigned char *data, const int maxDataSize) |
Encoding and Decoding | |
These functions are generally meant for internal use only. | |
dtPolyRef | encodePolyId (unsigned int salt, unsigned int it, unsigned int ip) const |
void | decodePolyId (dtPolyRef ref, unsigned int &salt, unsigned int &it, unsigned int &ip) const |
unsigned int | decodePolyIdSalt (dtPolyRef ref) const |
unsigned int | decodePolyIdTile (dtPolyRef ref) const |
unsigned int | decodePolyIdPoly (dtPolyRef ref) const |
unsigned int | decodeClusterIdTile (dtClusterRef ref) const |
unsigned int | decodeClusterIdCluster (dtClusterRef ref) const |
Public Attributes | |
dtNavMeshParams | m_params |
Current initialization params. TODO: do not store this info twice. | |
float | m_orig [3] |
Origin of the tile (0,0) | |
float | m_tileWidth |
float | m_tileHeight |
Dimensions of each tile. | |
int | m_maxTiles |
Max number of tiles. | |
int | m_tileLutSize |
Tile hash lookup size (must be pot). | |
int | m_tileLutMask |
Tile hash lookup mask. | |
unsigned char | m_areaCostOrder [DT_MAX_AREAS] |
dtMeshTile ** | m_posLookup |
Tile hash lookup. | |
dtMeshTile * | m_nextFree |
Freelist of tiles. | |
dtMeshTile * | m_tiles |
List of tiles. | |
unsigned int | m_saltBits |
Number of salt bits in the tile ID. | |
unsigned int | m_tileBits |
Number of tile bits in the tile ID. | |
unsigned int | m_polyBits |
Number of poly bits in the tile ID. | |
A navigation mesh based on tiles of convex polygons.
dtStatus AtomsUtils::dtNavMesh::addTile | ( | unsigned char * | data, |
int | dataSize, | ||
int | flags, | ||
dtTileRef | lastRef, | ||
dtTileRef * | result | ||
) |
Adds a tile to the navigation mesh.
[in] | data | Data for the new tile mesh. (See: dtCreateNavMeshData) |
[in] | dataSize | Data size of the new tile mesh. |
[in] | flags | Tile flags. (See: dtTileFlags) |
[in] | lastRef | The desired reference for the tile. (When reloading a tile.) [opt] [Default: 0] |
[out] | result | The tile reference. (If the tile was succesfully added.) [opt] |
void AtomsUtils::dtNavMesh::calcTileLoc | ( | const float * | pos, |
int * | tx, | ||
int * | ty | ||
) | const |
Calculates the tile grid location for the specified world position.
[in] | pos | The world position for the query. [(x, y, z)] |
[out] | tx | The tile's x-location. (x, y) |
[out] | ty | The tile's y-location. (x, y) |
|
inline |
Extracts the cluster's index (within its tile) from the specified cluster reference.
[in] | ref | The cluster reference. |
|
inline |
Extracts the tile's index from the specified cluster reference.
[in] | ref | The cluster reference. |
|
inline |
Decodes a standard polygon reference.
[in] | ref | The polygon reference to decode. |
[out] | salt | The tile's salt value. |
[out] | it | The index of the tile. |
[out] | ip | The index of the polygon within the tile. |
|
inline |
Extracts the polygon's index (within its tile) from the specified polygon reference.
[in] | ref | The polygon reference. |
|
inline |
Extracts a tile's salt value from the specified polygon reference.
[in] | ref | The polygon reference. |
|
inline |
Extracts the tile's index from the specified polygon reference.
[in] | ref | The polygon reference. |
|
inline |
Derives a standard polygon reference.
[in] | salt | The tile's salt value. |
[in] | it | The index of the tile. |
[in] | ip | The index of the polygon within the tile. |
dtClusterRef AtomsUtils::dtNavMesh::getClusterRefBase | ( | const dtMeshTile * | tile | ) | const |
Gets the cluster reference for the tile's base cluster.
[in] | tile | The tile. |
int AtomsUtils::dtNavMesh::getMaxTiles | ( | ) | const |
The maximum number of tiles supported by the navigation mesh.
const dtOffMeshConnection* AtomsUtils::dtNavMesh::getOffMeshConnectionByRef | ( | dtPolyRef | ref | ) | const |
Gets the specified off-mesh connection: point type.
[in] | ref | The polygon reference of the off-mesh connection. |
dtStatus AtomsUtils::dtNavMesh::getOffMeshConnectionPolyEndPoints | ( | dtPolyRef | prevRef, |
dtPolyRef | polyRef, | ||
const float * | currentPos, | ||
float * | startPos, | ||
float * | endPos | ||
) | const |
Gets the endpoints for an off-mesh connection, ordered by "direction of travel".
[in] | prevRef | The reference of the polygon before the connection. |
[in] | polyRef | The reference of the off-mesh connection polygon. |
[in] | currentPos | Position before entering off-mesh connection [(x, y, z)] |
[out] | startPos | The start position of the off-mesh connection. [(x, y, z)] |
[out] | endPos | The end position of the off-mesh connection. [(x, y, z)] |
const dtOffMeshSegmentConnection* AtomsUtils::dtNavMesh::getOffMeshSegmentConnectionByRef | ( | dtPolyRef | ref | ) | const |
Gets the specified off-mesh connection: segment type
[in] | ref | The polygon reference of the off-mesh connection. |
dtStatus AtomsUtils::dtNavMesh::getPolyArea | ( | dtPolyRef | ref, |
unsigned char * | resultArea | ||
) | const |
Gets the user defined area for the specified polygon.
[in] | ref | The polygon reference. |
[out] | resultArea | The area id for the polygon. |
dtStatus AtomsUtils::dtNavMesh::getPolyFlags | ( | dtPolyRef | ref, |
unsigned short * | resultFlags | ||
) | const |
Gets the user defined flags for the specified polygon.
[in] | ref | The polygon reference. |
[out] | resultFlags | The polygon flags. |
dtPolyRef AtomsUtils::dtNavMesh::getPolyRefBase | ( | const dtMeshTile * | tile | ) | const |
Gets the polygon reference for the tile's base polygon.
[in] | tile | The tile. |
const dtMeshTile* AtomsUtils::dtNavMesh::getTile | ( | int | i | ) | const |
Gets the tile at the specified index.
[in] | i | The tile index. [Limit: 0 >= index < getMaxTiles()] |
dtStatus AtomsUtils::dtNavMesh::getTileAndPolyByRef | ( | const dtPolyRef | ref, |
const dtMeshTile ** | tile, | ||
const dtPoly ** | poly | ||
) | const |
Gets the tile and polygon for the specified polygon reference.
[in] | ref | The reference for the a polygon. |
[out] | tile | The tile containing the polygon. |
[out] | poly | The polygon. |
void AtomsUtils::dtNavMesh::getTileAndPolyByRefUnsafe | ( | const dtPolyRef | ref, |
const dtMeshTile ** | tile, | ||
const dtPoly ** | poly | ||
) | const |
Returns the tile and polygon for the specified polygon reference.
[in] | ref | A known valid reference for a polygon. |
[out] | tile | The tile containing the polygon. |
[out] | poly | The polygon. |
const dtMeshTile* AtomsUtils::dtNavMesh::getTileAt | ( | const int | x, |
const int | y, | ||
const int | layer | ||
) | const |
Gets the tile at the specified grid location.
[in] | x | The tile's x-location. (x, y, layer) |
[in] | y | The tile's y-location. (x, y, layer) |
[in] | layer | The tile's layer. (x, y, layer) |
const dtMeshTile* AtomsUtils::dtNavMesh::getTileByRef | ( | dtTileRef | ref | ) | const |
Gets the tile for the specified tile reference.
[in] | ref | The tile reference of the tile to retrieve. |
int AtomsUtils::dtNavMesh::getTileCountAt | ( | const int | x, |
const int | y | ||
) | const |
Gets number of tiles at the specified grid location. (All layers.)
[in] | x | The tile's x-location. (x, y) |
[in] | y | The tile's y-location. (x, y) |
dtTileRef AtomsUtils::dtNavMesh::getTileRef | ( | const dtMeshTile * | tile | ) | const |
Gets the tile reference for the specified tile.
[in] | tile | The tile. |
dtTileRef AtomsUtils::dtNavMesh::getTileRefAt | ( | int | x, |
int | y, | ||
int | layer | ||
) | const |
Gets the tile reference for the tile at specified grid location.
[in] | x | The tile's x-location. (x, y, layer) |
[in] | y | The tile's y-location. (x, y, layer) |
[in] | layer | The tile's layer. (x, y, layer) |
int AtomsUtils::dtNavMesh::getTilesAt | ( | const int | x, |
const int | y, | ||
dtMeshTile const ** | tiles, | ||
const int | maxTiles | ||
) | const |
Gets all tiles at the specified grid location. (All layers.)
[in] | x | The tile's x-location. (x, y) |
[in] | y | The tile's y-location. (x, y) |
[out] | tiles | A pointer to an array of tiles that will hold the result. |
[in] | maxTiles | The maximum tiles the tiles parameter can hold. |
int AtomsUtils::dtNavMesh::getTileStateSize | ( | const dtMeshTile * | tile | ) | const |
Gets the size of the buffer required by storeTileState to store the specified tile's state.
[in] | tile | The tile. |
dtStatus AtomsUtils::dtNavMesh::init | ( | const dtNavMeshParams * | params | ) |
Initializes the navigation mesh for tiled use.
[in] | params | Initialization parameters. |
dtStatus AtomsUtils::dtNavMesh::init | ( | unsigned char * | data, |
const int | dataSize, | ||
const int | flags | ||
) |
Initializes the navigation mesh for single tile use.
[in] | data | Data of the new tile. (See: dtCreateNavMeshData) |
[in] | dataSize | The data size of the new tile. |
[in] | flags | The tile flags. (See: dtTileFlags) |
bool AtomsUtils::dtNavMesh::isValidPolyRef | ( | dtPolyRef | ref | ) | const |
Checks the validity of a polygon reference.
[in] | ref | The polygon reference to check. |
dtStatus AtomsUtils::dtNavMesh::removeTile | ( | dtTileRef | ref, |
unsigned char ** | data, | ||
int * | dataSize | ||
) |
Removes the specified tile from the navigation mesh.
[in] | ref | The reference of the tile to remove. |
[out] | data | Data associated with deleted tile. |
[out] | dataSize | Size of the data associated with deleted tile. |
dtStatus AtomsUtils::dtNavMesh::restoreTileState | ( | dtMeshTile * | tile, |
const unsigned char * | data, | ||
const int | maxDataSize | ||
) |
Restores the state of the tile.
[in] | tile | The tile. |
[in] | data | The new state. (Obtained from storeTileState.) |
[in] | maxDataSize | The size of the state within the data buffer. |
dtStatus AtomsUtils::dtNavMesh::setPolyArea | ( | dtPolyRef | ref, |
unsigned char | area | ||
) |
Sets the user defined area for the specified polygon.
[in] | ref | The polygon reference. |
[in] | area | The new area id for the polygon. [Limit: < #DT_MAX_AREAS] |
dtStatus AtomsUtils::dtNavMesh::setPolyFlags | ( | dtPolyRef | ref, |
unsigned short | flags | ||
) |
Sets the user defined flags for the specified polygon.
[in] | ref | The polygon reference. |
[in] | flags | The new flags for the polygon. |
dtStatus AtomsUtils::dtNavMesh::storeTileState | ( | const dtMeshTile * | tile, |
unsigned char * | data, | ||
const int | maxDataSize | ||
) | const |
Stores the non-structural state of the tile in the specified buffer. (Flags, area ids, etc.)
[in] | tile | The tile. |
[out] | data | The buffer to store the tile's state in. |
[in] | maxDataSize | The size of the data buffer. [Limit: >= getTileStateSize] |
void AtomsUtils::dtNavMesh::updateOffMeshConnectionByUserId | ( | unsigned int | userId, |
unsigned char | newArea, | ||
unsigned short | newFlags | ||
) |
Updates area and flags for specified off-mesh connection: point type
[in] | userId | User Id of connection |
[in] | newArea | Area code to apply |
void AtomsUtils::dtNavMesh::updateOffMeshSegmentConnectionByUserId | ( | unsigned int | userId, |
unsigned char | newArea, | ||
unsigned short | newFlags | ||
) |
Updates area and flags for specified off-mesh connection: segment type
[in] | userId | User Id of connection |
[in] | newArea | Area code to apply |