diff --git a/RecastDemo/Include/Sample.h b/RecastDemo/Include/Sample.h index 3b3225d9..5c7575a5 100644 --- a/RecastDemo/Include/Sample.h +++ b/RecastDemo/Include/Sample.h @@ -116,8 +116,6 @@ public: unsigned char navMeshDrawFlags; - SampleToolState* toolStates[static_cast(SampleToolType::MAX_TOOLS)] = {}; -protected: float cellSize; float cellHeight; float agentHeight; @@ -138,13 +136,13 @@ protected: bool filterWalkableLowHeightSpans = true; SampleTool* tool = nullptr; + SampleToolState* toolStates[static_cast(SampleToolType::MAX_TOOLS)] = {}; BuildContext* buildContext = nullptr; dtNavMesh* loadAll(const char* path); void saveAll(const char* path, const dtNavMesh* mesh); -public: Sample(); virtual ~Sample(); Sample(const Sample&) = delete; @@ -169,7 +167,6 @@ public: virtual void handleUpdate(float dt); virtual void collectSettings(struct BuildSettings& settings); - float getAgentRadius() { return agentRadius; } float getAgentHeight() { return agentHeight; } float getAgentClimb() { return agentMaxClimb; } diff --git a/RecastDemo/Source/CrowdTool.cpp b/RecastDemo/Source/CrowdTool.cpp index 34e5537a..2185ea66 100644 --- a/RecastDemo/Source/CrowdTool.cpp +++ b/RecastDemo/Source/CrowdTool.cpp @@ -138,7 +138,7 @@ void CrowdToolState::init(Sample* newSample) return; } - crowd->init(MAX_AGENTS, sample->getAgentRadius(), navmesh); + crowd->init(MAX_AGENTS, sample->agentRadius, navmesh); // Make polygons with 'disabled' flag invalid. crowd->getEditableFilter(0)->setExcludeFlags(SAMPLE_POLYFLAGS_DISABLED); @@ -183,7 +183,7 @@ void CrowdToolState::reset() {} void CrowdToolState::handleRender() { duDebugDraw& dd = sample->debugDraw; - const float rad = sample->getAgentRadius(); + const float rad = sample->agentRadius; dtNavMesh* nav = sample->navMesh; dtCrowd* crowd = sample->crowd; @@ -763,7 +763,7 @@ void CrowdToolState::addAgent(const float* p) dtCrowdAgentParams ap; memset(&ap, 0, sizeof(ap)); - ap.radius = sample->getAgentRadius(); + ap.radius = sample->agentRadius; ap.height = sample->getAgentHeight(); ap.maxAcceleration = 8.0f; ap.maxSpeed = 3.5f; diff --git a/RecastDemo/Source/NavMeshPruneTool.cpp b/RecastDemo/Source/NavMeshPruneTool.cpp index fff2fa93..daf9712e 100644 --- a/RecastDemo/Source/NavMeshPruneTool.cpp +++ b/RecastDemo/Source/NavMeshPruneTool.cpp @@ -289,7 +289,7 @@ void NavMeshPruneTool::handleRender() if (hitPosSet) { - const float s = sample->getAgentRadius(); + const float s = sample->agentRadius; const unsigned int col = duRGBA(255, 255, 255, 255); debugDraw.begin(DU_DRAW_LINES); debugDraw.vertex(hitPos[0] - s, hitPos[1], hitPos[2], col); diff --git a/RecastDemo/Source/NavMeshTesterTool.cpp b/RecastDemo/Source/NavMeshTesterTool.cpp index 9f9b4987..c2d1cbaa 100644 --- a/RecastDemo/Source/NavMeshTesterTool.cpp +++ b/RecastDemo/Source/NavMeshTesterTool.cpp @@ -204,8 +204,8 @@ void NavMeshTesterTool::init(Sample* newSample) filter.setAreaCost(SAMPLE_POLYAREA_JUMP, 1.5f); } - neighbourhoodRadius = sample->getAgentRadius() * 20.0f; - randomRadius = sample->getAgentRadius() * 30.0f; + neighbourhoodRadius = sample->agentRadius * 20.0f; + randomRadius = sample->agentRadius * 30.0f; } void NavMeshTesterTool::handleMenu() @@ -1104,7 +1104,7 @@ void NavMeshTesterTool::handleRender() static const unsigned int endCol = duRGBA(51, 102, 0, 129); static const unsigned int pathCol = duRGBA(0, 0, 0, 64); - const float agentRadius = sample->getAgentRadius(); + const float agentRadius = sample->agentRadius; const float agentHeight = sample->getAgentHeight(); const float agentClimb = sample->getAgentClimb(); diff --git a/RecastDemo/Source/OffMeshConnectionTool.cpp b/RecastDemo/Source/OffMeshConnectionTool.cpp index e71fff13..9e2a9188 100644 --- a/RecastDemo/Source/OffMeshConnectionTool.cpp +++ b/RecastDemo/Source/OffMeshConnectionTool.cpp @@ -97,7 +97,7 @@ void OffMeshConnectionTool::handleClick(const float* /*rayStartPos*/, const floa } // If end point close enough, delete it. - if (nearestIndex != -1 && sqrtf(nearestDist) < sample->getAgentRadius()) + if (nearestIndex != -1 && sqrtf(nearestDist) < sample->agentRadius) { geom->deleteOffMeshConnection(nearestIndex); } @@ -115,7 +115,7 @@ void OffMeshConnectionTool::handleClick(const float* /*rayStartPos*/, const floa geom->addOffMeshConnection( hitPos, rayHitPos, - sample->getAgentRadius(), + sample->agentRadius, bidir ? 1 : 0, SAMPLE_POLYAREA_JUMP, SAMPLE_POLYFLAGS_JUMP); @@ -136,7 +136,7 @@ void OffMeshConnectionTool::handleRender() if (hitPosSet) { - duDebugDrawCross(&dd, hitPos[0], hitPos[1] + 0.1f, hitPos[2], sample->getAgentRadius(), duRGBA(0, 0, 0, 128), 2.0f); + duDebugDrawCross(&dd, hitPos[0], hitPos[1] + 0.1f, hitPos[2], sample->agentRadius, duRGBA(0, 0, 0, 128), 2.0f); } if (InputGeom* geom = sample->inputGeometry) diff --git a/RecastDemo/Source/Sample_TempObstacles.cpp b/RecastDemo/Source/Sample_TempObstacles.cpp index 13762589..334f4834 100644 --- a/RecastDemo/Source/Sample_TempObstacles.cpp +++ b/RecastDemo/Source/Sample_TempObstacles.cpp @@ -798,7 +798,7 @@ public: { if (m_hitPosSet && m_sample) { - const float s = m_sample->getAgentRadius(); + const float s = m_sample->agentRadius; glColor4ub(0, 0, 0, 128); glLineWidth(2.0f); glBegin(GL_LINES); diff --git a/RecastDemo/Source/Sample_TileMesh.cpp b/RecastDemo/Source/Sample_TileMesh.cpp index 007540ef..ef728b92 100644 --- a/RecastDemo/Source/Sample_TileMesh.cpp +++ b/RecastDemo/Source/Sample_TileMesh.cpp @@ -144,7 +144,7 @@ public: return; } - const float s = m_sample->getAgentRadius(); + const float s = m_sample->agentRadius; glColor4ub(0, 0, 0, 128); glLineWidth(2.0f); glBegin(GL_LINES);