From 629cedb6d03a8cd317aa227915a4917f60cf8de2 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 18 Apr 2021 17:01:09 +0200 Subject: [PATCH] Do not track last build revision in RecastMeshManger mLastBuildRevision == mRevision with current use cases does not happen. But even if this will happen when another use case will be added it does not save much computation. The most expensive operation is not adding objects to the MeshBuilder but to optimize resulting navmesh that will happen anyway in MeshBuilder::create call. --- components/detournavigator/recastmeshmanager.cpp | 5 +---- components/detournavigator/recastmeshmanager.hpp | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/components/detournavigator/recastmeshmanager.cpp b/components/detournavigator/recastmeshmanager.cpp index 3796c9816..0b0298bc0 100644 --- a/components/detournavigator/recastmeshmanager.cpp +++ b/components/detournavigator/recastmeshmanager.cpp @@ -74,7 +74,7 @@ namespace DetourNavigator std::shared_ptr RecastMeshManager::getMesh() { rebuild(); - return mMeshBuilder.create(mGeneration, mLastBuildRevision); + return mMeshBuilder.create(mGeneration, mRevision); } bool RecastMeshManager::isEmpty() const @@ -84,13 +84,10 @@ namespace DetourNavigator void RecastMeshManager::rebuild() { - if (mLastBuildRevision == mRevision) - return; mMeshBuilder.reset(); for (const auto& v : mWaterOrder) mMeshBuilder.addWater(v.mCellSize, v.mTransform); for (const auto& v : mObjectsOrder) mMeshBuilder.addObject(v.getShape(), v.getTransform(), v.getAreaType()); - mLastBuildRevision = mRevision; } } diff --git a/components/detournavigator/recastmeshmanager.hpp b/components/detournavigator/recastmeshmanager.hpp index 5b568e004..0ad111b5d 100644 --- a/components/detournavigator/recastmeshmanager.hpp +++ b/components/detournavigator/recastmeshmanager.hpp @@ -52,7 +52,6 @@ namespace DetourNavigator private: std::size_t mRevision = 0; - std::size_t mLastBuildRevision = 0; std::size_t mGeneration; RecastMeshBuilder mMeshBuilder; std::list mObjectsOrder;