mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 12:25:30 +00:00
update recast
This commit is contained in:
parent
e079536122
commit
8aa48ff21b
34 changed files with 1138 additions and 407 deletions
|
|
@ -20,13 +20,26 @@
|
|||
#include <string.h>
|
||||
#include "DebugDraw.h"
|
||||
#include "DetourMath.h"
|
||||
#include "DetourNavMesh.h"
|
||||
|
||||
|
||||
duDebugDraw::~duDebugDraw()
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
|
||||
unsigned int duDebugDraw::areaToCol(unsigned int area)
|
||||
{
|
||||
if (area == 0)
|
||||
{
|
||||
// Treat zero area type as default.
|
||||
return duRGBA(0, 192, 255, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
return duIntToCol(area, 255);
|
||||
}
|
||||
}
|
||||
|
||||
inline int bit(int a, int b)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void duDebugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf)
|
|||
else if (s->area == RC_NULL_AREA)
|
||||
fcol[0] = duRGBA(64,64,64,255);
|
||||
else
|
||||
fcol[0] = duMultCol(duIntToCol(s->area, 255), 200);
|
||||
fcol[0] = duMultCol(dd->areaToCol(s->area), 200);
|
||||
|
||||
duAppendBox(dd, fx, orig[1]+s->smin*ch, fz, fx+cs, orig[1] + s->smax*ch, fz+cs, fcol);
|
||||
s = s->next;
|
||||
|
|
@ -230,13 +230,14 @@ void duDebugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfi
|
|||
{
|
||||
const rcCompactSpan& s = chf.spans[i];
|
||||
|
||||
const unsigned char area = chf.areas[i];
|
||||
unsigned int color;
|
||||
if (chf.areas[i] == RC_WALKABLE_AREA)
|
||||
if (area == RC_WALKABLE_AREA)
|
||||
color = duRGBA(0,192,255,64);
|
||||
else if (chf.areas[i] == RC_NULL_AREA)
|
||||
else if (area == RC_NULL_AREA)
|
||||
color = duRGBA(0,0,0,64);
|
||||
else
|
||||
color = duIntToCol(chf.areas[i], 255);
|
||||
color = dd->areaToCol(area);
|
||||
|
||||
const float fy = chf.bmin[1] + (s.y+1)*ch;
|
||||
dd->vertex(fx, fy, fz, color);
|
||||
|
|
@ -403,7 +404,7 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye
|
|||
else if (area == RC_NULL_AREA)
|
||||
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 = layer.bmin[0] + x*cs;
|
||||
const float fy = layer.bmin[1] + (lh+1)*ch;
|
||||
|
|
@ -866,14 +867,15 @@ void duDebugDrawPolyMesh(duDebugDraw* dd, const struct rcPolyMesh& mesh)
|
|||
for (int i = 0; i < mesh.npolys; ++i)
|
||||
{
|
||||
const unsigned short* p = &mesh.polys[i*nvp*2];
|
||||
const unsigned char area = mesh.areas[i];
|
||||
|
||||
unsigned int color;
|
||||
if (mesh.areas[i] == RC_WALKABLE_AREA)
|
||||
if (area == RC_WALKABLE_AREA)
|
||||
color = duRGBA(0,192,255,64);
|
||||
else if (mesh.areas[i] == RC_NULL_AREA)
|
||||
else if (area == RC_NULL_AREA)
|
||||
color = duRGBA(0,0,0,64);
|
||||
else
|
||||
color = duIntToCol(mesh.areas[i], 255);
|
||||
color = dd->areaToCol(area);
|
||||
|
||||
unsigned short vi[3];
|
||||
for (int j = 2; j < nvp; ++j)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue