1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-27 03:40:24 +00:00

Rename DetourNavigator::Water -> Cell

This commit is contained in:
elsid 2021-07-14 22:00:16 +02:00
parent 753767d6d9
commit 5d6c93566d
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
17 changed files with 48 additions and 48 deletions

View file

@ -83,7 +83,7 @@ namespace
std::uniform_real_distribution<float> distribution(0.0, 1.0); std::uniform_real_distribution<float> distribution(0.0, 1.0);
std::generate_n(out, count, [&] { std::generate_n(out, count, [&] {
const osg::Vec3f shift(distribution(random), distribution(random), distribution(random)); const osg::Vec3f shift(distribution(random), distribution(random), distribution(random));
return Water {1, shift}; return Cell {1, shift};
}); });
} }
@ -108,7 +108,7 @@ namespace
const std::size_t generation = std::uniform_int_distribution<std::size_t>(0, 100)(random); const std::size_t generation = std::uniform_int_distribution<std::size_t>(0, 100)(random);
const std::size_t revision = std::uniform_int_distribution<std::size_t>(0, 10000)(random); const std::size_t revision = std::uniform_int_distribution<std::size_t>(0, 10000)(random);
Mesh mesh = generateMesh(triangles, random); Mesh mesh = generateMesh(triangles, random);
std::vector<Water> water; std::vector<Cell> water;
generateWater(std::back_inserter(water), 2, random); generateWater(std::back_inserter(water), 2, random);
RecastMesh recastMesh(generation, revision, std::move(mesh), std::move(water)); RecastMesh recastMesh(generation, revision, std::move(mesh), std::move(water));
return Key {agentHalfExtents, tilePosition, std::move(recastMesh)}; return Key {agentHalfExtents, tilePosition, std::move(recastMesh)};

View file

@ -143,12 +143,12 @@ namespace
const std::size_t mGeneration = 0; const std::size_t mGeneration = 0;
const std::size_t mRevision = 0; const std::size_t mRevision = 0;
const Mesh mMesh {makeMesh()}; const Mesh mMesh {makeMesh()};
const std::vector<Water> mWater {}; const std::vector<Cell> mWater {};
const RecastMesh mRecastMesh {mGeneration, mRevision, mMesh, mWater}; const RecastMesh mRecastMesh {mGeneration, mRevision, mMesh, mWater};
std::unique_ptr<PreparedNavMeshData> mPreparedNavMeshData {makePeparedNavMeshData(3)}; std::unique_ptr<PreparedNavMeshData> mPreparedNavMeshData {makePeparedNavMeshData(3)};
const std::size_t mRecastMeshSize = sizeof(mRecastMesh) + getSize(mRecastMesh); const std::size_t mRecastMeshSize = sizeof(mRecastMesh) + getSize(mRecastMesh);
const std::size_t mRecastMeshWithWaterSize = mRecastMeshSize + sizeof(Water); const std::size_t mRecastMeshWithWaterSize = mRecastMeshSize + sizeof(Cell);
const std::size_t mPreparedNavMeshDataSize = sizeof(*mPreparedNavMeshData) + getSize(*mPreparedNavMeshData); const std::size_t mPreparedNavMeshDataSize = sizeof(*mPreparedNavMeshData) + getSize(*mPreparedNavMeshData);
}; };
@ -231,7 +231,7 @@ namespace
{ {
const std::size_t maxSize = 1; const std::size_t maxSize = 1;
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh unexistentRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh unexistentRecastMesh {mGeneration, mRevision, mMesh, water};
cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, std::move(mPreparedNavMeshData)); cache.set(mAgentHalfExtents, mTilePosition, mRecastMesh, std::move(mPreparedNavMeshData));
@ -243,7 +243,7 @@ namespace
const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize; const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize;
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water};
auto anotherPreparedNavMeshData = makePeparedNavMeshData(3); auto anotherPreparedNavMeshData = makePeparedNavMeshData(3);
const auto copy = clone(*anotherPreparedNavMeshData); const auto copy = clone(*anotherPreparedNavMeshData);
@ -261,7 +261,7 @@ namespace
const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize; const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize;
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water};
auto anotherPreparedNavMeshData = makePeparedNavMeshData(3); auto anotherPreparedNavMeshData = makePeparedNavMeshData(3);
@ -277,11 +277,11 @@ namespace
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const auto copy = clone(*mPreparedNavMeshData); const auto copy = clone(*mPreparedNavMeshData);
const std::vector<Water> leastRecentlySetWater {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> leastRecentlySetWater {1, Cell {1, osg::Vec3f()}};
const RecastMesh leastRecentlySetRecastMesh {mGeneration, mRevision, mMesh, leastRecentlySetWater}; const RecastMesh leastRecentlySetRecastMesh {mGeneration, mRevision, mMesh, leastRecentlySetWater};
auto leastRecentlySetData = makePeparedNavMeshData(3); auto leastRecentlySetData = makePeparedNavMeshData(3);
const std::vector<Water> mostRecentlySetWater {1, Water {2, osg::Vec3f()}}; const std::vector<Cell> mostRecentlySetWater {1, Cell {2, osg::Vec3f()}};
const RecastMesh mostRecentlySetRecastMesh {mGeneration, mRevision, mMesh, mostRecentlySetWater}; const RecastMesh mostRecentlySetRecastMesh {mGeneration, mRevision, mMesh, mostRecentlySetWater};
auto mostRecentlySetData = makePeparedNavMeshData(3); auto mostRecentlySetData = makePeparedNavMeshData(3);
@ -303,12 +303,12 @@ namespace
const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize); const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize);
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> leastRecentlyUsedWater {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> leastRecentlyUsedWater {1, Cell {1, osg::Vec3f()}};
const RecastMesh leastRecentlyUsedRecastMesh {mGeneration, mRevision, mMesh, leastRecentlyUsedWater}; const RecastMesh leastRecentlyUsedRecastMesh {mGeneration, mRevision, mMesh, leastRecentlyUsedWater};
auto leastRecentlyUsedData = makePeparedNavMeshData(3); auto leastRecentlyUsedData = makePeparedNavMeshData(3);
const auto leastRecentlyUsedCopy = clone(*leastRecentlyUsedData); const auto leastRecentlyUsedCopy = clone(*leastRecentlyUsedData);
const std::vector<Water> mostRecentlyUsedWater {1, Water {2, osg::Vec3f()}}; const std::vector<Cell> mostRecentlyUsedWater {1, Cell {2, osg::Vec3f()}};
const RecastMesh mostRecentlyUsedRecastMesh {mGeneration, mRevision, mMesh, mostRecentlyUsedWater}; const RecastMesh mostRecentlyUsedRecastMesh {mGeneration, mRevision, mMesh, mostRecentlyUsedWater};
auto mostRecentlyUsedData = makePeparedNavMeshData(3); auto mostRecentlyUsedData = makePeparedNavMeshData(3);
const auto mostRecentlyUsedCopy = clone(*mostRecentlyUsedData); const auto mostRecentlyUsedCopy = clone(*mostRecentlyUsedData);
@ -342,7 +342,7 @@ namespace
const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize); const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize);
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh tooLargeRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh tooLargeRecastMesh {mGeneration, mRevision, mMesh, water};
auto tooLargeData = makePeparedNavMeshData(10); auto tooLargeData = makePeparedNavMeshData(10);
@ -356,11 +356,11 @@ namespace
const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize); const std::size_t maxSize = 2 * (mRecastMeshWithWaterSize + mPreparedNavMeshDataSize);
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> anotherWater {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> anotherWater {1, Cell {1, osg::Vec3f()}};
const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, anotherWater}; const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, anotherWater};
auto anotherData = makePeparedNavMeshData(3); auto anotherData = makePeparedNavMeshData(3);
const std::vector<Water> tooLargeWater {1, Water {2, osg::Vec3f()}}; const std::vector<Cell> tooLargeWater {1, Cell {2, osg::Vec3f()}};
const RecastMesh tooLargeRecastMesh {mGeneration, mRevision, mMesh, tooLargeWater}; const RecastMesh tooLargeRecastMesh {mGeneration, mRevision, mMesh, tooLargeWater};
auto tooLargeData = makePeparedNavMeshData(10); auto tooLargeData = makePeparedNavMeshData(10);
@ -380,7 +380,7 @@ namespace
const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize; const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize;
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water};
auto anotherData = makePeparedNavMeshData(3); auto anotherData = makePeparedNavMeshData(3);
@ -399,7 +399,7 @@ namespace
const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize; const std::size_t maxSize = mRecastMeshWithWaterSize + mPreparedNavMeshDataSize;
NavMeshTilesCache cache(maxSize); NavMeshTilesCache cache(maxSize);
const std::vector<Water> water {1, Water {1, osg::Vec3f()}}; const std::vector<Cell> water {1, Cell {1, osg::Vec3f()}};
const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water}; const RecastMesh anotherRecastMesh {mGeneration, mRevision, mMesh, water};
auto anotherData = makePeparedNavMeshData(3); auto anotherData = makePeparedNavMeshData(3);

View file

@ -19,9 +19,9 @@
namespace DetourNavigator namespace DetourNavigator
{ {
static inline bool operator ==(const Water& lhs, const Water& rhs) static inline bool operator ==(const Cell& lhs, const Cell& rhs)
{ {
return lhs.mCellSize == rhs.mCellSize && lhs.mShift == rhs.mShift; return lhs.mSize == rhs.mSize && lhs.mShift == rhs.mShift;
} }
} }
@ -404,8 +404,8 @@ namespace
RecastMeshBuilder builder(mBounds); RecastMeshBuilder builder(mBounds);
builder.addWater(1000, osg::Vec3f(100, 200, 300)); builder.addWater(1000, osg::Vec3f(100, 200, 300));
const auto recastMesh = std::move(builder).create(mGeneration, mRevision); const auto recastMesh = std::move(builder).create(mGeneration, mRevision);
EXPECT_EQ(recastMesh->getWater(), std::vector<Water>({ EXPECT_EQ(recastMesh->getWater(), std::vector<Cell>({
Water {1000, osg::Vec3f(100, 200, 300)} Cell {1000, osg::Vec3f(100, 200, 300)}
})); }));
} }

View file

@ -295,7 +295,7 @@ namespace
ASSERT_TRUE(manager.addWater(cellPosition, cellSize, osg::Vec3f())); ASSERT_TRUE(manager.addWater(cellPosition, cellSize, osg::Vec3f()));
const auto result = manager.removeWater(cellPosition); const auto result = manager.removeWater(cellPosition);
ASSERT_TRUE(result.has_value()); ASSERT_TRUE(result.has_value());
EXPECT_EQ(result->mCellSize, cellSize); EXPECT_EQ(result->mSize, cellSize);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_remove_empty_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_remove_empty_tiles)

View file

@ -42,7 +42,7 @@ namespace DetourNavigator
return true; return true;
} }
std::optional<Water> CachedRecastMeshManager::removeWater(const osg::Vec2i& cellPosition) std::optional<Cell> CachedRecastMeshManager::removeWater(const osg::Vec2i& cellPosition)
{ {
const auto water = mImpl.removeWater(cellPosition); const auto water = mImpl.removeWater(cellPosition);
if (water) if (water)

View file

@ -18,7 +18,7 @@ namespace DetourNavigator
bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift); bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift);
std::optional<Water> removeWater(const osg::Vec2i& cellPosition); std::optional<Cell> removeWater(const osg::Vec2i& cellPosition);
std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id); std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id);

View file

@ -34,10 +34,10 @@ namespace
osg::Vec3f mMax; osg::Vec3f mMax;
}; };
WaterBounds getWaterBounds(const Water& water, const Settings& settings, WaterBounds getWaterBounds(const Cell& water, const Settings& settings,
const osg::Vec3f& agentHalfExtents) const osg::Vec3f& agentHalfExtents)
{ {
if (water.mCellSize == std::numeric_limits<int>::max()) if (water.mSize == std::numeric_limits<int>::max())
{ {
const auto transform = getSwimLevelTransform(settings, water.mShift, agentHalfExtents.z()); const auto transform = getSwimLevelTransform(settings, water.mShift, agentHalfExtents.z());
const auto min = toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(-1, -1, 0)))); const auto min = toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(-1, -1, 0))));
@ -50,7 +50,7 @@ namespace
else else
{ {
const auto transform = getSwimLevelTransform(settings, water.mShift, agentHalfExtents.z()); const auto transform = getSwimLevelTransform(settings, water.mShift, agentHalfExtents.z());
const auto halfCellSize = water.mCellSize / 2.0f; const auto halfCellSize = water.mSize / 2.0f;
return WaterBounds { return WaterBounds {
toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(-halfCellSize, -halfCellSize, 0)))), toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(-halfCellSize, -halfCellSize, 0)))),
toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(halfCellSize, halfCellSize, 0)))) toNavMeshCoordinates(settings, Misc::Convert::makeOsgVec3f(transform(btVector3(halfCellSize, halfCellSize, 0))))

View file

@ -85,7 +85,7 @@ namespace DetourNavigator
const auto water = mRecastMeshManager.removeWater(cellPosition); const auto water = mRecastMeshManager.removeWater(cellPosition);
if (!water) if (!water)
return false; return false;
addChangedTiles(water->mCellSize, water->mShift, ChangeType::remove); addChangedTiles(water->mSize, water->mShift, ChangeType::remove);
return true; return true;
} }

View file

@ -23,7 +23,7 @@ namespace DetourNavigator
struct RecastMeshData struct RecastMeshData
{ {
Mesh mMesh; Mesh mMesh;
std::vector<Water> mWater; std::vector<Cell> mWater;
}; };
inline bool operator <(const RecastMeshData& lhs, const RecastMeshData& rhs) inline bool operator <(const RecastMeshData& lhs, const RecastMeshData& rhs)

View file

@ -18,7 +18,7 @@ namespace DetourNavigator
mAreaTypes = std::move(areaTypes); mAreaTypes = std::move(areaTypes);
} }
RecastMesh::RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector<Water> water) RecastMesh::RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector<Cell> water)
: mGeneration(generation) : mGeneration(generation)
, mRevision(revision) , mRevision(revision)
, mMesh(std::move(mesh)) , mMesh(std::move(mesh))

View file

@ -45,16 +45,16 @@ namespace DetourNavigator
} }
}; };
struct Water struct Cell
{ {
int mCellSize; int mSize;
osg::Vec3f mShift; osg::Vec3f mShift;
}; };
class RecastMesh class RecastMesh
{ {
public: public:
RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector<Water> water); RecastMesh(std::size_t generation, std::size_t revision, Mesh mesh, std::vector<Cell> water);
std::size_t getGeneration() const std::size_t getGeneration() const
{ {
@ -68,7 +68,7 @@ namespace DetourNavigator
const Mesh& getMesh() const noexcept { return mMesh; } const Mesh& getMesh() const noexcept { return mMesh; }
const std::vector<Water>& getWater() const const std::vector<Cell>& getWater() const
{ {
return mWater; return mWater;
} }
@ -82,7 +82,7 @@ namespace DetourNavigator
std::size_t mGeneration; std::size_t mGeneration;
std::size_t mRevision; std::size_t mRevision;
Mesh mMesh; Mesh mMesh;
std::vector<Water> mWater; std::vector<Cell> mWater;
Bounds mBounds; Bounds mBounds;
friend inline bool operator <(const RecastMesh& lhs, const RecastMesh& rhs) noexcept friend inline bool operator <(const RecastMesh& lhs, const RecastMesh& rhs) noexcept
@ -92,13 +92,13 @@ namespace DetourNavigator
friend inline std::size_t getSize(const RecastMesh& value) noexcept friend inline std::size_t getSize(const RecastMesh& value) noexcept
{ {
return getSize(value.mMesh) + value.mWater.size() * sizeof(Water); return getSize(value.mMesh) + value.mWater.size() * sizeof(Cell);
} }
}; };
inline bool operator<(const Water& lhs, const Water& rhs) noexcept inline bool operator<(const Cell& lhs, const Cell& rhs) noexcept
{ {
return std::tie(lhs.mCellSize, lhs.mShift) < std::tie(rhs.mCellSize, rhs.mShift); return std::tie(lhs.mSize, lhs.mShift) < std::tie(rhs.mSize, rhs.mShift);
} }
} }

View file

@ -160,7 +160,7 @@ namespace DetourNavigator
void RecastMeshBuilder::addWater(const int cellSize, const osg::Vec3f& shift) void RecastMeshBuilder::addWater(const int cellSize, const osg::Vec3f& shift)
{ {
mWater.push_back(Water {cellSize, shift}); mWater.push_back(Cell {cellSize, shift});
} }
std::shared_ptr<RecastMesh> RecastMeshBuilder::create(std::size_t generation, std::size_t revision) && std::shared_ptr<RecastMesh> RecastMeshBuilder::create(std::size_t generation, std::size_t revision) &&

View file

@ -56,7 +56,7 @@ namespace DetourNavigator
private: private:
const TileBounds mBounds; const TileBounds mBounds;
std::vector<RecastMeshTriangle> mTriangles; std::vector<RecastMeshTriangle> mTriangles;
std::vector<Water> mWater; std::vector<Cell> mWater;
void addObject(const btConcaveShape& shape, const btTransform& transform, btTriangleCallback&& callback); void addObject(const btConcaveShape& shape, const btTransform& transform, btTriangleCallback&& callback);

View file

@ -49,19 +49,19 @@ namespace DetourNavigator
bool RecastMeshManager::addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift) bool RecastMeshManager::addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift)
{ {
if (!mWater.emplace(cellPosition, Water {cellSize, shift}).second) if (!mWater.emplace(cellPosition, Cell {cellSize, shift}).second)
return false; return false;
++mRevision; ++mRevision;
return true; return true;
} }
std::optional<Water> RecastMeshManager::removeWater(const osg::Vec2i& cellPosition) std::optional<Cell> RecastMeshManager::removeWater(const osg::Vec2i& cellPosition)
{ {
const auto water = mWater.find(cellPosition); const auto water = mWater.find(cellPosition);
if (water == mWater.end()) if (water == mWater.end())
return std::nullopt; return std::nullopt;
++mRevision; ++mRevision;
const Water result = water->second; const Cell result = water->second;
mWater.erase(water); mWater.erase(water);
return result; return result;
} }
@ -73,7 +73,7 @@ namespace DetourNavigator
tileBounds.mMax /= mSettings.mRecastScaleFactor; tileBounds.mMax /= mSettings.mRecastScaleFactor;
RecastMeshBuilder builder(tileBounds); RecastMeshBuilder builder(tileBounds);
for (const auto& [k, v] : mWater) for (const auto& [k, v] : mWater)
builder.addWater(v.mCellSize, v.mShift); builder.addWater(v.mSize, v.mShift);
for (const auto& [k, object] : mObjects) for (const auto& [k, object] : mObjects)
{ {
const RecastMeshObject& v = object.getImpl(); const RecastMeshObject& v = object.getImpl();

View file

@ -39,7 +39,7 @@ namespace DetourNavigator
bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift); bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift);
std::optional<Water> removeWater(const osg::Vec2i& cellPosition); std::optional<Cell> removeWater(const osg::Vec2i& cellPosition);
std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id); std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id);
@ -63,7 +63,7 @@ namespace DetourNavigator
std::size_t mGeneration; std::size_t mGeneration;
TileBounds mTileBounds; TileBounds mTileBounds;
std::map<ObjectId, OscillatingRecastMeshObject> mObjects; std::map<ObjectId, OscillatingRecastMeshObject> mObjects;
std::map<osg::Vec2i, Water> mWater; std::map<osg::Vec2i, Cell> mWater;
std::optional<Report> mLastNavMeshReportedChange; std::optional<Report> mLastNavMeshReportedChange;
std::optional<Report> mLastNavMeshReport; std::optional<Report> mLastNavMeshReport;
}; };

View file

@ -102,12 +102,12 @@ namespace DetourNavigator
return result; return result;
} }
std::optional<Water> TileCachedRecastMeshManager::removeWater(const osg::Vec2i& cellPosition) std::optional<Cell> TileCachedRecastMeshManager::removeWater(const osg::Vec2i& cellPosition)
{ {
const auto object = mWaterTilesPositions.find(cellPosition); const auto object = mWaterTilesPositions.find(cellPosition);
if (object == mWaterTilesPositions.end()) if (object == mWaterTilesPositions.end())
return std::nullopt; return std::nullopt;
std::optional<Water> result; std::optional<Cell> result;
for (const auto& tilePosition : object->second) for (const auto& tilePosition : object->second)
{ {
const auto tiles = mTiles.lock(); const auto tiles = mTiles.lock();

View file

@ -78,7 +78,7 @@ namespace DetourNavigator
bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift); bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const osg::Vec3f& shift);
std::optional<Water> removeWater(const osg::Vec2i& cellPosition); std::optional<Cell> removeWater(const osg::Vec2i& cellPosition);
std::shared_ptr<RecastMesh> getMesh(const TilePosition& tilePosition); std::shared_ptr<RecastMesh> getMesh(const TilePosition& tilePosition);