engine
 
载入中...
搜索中...
未找到
所有成员列表
dtNavMesh类 参考

A navigation mesh based on tiles of convex polygons. 更多...

#include <DetourNavMesh.h>

Public 成员函数

Initialization and Tile Management
dtStatus init (const dtNavMeshParams *params)
 Initializes the navigation mesh for tiled use. 更多...
 
dtStatus init (unsigned char *data, const int dataSize, const int flags)
 Initializes the navigation mesh for single tile use. 更多...
 
const dtNavMeshParams * getParams () const
 The navigation mesh initialization params.
 
dtStatus addTile (unsigned char *data, int dataSize, int flags, dtTileRef lastRef, dtTileRef *result)
 Adds a tile to the navigation mesh. 更多...
 
dtStatus removeTile (dtTileRef ref, unsigned char **data, int *dataSize)
 Removes the specified tile from the navigation mesh. 更多...
 
Query Functions
void calcTileLoc (const float *pos, int *tx, int *ty) const
 Calculates the tile grid location for the specified world position. 更多...
 
const dtMeshTile * getTileAt (const int x, const int y, const int layer) const
 Gets the tile at the specified grid location. 更多...
 
int getTileCountAt (const int x, const int y) const
 Gets number of tiles at the specified grid location. 更多...
 
int getTilesAt (const int x, const int y, dtMeshTile const **tiles, const int maxTiles) const
 Gets all tiles at the specified grid location. 更多...
 
dtTileRef getTileRefAt (int x, int y, int layer) const
 Gets the tile reference for the tile at specified grid location. 更多...
 
dtTileRef getTileRef (const dtMeshTile *tile) const
 Gets the tile reference for the specified tile. 更多...
 
const dtMeshTile * getTileByRef (dtTileRef ref) const
 Gets the tile for the specified tile reference. 更多...
 
int getMaxTiles () const
 The maximum number of tiles supported by the navigation mesh. 更多...
 
const dtMeshTile * getTile (int i) const
 Gets the tile at the specified index. 更多...
 
dtStatus getTileAndPolyByRef (const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
 Gets the tile and polygon for the specified polygon reference. 更多...
 
void getTileAndPolyByRefUnsafe (const dtPolyRef ref, const dtMeshTile **tile, const dtPoly **poly) const
 Returns the tile and polygon for the specified polygon reference. 更多...
 
bool isValidPolyRef (dtPolyRef ref) const
 Checks the validity of a polygon reference. 更多...
 
dtPolyRef getPolyRefBase (const dtMeshTile *tile) const
 Gets the polygon reference for the tile's base polygon. 更多...
 
dtClusterRef getClusterRefBase (const dtMeshTile *tile) const
 Gets the cluster reference for the tile's base cluster. 更多...
 
dtStatus 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". 更多...
 
const dtOffMeshConnection * getOffMeshConnectionByRef (dtPolyRef ref) const
 Gets the specified off-mesh connection: point type. 更多...
 
void updateOffMeshConnectionByUserId (unsigned int userId, unsigned char newArea, unsigned short newFlags)
 Updates area and flags for specified off-mesh connection: point type 更多...
 
State Management

These functions do not effect dtTileRef or dtPolyRef's.

dtStatus setPolyFlags (dtPolyRef ref, unsigned short flags)
 Sets the user defined flags for the specified polygon. 更多...
 
dtStatus getPolyFlags (dtPolyRef ref, unsigned short *resultFlags) const
 Gets the user defined flags for the specified polygon. 更多...
 
dtStatus setPolyArea (dtPolyRef ref, unsigned char area)
 Sets the user defined area for the specified polygon. 更多...
 
dtStatus getPolyArea (dtPolyRef ref, unsigned char *resultArea) const
 Gets the user defined area for the specified polygon. 更多...
 
int getTileStateSize (const dtMeshTile *tile) const
 Gets the size of the buffer required by storeTileState to store the specified tile's state. 更多...
 
dtStatus storeTileState (const dtMeshTile *tile, unsigned char *data, const int maxDataSize) const
 Stores the non-structural state of the tile in the specified buffer. 更多...
 
dtStatus restoreTileState (dtMeshTile *tile, const unsigned char *data, const int maxDataSize)
 Restores the state of the tile. 更多...
 
Encoding and Decoding

These functions are generally meant for internal use only.

dtPolyRef encodePolyId (unsigned int salt, unsigned int it, unsigned int ip) const
 Derives a standard polygon reference. 更多...
 
void decodePolyId (dtPolyRef ref, unsigned int &salt, unsigned int &it, unsigned int &ip) const
 Decodes a standard polygon reference. 更多...
 
unsigned int decodePolyIdSalt (dtPolyRef ref) const
 Extracts a tile's salt value from the specified polygon reference. 更多...
 
unsigned int decodePolyIdTile (dtPolyRef ref) const
 Extracts the tile's index from the specified polygon reference. 更多...
 
unsigned int decodePolyIdPoly (dtPolyRef ref) const
 Extracts the polygon's index (within its tile) from the specified polygon reference. 更多...
 
unsigned int decodeClusterIdTile (dtClusterRef ref) const
 Extracts the tile's index from the specified cluster reference. 更多...
 
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
 
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
 

详细描述

A navigation mesh based on tiles of convex polygons.

成员函数说明

◆ addTile()

dtStatus dtNavMesh::addTile ( unsigned char *  data,
int  dataSize,
int  flags,
dtTileRef  lastRef,
dtTileRef *  result 
)

Adds a tile to the navigation mesh.

参数
[in]dataData for the new tile mesh. (See: dtCreateNavMeshData)
[in]dataSizeData size of the new tile mesh.
[in]flagsTile flags. (See: dtTileFlags)
[in]lastRefThe desired reference for the tile. (When reloading a tile.) [opt] [Default: 0]
[out]resultThe tile reference. (If the tile was succesfully added.) [opt]
返回
The status flags for the operation.

◆ calcTileLoc()

void dtNavMesh::calcTileLoc ( const float *  pos,
int *  tx,
int *  ty 
) const

Calculates the tile grid location for the specified world position.

参数
[in]posThe world position for the query. [(x, y, z)]
[out]txThe tile's x-location. (x, y)
[out]tyThe tile's y-location. (x, y)

◆ decodeClusterIdTile()

unsigned int dtNavMesh::decodeClusterIdTile ( dtClusterRef  ref) const
inline

Extracts the tile's index from the specified cluster reference.

注解
This function is generally meant for internal use only.
参数
[in]refThe cluster reference.

◆ decodePolyId()

void dtNavMesh::decodePolyId ( dtPolyRef  ref,
unsigned int &  salt,
unsigned int &  it,
unsigned int &  ip 
) const
inline

Decodes a standard polygon reference.

注解
This function is generally meant for internal use only.
参数
[in]refThe polygon reference to decode.
[out]saltThe tile's salt value.
[out]itThe index of the tile.
[out]ipThe index of the polygon within the tile.
参见
encodePolyId

◆ decodePolyIdPoly()

unsigned int dtNavMesh::decodePolyIdPoly ( dtPolyRef  ref) const
inline

Extracts the polygon's index (within its tile) from the specified polygon reference.

注解
This function is generally meant for internal use only.
参数
[in]refThe polygon reference.
参见
encodePolyId

◆ decodePolyIdSalt()

unsigned int dtNavMesh::decodePolyIdSalt ( dtPolyRef  ref) const
inline

Extracts a tile's salt value from the specified polygon reference.

注解
This function is generally meant for internal use only.
参数
[in]refThe polygon reference.
参见
encodePolyId

◆ decodePolyIdTile()

unsigned int dtNavMesh::decodePolyIdTile ( dtPolyRef  ref) const
inline

Extracts the tile's index from the specified polygon reference.

注解
This function is generally meant for internal use only.
参数
[in]refThe polygon reference.
参见
encodePolyId

◆ encodePolyId()

dtPolyRef dtNavMesh::encodePolyId ( unsigned int  salt,
unsigned int  it,
unsigned int  ip 
) const
inline

Derives a standard polygon reference.

注解
This function is generally meant for internal use only.
参数
[in]saltThe tile's salt value.
[in]itThe index of the tile.
[in]ipThe index of the polygon within the tile.

◆ getClusterRefBase()

dtClusterRef dtNavMesh::getClusterRefBase ( const dtMeshTile *  tile) const

Gets the cluster reference for the tile's base cluster.

参数
[in]tileThe tile.
返回
The cluster reference for the base cluster in the specified tile.

◆ getMaxTiles()

int dtNavMesh::getMaxTiles ( ) const

The maximum number of tiles supported by the navigation mesh.

返回
The maximum number of tiles supported by the navigation mesh.

◆ getOffMeshConnectionByRef()

const dtOffMeshConnection * dtNavMesh::getOffMeshConnectionByRef ( dtPolyRef  ref) const

Gets the specified off-mesh connection: point type.

参数
[in]refThe polygon reference of the off-mesh connection.
返回
The specified off-mesh connection, or null if the polygon reference is not valid.

◆ getOffMeshConnectionPolyEndPoints()

dtStatus 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]prevRefThe reference of the polygon before the connection.
[in]polyRefThe reference of the off-mesh connection polygon.
[in]currentPosPosition before entering off-mesh connection [(x, y, z)]
[out]startPosThe start position of the off-mesh connection. [(x, y, z)]
[out]endPosThe end position of the off-mesh connection. [(x, y, z)]
返回
The status flags for the operation.

◆ getPolyArea()

dtStatus dtNavMesh::getPolyArea ( dtPolyRef  ref,
unsigned char *  resultArea 
) const

Gets the user defined area for the specified polygon.

参数
[in]refThe polygon reference.
[out]resultAreaThe area id for the polygon.
返回
The status flags for the operation.

◆ getPolyFlags()

dtStatus dtNavMesh::getPolyFlags ( dtPolyRef  ref,
unsigned short *  resultFlags 
) const

Gets the user defined flags for the specified polygon.

参数
[in]refThe polygon reference.
[out]resultFlagsThe polygon flags.
返回
The status flags for the operation.

◆ getPolyRefBase()

dtPolyRef dtNavMesh::getPolyRefBase ( const dtMeshTile *  tile) const

Gets the polygon reference for the tile's base polygon.

参数
[in]tileThe tile.
返回
The polygon reference for the base polygon in the specified tile.

◆ getTile()

const dtMeshTile * dtNavMesh::getTile ( int  i) const

Gets the tile at the specified index.

参数
[in]iThe tile index. [Limit: 0 >= index < getMaxTiles()]
返回
The tile at the specified index.

◆ getTileAndPolyByRef()

dtStatus dtNavMesh::getTileAndPolyByRef ( const dtPolyRef  ref,
const dtMeshTile **  tile,
const dtPoly **  poly 
) const

Gets the tile and polygon for the specified polygon reference.

参数
[in]refThe reference for the a polygon.
[out]tileThe tile containing the polygon.
[out]polyThe polygon.
返回
The status flags for the operation.

◆ getTileAndPolyByRefUnsafe()

void dtNavMesh::getTileAndPolyByRefUnsafe ( const dtPolyRef  ref,
const dtMeshTile **  tile,
const dtPoly **  poly 
) const

Returns the tile and polygon for the specified polygon reference.

参数
[in]refA known valid reference for a polygon.
[out]tileThe tile containing the polygon.
[out]polyThe polygon.

◆ getTileAt()

const dtMeshTile * dtNavMesh::getTileAt ( const int  x,
const int  y,
const int  layer 
) const

Gets the tile at the specified grid location.

参数
[in]xThe tile's x-location. (x, y, layer)
[in]yThe tile's y-location. (x, y, layer)
[in]layerThe tile's layer. (x, y, layer)
返回
The tile, or null if the tile does not exist.

◆ getTileByRef()

const dtMeshTile * dtNavMesh::getTileByRef ( dtTileRef  ref) const

Gets the tile for the specified tile reference.

参数
[in]refThe tile reference of the tile to retrieve.
返回
The tile for the specified reference, or null if the reference is invalid.

◆ getTileCountAt()

int dtNavMesh::getTileCountAt ( const int  x,
const int  y 
) const

Gets number of tiles at the specified grid location.

(All layers.)

参数
[in]xThe tile's x-location. (x, y)
[in]yThe tile's y-location. (x, y)
返回
The number of tiles in grid.

◆ getTileRef()

dtTileRef dtNavMesh::getTileRef ( const dtMeshTile *  tile) const

Gets the tile reference for the specified tile.

参数
[in]tileThe tile.
返回
The tile reference of the tile.

◆ getTileRefAt()

dtTileRef dtNavMesh::getTileRefAt ( int  x,
int  y,
int  layer 
) const

Gets the tile reference for the tile at specified grid location.

参数
[in]xThe tile's x-location. (x, y, layer)
[in]yThe tile's y-location. (x, y, layer)
[in]layerThe tile's layer. (x, y, layer)
返回
The tile reference of the tile, or 0 if there is none.

◆ getTilesAt()

int 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]xThe tile's x-location. (x, y)
[in]yThe tile's y-location. (x, y)
[out]tilesA pointer to an array of tiles that will hold the result.
[in]maxTilesThe maximum tiles the tiles parameter can hold.
返回
The number of tiles returned in the tiles array.

◆ getTileStateSize()

int dtNavMesh::getTileStateSize ( const dtMeshTile *  tile) const

Gets the size of the buffer required by storeTileState to store the specified tile's state.

参数
[in]tileThe tile.
返回
The size of the buffer required to store the state.

◆ init() [1/2]

dtStatus dtNavMesh::init ( const dtNavMeshParams *  params)

Initializes the navigation mesh for tiled use.

参数
[in]paramsInitialization parameters.
返回
The status flags for the operation.

◆ init() [2/2]

dtStatus dtNavMesh::init ( unsigned char *  data,
const int  dataSize,
const int  flags 
)

Initializes the navigation mesh for single tile use.

参数
[in]dataData of the new tile. (See: dtCreateNavMeshData)
[in]dataSizeThe data size of the new tile.
[in]flagsThe tile flags. (See: dtTileFlags)
返回
The status flags for the operation.
参见
dtCreateNavMeshData

◆ isValidPolyRef()

bool dtNavMesh::isValidPolyRef ( dtPolyRef  ref) const

Checks the validity of a polygon reference.

参数
[in]refThe polygon reference to check.
返回
True if polygon reference is valid for the navigation mesh.

◆ removeTile()

dtStatus dtNavMesh::removeTile ( dtTileRef  ref,
unsigned char **  data,
int *  dataSize 
)

Removes the specified tile from the navigation mesh.

参数
[in]refThe reference of the tile to remove.
[out]dataData associated with deleted tile.
[out]dataSizeSize of the data associated with deleted tile.
返回
The status flags for the operation.

◆ restoreTileState()

dtStatus dtNavMesh::restoreTileState ( dtMeshTile *  tile,
const unsigned char *  data,
const int  maxDataSize 
)

Restores the state of the tile.

参数
[in]tileThe tile.
[in]dataThe new state. (Obtained from storeTileState.)
[in]maxDataSizeThe size of the state within the data buffer.
返回
The status flags for the operation.

◆ setPolyArea()

dtStatus dtNavMesh::setPolyArea ( dtPolyRef  ref,
unsigned char  area 
)

Sets the user defined area for the specified polygon.

参数
[in]refThe polygon reference.
[in]areaThe new area id for the polygon. [Limit: < DT_MAX_AREAS]
返回
The status flags for the operation.

◆ setPolyFlags()

dtStatus dtNavMesh::setPolyFlags ( dtPolyRef  ref,
unsigned short  flags 
)

Sets the user defined flags for the specified polygon.

参数
[in]refThe polygon reference.
[in]flagsThe new flags for the polygon.
返回
The status flags for the operation.

◆ storeTileState()

dtStatus 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]tileThe tile.
[out]dataThe buffer to store the tile's state in.
[in]maxDataSizeThe size of the data buffer. [Limit: >= getTileStateSize]
返回
The status flags for the operation.

◆ updateOffMeshConnectionByUserId()

void dtNavMesh::updateOffMeshConnectionByUserId ( unsigned int  userId,
unsigned char  newArea,
unsigned short  newFlags 
)

Updates area and flags for specified off-mesh connection: point type

参数
[in]userIdUser Id of connection
[in]newAreaArea code to apply

该类的文档由以下文件生成: