1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00
sapphire/src/world/Navi/NaviProvider.h

62 lines
1.3 KiB
C
Raw Normal View History

2019-01-20 16:10:48 +01:00
#ifndef _NAVIPROVIDER_H_
#define _NAVIPROVIDER_H_
#include <Common.h>
#include "ForwardsZone.h"
#include <recastnavigation/Detour/Include/DetourNavMesh.h>
#include <recastnavigation/Detour/Include/DetourNavMeshQuery.h>
namespace Sapphire
{
class NaviProvider
{
static const int NAVMESHSET_MAGIC = 'M' << 24 | 'S' << 16 | 'E' << 8 | 'T'; //'MSET';
static const int NAVMESHSET_VERSION = 1;
struct NavMeshSetHeader
{
int magic;
int version;
int numTiles;
dtNavMeshParams params;
};
struct NavMeshTileHeader
{
dtTileRef tileRef;
int dataSize;
};
2019-01-21 02:08:38 +01:00
static const int MAX_POLYS = 256;
static const int MAX_SMOOTH = 2048;
2019-01-20 16:10:48 +01:00
public:
NaviProvider( const ZonePtr pZone, Sapphire::FrameworkPtr pFw );
void init();
2019-01-21 14:02:47 +01:00
void loadMesh( std::string path );
void initQuery();
2019-01-20 16:10:48 +01:00
2019-01-21 14:02:47 +01:00
void toDetourPos(const Common::FFXIVARR_POSITION3 position, float* out);
2019-01-21 15:15:28 +01:00
Sapphire::Common::FFXIVARR_POSITION3 toGamePos( float* pos );
2019-01-21 02:08:38 +01:00
2019-01-21 14:02:47 +01:00
std::vector< Sapphire::Common::FFXIVARR_POSITION3 > findFollowPath(Common::FFXIVARR_POSITION3 startPos, Common::FFXIVARR_POSITION3 endPos);
bool hasNaviMesh() const;
2019-01-20 16:10:48 +01:00
protected:
FrameworkPtr m_pFw;
ZonePtr m_pZone;
dtNavMesh* m_naviMesh;
dtNavMeshQuery* m_naviMeshQuery;
2019-01-21 02:08:38 +01:00
float m_polyFindRange[3];
2019-01-20 16:10:48 +01:00
};
}
#endif