From 7d4601b31422fd91ea0d428e9d030290c4964164 Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Tue, 5 Aug 2025 16:13:32 -0400 Subject: [PATCH] Removed unnecessary accessor for volumeCount --- RecastDemo/Include/InputGeom.h | 11 ++--------- RecastDemo/Source/ConvexVolumeTool.cpp | 2 +- RecastDemo/Source/Sample_SoloMesh.cpp | 2 +- RecastDemo/Source/Sample_TempObstacles.cpp | 2 +- RecastDemo/Source/Sample_TileMesh.cpp | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/RecastDemo/Include/InputGeom.h b/RecastDemo/Include/InputGeom.h index d1806b7e..45d3145d 100644 --- a/RecastDemo/Include/InputGeom.h +++ b/RecastDemo/Include/InputGeom.h @@ -104,7 +104,6 @@ public: int offMeshConCount = 0; ///@} -private: /// @name Convex Volumes. ///@{ static const int MAX_VOLUMES = 256; @@ -112,6 +111,7 @@ private: int volumeCount = 0; ///@} +private: bool loadMesh(rcContext* ctx, const std::string& filepath); bool loadGeomSet(rcContext* ctx, const std::string& filepath); bool loadGeomSet(rcContext* ctx, char* buffer, size_t bufferLen); @@ -138,20 +138,13 @@ public: /// @name Off-Mesh connections. ///@{ - void addOffMeshConnection( - const float* spos, - const float* epos, - float rad, - unsigned char bidir, - unsigned char area, - unsigned short flags); + void addOffMeshConnection(const float* startPos, const float* endPos, float rad, unsigned char bidir, unsigned char area, unsigned short flags); void deleteOffMeshConnection(int i); void drawOffMeshConnections(duDebugDraw* dd, bool highlight = false); ///@} /// @name Box Volumes. ///@{ - [[nodiscard]] int getConvexVolumeCount() const { return volumeCount; } [[nodiscard]] const ConvexVolume* getConvexVolumes() const { return volumes; } void addConvexVolume(const float* verts, int nverts, float minh, float maxh, unsigned char area); void deleteConvexVolume(int i); diff --git a/RecastDemo/Source/ConvexVolumeTool.cpp b/RecastDemo/Source/ConvexVolumeTool.cpp index 6a7e90c5..b7c8cc44 100644 --- a/RecastDemo/Source/ConvexVolumeTool.cpp +++ b/RecastDemo/Source/ConvexVolumeTool.cpp @@ -177,7 +177,7 @@ void ConvexVolumeTool::handleClick(const float* /*s*/, const float* p, bool shif // Delete int nearestIndex = -1; const ConvexVolume* vols = geom->getConvexVolumes(); - for (int i = 0; i < geom->getConvexVolumeCount(); ++i) + for (int i = 0; i < geom->volumeCount; ++i) { if (pointInPoly(vols[i].nverts, vols[i].verts, p) && p[1] >= vols[i].hmin && p[1] <= vols[i].hmax) { diff --git a/RecastDemo/Source/Sample_SoloMesh.cpp b/RecastDemo/Source/Sample_SoloMesh.cpp index 4c8416ba..d0c53641 100644 --- a/RecastDemo/Source/Sample_SoloMesh.cpp +++ b/RecastDemo/Source/Sample_SoloMesh.cpp @@ -515,7 +515,7 @@ bool Sample_SoloMesh::build() // (Optional) Marks the surface type of voxels in an area defined by a convex volume. // Useful to mark areas of differing cost. const ConvexVolume* vols = inputGeometry->getConvexVolumes(); - for (int i = 0; i < inputGeometry->getConvexVolumeCount(); ++i) + for (int i = 0; i < inputGeometry->volumeCount; ++i) { rcMarkConvexPolyArea( buildContext, diff --git a/RecastDemo/Source/Sample_TempObstacles.cpp b/RecastDemo/Source/Sample_TempObstacles.cpp index 27eec0f0..1ae3fe8d 100644 --- a/RecastDemo/Source/Sample_TempObstacles.cpp +++ b/RecastDemo/Source/Sample_TempObstacles.cpp @@ -671,7 +671,7 @@ int Sample_TempObstacles::rasterizeTileLayers( // (Optional) Mark areas. const ConvexVolume* vols = inputGeometry->getConvexVolumes(); - for (int i = 0; i < inputGeometry->getConvexVolumeCount(); ++i) + for (int i = 0; i < inputGeometry->volumeCount; ++i) { rcMarkConvexPolyArea( buildContext, diff --git a/RecastDemo/Source/Sample_TileMesh.cpp b/RecastDemo/Source/Sample_TileMesh.cpp index 26bd35b0..42247cd4 100644 --- a/RecastDemo/Source/Sample_TileMesh.cpp +++ b/RecastDemo/Source/Sample_TileMesh.cpp @@ -1029,7 +1029,7 @@ unsigned char* Sample_TileMesh::buildTileMesh( // (Optional) Mark areas. const ConvexVolume* convexVolumes = inputGeometry->getConvexVolumes(); - for (int i = 0; i < inputGeometry->getConvexVolumeCount(); ++i) + for (int i = 0; i < inputGeometry->volumeCount; ++i) { rcMarkConvexPolyArea( buildContext,