From 55c98902f3f78e7e5256c918315f899ff0b6a658 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:46:24 +0200 Subject: [PATCH] Recast: optimize traverse link debug draw Should be checked in the outer loop. --- src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp index 8fdd7b4e..cca43ec4 100644 --- a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -143,13 +143,16 @@ static void drawTraverseLinks(duDebugDraw* dd, const dtNavMesh& mesh, const dtNa if (startPoly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) // Skip off-mesh links. continue; + if (tile->links[i].ref == 0) + continue; + // Iterate through links in the poly. for (int j = startPoly->firstLink; j != -1; j = tile->links[j].next) { const dtLink* link = &tile->links[j]; // Skip "normal" links (non-jumping ones). - if (link->traverseType == DT_NULL_TRAVERSE_TYPE || tile->links[i].ref == 0) + if (link->traverseType == DT_NULL_TRAVERSE_TYPE) continue; // Filter, drawLinkType -1 means draw all