53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <a8/vec3.h>
|
|
|
|
#include "DetourTileCache.h"
|
|
|
|
class dtTileCache;
|
|
class dtNavMesh;
|
|
class dtNavMeshQuery;
|
|
namespace f8
|
|
{
|
|
|
|
typedef dtObstacleRef ObstacleRef;
|
|
|
|
class NavMeshLayer
|
|
{
|
|
public:
|
|
int FindStraightPath(const a8::Vec3& start, const a8::Vec3& end,
|
|
std::vector<a8::Vec3>& path_list);
|
|
int FindRandomPointAroundCircle(const a8::Vec3& center_pos,
|
|
std::vector<a8::Vec3>& points, int max_points, float max_radius);
|
|
int Raycast(const a8::Vec3& start, const a8::Vec3& end,
|
|
std::vector<a8::Vec3>& hit_points);
|
|
|
|
bool AddObstacle(a8::Vec3& pos, const float radius, const float height, ObstacleRef* obstacle_ref);
|
|
bool AddBoxObstacle(a8::Vec3& bmin, a8::Vec3& bmax, ObstacleRef* obstacle_ref);
|
|
bool RemoveObstacle(const ObstacleRef& obstacle_ref);
|
|
void WaitRebuildOk();
|
|
bool Update();
|
|
|
|
private:
|
|
|
|
dtNavMesh* navmesh_ = nullptr;
|
|
dtTileCache* tile_cache_ = nullptr;
|
|
dtNavMeshQuery* navmesh_query_ = nullptr;
|
|
};
|
|
|
|
class NavigationHandle
|
|
{
|
|
public:
|
|
NavigationHandle() {};
|
|
~NavigationHandle() {};
|
|
|
|
NavMeshLayer* GetLayer(int layer);
|
|
void WaitRebuildOk();
|
|
bool Update();
|
|
|
|
private:
|
|
std::map<int, NavMeshLayer> navmesh_layers_;
|
|
};
|
|
|
|
}
|