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.
pull/593/head
elsid 4 years ago
parent 62f32f4543
commit 629cedb6d0
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -74,7 +74,7 @@ namespace DetourNavigator
std::shared_ptr<RecastMesh> 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;
}
}

@ -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<RecastMeshObject> mObjectsOrder;

Loading…
Cancel
Save