19 #ifndef DETOURNAVMESHQUERY_H
20 #define DETOURNAVMESHQUERY_H
38 unsigned short m_includeFlags;
39 unsigned short m_excludeFlags;
44 #ifdef DT_VIRTUAL_QUERYFILTER
52 #ifdef DT_VIRTUAL_QUERYFILTER
75 #ifdef DT_VIRTUAL_QUERYFILTER
76 virtual float getCost(
const float* pa,
const float* pb,
81 float getCost(
const float* pa,
const float* pb,
93 inline float getAreaCost(
const int i)
const {
return m_areaCost[i]; }
98 inline void setAreaCost(
const int i,
const float cost) { m_areaCost[i] = cost; }
191 const float* startPos,
const float* endPos,
193 dtPolyRef* path,
int* pathCount,
const int maxPath)
const;
208 const dtPolyRef* path,
const int pathSize,
209 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
210 int* straightPathCount,
const int maxStraightPath,
const int options = 0)
const;
229 const float* startPos,
const float* endPos,
230 const dtQueryFilter* filter,
const unsigned int options = 0);
256 dtPolyRef* path,
int* pathCount,
const int maxPath);
277 int* resultCount,
const int maxResult)
const;
295 int* resultCount,
const int maxResult)
const;
326 dtPolyRef* nearestRef,
float* nearestPt)
const;
340 dtPolyRef* nearestRef,
float* nearestPt,
bool* isOverPoly)
const;
352 dtPolyRef* polys,
int* polyCount,
const int maxPolys)
const;
376 int* resultCount,
const int maxResult)
const;
390 float* resultPos,
dtPolyRef* visited,
int* visitedCount,
const int maxVisitedSize)
const;
408 float* t,
float* hitNormal,
dtPolyRef* path,
int* pathCount,
const int maxPath)
const;
438 float* hitDist,
float* hitPos,
float* hitNormal)
const;
450 float* segmentVerts,
dtPolyRef* segmentRefs,
int* segmentCount,
451 const int maxSegments)
const;
461 dtPolyRef* randomRef,
float* randomPt)
const;
476 dtPolyRef* randomRef,
float* randomPt)
const;
531 void queryPolygonsInTile(
const dtMeshTile* tile,
const float* qmin,
const float* qmax,
536 unsigned char& fromType,
unsigned char& toType)
const;
539 float*
left,
float* right)
const;
549 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
550 int* straightPathCount,
const int maxStraightPath)
const;
553 dtStatus appendPortals(
const int startIdx,
const int endIdx,
const float* endPos,
const dtPolyRef* path,
554 float* straightPath,
unsigned char* straightPathFlags,
dtPolyRef* straightPathRefs,
555 int* straightPathCount,
const int maxStraightPath,
const int options)
const;
565 struct dtNode* lastBestNode;
566 float lastBestNodeCost;
568 float startPos[3], endPos[3];
570 unsigned int options;
571 float raycastLimitSqr;
unsigned int dtStatus
Definition: DetourStatus.h:22
static bool appendVertex(dtTempContour &cont, const int x, const int y, const int z, const int r)
Definition: DetourTileCacheBuilder.cpp:394
bool left(const unsigned char *a, const unsigned char *b, const unsigned char *c)
Definition: DetourTileCacheBuilder.cpp:1098
Provides the ability to perform pathfinding related queries against a navigation mesh.
Definition: DetourNavMeshQuery.h:166
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:1587
const dtNavMesh * getAttachedNavMesh() const
Gets the navigation mesh the query object is using.
Definition: DetourNavMeshQuery.h:521
dtStatus queryPolygons(const float *center, const float *halfExtents, const dtQueryFilter *filter, dtPolyRef *polys, int *polyCount, const int maxPolys) const
Finds polygons that overlap the search box.
Definition: DetourNavMeshQuery.cpp:899
dtStatus closestPointOnPoly(dtPolyRef ref, const float *pos, float *closest, bool *posOverPoly) const
Finds the closest point on the specified polygon.
Definition: DetourNavMeshQuery.cpp:511
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:2720
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:3470
~dtNavMeshQuery()
Definition: DetourNavMeshQuery.cpp:152
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:3314
dtStatus findNearestPoly(const float *center, const float *halfExtents, const dtQueryFilter *filter, dtPolyRef *nearestRef, float *nearestPt) const
Finds the polygon nearest to the specified center point.
Definition: DetourNavMeshQuery.cpp:693
class dtNodePool * getNodePool() const
Gets the node pool.
Definition: DetourNavMeshQuery.h:517
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:2408
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:2044
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:3092
dtStatus finalizeSlicedFindPath(dtPolyRef *path, int *pathCount, const int maxPath)
Finalizes and returns the results of a sliced path query.
Definition: DetourNavMeshQuery.cpp:1497
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:973
dtStatus updateSlicedFindPath(const int maxIter, int *doneIters)
Updates an in-progress sliced path query.
Definition: DetourNavMeshQuery.cpp:1280
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:2894
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:536
dtNavMeshQuery()
Definition: DetourNavMeshQuery.cpp:143
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:317
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:1793
bool isValidPolyRef(dtPolyRef ref, const dtQueryFilter *filter) const
Returns true if the polygon reference is valid and passes the filter restrictions.
Definition: DetourNavMeshQuery.cpp:3657
dtStatus init(const dtNavMesh *nav, const int maxNodes)
Initializes the query object.
Definition: DetourNavMeshQuery.cpp:171
bool isInClosedList(dtPolyRef ref) const
Returns true if the polygon reference is in the closed list.
Definition: DetourNavMeshQuery.cpp:3676
dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef, const float *startPos, const float *endPos, const dtQueryFilter *filter, const unsigned int options=0)
Initializes a sliced path query.
Definition: DetourNavMeshQuery.cpp:1216
dtStatus getPathFromDijkstraSearch(dtPolyRef endRef, dtPolyRef *path, int *pathCount, int maxPath) const
Gets a path from the explored nodes in the previous search.
Definition: DetourNavMeshQuery.cpp:3055
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:591
dtStatus findRandomPoint(const dtQueryFilter *filter, float(*frand)(), dtPolyRef *randomRef, float *randomPt) const
Returns random location on navmesh.
Definition: DetourNavMeshQuery.cpp:226
A navigation mesh based on tiles of convex polygons.
Definition: DetourNavMesh.h:339
Definition: DetourNode.h:50
Definition: DetourNode.h:109
Provides custom polygon query behavior.
Definition: DetourNavMeshQuery.h:153
virtual void process(const dtMeshTile *tile, dtPoly **polys, dtPolyRef *refs, int count)=0
Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons.
virtual ~dtPolyQuery()
Definition: DetourNavMeshQuery.cpp:120
Defines polygon filtering and traversal costs for navigation mesh query operations.
Definition: DetourNavMeshQuery.h:36
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:94
void setExcludeFlags(const unsigned short flags)
Sets the exclude flags for the filter.
Definition: DetourNavMeshQuery.h:116
float getAreaCost(const int i) const
Returns the traversal cost of the area.
Definition: DetourNavMeshQuery.h:93
void setAreaCost(const int i, const float cost)
Sets the traversal cost of the area.
Definition: DetourNavMeshQuery.h:98
unsigned short getIncludeFlags() const
Returns the include flags for the filter.
Definition: DetourNavMeshQuery.h:103
bool passFilter(const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const
Returns true if the polygon can be visited.
Definition: DetourNavMeshQuery.cpp:87
void setIncludeFlags(const unsigned short flags)
Sets the include flags for the filter.
Definition: DetourNavMeshQuery.h:107
unsigned short getExcludeFlags() const
Returns the exclude flags for the filter.
Definition: DetourNavMeshQuery.h:112
dtQueryFilter()
Definition: DetourNavMeshQuery.cpp:63
void dtFreeNavMeshQuery(dtNavMeshQuery *query)
Frees the specified query object using the Detour allocator.
Definition: DetourNavMeshQuery.cpp:113
static const int DT_MAX_AREAS
The maximum number of user defined area ids.
Definition: DetourNavMesh.h:95
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition: DetourNavMesh.h:48
dtNavMeshQuery * dtAllocNavMeshQuery()
Allocates a query object using the Detour allocator.
Definition: DetourNavMeshQuery.cpp:106
Defines a navigation mesh tile.
Definition: DetourNavMesh.h:282
Definition: DetourNode.h:37
Defines a polygon within a dtMeshTile object.
Definition: DetourNavMesh.h:156
Provides information about raycast hit filled by dtNavMeshQuery::raycast.
Definition: DetourNavMeshQuery.h:126
int hitEdgeIndex
The index of the edge on the final polygon where the wall was hit.
Definition: DetourNavMeshQuery.h:134
float hitNormal[3]
hitNormal The normal of the nearest wall hit. [(x, y, z)]
Definition: DetourNavMeshQuery.h:131
int maxPath
The maximum number of polygons the path array can hold.
Definition: DetourNavMeshQuery.h:143
float t
The hit parameter. (FLT_MAX if no wall hit.)
Definition: DetourNavMeshQuery.h:128
float pathCost
The cost of the path until hit.
Definition: DetourNavMeshQuery.h:146
int pathCount
The number of visited polygons. [opt].
Definition: DetourNavMeshQuery.h:140
dtPolyRef * path
Pointer to an array of reference ids of the visited polygons. [opt].
Definition: DetourNavMeshQuery.h:137