From 91064ae3e84c726e5212dc49c651ff5e0a9c1db9 Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Tue, 22 Jul 2025 00:56:27 -0400 Subject: [PATCH] Removed unnecessary debug draw accessor --- RecastDemo/Include/Sample.h | 5 +---- RecastDemo/Source/ConvexVolumeTool.cpp | 2 +- RecastDemo/Source/CrowdTool.cpp | 2 +- RecastDemo/Source/NavMeshPruneTool.cpp | 2 +- RecastDemo/Source/NavMeshTesterTool.cpp | 4 ++-- RecastDemo/Source/OffMeshConnectionTool.cpp | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/RecastDemo/Include/Sample.h b/RecastDemo/Include/Sample.h index 9f7bd1c2..3b3225d9 100644 --- a/RecastDemo/Include/Sample.h +++ b/RecastDemo/Include/Sample.h @@ -112,6 +112,7 @@ public: dtNavMesh* navMesh = nullptr; dtNavMeshQuery* navQuery = nullptr; dtCrowd* crowd = nullptr; + SampleDebugDraw debugDraw; unsigned char navMeshDrawFlags; @@ -140,8 +141,6 @@ protected: BuildContext* buildContext = nullptr; - SampleDebugDraw debugDraw; - dtNavMesh* loadAll(const char* path); void saveAll(const char* path, const dtNavMesh* mesh); @@ -157,8 +156,6 @@ public: void setTool(SampleTool* tool); - SampleDebugDraw& getDebugDraw() { return debugDraw; } - virtual void handleSettings(); virtual void handleTools(); virtual void handleDebugMode(); diff --git a/RecastDemo/Source/ConvexVolumeTool.cpp b/RecastDemo/Source/ConvexVolumeTool.cpp index db84974f..f6f6e9c9 100644 --- a/RecastDemo/Source/ConvexVolumeTool.cpp +++ b/RecastDemo/Source/ConvexVolumeTool.cpp @@ -255,7 +255,7 @@ void ConvexVolumeTool::handleClick(const float* /*s*/, const float* p, bool shif void ConvexVolumeTool::handleRender() { - duDebugDraw& dd = sample->getDebugDraw(); + duDebugDraw& dd = sample->debugDraw; // Find height extent of the shape. float minh = FLT_MAX, maxh = 0; diff --git a/RecastDemo/Source/CrowdTool.cpp b/RecastDemo/Source/CrowdTool.cpp index d1b27fbb..34e5537a 100644 --- a/RecastDemo/Source/CrowdTool.cpp +++ b/RecastDemo/Source/CrowdTool.cpp @@ -182,7 +182,7 @@ void CrowdToolState::reset() {} void CrowdToolState::handleRender() { - duDebugDraw& dd = sample->getDebugDraw(); + duDebugDraw& dd = sample->debugDraw; const float rad = sample->getAgentRadius(); dtNavMesh* nav = sample->navMesh; diff --git a/RecastDemo/Source/NavMeshPruneTool.cpp b/RecastDemo/Source/NavMeshPruneTool.cpp index bfa52009..fff2fa93 100644 --- a/RecastDemo/Source/NavMeshPruneTool.cpp +++ b/RecastDemo/Source/NavMeshPruneTool.cpp @@ -285,7 +285,7 @@ void NavMeshPruneTool::handleClick(const float* s, const float* p, bool shift) void NavMeshPruneTool::handleRender() { - duDebugDraw& debugDraw = sample->getDebugDraw(); + duDebugDraw& debugDraw = sample->debugDraw; if (hitPosSet) { diff --git a/RecastDemo/Source/NavMeshTesterTool.cpp b/RecastDemo/Source/NavMeshTesterTool.cpp index 980fe059..9f9b4987 100644 --- a/RecastDemo/Source/NavMeshTesterTool.cpp +++ b/RecastDemo/Source/NavMeshTesterTool.cpp @@ -1098,7 +1098,7 @@ static void getPolyCenter(dtNavMesh* navMesh, dtPolyRef ref, float* center) void NavMeshTesterTool::handleRender() { - duDebugDraw& dd = sample->getDebugDraw(); + duDebugDraw& dd = sample->debugDraw; static const unsigned int startCol = duRGBA(128, 25, 0, 192); static const unsigned int endCol = duRGBA(51, 102, 0, 129); @@ -1514,7 +1514,7 @@ void NavMeshTesterTool::handleRenderOverlay(double* proj, double* model, int* vi void NavMeshTesterTool::drawAgent(const float* pos, float r, float h, float c, const unsigned int col) { - duDebugDraw& dd = sample->getDebugDraw(); + duDebugDraw& dd = sample->debugDraw; dd.depthMask(false); diff --git a/RecastDemo/Source/OffMeshConnectionTool.cpp b/RecastDemo/Source/OffMeshConnectionTool.cpp index 0f8a56d0..e71fff13 100644 --- a/RecastDemo/Source/OffMeshConnectionTool.cpp +++ b/RecastDemo/Source/OffMeshConnectionTool.cpp @@ -132,7 +132,7 @@ void OffMeshConnectionTool::handleUpdate(const float /*dt*/) {} void OffMeshConnectionTool::handleRender() { - duDebugDraw& dd = sample->getDebugDraw(); + duDebugDraw& dd = sample->debugDraw; if (hitPosSet) {