10 #include <AtomsUtils/Globals.h>
11 #include <AtomsUtils/Mesh.h>
13 #include <AtomsUtils/NavigationMesh/Recast/Recast.h>
14 #include <AtomsUtils/NavigationMesh/Detour/DetourNavMesh.h>
15 #include <AtomsUtils/NavigationMesh/Detour/DetourNavMeshQuery.h>
16 #include <AtomsUtils/NavigationMesh/RecastContext.h>
22 class ATOMSUTILS_EXPORT dtNavMeshQuery
30 typedef dtNavMeshQuery NavMeshQuery;
36 std::vector<AtomsMath::Vector3f> points;
38 std::vector<dtPolyRef> polygons;
40 std::vector<float> costs;
41 std::vector<unsigned int> customLinks;
54 SAMPLE_PARTITION_WATERSHED,
55 SAMPLE_PARTITION_MONOTONE,
56 SAMPLE_PARTITION_LAYERS,
66 float m_agentMaxClimb;
67 float m_agentMaxSlope;
68 float m_regionMinSize;
69 float m_regionMergeSize;
73 float m_detailSampleDist;
74 float m_detailSampleMaxError;
77 bool m_filterLowHangingObstacles;
78 bool m_filterLedgeSpans;
79 bool m_filterWalkableLowHeightSpans;
87 unsigned char* buildTileMesh(
const AtomsUtils::Mesh& mesh,
const Config& config,
const int tx,
const int ty,
const float* bmin,
const float* bmax,
int& dataSize);
88 void getTilePos(
const AtomsUtils::Mesh& mesh,
const Config& config,
const float* pos,
int& tx,
int& ty,
const float* bmin,
const float* bmax);
89 void buildTile(
const AtomsUtils::Mesh& mesh,
const Config& config,
const float* pos,
const float* bmin,
const float* bmax);
90 void removeTile(
const AtomsUtils::Mesh& mesh,
const Config& config,
const float* pos,
const float* bmin,
const float* bmax);
91 void buildAllTiles(
const AtomsUtils::Mesh& mesh,
const Config& config,
const float* bmin,
const float* bmax);
92 void removeAllTiles(
const AtomsUtils::Mesh& mesh,
const Config& config,
const float* bmin,
const float* bmax);
100 void setBoundingBox(
const AtomsMath::Box3f& box);
102 virtual void findPath(
const AtomsMath::Vector3f& start,
const AtomsMath::Vector3f& end,
NavMeshPath& path,
const dtNavMeshQuery* m_navQuery =
nullptr);
104 virtual unsigned int findCorridorPath(
const AtomsMath::Vector3f& start,
const AtomsMath::Vector3f& end,
NavMeshPath& path,
const dtNavMeshQuery* m_navQuery =
nullptr);
106 virtual bool findStraightPath(
const AtomsMath::Vector3f& start,
const AtomsMath::Vector3f& end,
NavMeshPath& path,
const dtNavMeshQuery* m_navQuery =
nullptr);
108 virtual bool projectPointToNavMesh(
const AtomsMath::Vector3f& point, AtomsMath::Vector3f& result,
const AtomsMath::Vector3f& extent,
const dtNavMeshQuery* m_navQuery =
nullptr);
110 virtual bool pathCost(
const AtomsMath::Vector3f& pathStart,
const AtomsMath::Vector3f& pathEnd,
float& cost,
const dtNavMeshQuery* m_navQuery =
nullptr);
112 virtual bool pathLength(
const AtomsMath::Vector3f& pathStart,
const AtomsMath::Vector3f& pathEnd,
float& length,
const dtNavMeshQuery* m_navQuery =
nullptr);
114 virtual bool pathConstAndLength(
const AtomsMath::Vector3f& pathStart,
const AtomsMath::Vector3f& pathEnd,
float& cost,
float& length,
const dtNavMeshQuery* m_navQuery =
nullptr);
116 virtual bool raycast(
const AtomsMath::Vector3f& rayStart,
const AtomsMath::Vector3f& rayEnd, AtomsMath::Vector3f& hitPoint,
bool& hit,
const dtNavMeshQuery* m_navQuery =
nullptr);
118 virtual bool randomPoint(AtomsMath::Vector3f& result,
int seed,
const dtNavMeshQuery* m_navQuery =
nullptr);
120 virtual bool randomReachablePointInRadius(
const AtomsMath::Vector3f& origin,
int seed,
float radius, AtomsMath::Vector3f& result,
const dtNavMeshQuery* m_navQuery =
nullptr);
122 virtual bool findDistanceToWall(
const AtomsMath::Vector3f& point,
const float radius,
float& hitDist, AtomsMath::Vector3f& hitPos, AtomsMath::Vector3f& hitNormal,
const AtomsMath::Vector3f& extent = AtomsMath::Vector3f(1.0, 1.0, 1.0),
const dtNavMeshQuery* m_navQuery =
nullptr);
124 virtual void getPolyBoundaries(std::vector<AtomsMath::Vector3f>& segmentVerts,
int& segmentCount,
bool inner,
const NavMeshQuery* m_navQuery =
nullptr);
128 virtual bool getEdgeBorderInRadius(
const AtomsMath::Vector3f& position,
double radius, std::vector<AtomsMath::Vector3f>& lines);
129 virtual bool getEdgeBorderInRadius(
const AtomsMath::Vector3& position,
double radius, std::vector<AtomsMath::Vector3>& lines);
131 inline const AtomsMath::Box3f& boundingBox()
const {
return m_bbox; }
133 inline const RecastContext* recastContext()
const {
return m_ctx; };
134 inline const dtNavMesh* recastNavMesh()
const {
return m_navMesh; };
135 inline const dtNavMeshQuery& recastNavMeshQuery()
const {
return m_navQuery; };
136 inline const dtQueryFilter& recastNavMeshQueryFilter()
const {
return m_navQueryFilter; };
141 void PostProcessPath(dtStatus FindPathStatus, NavMeshPath& Path,
142 const dtNavMeshQuery& NavQuery,
const dtQueryFilter* Filter,
143 int StartPolyID,
int EndPolyID,
144 AtomsMath::Vector3f StartLoc, AtomsMath::Vector3f EndLoc,
145 AtomsMath::Vector3f RecastStartPos, AtomsMath::Vector3f RecastEndPos,
146 dtQueryResult& PathResult);
153 AtomsMath::Box3f m_bbox;
155 RecastContext* m_ctx;
156 dtNavMesh* m_navMesh;
157 dtNavMeshQuery m_navQuery;
158 dtQueryFilter m_navQueryFilter;
Mesh class.
Definition: Mesh.h:30
Base64 encode/decode.
Definition: RecastContext.h:20
Definition: DetourNavMeshQuery.h:323
AtomsCore namespace.
Definition: Base64.h:13