diff --git a/apps/benchmarks/detournavigator/navmeshtilescache.cpp b/apps/benchmarks/detournavigator/navmeshtilescache.cpp index a0c204dc6c..79726955c9 100644 --- a/apps/benchmarks/detournavigator/navmeshtilescache.cpp +++ b/apps/benchmarks/detournavigator/navmeshtilescache.cpp @@ -140,12 +140,14 @@ namespace const CollisionShapeType agentShapeType = CollisionShapeType::Aabb; const osg::Vec3f agentHalfExtents = generateAgentHalfExtents(0.5, 1.5, random); const TilePosition tilePosition = generateVec2i(10000, random); - const std::size_t generation = std::uniform_int_distribution(0, 100)(random); - const std::size_t revision = std::uniform_int_distribution(0, 10000)(random); + const Version version { + .mGeneration = std::uniform_int_distribution(0, 100)(random), + .mRevision = std::uniform_int_distribution(0, 10000)(random), + }; Mesh mesh = generateMesh(triangles, random); std::vector water; generateWater(std::back_inserter(water), 1, random); - RecastMesh recastMesh(generation, revision, std::move(mesh), std::move(water), + RecastMesh recastMesh(version, std::move(mesh), std::move(water), {generateHeightfield(random)}, {generateFlatHeightfield(random)}, {}); return Key {AgentBounds {agentShapeType, agentHalfExtents}, tilePosition, std::move(recastMesh)}; } diff --git a/apps/openmw/mwrender/recastmesh.cpp b/apps/openmw/mwrender/recastmesh.cpp index 06884f1332..e5f5438dcb 100644 --- a/apps/openmw/mwrender/recastmesh.cpp +++ b/apps/openmw/mwrender/recastmesh.cpp @@ -53,8 +53,7 @@ namespace MWRender continue; } - if (it->second.mGeneration != tile->second->getGeneration() - || it->second.mRevision != tile->second->getRevision()) + if (it->second.mVersion != tile->second->getVersion()) { const auto group = SceneUtil::createRecastMeshGroup(*tile->second, settings.mRecast); MWBase::Environment::get().getResourceSystem()->getSceneManager()->recreateShaders(group, "debug"); @@ -62,8 +61,7 @@ namespace MWRender mRootNode->removeChild(it->second.mValue); mRootNode->addChild(group); it->second.mValue = group; - it->second.mGeneration = tile->second->getGeneration(); - it->second.mRevision = tile->second->getRevision(); + it->second.mVersion = tile->second->getVersion(); } ++it; @@ -76,7 +74,7 @@ namespace MWRender const auto group = SceneUtil::createRecastMeshGroup(*tile.second, settings.mRecast); MWBase::Environment::get().getResourceSystem()->getSceneManager()->recreateShaders(group, "debug"); group->setNodeMask(Mask_Debug); - mGroups.emplace(tile.first, Group {tile.second->getGeneration(), tile.second->getRevision(), group}); + mGroups.emplace(tile.first, Group {tile.second->getVersion(), group}); mRootNode->addChild(group); } } diff --git a/apps/openmw/mwrender/recastmesh.hpp b/apps/openmw/mwrender/recastmesh.hpp index 194ec04a62..0f0b34423a 100644 --- a/apps/openmw/mwrender/recastmesh.hpp +++ b/apps/openmw/mwrender/recastmesh.hpp @@ -2,6 +2,7 @@ #define OPENMW_MWRENDER_RECASTMESH_H #include +#include #include @@ -44,8 +45,7 @@ namespace MWRender private: struct Group { - std::size_t mGeneration; - std::size_t mRevision; + DetourNavigator::Version mVersion; osg::ref_ptr mValue; }; diff --git a/apps/openmw_test_suite/detournavigator/navmeshtilescache.cpp b/apps/openmw_test_suite/detournavigator/navmeshtilescache.cpp index 0180373e10..bc31b5be79 100644 --- a/apps/openmw_test_suite/detournavigator/navmeshtilescache.cpp +++ b/apps/openmw_test_suite/detournavigator/navmeshtilescache.cpp @@ -97,14 +97,13 @@ namespace { const AgentBounds mAgentBounds {CollisionShapeType::Aabb, {1, 2, 3}}; const TilePosition mTilePosition {0, 0}; - const std::size_t mGeneration = 0; - const std::size_t mRevision = 0; + const Version mVersion {0, 0}; const Mesh mMesh {makeMesh()}; const std::vector mWater {}; const std::vector mHeightfields {}; const std::vector mFlatHeightfields {}; const std::vector mSources {}; - const RecastMesh mRecastMesh {mGeneration, mRevision, mMesh, mWater, mHeightfields, mFlatHeightfields, mSources}; + const RecastMesh mRecastMesh {mVersion, mMesh, mWater, mHeightfields, mFlatHeightfields, mSources}; std::unique_ptr mPreparedNavMeshData {makePeparedNavMeshData(3)}; const std::size_t mRecastMeshSize = sizeof(mRecastMesh) + getSize(mRecastMesh); @@ -192,7 +191,7 @@ namespace const std::size_t maxSize = 1; NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh unexistentRecastMesh(mGeneration, mRevision, mMesh, water, mHeightfields, mFlatHeightfields, mSources); + const RecastMesh unexistentRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); cache.set(mAgentBounds, mTilePosition, mRecastMesh, std::move(mPreparedNavMeshData)); EXPECT_FALSE(cache.get(mAgentBounds, mTilePosition, unexistentRecastMesh)); @@ -204,7 +203,7 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh anotherRecastMesh(mGeneration, mRevision, mMesh, water, mHeightfields, mFlatHeightfields, mSources); + const RecastMesh anotherRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); auto anotherPreparedNavMeshData = makePeparedNavMeshData(3); const auto copy = clone(*anotherPreparedNavMeshData); @@ -222,7 +221,7 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh anotherRecastMesh(mGeneration, mRevision, mMesh, water, mHeightfields, mFlatHeightfields, mSources); + const RecastMesh anotherRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); auto anotherPreparedNavMeshData = makePeparedNavMeshData(3); const auto value = cache.set(mAgentBounds, mTilePosition, mRecastMesh, @@ -238,12 +237,12 @@ namespace const auto copy = clone(*mPreparedNavMeshData); const std::vector leastRecentlySetWater(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh leastRecentlySetRecastMesh(mGeneration, mRevision, mMesh, leastRecentlySetWater, + const RecastMesh leastRecentlySetRecastMesh(mVersion, mMesh, leastRecentlySetWater, mHeightfields, mFlatHeightfields, mSources); auto leastRecentlySetData = makePeparedNavMeshData(3); const std::vector mostRecentlySetWater(1, CellWater {osg::Vec2i(), Water {2, 0.0f}}); - const RecastMesh mostRecentlySetRecastMesh(mGeneration, mRevision, mMesh, mostRecentlySetWater, + const RecastMesh mostRecentlySetRecastMesh(mVersion, mMesh, mostRecentlySetWater, mHeightfields, mFlatHeightfields, mSources); auto mostRecentlySetData = makePeparedNavMeshData(3); @@ -266,13 +265,13 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector leastRecentlyUsedWater(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh leastRecentlyUsedRecastMesh(mGeneration, mRevision, mMesh, leastRecentlyUsedWater, + const RecastMesh leastRecentlyUsedRecastMesh(mVersion, mMesh, leastRecentlyUsedWater, mHeightfields, mFlatHeightfields, mSources); auto leastRecentlyUsedData = makePeparedNavMeshData(3); const auto leastRecentlyUsedCopy = clone(*leastRecentlyUsedData); const std::vector mostRecentlyUsedWater(1, CellWater {osg::Vec2i(), Water {2, 0.0f}}); - const RecastMesh mostRecentlyUsedRecastMesh(mGeneration, mRevision, mMesh, mostRecentlyUsedWater, + const RecastMesh mostRecentlyUsedRecastMesh(mVersion, mMesh, mostRecentlyUsedWater, mHeightfields, mFlatHeightfields, mSources); auto mostRecentlyUsedData = makePeparedNavMeshData(3); const auto mostRecentlyUsedCopy = clone(*mostRecentlyUsedData); @@ -307,7 +306,7 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh tooLargeRecastMesh(mGeneration, mRevision, mMesh, water, + const RecastMesh tooLargeRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); auto tooLargeData = makePeparedNavMeshData(10); @@ -322,12 +321,12 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector anotherWater(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh anotherRecastMesh(mGeneration, mRevision, mMesh, anotherWater, + const RecastMesh anotherRecastMesh(mVersion, mMesh, anotherWater, mHeightfields, mFlatHeightfields, mSources); auto anotherData = makePeparedNavMeshData(3); const std::vector tooLargeWater(1, CellWater {osg::Vec2i(), Water {2, 0.0f}}); - const RecastMesh tooLargeRecastMesh(mGeneration, mRevision, mMesh, tooLargeWater, + const RecastMesh tooLargeRecastMesh(mVersion, mMesh, tooLargeWater, mHeightfields, mFlatHeightfields, mSources); auto tooLargeData = makePeparedNavMeshData(10); @@ -348,7 +347,7 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh anotherRecastMesh(mGeneration, mRevision, mMesh, water, mHeightfields, mFlatHeightfields, mSources); + const RecastMesh anotherRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); auto anotherData = makePeparedNavMeshData(3); const auto firstCopy = cache.set(mAgentBounds, mTilePosition, mRecastMesh, std::move(mPreparedNavMeshData)); @@ -367,7 +366,7 @@ namespace NavMeshTilesCache cache(maxSize); const std::vector water(1, CellWater {osg::Vec2i(), Water {1, 0.0f}}); - const RecastMesh anotherRecastMesh(mGeneration, mRevision, mMesh, water, mHeightfields, mFlatHeightfields, mSources); + const RecastMesh anotherRecastMesh(mVersion, mMesh, water, mHeightfields, mFlatHeightfields, mSources); auto anotherData = makePeparedNavMeshData(3); cache.set(mAgentBounds, mTilePosition, mRecastMesh, std::move(mPreparedNavMeshData)); diff --git a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp index dcdca1ee72..4018b02de0 100644 --- a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp +++ b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp @@ -58,8 +58,7 @@ namespace struct DetourNavigatorRecastMeshBuilderTest : Test { TileBounds mBounds; - const std::size_t mGeneration = 0; - const std::size_t mRevision = 0; + const Version mVersion {0, 0}; const osg::ref_ptr mSource {nullptr}; const ObjectTransform mObjectTransform {ESM::Position {{0, 0, 0}, {0, 0, 0}}, 0.0f}; @@ -75,7 +74,7 @@ namespace TEST_F(DetourNavigatorRecastMeshBuilderTest, create_for_empty_should_return_empty) { RecastMeshBuilder builder(mBounds); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector()); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector()); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector()); @@ -90,7 +89,7 @@ namespace RecastMeshBuilder builder(mBounds); builder.addObject(static_cast(shape), btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -1, -1, 0, -1, 1, 0, @@ -111,7 +110,7 @@ namespace btTransform(btMatrix3x3::getIdentity().scaled(btVector3(1, 2, 3)), btVector3(1, 2, 3)), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ 0, 0, 3, 0, 4, 3, @@ -128,7 +127,7 @@ namespace RecastMeshBuilder builder(mBounds); builder.addObject(static_cast(shape), btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -0.5, -0.5, 0, -0.5, 0.5, 0, @@ -145,7 +144,7 @@ namespace RecastMeshBuilder builder(mBounds); builder.addObject(static_cast(shape), btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -1, -1, -2, -1, -1, 2, @@ -192,7 +191,7 @@ namespace btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -1, -1, -2, -1, -1, 0, @@ -239,7 +238,7 @@ namespace btTransform(btMatrix3x3::getIdentity().scaled(btVector3(1, 2, 3)), btVector3(1, 2, 3)), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ 0, 0, 3, 0, 4, 3, @@ -263,7 +262,7 @@ namespace btTransform(btMatrix3x3::getIdentity().scaled(btVector3(1, 2, 3)), btVector3(1, 2, 3)), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ 1, 2, 12, 1, 10, 12, @@ -285,7 +284,7 @@ namespace btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -3, -3, 0, -3, -2, 0, @@ -312,7 +311,7 @@ namespace btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -3, -3, 0, -3, -2, 0, @@ -337,7 +336,7 @@ namespace static_cast(-osg::PI_4))), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ 0, -4.24264049530029296875f, 4.44089209850062616169452667236328125e-16f, 0, -3.535533905029296875f, -0.707106769084930419921875f, @@ -362,7 +361,7 @@ namespace static_cast(osg::PI_4))), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ -4.24264049530029296875f, 0, 4.44089209850062616169452667236328125e-16f, -3.535533905029296875f, 0, -0.707106769084930419921875f, @@ -387,7 +386,7 @@ namespace static_cast(osg::PI_4))), AreaType_ground, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ -1.41421353816986083984375f, -1.1102230246251565404236316680908203125e-16f, 0, 1.1102230246251565404236316680908203125e-16f, -1.41421353816986083984375f, 0, @@ -416,7 +415,7 @@ namespace btTransform::getIdentity(), AreaType_null, mSource, mObjectTransform ); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -3, -3, 0, -3, -2, 0, @@ -433,7 +432,7 @@ namespace { RecastMeshBuilder builder(mBounds); builder.addWater(osg::Vec2i(1, 2), Water {1000, 300.0f}); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getWater(), std::vector({ CellWater {osg::Vec2i(1, 2), Water {1000, 300.0f}} })); @@ -448,7 +447,7 @@ namespace RecastMeshBuilder builder(mBounds); builder.addObject(static_cast(shape), btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ -1, -1, 0, -1, 1, 0, @@ -467,7 +466,7 @@ namespace mBounds.mMin = osg::Vec2f(100, 100); RecastMeshBuilder builder(mBounds); builder.addHeightfield(cellPosition, cellSize, height); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getFlatHeightfields(), std::vector({ FlatHeightfield {cellPosition, cellSize, height}, })); @@ -487,7 +486,7 @@ namespace const float maxHeight = 8; RecastMeshBuilder builder(mBounds); builder.addHeightfield(cellPosition, cellSize, heights.data(), size, minHeight, maxHeight); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); Heightfield expected; expected.mCellPosition = cellPosition; expected.mCellSize = cellSize; @@ -519,7 +518,7 @@ namespace const float maxHeight = 8; RecastMeshBuilder builder(maxCellTileBounds(cellPosition, cellSize)); builder.addHeightfield(cellPosition, cellSize, heights.data(), size, minHeight, maxHeight); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); Heightfield expected; expected.mCellPosition = cellPosition; expected.mCellSize = cellSize; @@ -552,7 +551,7 @@ namespace mBounds.mMin = osg::Vec2f(750, 750); RecastMeshBuilder builder(mBounds); builder.addHeightfield(cellPosition, cellSize, heights.data(), size, minHeight, maxHeight); - const auto recastMesh = std::move(builder).create(mGeneration, mRevision); + const auto recastMesh = std::move(builder).create(mVersion); Heightfield expected; expected.mCellPosition = cellPosition; expected.mCellSize = cellSize; diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index ea69a9b32e..1ece1131c7 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -513,9 +513,7 @@ namespace DetourNavigator const Job& job, const GuardedNavMeshCacheItem& navMeshCacheItem, const RecastMesh& recastMesh) { const Version navMeshVersion = navMeshCacheItem.lockConst()->getVersion(); - mRecastMeshManager.get().reportNavMeshChange(job.mChangedTile, - Version {recastMesh.getGeneration(), recastMesh.getRevision()}, - navMeshVersion); + mRecastMeshManager.get().reportNavMeshChange(job.mChangedTile, recastMesh.getVersion(), navMeshVersion); if (status == UpdateNavMeshStatus::removed || status == UpdateNavMeshStatus::lost) { diff --git a/components/detournavigator/recastmesh.cpp b/components/detournavigator/recastmesh.cpp index 16220d74f1..9f344d0918 100644 --- a/components/detournavigator/recastmesh.cpp +++ b/components/detournavigator/recastmesh.cpp @@ -18,11 +18,10 @@ namespace DetourNavigator mAreaTypes = std::move(areaTypes); } - RecastMesh::RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector water, + RecastMesh::RecastMesh(const Version& version, Mesh mesh, std::vector water, std::vector heightfields, std::vector flatHeightfields, std::vector meshSources) - : mGeneration(generation) - , mRevision(revision) + : mVersion(version) , mMesh(std::move(mesh)) , mWater(std::move(water)) , mHeightfields(std::move(heightfields)) diff --git a/components/detournavigator/recastmesh.hpp b/components/detournavigator/recastmesh.hpp index ebe372a015..1ad1348136 100644 --- a/components/detournavigator/recastmesh.hpp +++ b/components/detournavigator/recastmesh.hpp @@ -3,6 +3,7 @@ #include "areatype.hpp" #include "objecttransform.hpp" +#include "version.hpp" #include #include @@ -129,19 +130,11 @@ namespace DetourNavigator class RecastMesh { public: - RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector water, + explicit RecastMesh(const Version& version, Mesh mesh, std::vector water, std::vector heightfields, std::vector flatHeightfields, std::vector sources); - std::size_t getGeneration() const - { - return mGeneration; - } - - std::size_t getRevision() const - { - return mRevision; - } + const Version& getVersion() const noexcept { return mVersion; } const Mesh& getMesh() const noexcept { return mMesh; } @@ -163,8 +156,7 @@ namespace DetourNavigator const std::vector& getMeshSources() const noexcept { return mMeshSources; } private: - std::size_t mGeneration; - std::size_t mRevision; + Version mVersion; Mesh mMesh; std::vector mWater; std::vector mHeightfields; diff --git a/components/detournavigator/recastmeshbuilder.cpp b/components/detournavigator/recastmeshbuilder.cpp index 7f3557f6d3..ff216b0b0e 100644 --- a/components/detournavigator/recastmeshbuilder.cpp +++ b/components/detournavigator/recastmeshbuilder.cpp @@ -272,13 +272,13 @@ namespace DetourNavigator mHeightfields.push_back(std::move(heightfield)); } - std::shared_ptr RecastMeshBuilder::create(std::size_t generation, std::size_t revision) && + std::shared_ptr RecastMeshBuilder::create(const Version& version) && { mTriangles.erase(std::remove_if(mTriangles.begin(), mTriangles.end(), isNan), mTriangles.end()); std::sort(mTriangles.begin(), mTriangles.end()); std::sort(mWater.begin(), mWater.end()); Mesh mesh = makeMesh(std::move(mTriangles)); - return std::make_shared(generation, revision, std::move(mesh), std::move(mWater), + return std::make_shared(version, std::move(mesh), std::move(mWater), std::move(mHeightfields), std::move(mFlatHeightfields), std::move(mSources)); } diff --git a/components/detournavigator/recastmeshbuilder.hpp b/components/detournavigator/recastmeshbuilder.hpp index d0848c2a45..de5cd03967 100644 --- a/components/detournavigator/recastmeshbuilder.hpp +++ b/components/detournavigator/recastmeshbuilder.hpp @@ -58,7 +58,7 @@ namespace DetourNavigator void addHeightfield(const osg::Vec2i& cellPosition, int cellSize, const float* heights, std::size_t size, float minHeight, float maxHeight); - std::shared_ptr create(std::size_t generation, std::size_t revision) &&; + std::shared_ptr create(const Version& version) &&; private: const TileBounds mBounds; diff --git a/components/detournavigator/recastmeshmanager.cpp b/components/detournavigator/recastmeshmanager.cpp index b0ac337da5..a883f7839b 100644 --- a/components/detournavigator/recastmeshmanager.cpp +++ b/components/detournavigator/recastmeshmanager.cpp @@ -143,7 +143,7 @@ namespace DetourNavigator } for (const auto& [instance, objectTransform, shape, transform, areaType] : objects) builder.addObject(shape, transform, areaType, instance->getSource(), objectTransform); - return std::move(builder).create(mGeneration, revision); + return std::move(builder).create(Version {.mGeneration = mGeneration, .mRevision = revision}); } bool RecastMeshManager::isEmpty() const