mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
Move Navmesh code away from dPhysics (#701)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Singleton.h"
|
||||
#include <vector>
|
||||
|
||||
//Navmesh includes:
|
||||
#include "Recast.h"
|
||||
@@ -11,23 +11,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
static const int MAX_POLYS = 256;
|
||||
static const int MAX_SMOOTH = 2048;
|
||||
#include "dNavMesh.h"
|
||||
|
||||
class NiPoint3;
|
||||
class dpEntity;
|
||||
@@ -38,22 +22,17 @@ public:
|
||||
void Initialize(unsigned int zoneID);
|
||||
|
||||
~dpWorld();
|
||||
void RecastCleanup();
|
||||
|
||||
bool LoadNavmeshByZoneID(unsigned int zoneID);
|
||||
dtNavMesh* LoadNavmesh(const char* path);
|
||||
bool ShouldLoadNavmesh(unsigned int zoneID);
|
||||
bool ShouldUseSP(unsigned int zoneID);
|
||||
|
||||
float GetHeightAtPoint(const NiPoint3& location);
|
||||
std::vector<NiPoint3> GetPath(const NiPoint3& startPos, const NiPoint3& endPos, float speed = 10.0f);
|
||||
bool IsLoaded() const { return m_navMesh != nullptr; }
|
||||
bool IsLoaded() const { return m_NavMesh != nullptr; }
|
||||
|
||||
void StepWorld(float deltaTime);
|
||||
|
||||
void AddEntity(dpEntity* entity);
|
||||
void RemoveEntity(dpEntity* entity);
|
||||
|
||||
dNavMesh* GetNavMesh() { return m_NavMesh; }
|
||||
|
||||
private:
|
||||
dpGrid* m_Grid;
|
||||
bool phys_spatial_partitioning = 1;
|
||||
@@ -63,18 +42,5 @@ private:
|
||||
std::vector<dpEntity*> m_StaticEntities;
|
||||
std::vector<dpEntity*> m_DynamicEntites;
|
||||
|
||||
//Navmesh stuffs:
|
||||
unsigned char* m_triareas;
|
||||
rcHeightfield* m_solid;
|
||||
rcCompactHeightfield* m_chf;
|
||||
rcContourSet* m_cset;
|
||||
rcPolyMesh* m_pmesh;
|
||||
rcConfig m_cfg;
|
||||
rcPolyMeshDetail* m_dmesh;
|
||||
|
||||
class InputGeom* m_geom;
|
||||
class dtNavMesh* m_navMesh;
|
||||
class dtNavMeshQuery* m_navQuery;
|
||||
unsigned char m_navMeshDrawFlags;
|
||||
rcContext* m_ctx;
|
||||
dNavMesh* m_NavMesh;
|
||||
};
|
||||
|
Reference in New Issue
Block a user