1
This commit is contained in:
parent
ee5edc4d5e
commit
3a5ae8d071
@ -10,6 +10,8 @@
|
||||
|
||||
#include "navmeshhelper.h"
|
||||
|
||||
#include "framework/cpp/inputgemo.h"
|
||||
|
||||
void NavMeshBuilder::Init()
|
||||
{
|
||||
|
||||
|
@ -107,41 +107,3 @@ void NavMeshHelper::OutputObjFile(MapInstance* map_instance)
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
static bool checkOverlapRect(const float amin[2], const float amax[2],
|
||||
const float bmin[2], const float bmax[2])
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
|
||||
return overlap;
|
||||
}
|
||||
|
||||
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm,
|
||||
float bmin[2], float bmax[2],
|
||||
int* ids, const int maxIds)
|
||||
{
|
||||
// Traverse tree
|
||||
int i = 0;
|
||||
int n = 0;
|
||||
while (i < cm->nnodes) {
|
||||
const rcChunkyTriMeshNode* node = &cm->nodes[i];
|
||||
const bool overlap = checkOverlapRect(bmin, bmax, node->bmin, node->bmax);
|
||||
const bool isLeafNode = node->i >= 0;
|
||||
|
||||
if (isLeafNode && overlap) {
|
||||
if (n < maxIds) {
|
||||
ids[n] = i;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
if (overlap || isLeafNode)
|
||||
i++;
|
||||
else {
|
||||
const int escapeIndex = -node->i;
|
||||
i += escapeIndex;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
@ -37,47 +37,6 @@ struct TileCacheData
|
||||
int dataSize;
|
||||
};
|
||||
|
||||
struct rcChunkyTriMeshNode
|
||||
{
|
||||
float bmin[2];
|
||||
float bmax[2];
|
||||
int i;
|
||||
int n;
|
||||
};
|
||||
|
||||
struct rcChunkyTriMesh
|
||||
{
|
||||
inline rcChunkyTriMesh() : nodes(0), nnodes(0), tris(0), ntris(0), maxTrisPerChunk(0) {};
|
||||
inline ~rcChunkyTriMesh() { delete [] nodes; delete [] tris; }
|
||||
|
||||
rcChunkyTriMeshNode* nodes;
|
||||
int nnodes;
|
||||
int* tris;
|
||||
int ntris;
|
||||
int maxTrisPerChunk;
|
||||
|
||||
private:
|
||||
// Explicitly disabled copy constructor and copy assignment operator.
|
||||
#if 0
|
||||
rcChunkyTriMesh(const rcChunkyTriMesh&);
|
||||
rcChunkyTriMesh& operator=(const rcChunkyTriMesh&);
|
||||
#endif
|
||||
};
|
||||
|
||||
static const int MAX_CONVEXVOL_PTS = 12;
|
||||
struct ConvexVolume
|
||||
{
|
||||
ConvexVolume(): areaMod(RC_AREA_FLAGS_MASK) {}
|
||||
float verts[MAX_CONVEXVOL_PTS*3];
|
||||
float hmin, hmax;
|
||||
int nverts;
|
||||
rcAreaModification areaMod;
|
||||
};
|
||||
|
||||
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm,
|
||||
float bmin[2], float bmax[2],
|
||||
int* ids, const int maxIds);
|
||||
|
||||
struct RasterizationContext
|
||||
{
|
||||
RasterizationContext() :
|
||||
@ -219,19 +178,10 @@ class NavMeshHelper
|
||||
static void OutputObjFile(MapInstance* map_instance);
|
||||
};
|
||||
|
||||
class InputGeom
|
||||
namespace f8
|
||||
{
|
||||
public:
|
||||
const float* GetMeshBoundsMin() const { return nullptr; }
|
||||
const float* GetMeshBoundsMax() const { return nullptr; }
|
||||
const float* GetVerts() const { return nullptr; }
|
||||
int GetVertCount() const { return 0; }
|
||||
const rcChunkyTriMesh* GetChunkyMesh() { return nullptr; }
|
||||
#if 0
|
||||
const ConvexVolume* GetConvexVolumes() { return nullptr; }
|
||||
int GetConvexVolumeCount() { return 0; }
|
||||
#endif
|
||||
};
|
||||
class InputGeom;
|
||||
}
|
||||
|
||||
struct BuilderParams
|
||||
{
|
||||
@ -285,7 +235,7 @@ struct BuilderParams
|
||||
int tile_height = 0;
|
||||
|
||||
MapInstance* map_instance = nullptr;
|
||||
InputGeom* gemo = nullptr;
|
||||
f8::InputGeom* gemo = nullptr;
|
||||
dtNavMesh* navmesh = nullptr;
|
||||
rcContext* ctx = nullptr;
|
||||
dtTileCache* tile_cache = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user