2022-08-02 05:30:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class NiPoint3;
|
2024-02-06 14:53:51 +00:00
|
|
|
class rcHeightfield;
|
|
|
|
class rcCompactHeightfield;
|
|
|
|
class rcContourSet;
|
|
|
|
class rcPolyMesh;
|
|
|
|
class rcPolyMeshDetail;
|
|
|
|
class InputGeom;
|
|
|
|
class dtNavMesh;
|
|
|
|
class dtNavMeshQuery;
|
|
|
|
class rcContext;
|
2022-08-02 05:30:19 +00:00
|
|
|
|
|
|
|
class dNavMesh {
|
|
|
|
public:
|
|
|
|
dNavMesh(uint32_t zoneId);
|
|
|
|
~dNavMesh();
|
|
|
|
|
2023-08-12 14:20:00 +00:00
|
|
|
/**
|
|
|
|
* Get the height at a point
|
2024-05-22 01:01:44 +00:00
|
|
|
*
|
2023-08-12 14:20:00 +00:00
|
|
|
* @param location The location to check for height at. This is the center of the search area.
|
|
|
|
* @param halfExtentsHeight The half extents height of the search area. This is the distance from the center to the top and bottom of the search area.
|
|
|
|
* The larger the value of halfExtentsHeight is, the larger the performance cost of the query.
|
|
|
|
* @return float The height at the point. If the point is not on the navmesh, the height of the point is returned.
|
|
|
|
*/
|
|
|
|
float GetHeightAtPoint(const NiPoint3& location, const float halfExtentsHeight = 32.0f) const;
|
2022-08-02 05:30:19 +00:00
|
|
|
std::vector<NiPoint3> GetPath(const NiPoint3& startPos, const NiPoint3& endPos, float speed = 10.0f);
|
2024-05-22 01:01:44 +00:00
|
|
|
NiPoint3 NearestPoint(const NiPoint3& location, const float halfExtent = 32.0f) const;
|
2024-02-06 14:53:51 +00:00
|
|
|
bool IsNavmeshLoaded() { return m_NavMesh != nullptr; }
|
2022-08-05 12:41:07 +00:00
|
|
|
|
2022-08-02 05:30:19 +00:00
|
|
|
private:
|
|
|
|
void LoadNavmesh();
|
|
|
|
|
|
|
|
uint32_t m_ZoneId;
|
|
|
|
|
2024-02-06 14:53:51 +00:00
|
|
|
dtNavMesh* m_NavMesh = nullptr;
|
|
|
|
dtNavMeshQuery* m_NavQuery = nullptr;
|
2022-08-02 05:30:19 +00:00
|
|
|
uint8_t m_NavMeshDrawFlags;
|
|
|
|
};
|