Detour: Submittin missing renamed file, deleting old (tiled->tile renaming).
This commit is contained in:
parent
a7cb1f86e2
commit
8278720ff2
289
Detour/Include/DetourTileNavMesh.h
Normal file
289
Detour/Include/DetourTileNavMesh.h
Normal file
@ -0,0 +1,289 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef DETOURTILENAVMESH_H
|
||||
#define DETOURTILENAVMESH_H
|
||||
|
||||
// Reference to navigation polygon.
|
||||
typedef unsigned int dtTilePolyRef;
|
||||
|
||||
// The bits used in the poly ref.
|
||||
static const int DT_TILE_REF_SALT_BITS = 12;
|
||||
static const int DT_TILE_REF_TILE_BITS = 12;
|
||||
static const int DT_TILE_REF_POLY_BITS = 8;
|
||||
static const int DT_TILE_REF_SALT_MASK = (1<<DT_TILE_REF_SALT_BITS)-1;
|
||||
static const int DT_TILE_REF_TILE_MASK = (1<<DT_TILE_REF_TILE_BITS)-1;
|
||||
static const int DT_TILE_REF_POLY_MASK = (1<<DT_TILE_REF_POLY_BITS)-1;
|
||||
|
||||
// Maximum number of vertices per navigation polygon.
|
||||
static const int DT_TILE_VERTS_PER_POLYGON = 6;
|
||||
|
||||
static const int DT_MAX_TILES = 1 << DT_TILE_REF_TILE_BITS;
|
||||
static const int DT_MAX_POLYGONS = 1 << DT_TILE_REF_POLY_BITS;
|
||||
|
||||
static const int DT_TILE_NAVMESH_MAGIC = 'NAVT';
|
||||
static const int DT_TILE_NAVMESH_VERSION = 1;
|
||||
|
||||
// Structure holding the navigation polygon data.
|
||||
struct dtTilePoly
|
||||
{
|
||||
unsigned short v[DT_TILE_VERTS_PER_POLYGON]; // Indices to vertices of the poly.
|
||||
unsigned short n[DT_TILE_VERTS_PER_POLYGON]; // Refs to neighbours of the poly.
|
||||
unsigned short links; // Base index to header 'links' array.
|
||||
unsigned char nlinks; // Number of links for
|
||||
unsigned char nv; // Number of vertices.
|
||||
unsigned char flags; // Flags (not used).
|
||||
};
|
||||
|
||||
// Stucture holding a link to another polygon.
|
||||
struct dtTileLink
|
||||
{
|
||||
dtTilePolyRef ref; // Neighbour reference.
|
||||
unsigned short p; // Index to polygon which owns this link.
|
||||
unsigned char e; // Index to polygon edge which owns this link.
|
||||
unsigned char side; // If boundary link, defines on which side the link is.
|
||||
unsigned char bmin, bmax; // If boundary link, defines the sub edge area.
|
||||
};
|
||||
|
||||
struct dtTileHeader
|
||||
{
|
||||
int magic;
|
||||
int version;
|
||||
int npolys;
|
||||
int nverts;
|
||||
int nlinks;
|
||||
int maxlinks;
|
||||
float cs;
|
||||
float bmin[3], bmax[3];
|
||||
dtTilePoly* polys;
|
||||
float* verts;
|
||||
dtTileLink* links;
|
||||
};
|
||||
|
||||
struct dtTile
|
||||
{
|
||||
int salt;
|
||||
int x,y;
|
||||
dtTileHeader* header;
|
||||
unsigned char* data;
|
||||
int dataSize;
|
||||
bool ownsData;
|
||||
dtTile* next;
|
||||
};
|
||||
|
||||
// Encodes a tile id.
|
||||
inline dtTilePolyRef dtEncodeTileId(unsigned int salt, unsigned int it, unsigned int ip)
|
||||
{
|
||||
return (salt << (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) | ((it+1) << DT_TILE_REF_POLY_BITS) | ip;
|
||||
}
|
||||
|
||||
// Decodes a tile id.
|
||||
inline void dtDecodeTileId(dtTilePolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip)
|
||||
{
|
||||
salt = (ref >> (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) & DT_TILE_REF_SALT_MASK;
|
||||
it = ((ref >> DT_TILE_REF_POLY_BITS) & DT_TILE_REF_TILE_MASK) - 1;
|
||||
ip = ref & DT_TILE_REF_POLY_MASK;
|
||||
}
|
||||
|
||||
static const int DT_TILE_LOOKUP_SIZE = DT_MAX_TILES/4;
|
||||
|
||||
class dtTiledNavMesh
|
||||
{
|
||||
public:
|
||||
dtTiledNavMesh();
|
||||
~dtTiledNavMesh();
|
||||
|
||||
// Initializes the nav mesh.
|
||||
// Params:
|
||||
// orig - (in) origin of the nav mesh tile space.
|
||||
// tileSiz - (in) size of a tile.
|
||||
// portalheight - (in) height of the portal region between tiles.
|
||||
// Returns: True if succeed, else false.
|
||||
bool init(const float* orig, float tileSize, float portalHeight);
|
||||
|
||||
// Adds new tile into the navmesh.
|
||||
// The add will fail if the data is in wrong format,
|
||||
// there is not enough tiles left, or if there is a tile already at the location.
|
||||
// Params:
|
||||
// x,y - (in) Location of the new tile.
|
||||
// data - (in) Data of the new tile mesh.
|
||||
// dataSize - (in) Data size of the new tile mesh.
|
||||
// ownsData - (in) Flag indicating if the navmesh should own and delete the data.
|
||||
// Returns: True if tile was added, else false.
|
||||
bool addTileAt(int x, int y, unsigned char* data, int dataSize, bool ownsData);
|
||||
|
||||
// Removes tile at specified location.
|
||||
// Params:
|
||||
// x,y - (in) Location of the tile to remove.
|
||||
// data - (out) Data associated with deleted tile.
|
||||
// dataSize - (out) Size of the data associated with deleted tile.
|
||||
// Returns: True if remove suceed, else false.
|
||||
bool removeTileAt(int x, int y, unsigned char** data, int* dataSize);
|
||||
|
||||
// Returns pointer to tile at specified location.
|
||||
// Params:
|
||||
// x,y - (in) Location of the tile to get.
|
||||
// Returns: pointer to tile if tile exists or 0 tile does not exists.
|
||||
dtTile* getTileAt(int x, int y);
|
||||
|
||||
// Returns pointer to tile in the tile array.
|
||||
// Params:
|
||||
// i - (in) Index to the tile to retrieve, must be in range [0,DT_MAX_TILES[
|
||||
// Returns: Pointer to specified tile.
|
||||
dtTile* getTile(int i);
|
||||
const dtTile* getTile(int i) const;
|
||||
|
||||
// Finds the nearest navigation polygon around the center location.
|
||||
// Params:
|
||||
// center - (in) The center of the search box.
|
||||
// extents - (in) The extents of the search box.
|
||||
// Returns: Reference identifier for the polygon, or 0 if no polygons found.
|
||||
dtTilePolyRef findNearestPoly(const float* center, const float* extents);
|
||||
|
||||
// Returns polygons which touch the query box.
|
||||
// Params:
|
||||
// center - (in) the center of the search box.
|
||||
// extents - (in) the extents of the search box.
|
||||
// polys - (out) array holding the search result.
|
||||
// maxPolys - (in) The max number of polygons the polys array can hold.
|
||||
// Returns: Number of polygons in search result array.
|
||||
int queryPolygons(const float* center, const float* extents,
|
||||
dtTilePolyRef* polys, const int maxPolys);
|
||||
|
||||
// Finds path from start polygon to end polygon.
|
||||
// If target polygon canno be reached through the navigation graph,
|
||||
// the last node on the array is nearest node to the end polygon.
|
||||
// Params:
|
||||
// startRef - (in) ref to path start polygon.
|
||||
// endRef - (in) ref to path end polygon.
|
||||
// path - (out) array holding the search result.
|
||||
// maxPathSize - (in) The max number of polygons the path array can hold.
|
||||
// Returns: Number of polygons in search result array.
|
||||
int findPath(dtTilePolyRef startRef, dtTilePolyRef endRef,
|
||||
dtTilePolyRef* path, const int maxPathSize);
|
||||
|
||||
// Finds a straight path from start to end locations within the corridor
|
||||
// described by the path polygons.
|
||||
// Start and end locations will be clamped on the corridor.
|
||||
// Params:
|
||||
// startPos - (in) Path start location.
|
||||
// endPos - (in) Path end location.
|
||||
// path - (in) Array of connected polygons describing the corridor.
|
||||
// pathSize - (in) Number of polygons in path array.
|
||||
// straightPath - (out) Points describing the straight path.
|
||||
// maxStraightPathSize - (in) The max number of points the straight path array can hold.
|
||||
// Returns: Number of points in the path.
|
||||
int findStraightPath(const float* startPos, const float* endPos,
|
||||
const dtTilePolyRef* path, const int pathSize,
|
||||
float* straightPath, const int maxStraightPathSize);
|
||||
|
||||
// Finds intersection againts walls starting from start pos.
|
||||
// Params:
|
||||
// startRef - (in) ref to the polygon where the start lies.
|
||||
// startPos - (in) start position of the query.
|
||||
// endPos - (in) end position of the query.
|
||||
// t - (out) hit parameter along the segment, 0 if no hit.
|
||||
// endRef - (out) ref to the last polygon which was processed.
|
||||
// Returns: Number of polygons in path or 0 if failed.
|
||||
int raycast(dtTilePolyRef startRef, const float* startPos, const float* endPos,
|
||||
float& t, dtTilePolyRef* path, const int pathSize);
|
||||
|
||||
// Returns distance to nearest wall from the specified location.
|
||||
// Params:
|
||||
// centerRef - (in) ref to the polygon where the center lies.
|
||||
// centerPos - (in) center if the query circle.
|
||||
// maxRadius - (in) max search radius.
|
||||
// hitPos - (out) location of the nearest hit.
|
||||
// hitNormal - (out) normal of the nearest hit.
|
||||
// Returns: Distance to nearest wall from the test location.
|
||||
float findDistanceToWall(dtTilePolyRef centerRef, const float* centerPos, float maxRadius,
|
||||
float* hitPos, float* hitNormal);
|
||||
|
||||
// Finds polygons found along the navigation graph which touch the specified circle.
|
||||
// Params:
|
||||
// centerRef - (in) ref to the polygon where the center lies.
|
||||
// centerPos - (in) center if the query circle
|
||||
// radius - (in) radius of the query circle
|
||||
// resultRef - (out, opt) refs to the polygons touched by the circle.
|
||||
// resultParent - (out, opt) parent of each result polygon.
|
||||
// resultCost - (out, opt) search cost at each result polygon.
|
||||
// maxResult - (int) maximum capacity of search results.
|
||||
// Returns: Number of results.
|
||||
int findPolysAround(dtTilePolyRef centerRef, const float* centerPos, float radius,
|
||||
dtTilePolyRef* resultRef, dtTilePolyRef* resultParent, float* resultCost,
|
||||
const int maxResult);
|
||||
|
||||
// Returns closest point on navigation polygon.
|
||||
// Params:
|
||||
// ref - (in) ref to the polygon.
|
||||
// pos - (in) the point to check.
|
||||
// closest - (out) closest point.
|
||||
// Returns: true if closest point found.
|
||||
bool closestPointToPoly(dtTilePolyRef ref, const float* pos, float* closest) const;
|
||||
|
||||
// Returns pointer to a polygon based on ref.
|
||||
const dtTilePoly* getPolyByRef(dtTilePolyRef ref) const;
|
||||
|
||||
// Returns pointer to a polygon vertices based on ref.
|
||||
const float* getPolyVertsByRef(dtTilePolyRef ref) const;
|
||||
|
||||
// Returns pointer to a polygon link based on ref.
|
||||
const dtTileLink* getPolyLinksByRef(dtTilePolyRef ref) const;
|
||||
|
||||
private:
|
||||
|
||||
// Returns base id for the tile.
|
||||
dtTilePolyRef getTileId(dtTile* tile);
|
||||
// Returns neighbour tile based on side.
|
||||
dtTile* getNeighbourTileAt(int x, int y, int side);
|
||||
// Returns all polygons in neighbour tile based on portal defined by the segment.
|
||||
int findConnectingPolys(const float* va, const float* vb,
|
||||
dtTile* tile, int side,
|
||||
dtTilePolyRef* con, float* conarea, int maxcon);
|
||||
// Builds internal polygons links for a tile.
|
||||
void buildIntLinks(dtTile* tile);
|
||||
// Builds external polygon links for a tile.
|
||||
void buildExtLinks(dtTile* tile, dtTile* target, int side);
|
||||
// Removes external links at specified side.
|
||||
void removeExtLinks(dtTile* tile, int side);
|
||||
// Queries polygons within a tile.
|
||||
int queryTilePolygons(dtTile* tile, const float* qmin, const float* qmax,
|
||||
dtTilePolyRef* polys, const int maxPolys);
|
||||
// Returns travel cost between two polygons.
|
||||
float getCost(dtTilePolyRef prev, dtTilePolyRef from, dtTilePolyRef to) const;
|
||||
// returns A* heuristics between two polygons.
|
||||
float getHeuristic(dtTilePolyRef from, dtTilePolyRef to) const;
|
||||
// Returns portal points between two polygons.
|
||||
bool getPortalPoints(dtTilePolyRef from, dtTilePolyRef to, float* left, float* right) const;
|
||||
|
||||
float m_orig[3];
|
||||
float m_tileSize;
|
||||
float m_portalHeight;
|
||||
|
||||
dtTile* m_posLookup[DT_TILE_LOOKUP_SIZE];
|
||||
dtTile* m_nextFree;
|
||||
dtTile m_tiles[DT_MAX_TILES];
|
||||
|
||||
dtTileLink* m_tmpLinks;
|
||||
int m_ntmpLinks;
|
||||
|
||||
class dtNodePool* m_nodePool;
|
||||
class dtNodeQueue* m_openList;
|
||||
};
|
||||
|
||||
#endif // DETOURTILENAVMESH_H
|
27
Detour/Include/DetourTileNavMeshBuilder.h
Normal file
27
Detour/Include/DetourTileNavMeshBuilder.h
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef DETOURTILEDNAVMESHBUILDER_H
|
||||
#define DETOURTILEDNAVMESHBUILDER_H
|
||||
|
||||
bool dtCreateNavMeshTileData(const unsigned short* verts, const int nverts,
|
||||
const unsigned short* polys, const int npolys, const int nvp,
|
||||
const float* bmin, const float* bmax, float cs, float ch, int tileSize, int walkableClimb,
|
||||
unsigned char** outData, int* outDataSize);
|
||||
|
||||
#endif // DETOURTILEDNAVMESHBUILDER_H
|
@ -1,209 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2009 Mikko Mononen memon@inside.org
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#ifndef DETOURTILEDNAVMESH_H
|
||||
#define DETOURTILEDNAVMESH_H
|
||||
|
||||
// Reference to navigation polygon.
|
||||
typedef unsigned int dtTilePolyRef;
|
||||
|
||||
static const int DT_TILE_REF_SALT_BITS = 12;
|
||||
static const int DT_TILE_REF_SALT_MASK = (1<<DT_TILE_REF_SALT_BITS)-1;
|
||||
static const int DT_TILE_REF_TILE_BITS = 12;
|
||||
static const int DT_TILE_REF_TILE_MASK = (1<<DT_TILE_REF_TILE_BITS)-1;
|
||||
static const int DT_TILE_REF_POLY_BITS = 8;
|
||||
static const int DT_TILE_REF_POLY_MASK = (1<<DT_TILE_REF_POLY_BITS)-1;
|
||||
|
||||
// Maximum number of vertices per navigation polygon.
|
||||
static const int DT_TILE_VERTS_PER_POLYGON = 6;
|
||||
|
||||
static const int DT_MAX_TILES = 1 << DT_TILE_REF_TILE_BITS;
|
||||
static const int DT_MAX_POLYGONS = 1 << DT_TILE_REF_POLY_BITS;
|
||||
|
||||
// Structure holding the navigation polygon data.
|
||||
struct dtTilePoly
|
||||
{
|
||||
unsigned short v[DT_TILE_VERTS_PER_POLYGON]; // Indices to vertices of the poly.
|
||||
unsigned short n[DT_TILE_VERTS_PER_POLYGON]; // Refs to neighbours of the poly.
|
||||
unsigned short links;
|
||||
unsigned char nlinks;
|
||||
unsigned char nv; // Number of vertices.
|
||||
unsigned char flags; // Flags (not used).
|
||||
};
|
||||
|
||||
struct dtTileLink
|
||||
{
|
||||
dtTilePolyRef ref;
|
||||
unsigned short p;
|
||||
unsigned char e;
|
||||
unsigned char side;
|
||||
float bmin, bmax;
|
||||
};
|
||||
|
||||
static const int DT_TILE_NAVMESH_MAGIC = 'NAVT';
|
||||
static const int DT_TILE_NAVMESH_VERSION = 1;
|
||||
|
||||
struct dtTileHeader
|
||||
{
|
||||
int magic;
|
||||
int version;
|
||||
int npolys;
|
||||
int nverts;
|
||||
int nportals[4];
|
||||
int nlinks;
|
||||
int maxlinks;
|
||||
float cs;
|
||||
float bmin[3], bmax[3];
|
||||
dtTilePoly* polys;
|
||||
float* verts;
|
||||
dtTileLink* links;
|
||||
struct dtTile* nei[4];
|
||||
};
|
||||
|
||||
struct dtTile
|
||||
{
|
||||
int salt;
|
||||
int x,y;
|
||||
dtTileHeader* header;
|
||||
dtTile* next;
|
||||
};
|
||||
|
||||
inline dtTilePolyRef encodeId(int salt, int it, int ip)
|
||||
{
|
||||
return ((unsigned int)salt << (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) | ((unsigned int)(it+1) << DT_TILE_REF_POLY_BITS) | (unsigned int)ip;
|
||||
}
|
||||
|
||||
inline void decodeId(dtTilePolyRef ref, int& salt, int& it, int& ip)
|
||||
{
|
||||
salt = (int)((ref >> (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) & DT_TILE_REF_SALT_MASK);
|
||||
it = (int)(((ref >> DT_TILE_REF_POLY_BITS) & DT_TILE_REF_TILE_MASK) - 1);
|
||||
ip = (int)(ref & DT_TILE_REF_POLY_MASK);
|
||||
}
|
||||
|
||||
static const int DT_TILE_LOOKUP_SIZE = DT_MAX_TILES/4;
|
||||
|
||||
class dtTiledNavMesh
|
||||
{
|
||||
public:
|
||||
dtTiledNavMesh();
|
||||
~dtTiledNavMesh();
|
||||
|
||||
bool init(const float* orig, float tileSize, float portalHeight);
|
||||
bool addTile(int x, int y, unsigned char* data, int dataSize);
|
||||
bool removeTile(int x, int y);
|
||||
dtTile* getTile(int x, int y);
|
||||
const dtTile* getTile(int i) const { return &m_tiles[i]; }
|
||||
|
||||
// Finds the nearest navigation polygon around the center location.
|
||||
// Params:
|
||||
// center - (in) The center of the search box.
|
||||
// extents - (in) The extents of the search box.
|
||||
// Returns: Reference identifier for the polygon, or 0 if no polygons found.
|
||||
dtTilePolyRef findNearestPoly(const float* center, const float* extents);
|
||||
|
||||
// Returns polygons which touch the query box.
|
||||
// Params:
|
||||
// center - (in) the center of the search box.
|
||||
// extents - (in) the extents of the search box.
|
||||
// polys - (out) array holding the search result.
|
||||
// maxPolys - (in) The max number of polygons the polys array can hold.
|
||||
// Returns: Number of polygons in search result array.
|
||||
int queryPolygons(const float* center, const float* extents,
|
||||
dtTilePolyRef* polys, const int maxPolys);
|
||||
|
||||
bool closestPointToPoly(dtTilePolyRef ref, const float* pos, float* closest) const;
|
||||
|
||||
int getPolyNeighbours(dtTilePolyRef ref, dtTilePolyRef* nei, int maxNei) const;
|
||||
|
||||
int findPath(dtTilePolyRef startRef, dtTilePolyRef endRef,
|
||||
dtTilePolyRef* path, const int maxPathSize);
|
||||
|
||||
int findStraightPath(const float* startPos, const float* endPos,
|
||||
const dtTilePolyRef* path, const int pathSize,
|
||||
float* straightPath, const int maxStraightPathSize);
|
||||
|
||||
int raycast(dtTilePolyRef startRef, const float* startPos, const float* endPos,
|
||||
float& t, dtTilePolyRef* path, const int pathSize);
|
||||
|
||||
int findPolysAround(dtTilePolyRef centerRef, const float* centerPos, float radius,
|
||||
dtTilePolyRef* resultRef, dtTilePolyRef* resultParent,
|
||||
float* resultCost, unsigned short* resultDepth,
|
||||
const int maxResult);
|
||||
|
||||
float findDistanceToWall(dtTilePolyRef centerRef, const float* centerPos, float maxRadius,
|
||||
float* hitPos, float* hitNormal);
|
||||
|
||||
inline const dtTilePoly* getPolyByRef(dtTilePolyRef ref) const
|
||||
{
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
if (ip >= m_tiles[it].header->npolys) return 0;
|
||||
return &m_tiles[it].header->polys[ip];
|
||||
}
|
||||
|
||||
inline const float* getPolyVertsByRef(dtTilePolyRef ref) const
|
||||
{
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
if (ip >= m_tiles[it].header->npolys) return 0;
|
||||
return m_tiles[it].header->verts;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
dtTilePolyRef getTileId(dtTile* tile);
|
||||
dtTile* getNeighbourTile(int x, int y, int side);
|
||||
|
||||
void buildIntLinks(dtTile* tile);
|
||||
void buildExtLinks(dtTile* tile, dtTile* target, int side);
|
||||
void removeExtLinks(dtTile* tile, int side);
|
||||
|
||||
void createConnections(dtTile* tilea, dtTile* tileb, int sidea);
|
||||
void removeConnections(dtTile* tile, int side);
|
||||
int queryTilePolygons(dtTile* tile, const float* qmin, const float* qmax,
|
||||
dtTilePolyRef* polys, const int maxPolys);
|
||||
int findConnectingPolys(const float* va, const float* vb,
|
||||
dtTile* tile, int side,
|
||||
dtTilePolyRef* con, float* conarea, int maxcon);
|
||||
|
||||
float getCost(dtTilePolyRef prev, dtTilePolyRef from, dtTilePolyRef to) const;
|
||||
float getHeuristic(dtTilePolyRef from, dtTilePolyRef to) const;
|
||||
|
||||
// Returns portal points between two polygons.
|
||||
bool getPortalPoints(dtTilePolyRef from, dtTilePolyRef to, float* left, float* right) const;
|
||||
|
||||
float m_orig[3];
|
||||
float m_tileSize;
|
||||
float m_portalHeight;
|
||||
|
||||
dtTile* m_posLookup[DT_TILE_LOOKUP_SIZE];
|
||||
dtTile* m_nextFree;
|
||||
dtTile m_tiles[DT_MAX_TILES];
|
||||
|
||||
dtTileLink* m_tmpLinks;
|
||||
int m_ntmpLinks;
|
||||
|
||||
class dtTileNodePool* m_nodePool;
|
||||
class dtTileNodeQueue* m_openList;
|
||||
};
|
||||
|
||||
#endif // DETOURTILEDNAVMESH_H
|
@ -1,9 +0,0 @@
|
||||
#ifndef DETOURTILEDNAVMESHBUILDER_H
|
||||
#define DETOURTILEDNAVMESHBUILDER_H
|
||||
|
||||
bool dtCreateNavMeshTileData(const unsigned short* verts, const int nverts,
|
||||
const unsigned short* polys, const int npolys, const int nvp,
|
||||
const float* bmin, const float* bmax, float cs, float ch, int tileSize, int walkableClimb,
|
||||
unsigned char** outData, int* outDataSize);
|
||||
|
||||
#endif // DETOURTILEDNAVMESHBUILDER_H
|
Loading…
x
Reference in New Issue
Block a user