2021-01-04 09:39:07 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
// Smart pointer deleters
|
|
|
|
|
|
|
|
struct NavMeshDeleter
|
|
|
|
{
|
|
|
|
void operator()(dtNavMesh* navMesh)
|
|
|
|
{
|
|
|
|
if (navMesh)
|
|
|
|
dtFreeNavMesh(navMesh);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NavMeshQueryDeleter
|
|
|
|
{
|
|
|
|
void operator()(dtNavMeshQuery* navMeshQuery)
|
|
|
|
{
|
|
|
|
if (navMeshQuery)
|
|
|
|
dtFreeNavMeshQuery(navMeshQuery);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
// Serialization logic
|
2021-01-05 04:19:21 +01:00
|
|
|
// Note: identical to Recast's demo app so it can be loaded by it
|
2021-01-04 09:39:07 +01:00
|
|
|
struct NavMeshSetHeader
|
|
|
|
{
|
|
|
|
int magic;
|
|
|
|
int version;
|
|
|
|
int numTiles;
|
|
|
|
dtNavMeshParams params;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NavMeshTileHeader
|
|
|
|
{
|
|
|
|
dtTileRef tileRef;
|
|
|
|
int dataSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int NAVMESHSET_MAGIC = 'M' << 24 | 'S' << 16 | 'E' << 8 | 'T'; //'MSET';
|
|
|
|
static const int NAVMESHSET_VERSION = 1;
|