TrinityCore
|
#include <DetourNavMeshQuery.h>
Public Member Functions | |
dtQueryFilter () | |
bool | passFilter (const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const |
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 |
Getters and setters for the default implementation data. | |
float | getAreaCost (const int i) const |
void | setAreaCost (const int i, const float cost) |
unsigned short | getIncludeFlags () const |
void | setIncludeFlags (const unsigned short flags) |
unsigned short | getExcludeFlags () const |
void | setExcludeFlags (const unsigned short flags) |
Private Attributes | |
float | m_areaCost [DT_MAX_AREAS] |
Cost per area type. (Used by default implementation.) More... | |
unsigned short | m_includeFlags |
Flags for polygons that can be visited. (Used by default implementation.) More... | |
unsigned short | m_excludeFlags |
Flags for polygons that should not be visted. (Used by default implementation.) More... | |
Defines polygon filtering and traversal costs for navigation mesh query operations.
The Default Implementation
At construction: All area costs default to 1.0. All flags are included and none are excluded.
If a polygon has both an include and an exclude flag, it will be excluded.
The way filtering works, a navigation mesh polygon must have at least one flag set to ever be considered by a query. So a polygon with no flags will never be considered.
Setting the include flags to 0 will result in all polygons being excluded.
Custom Implementations
DT_VIRTUAL_QUERYFILTER must be defined in order to extend this class.
Implement a custom query filter by overriding the virtual passFilter() and getCost() functions. If this is done, both functions should be as fast as possible. Use cached local copies of data rather than accessing your own objects where possible.
Custom implementations do not need to adhere to the flags or cost logic used by the default implementation.
In order for A* searches to work properly, the cost should be proportional to the travel distance. Implementing a cost modifier less than 1.0 is likely to lead to problems during pathfinding.
dtQueryFilter::dtQueryFilter | ( | ) |
|
inline |
Returns the traversal cost of the area.
[in] | i | The id of the area. |
|
inline |
Returns cost to move from the beginning to the end of a line segment that is fully contained within a polygon.
[in] | pa | The start position on the edge of the previous and current polygon. [(x, y, z)] |
[in] | pb | The end position on the edge of the current and next polygon. [(x, y, z)] |
[in] | prevRef | The reference id of the previous polygon. [opt] |
[in] | prevTile | The tile containing the previous polygon. [opt] |
[in] | prevPoly | The previous polygon. [opt] |
[in] | curRef | The reference id of the current polygon. |
[in] | curTile | The tile containing the current polygon. |
[in] | curPoly | The current polygon. |
[in] | nextRef | The refernece id of the next polygon. [opt] |
[in] | nextTile | The tile containing the next polygon. [opt] |
[in] | nextPoly | The next polygon. [opt] |
|
inline |
Returns the exclude flags for the filter. Any polygons that include one ore more of these flags will be excluded from the operation.
|
inline |
Returns the include flags for the filter. Any polygons that include one or more of these flags will be included in the operation.
|
inline |
Returns true if the polygon can be visited. (I.e. Is traversable.)
[in] | ref | The reference id of the polygon test. |
[in] | tile | The tile containing the polygon. |
[in] | poly | The polygon to test. |
Sets the traversal cost of the area.
[in] | i | The id of the area. |
[in] | cost | The new cost of traversing the area. |
|
inline |
Sets the exclude flags for the filter.
[in] | flags | The new flags. |
|
inline |
Sets the include flags for the filter.
[in] | flags | The new flags. |
|
private |
Cost per area type. (Used by default implementation.)
|
private |
Flags for polygons that should not be visted. (Used by default implementation.)
|
private |
Flags for polygons that can be visited. (Used by default implementation.)