update recast

This commit is contained in:
Johxz 2018-02-28 22:15:31 -06:00
parent e079536122
commit 8aa48ff21b
34 changed files with 1138 additions and 407 deletions

View file

@ -121,6 +121,7 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh
dtPolyRef base = mesh.getPolyRefBase(tile);
int tileNum = mesh.decodePolyIdTile(base);
const unsigned int tileColor = duIntToCol(tileNum, 128);
dd->depthMask(false);
@ -139,16 +140,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh
else
{
if (flags & DU_DRAWNAVMESH_COLOR_TILES)
{
col = duIntToCol(tileNum, 128);
}
col = tileColor;
else
{
if (p->getArea() == 0) // Treat zero area type as default.
col = duRGBA(0,192,255,64);
else
col = duIntToCol(p->getArea(), 64);
}
col = duTransCol(dd->areaToCol(p->getArea()), 64);
}
for (int j = 0; j < pd->triCount; ++j)
@ -184,8 +178,8 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh
if (query && query->isInClosedList(base | (dtPolyRef)i))
col = duRGBA(255,196,0,220);
else
col = duDarkenCol(duIntToCol(p->getArea(), 220));
col = duDarkenCol(duTransCol(dd->areaToCol(p->getArea()), 220));
const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase];
const float* va = &tile->verts[p->verts[0]*3];
const float* vb = &tile->verts[p->verts[1]*3];
@ -451,7 +445,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re
dd->depthMask(false);
const unsigned int c = (col & 0x00ffffff) | (64 << 24);
const unsigned int c = duTransCol(col, 64);
const unsigned int ip = (unsigned int)(poly - tile->polys);
if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION)
@ -462,7 +456,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re
// Connection arc.
duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f,
(con->flags & 1) ? 0.6f : 0, 0.6f, c);
(con->flags & 1) ? 0.6f : 0.0f, 0.6f, c);
dd->end();
}
@ -559,15 +553,15 @@ void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLay
const int lidx = x+y*w;
const int lh = (int)layer.heights[lidx];
if (lh == 0xff) continue;
const unsigned char area = layer.areas[lidx];
unsigned int col;
if (area == 63)
col = duLerpCol(color, duRGBA(0,192,255,64), 32);
else if (area == 0)
col = duLerpCol(color, duRGBA(0,0,0,64), 32);
else
col = duLerpCol(color, duIntToCol(area, 255), 32);
col = duLerpCol(color, dd->areaToCol(area), 32);
const float fx = bmin[0] + x*cs;
const float fy = bmin[1] + (lh+1)*ch;
@ -743,14 +737,15 @@ void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyM
for (int i = 0; i < lmesh.npolys; ++i)
{
const unsigned short* p = &lmesh.polys[i*nvp*2];
const unsigned char area = lmesh.areas[i];
unsigned int color;
if (lmesh.areas[i] == DT_TILECACHE_WALKABLE_AREA)
if (area == DT_TILECACHE_WALKABLE_AREA)
color = duRGBA(0,192,255,64);
else if (lmesh.areas[i] == DT_TILECACHE_NULL_AREA)
else if (area == DT_TILECACHE_NULL_AREA)
color = duRGBA(0,0,0,64);
else
color = duIntToCol(lmesh.areas[i], 255);
color = dd->areaToCol(area);
unsigned short vi[3];
for (int j = 2; j < nvp; ++j)