19 #ifndef DETOURNAVMESHQUERY_H
20 #define DETOURNAVMESHQUERY_H
37 enum { MAX_AREA_COSTS = 64 };
38 navAreaMask m_costMask[MAX_AREA_COSTS];
39 float m_areaCost[MAX_AREA_COSTS];
40 navAreaMask m_includeFlags;
41 navAreaMask m_excludeFlags;
46 #ifdef DT_VIRTUAL_QUERYFILTER
54 #ifdef DT_VIRTUAL_QUERYFILTER
77 #ifdef DT_VIRTUAL_QUERYFILTER
78 virtual float getCost(
const float* pa,
const float* pb,
83 float getCost(
const float* pa,
const float* pb,
97 for (
int i = 0; i < MAX_AREA_COSTS; ++i )
99 if ( ( m_costMask[ i ] & areaMask ) == areaMask )
101 return m_areaCost[ i ];
112 for (
int i = 0; i < MAX_AREA_COSTS; ++i )
114 if ( ( m_costMask[ i ] & areaMask ) == areaMask )
116 m_areaCost[ i ] = cost;
120 for (
int i = 0; i < MAX_AREA_COSTS; ++i )
122 if ( m_costMask[ i ] == 0 )
124 m_costMask[ i ] = areaMask;
125 m_areaCost[ i ] = cost;
221 const float* startPos,
const float* endPos,
223 dtPolyRef* path,
int* pathCount,
const int maxPath)
const;
238 const dtPolyRef* path,
const int pathSize,
239 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
240 int* straightPathCount,
const int maxStraightPath,
const int options = 0)
const;
259 const float* startPos,
const float* endPos,
260 const dtQueryFilter* filter,
const unsigned int options = 0);
286 dtPolyRef* path,
int* pathCount,
const int maxPath);
307 int* resultCount,
const int maxResult)
const;
327 int* resultCount,
const int maxResult)
const;
342 dtPolyRef* nearestRef,
float* nearestPt)
const;
354 dtPolyRef* polys,
int* polyCount,
const int maxPolys)
const;
370 int* resultCount,
const int maxResult)
const;
384 float* resultPos,
dtPolyRef* visited,
int* visitedCount,
const int maxVisitedSize)
const;
402 float* t,
float* hitNormal,
dtPolyRef* path,
int* pathCount,
const int maxPath)
const;
432 float* hitDist,
float* hitPos,
float* hitNormal)
const;
444 float* segmentVerts,
dtPolyRef* segmentRefs,
int* segmentCount,
445 const int maxSegments)
const;
455 dtPolyRef* randomRef,
float* randomPt)
const;
472 dtPolyRef* randomRef,
float* randomPt)
const;
524 dtMeshTile* getNeighbourTileAt(
int x,
int y,
int side)
const;
527 int queryPolygonsInTile(
const dtMeshTile* tile,
const float* qmin,
const float* qmax,
const dtQueryFilter* filter,
528 dtPolyRef* polys,
const int maxPolys)
const;
532 unsigned char& fromType,
unsigned char& toType)
const;
535 float*
left,
float* right)
const;
545 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
546 int* straightPathCount,
const int maxStraightPath)
const;
549 dtStatus appendPortals(
const int startIdx,
const int endIdx,
const float* endPos,
const dtPolyRef* path,
550 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
551 int* straightPathCount,
const int maxStraightPath,
const int options)
const;
558 struct dtNode* lastBestNode;
559 float lastBestNodeCost;
561 float startPos[3], endPos[3];
563 unsigned int options;
564 float raycastLimitSqr;
583 #endif // DETOURNAVMESHQUERY_H
dtStatus queryPolygons(const float *center, const float *extents, const dtQueryFilter *filter, dtPolyRef *polys, int *polyCount, const int maxPolys) const
Finds polygons that overlap the search box.
Definition: DetourNavMeshQuery.cpp:913
bool isInClosedList(dtPolyRef ref) const
Returns true if the polygon reference is in the closed list.
Definition: DetourNavMeshQuery.cpp:3793
float t
The hit parameter. (FLT_MAX if no wall hit.)
Definition: DetourNavMeshQuery.h:161
dtStatus findRandomPointAroundCircle(dtPolyRef startRef, const float *centerPos, const float maxRadius, const dtQueryFilter *filter, float(*frand)(), dtPolyRef *randomRef, float *randomPt) const
Returns random location on navmesh within the reach of specified location.
Definition: DetourNavMeshQuery.cpp:355
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:44
Definition: DetourNavMeshQuery.h:182
dtStatus findPolysAroundCircle(dtPolyRef startRef, const float *centerPos, const float radius, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, float *resultCost, int *resultCount, const int maxResult) const
Finds the polygons along the navigation graph that touch the specified circle.
Definition: DetourNavMeshQuery.cpp:2689
float pathCost
The cost of the path until hit.
Definition: DetourNavMeshQuery.h:179
const dtNavMesh * getAttachedNavMesh() const
Gets the navigation mesh the query object is using.
Definition: DetourNavMeshQuery.h:517
Definition: DetourNode.h:35
dtQueryFilter()
Definition: DetourNavMeshQuery.cpp:63
dtStatus findMultiPath(dtPolyRef startRef, const float *startPos, const dtQueryFilter *filter, dtMultiPathGoal *goals, int numGoals) const
Definition: DetourNavMeshQuery.cpp:2849
dtStatus findStraightPath(const float *startPos, const float *endPos, const dtPolyRef *path, const int pathSize, float *straightPath, unsigned char *straightPathFlags, dtPolyRef *straightPathRefs, int *straightPathCount, const int maxStraightPath, const int options=0) const
Finds the straight path from the start to the end position within the polygon corridor.
Definition: DetourNavMeshQuery.cpp:1787
bool left(const float *a, const float *b, const float *c)
Definition: DetourCommon.cpp:389
dtMultiPathGoal()
Definition: DetourNavMeshQuery.cpp:2842
void setExcludeFlags(const navAreaMask flags)
Sets the exclude flags for the filter.
Definition: DetourNavMeshQuery.h:147
dtStatus raycast(dtPolyRef startRef, const float *startPos, const float *endPos, const dtQueryFilter *filter, float *t, float *hitNormal, dtPolyRef *path, int *pathCount, const int maxPath) const
Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the...
Definition: DetourNavMeshQuery.cpp:2384
float mThreat
Definition: DetourNavMeshQuery.h:187
void setAreaCost(navAreaMask areaMask, const float cost)
Sets the traversal cost of the area.
Definition: DetourNavMeshQuery.h:110
static bool appendVertex(dtTempContour &cont, const int x, const int y, const int z, const int r)
Definition: DetourTileCacheBuilder.cpp:386
Provides information about raycast hit filled by dtNavMeshQuery::raycast.
Definition: DetourNavMeshQuery.h:158
dtPolyRef mDestPoly
Definition: DetourNavMeshQuery.h:185
void setIncludeFlags(const navAreaMask flags)
Sets the include flags for the filter.
Definition: DetourNavMeshQuery.h:138
Defines polygon filtering and traversal costs for navigation mesh query operations.
Definition: DetourNavMeshQuery.h:35
unsigned int dtStatus
Definition: DetourStatus.h:22
dtStatus closestPointOnPolyBoundary(dtPolyRef ref, const float *pos, float *closest) const
Returns a point on the boundary closest to the source point if the source point is outside the polygo...
Definition: DetourNavMeshQuery.cpp:644
Definition: DetourNode.h:108
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:328
dtStatus findRandomPointInPoly(const dtPolyRef ref, float(*frand)(), float *randomPt) const
Definition: DetourNavMeshQuery.cpp:320
dtStatus findPath(dtPolyRef startRef, dtPolyRef endRef, const float *startPos, const float *endPos, const dtQueryFilter *filter, dtPolyRef *path, int *pathCount, const int maxPath) const
Finds a path from the start polygon to the end polygon.
Definition: DetourNavMeshQuery.cpp:964
float getCost(const float *pa, const float *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const
Returns cost to move from the beginning to the end of a line segment that is fully contained within a...
Definition: DetourNavMeshQuery.cpp:103
dtPolyRef * path
Pointer to an array of reference ids of the visited polygons. [opt].
Definition: DetourNavMeshQuery.h:170
dtStatus finalizeSlicedFindPath(dtPolyRef *path, int *pathCount, const int maxPath)
Finalizes and returns the results of a sliced path query.
Definition: DetourNavMeshQuery.cpp:1505
dtNavMeshQuery()
Definition: DetourNavMeshQuery.cpp:147
navAreaMask getIncludeFlags() const
Returns the include flags for the filter.
Definition: DetourNavMeshQuery.h:134
int maxPath
The maximum number of polygons the path array can hold.
Definition: DetourNavMeshQuery.h:176
Defines a polyogn within a dtMeshTile object.
Definition: DetourNavMesh.h:153
int pathCount
The number of visited polygons. [opt].
Definition: DetourNavMeshQuery.h:173
dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef, const float *startPos, const float *endPos, const dtQueryFilter *filter, const unsigned int options=0)
Intializes a sliced path query.
Definition: DetourNavMeshQuery.cpp:1227
dtStatus finalizeSlicedFindPathPartial(const dtPolyRef *existing, const int existingSize, dtPolyRef *path, int *pathCount, const int maxPath)
Finalizes and returns the results of an incomplete sliced path query, returning the path to the furth...
Definition: DetourNavMeshQuery.cpp:1589
float hitNormal[3]
hitNormal The normal of the nearest wall hit. [(x, y, z)]
Definition: DetourNavMeshQuery.h:164
float mDest[3]
Definition: DetourNavMeshQuery.h:184
navAreaMask getExcludeFlags() const
Returns the exclude flags for the filter.
Definition: DetourNavMeshQuery.h:143
dtStatus findLocalNeighbourhood(dtPolyRef startRef, const float *centerPos, const float radius, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, int *resultCount, const int maxResult) const
Finds the non-overlapping navigation polygons in the local neighbourhood around the center position...
Definition: DetourNavMeshQuery.cpp:3227
~dtNavMeshQuery()
Definition: DetourNavMeshQuery.cpp:156
bool isValidPolyRef(dtPolyRef ref, const dtQueryFilter *filter) const
Returns true if the polygon reference is valid and passes the filter restrictions.
Definition: DetourNavMeshQuery.cpp:3774
int hitEdgeIndex
The index of the edge on the final polygon where the wall was hit.
Definition: DetourNavMeshQuery.h:167
dtStatus getPolyHeight(dtPolyRef ref, const float *pos, float *height) const
Gets the height of the polygon at the provided position using the height detail.
Definition: DetourNavMeshQuery.cpp:696
dtStatus findPolysAroundShape(dtPolyRef startRef, const float *verts, const int nverts, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, float *resultCost, int *resultCount, const int maxResult) const
Finds the polygons along the naviation graph that touch the specified convex polygon.
Definition: DetourNavMeshQuery.cpp:3047
dtStatus findNearestPoly(const float *center, const float *extents, const dtQueryFilter *filter, dtPolyRef *nearestRef, float *nearestPt) const
Finds the polygon nearest to the specified center point.
Definition: DetourNavMeshQuery.cpp:753
class dtNodePool * getNodePool() const
Gets the node pool.
Definition: DetourNavMeshQuery.h:513
Definition: DetourNode.h:51
float mNavDist
Definition: DetourNavMeshQuery.h:186
dtNavMeshQuery * dtAllocNavMeshQuery()
Allocates a query object using the Detour allocator.
Definition: DetourNavMeshQuery.cpp:115
dtStatus updateSlicedFindPath(const int maxIter, int *doneIters)
Updates an in-progress sliced path query.
Definition: DetourNavMeshQuery.cpp:1288
dtStatus init(const dtNavMesh *nav, const int maxNodes)
Initializes the query object.
Definition: DetourNavMeshQuery.cpp:175
dtStatus findDistanceToWall(dtPolyRef startRef, const float *centerPos, const float maxRadius, const dtQueryFilter *filter, float *hitDist, float *hitPos, float *hitNormal) const
Finds the distance from the specified position to the nearest polygon wall.
Definition: DetourNavMeshQuery.cpp:3592
dtStatus findRandomPoint(const dtQueryFilter *filter, float(*frand)(), dtPolyRef *randomRef, float *randomPt) const
Returns random location on navmesh.
Definition: DetourNavMeshQuery.cpp:228
void dtFreeNavMeshQuery(dtNavMeshQuery *query)
Frees the specified query object using the Detour allocator.
Definition: DetourNavMeshQuery.cpp:122
Defines a navigation mesh tile.
Definition: DetourNavMesh.h:282
float getAreaCost(navAreaMask areaMask) const
Returns the traversal cost of the area.
Definition: DetourNavMeshQuery.h:95
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:195
bool passFilter(const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const
Returns true if the polygon can be visited.
Definition: DetourNavMeshQuery.cpp:96
dtStatus getPolyWallSegments(dtPolyRef ref, const dtQueryFilter *filter, float *segmentVerts, dtPolyRef *segmentRefs, int *segmentCount, const int maxSegments) const
Returns the segments for the specified polygon, optionally including portals.
Definition: DetourNavMeshQuery.cpp:3442
dtStatus moveAlongSurface(dtPolyRef startRef, const float *startPos, const float *endPos, const dtQueryFilter *filter, float *resultPos, dtPolyRef *visited, int *visitedCount, const int maxVisitedSize) const
Moves from the start to the end position constrained to the navigation mesh.
Definition: DetourNavMeshQuery.cpp:2028
dtStatus closestPointOnPoly(dtPolyRef ref, const float *pos, float *closest, bool *posOverPoly) const
Finds the closest point on the specified polygon.
Definition: DetourNavMeshQuery.cpp:548