Recast: optimize and improve traverse link renderer

Only render the cross at the start as the reverse link will render the 2nd one. Else we render 4 crosses. Also made the alpha of the line around 50%, since we render the forward and reverse link, it will render with 100% opacity, if the reverse link is missing, the crosses will disappear and the line will only render at 50% opacity to make it more clear something is wrong.
This commit is contained in:
Kawe Mazidjatari 2024-08-11 02:48:28 +02:00
parent cf2d873db3
commit 4c2f4e39a0

View File

@ -179,7 +179,7 @@ static void drawTraverseLinks(duDebugDraw* dd, const dtNavMesh& mesh, const dtNa
query->getEdgeMidPoint(link->ref, mesh.getPolyRefBase(tile) | (dtPolyRef)i, endPos); query->getEdgeMidPoint(link->ref, mesh.getPolyRefBase(tile) | (dtPolyRef)i, endPos);
// Unique color for each type. // Unique color for each type.
const int col = duIntToCol(link->traverseType, 180); const int col = duIntToCol(link->traverseType, 128);
dd->begin(DU_DRAW_LINES, 2.0f, offset); dd->begin(DU_DRAW_LINES, 2.0f, offset);
@ -193,7 +193,6 @@ static void drawTraverseLinks(duDebugDraw* dd, const dtNavMesh& mesh, const dtNa
// If the reverse link is set, render white crosses to confirm // If the reverse link is set, render white crosses to confirm
// the links are set properly. // the links are set properly.
duAppendCross(dd, startPos[0], startPos[1], startPos[2], 10.f, duRGBA(255,255,255,180)); duAppendCross(dd, startPos[0], startPos[1], startPos[2], 10.f, duRGBA(255,255,255,180));
duAppendCross(dd, endPos[0], endPos[1], endPos[2], 10.f, duRGBA(255,255,255,180));
} }
dd->end(); dd->end();