From e6fd678ad8ca5db7870ce47cb798298740b0e59f Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Wed, 6 Aug 2025 11:12:13 -0400 Subject: [PATCH] Removed unnecessary accessors for input geometry mesh bounds --- RecastDemo/Include/InputGeom.h | 6 +++--- RecastDemo/Source/Sample.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/RecastDemo/Include/InputGeom.h b/RecastDemo/Include/InputGeom.h index b135d54a..689fa107 100644 --- a/RecastDemo/Include/InputGeom.h +++ b/RecastDemo/Include/InputGeom.h @@ -85,9 +85,10 @@ public: [[nodiscard]] int getTriCount() const { return static_cast(tris.size()) / 3; } ChunkyTriMesh* chunkyMesh = nullptr; -private: float meshBoundsMin[3] = {}; float meshBoundsMax[3] = {}; + +private: BuildSettings buildSettings; bool hasBuildSettings = false; @@ -122,8 +123,6 @@ public: bool saveGeomSet(const BuildSettings* settings); /// Method to return static mesh data. - [[nodiscard]] const float* getMeshBoundsMin() const { return meshBoundsMin; } - [[nodiscard]] const float* getMeshBoundsMax() const { return meshBoundsMax; } [[nodiscard]] const float* getNavMeshBoundsMin() const { return hasBuildSettings ? buildSettings.navMeshBMin : meshBoundsMin; } [[nodiscard]] const float* getNavMeshBoundsMax() const { return hasBuildSettings ? buildSettings.navMeshBMax : meshBoundsMax; } [[nodiscard]] const BuildSettings* getBuildSettings() const { return hasBuildSettings ? &buildSettings : nullptr; } @@ -148,3 +147,4 @@ private: bool loadGeomSet(rcContext* ctx, const std::string& filepath); bool loadGeomSet(rcContext* ctx, char* buffer, size_t bufferLen); }; + diff --git a/RecastDemo/Source/Sample.cpp b/RecastDemo/Source/Sample.cpp index 8e138358..a5dc6778 100644 --- a/RecastDemo/Source/Sample.cpp +++ b/RecastDemo/Source/Sample.cpp @@ -138,9 +138,16 @@ void Sample::render() 0, 1.0f); // Draw bounds - const float* min = inputGeometry->getMeshBoundsMin(); - const float* max = inputGeometry->getMeshBoundsMax(); - duDebugDrawBoxWire(&debugDraw, min[0], min[1], min[2], max[0], max[1], max[2], duRGBA(255, 255, 255, 128), 1.0f); + duDebugDrawBoxWire( + &debugDraw, + inputGeometry->meshBoundsMin[0], + inputGeometry->meshBoundsMin[1], + inputGeometry->meshBoundsMin[2], + inputGeometry->meshBoundsMax[0], + inputGeometry->meshBoundsMax[1], + inputGeometry->meshBoundsMax[2], + duRGBA(255, 255, 255, 128), + 1.0f); } void Sample::renderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) {}