From 5c467f5a4903d8be0e354af378ef8bbb66895cff Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:58:50 +0200 Subject: [PATCH] Recast: also hook up depth test option for duDebugDrawNavMeshPoly --- .../recast/DebugUtils/Source/DetourDebugDraw.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp index 214703b7..6fca8d3f 100644 --- a/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/src/thirdparty/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -262,7 +262,8 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh dd->end(); } - dd->depthMask(true); + if (!depthTest) + dd->depthMask(true); } void duDebugDrawNavMesh(duDebugDraw* dd, const dtNavMesh& mesh, const float* offset, unsigned int flags) @@ -482,7 +483,8 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re if (dtStatusFailed(mesh.getTileAndPolyByRef(ref, &tile, &poly))) return; - dd->depthMask(false); + const bool depthTest = drawFlags & DU_DRAWNAVMESH_DEPTH_MASK; + dd->depthMask(depthTest); const unsigned int c = duTransCol(col, 64); const unsigned int ip = (unsigned int)(poly - tile->polys); @@ -524,8 +526,8 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re dd->end(); } - dd->depthMask(true); - + if (!depthTest) + dd->depthMask(true); } static void debugDrawTileCachePortals(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch, const float* offset) @@ -830,7 +832,7 @@ void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyM const float x = orig[0] + v[0]*cs; const float y = orig[1] + v[1]*cs; const float z = orig[2] +(v[2]+1)*ch + 0.1f; - dd->vertex(x, y, z, coln); + dd->vertex(x,y,z, coln); } } } @@ -884,7 +886,7 @@ void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyM const float x = orig[0] + v[0]*cs; const float y = orig[1] + v[1]*cs; const float z = orig[2] +(v[2]+1)*ch + 0.1f; - dd->vertex(x, y, z, col); + dd->vertex(x,y,z, col); } } }