text
stringlengths 0
2.2M
|
---|
dtTileCacheContourSet* dtAllocTileCacheContourSet(dtTileCacheAlloc* alloc)
|
{
|
dtAssert(alloc);
|
dtTileCacheContourSet* cset = (dtTileCacheContourSet*)alloc->alloc(sizeof(dtTileCacheContourSet));
|
memset(cset, 0, sizeof(dtTileCacheContourSet));
|
return cset;
|
}
|
void dtFreeTileCacheContourSet(dtTileCacheAlloc* alloc, dtTileCacheContourSet* cset)
|
{
|
dtAssert(alloc);
|
if (!cset) return;
|
for (int i = 0; i < cset->nconts; ++i)
|
alloc->free(cset->conts[i].verts);
|
alloc->free(cset->conts);
|
alloc->free(cset);
|
}
|
dtTileCachePolyMesh* dtAllocTileCachePolyMesh(dtTileCacheAlloc* alloc)
|
{
|
dtAssert(alloc);
|
dtTileCachePolyMesh* lmesh = (dtTileCachePolyMesh*)alloc->alloc(sizeof(dtTileCachePolyMesh));
|
memset(lmesh, 0, sizeof(dtTileCachePolyMesh));
|
return lmesh;
|
}
|
void dtFreeTileCachePolyMesh(dtTileCacheAlloc* alloc, dtTileCachePolyMesh* lmesh)
|
{
|
dtAssert(alloc);
|
if (!lmesh) return;
|
alloc->free(lmesh->verts);
|
alloc->free(lmesh->polys);
|
alloc->free(lmesh->flags);
|
alloc->free(lmesh->areas);
|
alloc->free(lmesh);
|
}
|
struct dtLayerSweepSpan
|
{
|
unsigned short ns; // number samples
|
unsigned char id; // region id
|
unsigned char nei; // neighbour id
|
};
|
static const int DT_LAYER_MAX_NEIS = 16;
|
struct dtLayerMonotoneRegion
|
{
|
int area;
|
unsigned char neis[DT_LAYER_MAX_NEIS];
|
unsigned char nneis;
|
unsigned char regId;
|
unsigned char areaId;
|
};
|
struct dtTempContour
|
{
|
inline dtTempContour(unsigned char* vbuf, const int nvbuf,
|
unsigned short* pbuf, const int npbuf) :
|
verts(vbuf), nverts(0), cverts(nvbuf),
|
poly(pbuf), npoly(0), cpoly(npbuf)
|
{
|
}
|
unsigned char* verts;
|
int nverts;
|
int cverts;
|
unsigned short* poly;
|
int npoly;
|
int cpoly;
|
};
|
inline bool overlapRangeExl(const unsigned short amin, const unsigned short amax,
|
const unsigned short bmin, const unsigned short bmax)
|
{
|
return (amin >= bmax || amax <= bmin) ? false : true;
|
}
|
static void addUniqueLast(unsigned char* a, unsigned char& an, unsigned char v)
|
{
|
const int n = (int)an;
|
if (n > 0 && a[n-1] == v) return;
|
a[an] = v;
|
an++;
|
}
|
inline bool isConnected(const dtTileCacheLayer& layer,
|
const int ia, const int ib, const int walkableClimb)
|
{
|
if (layer.areas[ia] != layer.areas[ib]) return false;
|
if (dtAbs((int)layer.heights[ia] - (int)layer.heights[ib]) > walkableClimb) return false;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.