From fd234b8550f122286eb205c2c1001640f5d4612e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 17 Jul 2024 00:40:44 +0200 Subject: [PATCH] Recast: improve rendering of off-mesh connections Make the line always blue, and render a cross if the start and/or the end position has been set correctly. --- .../recast/DebugUtils/Source/DetourDebugDraw.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp index f8e62242..f4a41fab 100644 --- a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -201,11 +201,11 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh if (p->getType() != DT_POLYTYPE_OFFMESH_CONNECTION) // Skip regular polys. continue; - unsigned int col, col2; + unsigned int col; if (query && query->isInClosedList(base | (dtPolyRef)i)) col = duRGBA(255,196,0,220); else - col = duDarkenCol(duTransCol(dd->areaToCol(p->getArea()), 220)); + col = duDarkenCol(duTransCol(duRGBA(0,0,255,255), 220)); const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase]; const float* va = &tile->verts[p->verts[0]*3]; @@ -225,13 +225,17 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh // End points and their on-mesh locations. dd->vertex(va[0],va[1],va[2], col); dd->vertex(con->pos[0],con->pos[1],con->pos[2], col); - col2 = startSet ? col : duRGBA(220,32,16,196); - duAppendCircle(dd, con->pos[0],con->pos[1],con->pos[2]+5.0f, con->rad, col2); + duAppendCircle(dd, con->pos[0],con->pos[1],con->pos[2]+5.0f, con->rad, duRGBA(220,32,16,196)); + + if (startSet) + duAppendCross(dd, con->pos[0],con->pos[1],con->pos[2]+5.0f, con->rad, duRGBA(220,220,16,196)); dd->vertex(vb[0],vb[1],vb[2], col); dd->vertex(con->pos[3],con->pos[4],con->pos[5], col); - col2 = endSet ? col : duRGBA(32,220,16,196); - duAppendCircle(dd, con->pos[3],con->pos[4],con->pos[5]+5.0f, con->rad, col2); + duAppendCircle(dd, con->pos[3],con->pos[4],con->pos[5]+5.0f, con->rad, duRGBA(32,220,16,196)); + + if (endSet) + duAppendCross(dd, con->pos[3],con->pos[4],con->pos[5]+5.0f, con->rad, duRGBA(220,220,16,196)); // End point vertices. dd->vertex(con->pos[0],con->pos[1],con->pos[2], duRGBA(0,48,64,196));