1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 13:45:34 +00:00

Use ESM::RefId for worldspace type

This commit is contained in:
elsid 2024-05-19 14:26:28 +02:00
parent 5d28164416
commit 9854d42d56
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
26 changed files with 161 additions and 169 deletions

View file

@ -106,8 +106,8 @@ namespace NavMeshTool
return DetourNavigator::resolveMeshSource(mDb, source, mNextShapeId); return DetourNavigator::resolveMeshSource(mDb, source, mNextShapeId);
} }
std::optional<NavMeshTileInfo> find(std::string_view worldspace, const TilePosition& tilePosition, std::optional<NavMeshTileInfo> find(
const std::vector<std::byte>& input) override ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input) override
{ {
std::optional<NavMeshTileInfo> result; std::optional<NavMeshTileInfo> result;
std::lock_guard lock(mMutex); std::lock_guard lock(mMutex);
@ -121,7 +121,7 @@ namespace NavMeshTool
return result; return result;
} }
void ignore(std::string_view worldspace, const TilePosition& tilePosition) override void ignore(ESM::RefId worldspace, const TilePosition& tilePosition) override
{ {
if (mRemoveUnusedTiles) if (mRemoveUnusedTiles)
{ {
@ -131,7 +131,7 @@ namespace NavMeshTool
report(); report();
} }
void identity(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t tileId) override void identity(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t tileId) override
{ {
if (mRemoveUnusedTiles) if (mRemoveUnusedTiles)
{ {
@ -142,7 +142,7 @@ namespace NavMeshTool
report(); report();
} }
void insert(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t version, void insert(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t version,
const std::vector<std::byte>& input, PreparedNavMeshData& data) override const std::vector<std::byte>& input, PreparedNavMeshData& data) override
{ {
{ {
@ -158,7 +158,7 @@ namespace NavMeshTool
report(); report();
} }
void update(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t tileId, void update(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t tileId,
std::int64_t version, PreparedNavMeshData& data) override std::int64_t version, PreparedNavMeshData& data) override
{ {
data.mUserId = static_cast<unsigned>(tileId); data.mUserId = static_cast<unsigned>(tileId);
@ -217,7 +217,7 @@ namespace NavMeshTool
mDb.vacuum(); mDb.vacuum();
} }
void removeTilesOutsideRange(std::string_view worldspace, const TilesPositionsRange& range) void removeTilesOutsideRange(ESM::RefId worldspace, const TilesPositionsRange& range)
{ {
const std::lock_guard lock(mMutex); const std::lock_guard lock(mMutex);
mTransaction.commit(); mTransaction.commit();

View file

@ -234,8 +234,8 @@ namespace NavMeshTool
} }
WorldspaceNavMeshInput::WorldspaceNavMeshInput( WorldspaceNavMeshInput::WorldspaceNavMeshInput(
std::string worldspace, const DetourNavigator::RecastSettings& settings) ESM::RefId worldspace, const DetourNavigator::RecastSettings& settings)
: mWorldspace(std::move(worldspace)) : mWorldspace(worldspace)
, mTileCachedRecastMeshManager(settings) , mTileCachedRecastMeshManager(settings)
{ {
mAabb.m_min = btVector3(0, 0, 0); mAabb.m_min = btVector3(0, 0, 0);
@ -248,7 +248,7 @@ namespace NavMeshTool
{ {
Log(Debug::Info) << "Processing " << esmData.mCells.size() << " cells..."; Log(Debug::Info) << "Processing " << esmData.mCells.size() << " cells...";
std::map<std::string_view, std::unique_ptr<WorldspaceNavMeshInput>> navMeshInputs; std::unordered_map<ESM::RefId, std::unique_ptr<WorldspaceNavMeshInput>> navMeshInputs;
WorldspaceData data; WorldspaceData data;
std::size_t objectsCounter = 0; std::size_t objectsCounter = 0;
@ -276,8 +276,7 @@ namespace NavMeshTool
const osg::Vec2i cellPosition(cell.mData.mX, cell.mData.mY); const osg::Vec2i cellPosition(cell.mData.mX, cell.mData.mY);
const std::size_t cellObjectsBegin = data.mObjects.size(); const std::size_t cellObjectsBegin = data.mObjects.size();
const auto cellWorldspace = Misc::StringUtils::lowerCase( const ESM::RefId cellWorldspace = cell.isExterior() ? ESM::Cell::sDefaultWorldspaceId : cell.mId;
(cell.isExterior() ? ESM::Cell::sDefaultWorldspaceId : cell.mId).serializeText());
WorldspaceNavMeshInput& navMeshInput = [&]() -> WorldspaceNavMeshInput& { WorldspaceNavMeshInput& navMeshInput = [&]() -> WorldspaceNavMeshInput& {
auto it = navMeshInputs.find(cellWorldspace); auto it = navMeshInputs.find(cellWorldspace);
if (it == navMeshInputs.end()) if (it == navMeshInputs.end())

View file

@ -48,12 +48,12 @@ namespace NavMeshTool
struct WorldspaceNavMeshInput struct WorldspaceNavMeshInput
{ {
std::string mWorldspace; ESM::RefId mWorldspace;
TileCachedRecastMeshManager mTileCachedRecastMeshManager; TileCachedRecastMeshManager mTileCachedRecastMeshManager;
btAABB mAabb; btAABB mAabb;
bool mAabbInitialized = false; bool mAabbInitialized = false;
explicit WorldspaceNavMeshInput(std::string worldspace, const DetourNavigator::RecastSettings& settings); explicit WorldspaceNavMeshInput(ESM::RefId worldspace, const DetourNavigator::RecastSettings& settings);
}; };
class BulletObject class BulletObject

View file

@ -591,9 +591,7 @@ namespace MWWorld
else else
unloadCell(cell, navigatorUpdateGuard.get()); unloadCell(cell, navigatorUpdateGuard.get());
} }
mNavigator.setWorldspace( mNavigator.setWorldspace(playerCellIndex.mWorldspace, navigatorUpdateGuard.get());
mWorld.getWorldModel().getExterior(playerCellIndex).getCell()->getWorldSpace().serializeText(),
navigatorUpdateGuard.get());
mNavigator.updateBounds(pos, navigatorUpdateGuard.get()); mNavigator.updateBounds(pos, navigatorUpdateGuard.get());
mCurrentGridCenter = osg::Vec2i(playerCellX, playerCellY); mCurrentGridCenter = osg::Vec2i(playerCellX, playerCellY);
@ -696,7 +694,7 @@ namespace MWWorld
CellStore& cell = mWorld.getWorldModel().getExterior( CellStore& cell = mWorld.getWorldModel().getExterior(
ESM::ExteriorCellLocation(it->mData.mX, it->mData.mY, ESM::Cell::sDefaultWorldspaceId)); ESM::ExteriorCellLocation(it->mData.mX, it->mData.mY, ESM::Cell::sDefaultWorldspaceId));
mNavigator.setWorldspace(cell.getCell()->getWorldSpace().serializeText(), navigatorUpdateGuard.get()); mNavigator.setWorldspace(cell.getCell()->getWorldSpace(), navigatorUpdateGuard.get());
const osg::Vec3f position const osg::Vec3f position
= osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits; = osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits;
mNavigator.updateBounds(position, navigatorUpdateGuard.get()); mNavigator.updateBounds(position, navigatorUpdateGuard.get());
@ -753,7 +751,7 @@ namespace MWWorld
+ std::to_string(cells.getIntSize()) + ")..."); + std::to_string(cells.getIntSize()) + ")...");
CellStore& cell = mWorld.getWorldModel().getInterior(it->mName); CellStore& cell = mWorld.getWorldModel().getInterior(it->mName);
mNavigator.setWorldspace(cell.getCell()->getWorldSpace().serializeText(), navigatorUpdateGuard.get()); mNavigator.setWorldspace(cell.getCell()->getWorldSpace(), navigatorUpdateGuard.get());
ESM::Position position; ESM::Position position;
mWorld.findInteriorPosition(it->mName, position); mWorld.findInteriorPosition(it->mName, position);
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get()); mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
@ -906,7 +904,7 @@ namespace MWWorld
loadingListener->setProgressRange(cell.count()); loadingListener->setProgressRange(cell.count());
mNavigator.setWorldspace(cell.getCell()->getWorldSpace().serializeText(), navigatorUpdateGuard.get()); mNavigator.setWorldspace(cell.getCell()->getWorldSpace(), navigatorUpdateGuard.get());
mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get()); mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get());
// Load cell. // Load cell.

View file

@ -52,7 +52,7 @@ namespace
OffMeshConnectionsManager mOffMeshConnectionsManager{ mSettings.mRecast }; OffMeshConnectionsManager mOffMeshConnectionsManager{ mSettings.mRecast };
const AgentBounds mAgentBounds{ CollisionShapeType::Aabb, { 29, 29, 66 } }; const AgentBounds mAgentBounds{ CollisionShapeType::Aabb, { 29, 29, 66 } };
const TilePosition mPlayerTile{ 0, 0 }; const TilePosition mPlayerTile{ 0, 0 };
const std::string mWorldspace = "sys::default"; const ESM::RefId mWorldspace = ESM::RefId::stringRefId("sys::default");
const btBoxShape mBox{ btVector3(100, 100, 20) }; const btBoxShape mBox{ btVector3(100, 100, 20) };
Loading::Listener mListener; Loading::Listener mListener;
}; };
@ -310,7 +310,7 @@ namespace
AsyncNavMeshUpdater updater(mSettings, mRecastMeshManager, mOffMeshConnectionsManager, std::move(db)); AsyncNavMeshUpdater updater(mSettings, mRecastMeshManager, mOffMeshConnectionsManager, std::move(db));
const TileId nextTileId(dbPtr->getMaxTileId() + 1); const TileId nextTileId(dbPtr->getMaxTileId() + 1);
ASSERT_EQ(dbPtr->insertTile(nextTileId, "worldspace", TilePosition{}, TileVersion{ 1 }, {}, {}), 1); ASSERT_EQ(dbPtr->insertTile(nextTileId, mWorldspace, TilePosition{}, TileVersion{ 1 }, {}, {}), 1);
const auto navMeshCacheItem = std::make_shared<GuardedNavMeshCacheItem>(1, mSettings); const auto navMeshCacheItem = std::make_shared<GuardedNavMeshCacheItem>(1, mSettings);
const TilePosition tilePosition{ 0, 0 }; const TilePosition tilePosition{ 0, 0 };
@ -385,7 +385,7 @@ namespace
const AgentBounds mAgentBounds{ CollisionShapeType::Aabb, osg::Vec3f(1, 1, 1) }; const AgentBounds mAgentBounds{ CollisionShapeType::Aabb, osg::Vec3f(1, 1, 1) };
const std::shared_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItemPtr; const std::shared_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItemPtr;
const std::weak_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItem = mNavMeshCacheItemPtr; const std::weak_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItem = mNavMeshCacheItemPtr;
const std::string_view mWorldspace = "worldspace"; const ESM::RefId mWorldspace = ESM::RefId::stringRefId("worldspace");
const TilePosition mChangedTile{ 0, 0 }; const TilePosition mChangedTile{ 0, 0 };
const std::chrono::steady_clock::time_point mProcessTime{}; const std::chrono::steady_clock::time_point mProcessTime{};
const TilePosition mPlayerTile{ 0, 0 }; const TilePosition mPlayerTile{ 0, 0 };
@ -397,20 +397,23 @@ namespace
std::list<Job> jobs; std::list<Job> jobs;
SpatialJobQueue queue; SpatialJobQueue queue;
queue.push(jobs.emplace(jobs.end(), mAgentBounds, mNavMeshCacheItem, "worldspace1", mChangedTile, const ESM::RefId worldspace1 = ESM::RefId::stringRefId("worldspace1");
ChangeType::remove, mProcessTime)); const ESM::RefId worldspace2 = ESM::RefId::stringRefId("worldspace2");
queue.push(jobs.emplace(jobs.end(), mAgentBounds, mNavMeshCacheItem, "worldspace2", mChangedTile,
ChangeType::update, mProcessTime)); queue.push(jobs.emplace(
jobs.end(), mAgentBounds, mNavMeshCacheItem, worldspace1, mChangedTile, ChangeType::remove, mProcessTime));
queue.push(jobs.emplace(
jobs.end(), mAgentBounds, mNavMeshCacheItem, worldspace2, mChangedTile, ChangeType::update, mProcessTime));
ASSERT_EQ(queue.size(), 2); ASSERT_EQ(queue.size(), 2);
const auto job1 = queue.pop(mChangedTile); const auto job1 = queue.pop(mChangedTile);
ASSERT_TRUE(job1.has_value()); ASSERT_TRUE(job1.has_value());
EXPECT_EQ((*job1)->mWorldspace, "worldspace1"); EXPECT_EQ((*job1)->mWorldspace, worldspace1);
const auto job2 = queue.pop(mChangedTile); const auto job2 = queue.pop(mChangedTile);
ASSERT_TRUE(job2.has_value()); ASSERT_TRUE(job2.has_value());
EXPECT_EQ((*job2)->mWorldspace, "worldspace2"); EXPECT_EQ((*job2)->mWorldspace, worldspace2);
EXPECT_EQ(queue.size(), 0); EXPECT_EQ(queue.size(), 0);
} }

View file

@ -8,7 +8,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <limits> #include <limits>
#include <numeric>
#include <random> #include <random>
namespace namespace
@ -19,7 +18,7 @@ namespace
struct Tile struct Tile
{ {
std::string mWorldspace; ESM::RefId mWorldspace;
TilePosition mTilePosition; TilePosition mTilePosition;
std::vector<std::byte> mInput; std::vector<std::byte> mInput;
std::vector<std::byte> mData; std::vector<std::byte> mData;
@ -39,12 +38,12 @@ namespace
Tile insertTile(TileId tileId, TileVersion version) Tile insertTile(TileId tileId, TileVersion version)
{ {
std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const TilePosition tilePosition{ 3, 4 }; const TilePosition tilePosition{ 3, 4 };
std::vector<std::byte> input = generateData(); std::vector<std::byte> input = generateData();
std::vector<std::byte> data = generateData(); std::vector<std::byte> data = generateData();
EXPECT_EQ(mDb.insertTile(tileId, worldspace, tilePosition, version, input, data), 1); EXPECT_EQ(mDb.insertTile(tileId, worldspace, tilePosition, version, input, data), 1);
return { std::move(worldspace), tilePosition, std::move(input), std::move(data) }; return { worldspace, tilePosition, std::move(input), std::move(data) };
} }
}; };
@ -89,7 +88,7 @@ namespace
{ {
const TileId tileId{ 53 }; const TileId tileId{ 53 };
const TileVersion version{ 1 }; const TileVersion version{ 1 };
const std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const TilePosition tilePosition{ 3, 4 }; const TilePosition tilePosition{ 3, 4 };
const std::vector<std::byte> input = generateData(); const std::vector<std::byte> input = generateData();
const std::vector<std::byte> data = generateData(); const std::vector<std::byte> data = generateData();
@ -101,7 +100,7 @@ namespace
{ {
const TileId tileId{ 53 }; const TileId tileId{ 53 };
const TileVersion version{ 1 }; const TileVersion version{ 1 };
const std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const TilePosition tilePosition{ 3, 4 }; const TilePosition tilePosition{ 3, 4 };
const std::vector<std::byte> input = generateData(); const std::vector<std::byte> input = generateData();
const std::vector<std::byte> data = generateData(); const std::vector<std::byte> data = generateData();
@ -113,7 +112,7 @@ namespace
TEST_F(DetourNavigatorNavMeshDbTest, delete_tiles_at_should_remove_all_tiles_with_given_worldspace_and_position) TEST_F(DetourNavigatorNavMeshDbTest, delete_tiles_at_should_remove_all_tiles_with_given_worldspace_and_position)
{ {
const TileVersion version{ 1 }; const TileVersion version{ 1 };
const std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const TilePosition tilePosition{ 3, 4 }; const TilePosition tilePosition{ 3, 4 };
const std::vector<std::byte> input1 = generateData(); const std::vector<std::byte> input1 = generateData();
const std::vector<std::byte> input2 = generateData(); const std::vector<std::byte> input2 = generateData();
@ -130,7 +129,7 @@ namespace
const TileId leftTileId{ 53 }; const TileId leftTileId{ 53 };
const TileId removedTileId{ 54 }; const TileId removedTileId{ 54 };
const TileVersion version{ 1 }; const TileVersion version{ 1 };
const std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const TilePosition tilePosition{ 3, 4 }; const TilePosition tilePosition{ 3, 4 };
const std::vector<std::byte> leftInput = generateData(); const std::vector<std::byte> leftInput = generateData();
const std::vector<std::byte> removedInput = generateData(); const std::vector<std::byte> removedInput = generateData();
@ -148,7 +147,7 @@ namespace
{ {
TileId tileId{ 1 }; TileId tileId{ 1 };
const TileVersion version{ 1 }; const TileVersion version{ 1 };
const std::string worldspace = "sys::default"; const ESM::RefId worldspace = ESM::RefId::stringRefId("sys::default");
const std::vector<std::byte> input = generateData(); const std::vector<std::byte> input = generateData();
const std::vector<std::byte> data = generateData(); const std::vector<std::byte> data = generateData();
for (int x = -2; x <= 2; ++x) for (int x = -2; x <= 2; ++x)

View file

@ -21,6 +21,7 @@ namespace
const ObjectTransform mObjectTransform{ ESM::Position{ { 0, 0, 0 }, { 0, 0, 0 } }, 0.0f }; const ObjectTransform mObjectTransform{ ESM::Position{ { 0, 0, 0 }, { 0, 0, 0 } }, 0.0f };
const osg::ref_ptr<const Resource::BulletShape> mShape = new Resource::BulletShape; const osg::ref_ptr<const Resource::BulletShape> mShape = new Resource::BulletShape;
const osg::ref_ptr<const Resource::BulletShapeInstance> mInstance = new Resource::BulletShapeInstance(mShape); const osg::ref_ptr<const Resource::BulletShapeInstance> mInstance = new Resource::BulletShapeInstance(mShape);
const ESM::RefId mWorldspace = ESM::RefId::stringRefId("worldspace");
DetourNavigatorTileCachedRecastMeshManagerTest() DetourNavigatorTileCachedRecastMeshManagerTest()
{ {
@ -34,7 +35,7 @@ namespace
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_for_empty_should_return_nullptr) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_for_empty_should_return_nullptr)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, get_revision_for_empty_should_return_zero) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, get_revision_for_empty_should_return_zero)
@ -65,14 +66,14 @@ namespace
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_object_should_add_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_object_should_add_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
ASSERT_TRUE(manager.addObject( ASSERT_TRUE(manager.addObject(
ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr)); ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr));
for (int x = -1; x < 1; ++x) for (int x = -1; x < 1; ++x)
for (int y = -1; y < 1; ++y) for (int y = -1; y < 1; ++y)
ASSERT_NE(manager.getMesh("worldspace", TilePosition(x, y)), nullptr); ASSERT_NE(manager.getMesh(mWorldspace, TilePosition(x, y)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_object_should_return_add_changed_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_object_should_return_add_changed_tiles)
@ -145,25 +146,25 @@ namespace
get_mesh_after_add_object_should_return_recast_mesh_for_each_used_tile) get_mesh_after_add_object_should_return_recast_mesh_for_each_used_tile)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
} }
TEST_F( TEST_F(
DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_after_add_object_should_return_nullptr_for_unused_tile) DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_after_add_object_should_return_nullptr_for_unused_tile)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(1, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(1, 0)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest,
@ -175,7 +176,7 @@ namespace
.mEnd = TilePosition(1, 1), .mEnd = TilePosition(1, 1),
}; };
manager.setRange(range, nullptr); manager.setRange(range, nullptr);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const btTransform transform( const btTransform transform(
@ -183,23 +184,23 @@ namespace
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, transform, AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, transform, AreaType::AreaType_ground, nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(1, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(1, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(1, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(1, -1)), nullptr);
manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
} }
TEST_F( TEST_F(
DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_for_moved_object_should_return_nullptr_for_unused_tile) DetourNavigatorTileCachedRecastMeshManagerTest, get_mesh_for_moved_object_should_return_nullptr_for_unused_tile)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const btTransform transform( const btTransform transform(
@ -207,48 +208,48 @@ namespace
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, transform, AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, transform, AreaType::AreaType_ground, nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(1, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(1, 0)), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(1, -1)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(1, -1)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest,
get_mesh_for_removed_object_should_return_nullptr_for_all_previously_used_tiles) get_mesh_for_removed_object_should_return_nullptr_for_all_previously_used_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
manager.removeObject(ObjectId(&boxShape), nullptr); manager.removeObject(ObjectId(&boxShape), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_EQ(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_EQ(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest,
get_mesh_for_not_changed_object_after_update_should_return_recast_mesh_for_same_tiles) get_mesh_for_not_changed_object_after_update_should_return_recast_mesh_for_same_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.updateObject(ObjectId(&boxShape), btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(-1, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(-1, 0)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, -1)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, -1)), nullptr);
EXPECT_NE(manager.getMesh("worldspace", TilePosition(0, 0)), nullptr); EXPECT_NE(manager.getMesh(mWorldspace, TilePosition(0, 0)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest,
@ -293,7 +294,7 @@ namespace
get_revision_after_update_not_changed_object_should_return_same_value) get_revision_after_update_not_changed_object_should_return_same_value)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr); manager.addObject(ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr);
@ -339,19 +340,19 @@ namespace
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_water_for_not_max_int_should_add_new_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_water_for_not_max_int_should_add_new_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const osg::Vec2i cellPosition(0, 0); const osg::Vec2i cellPosition(0, 0);
const int cellSize = 8192; const int cellSize = 8192;
manager.addWater(cellPosition, cellSize, 0.0f, nullptr); manager.addWater(cellPosition, cellSize, 0.0f, nullptr);
for (int x = -1; x < 12; ++x) for (int x = -1; x < 12; ++x)
for (int y = -1; y < 12; ++y) for (int y = -1; y < 12; ++y)
ASSERT_NE(manager.getMesh("worldspace", TilePosition(x, y)), nullptr); ASSERT_NE(manager.getMesh(mWorldspace, TilePosition(x, y)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_water_for_max_int_should_not_add_new_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, add_water_for_max_int_should_not_add_new_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
ASSERT_TRUE(manager.addObject( ASSERT_TRUE(manager.addObject(
@ -361,7 +362,7 @@ namespace
manager.addWater(cellPosition, cellSize, 0.0f, nullptr); manager.addWater(cellPosition, cellSize, 0.0f, nullptr);
for (int x = -6; x < 6; ++x) for (int x = -6; x < 6; ++x)
for (int y = -6; y < 6; ++y) for (int y = -6; y < 6; ++y)
ASSERT_EQ(manager.getMesh("worldspace", TilePosition(x, y)) != nullptr, ASSERT_EQ(manager.getMesh(mWorldspace, TilePosition(x, y)) != nullptr,
-1 <= x && x <= 0 && -1 <= y && y <= 0); -1 <= x && x <= 0 && -1 <= y && y <= 0);
} }
@ -390,20 +391,20 @@ namespace
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_remove_empty_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_remove_empty_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const osg::Vec2i cellPosition(0, 0); const osg::Vec2i cellPosition(0, 0);
const int cellSize = 8192; const int cellSize = 8192;
manager.addWater(cellPosition, cellSize, 0.0f, nullptr); manager.addWater(cellPosition, cellSize, 0.0f, nullptr);
manager.removeWater(cellPosition, nullptr); manager.removeWater(cellPosition, nullptr);
for (int x = -6; x < 6; ++x) for (int x = -6; x < 6; ++x)
for (int y = -6; y < 6; ++y) for (int y = -6; y < 6; ++y)
ASSERT_EQ(manager.getMesh("worldspace", TilePosition(x, y)), nullptr); ASSERT_EQ(manager.getMesh(mWorldspace, TilePosition(x, y)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_leave_not_empty_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_water_for_existing_cell_should_leave_not_empty_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
ASSERT_TRUE(manager.addObject( ASSERT_TRUE(manager.addObject(
@ -414,14 +415,14 @@ namespace
manager.removeWater(cellPosition, nullptr); manager.removeWater(cellPosition, nullptr);
for (int x = -6; x < 6; ++x) for (int x = -6; x < 6; ++x)
for (int y = -6; y < 6; ++y) for (int y = -6; y < 6; ++y)
ASSERT_EQ(manager.getMesh("worldspace", TilePosition(x, y)) != nullptr, ASSERT_EQ(manager.getMesh(mWorldspace, TilePosition(x, y)) != nullptr,
-1 <= x && x <= 0 && -1 <= y && y <= 0); -1 <= x && x <= 0 && -1 <= y && y <= 0);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_object_should_not_remove_tile_with_water) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_object_should_not_remove_tile_with_water)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const osg::Vec2i cellPosition(0, 0); const osg::Vec2i cellPosition(0, 0);
const int cellSize = 8192; const int cellSize = 8192;
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
@ -432,21 +433,22 @@ namespace
manager.removeObject(ObjectId(&boxShape), nullptr); manager.removeObject(ObjectId(&boxShape), nullptr);
for (int x = -1; x < 12; ++x) for (int x = -1; x < 12; ++x)
for (int y = -1; y < 12; ++y) for (int y = -1; y < 12; ++y)
ASSERT_NE(manager.getMesh("worldspace", TilePosition(x, y)), nullptr); ASSERT_NE(manager.getMesh(mWorldspace, TilePosition(x, y)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, set_new_worldspace_should_remove_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, set_new_worldspace_should_remove_tiles)
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
manager.setWorldspace("worldspace", nullptr); manager.setWorldspace(mWorldspace, nullptr);
const btBoxShape boxShape(btVector3(20, 20, 100)); const btBoxShape boxShape(btVector3(20, 20, 100));
const CollisionShape shape(nullptr, boxShape, mObjectTransform); const CollisionShape shape(nullptr, boxShape, mObjectTransform);
ASSERT_TRUE(manager.addObject( ASSERT_TRUE(manager.addObject(
ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr)); ObjectId(&boxShape), shape, btTransform::getIdentity(), AreaType::AreaType_ground, nullptr));
manager.setWorldspace("other", nullptr); const ESM::RefId otherWorldspace(ESM::FormId::fromUint32(0x1));
manager.setWorldspace(ESM::FormId::fromUint32(0x1), nullptr);
for (int x = -1; x < 1; ++x) for (int x = -1; x < 1; ++x)
for (int y = -1; y < 1; ++y) for (int y = -1; y < 1; ++y)
ASSERT_EQ(manager.getMesh("other", TilePosition(x, y)), nullptr); ASSERT_EQ(manager.getMesh(otherWorldspace, TilePosition(x, y)), nullptr);
} }
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, set_range_should_add_changed_tiles) TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, set_range_should_add_changed_tiles)
@ -475,8 +477,7 @@ namespace
{ {
TileCachedRecastMeshManager manager(mSettings); TileCachedRecastMeshManager manager(mSettings);
const std::string_view worldspace = "worldspace"; manager.setWorldspace(mWorldspace, nullptr);
manager.setWorldspace(worldspace, nullptr);
const btBoxShape boxShape(btVector3(100, 100, 20)); const btBoxShape boxShape(btVector3(100, 100, 20));
const CollisionShape shape(mInstance, boxShape, mObjectTransform); const CollisionShape shape(mInstance, boxShape, mObjectTransform);
@ -489,9 +490,9 @@ namespace
const TilePosition tilePosition(0, 0); const TilePosition tilePosition(0, 0);
ASSERT_EQ(manager.getCachedMesh(worldspace, tilePosition), nullptr); ASSERT_EQ(manager.getCachedMesh(mWorldspace, tilePosition), nullptr);
ASSERT_NE(manager.getMesh(worldspace, tilePosition), nullptr); ASSERT_NE(manager.getMesh(mWorldspace, tilePosition), nullptr);
ASSERT_NE(manager.getCachedMesh(worldspace, tilePosition), nullptr); ASSERT_NE(manager.getCachedMesh(mWorldspace, tilePosition), nullptr);
const TilesPositionsRange range2{ const TilesPositionsRange range2{
.mBegin = TilePosition(-1, -1), .mBegin = TilePosition(-1, -1),
@ -500,6 +501,6 @@ namespace
manager.takeChangedTiles(nullptr); manager.takeChangedTiles(nullptr);
manager.setRange(range2, nullptr); manager.setRange(range2, nullptr);
ASSERT_EQ(manager.getCachedMesh(worldspace, tilePosition), nullptr); ASSERT_EQ(manager.getCachedMesh(mWorldspace, tilePosition), nullptr);
} }
} }

View file

@ -91,7 +91,7 @@ namespace DetourNavigator
} }
Job::Job(const AgentBounds& agentBounds, std::weak_ptr<GuardedNavMeshCacheItem> navMeshCacheItem, Job::Job(const AgentBounds& agentBounds, std::weak_ptr<GuardedNavMeshCacheItem> navMeshCacheItem,
std::string_view worldspace, const TilePosition& changedTile, ChangeType changeType, ESM::RefId worldspace, const TilePosition& changedTile, ChangeType changeType,
std::chrono::steady_clock::time_point processTime) std::chrono::steady_clock::time_point processTime)
: mId(getNextJobId()) : mId(getNextJobId())
, mAgentBounds(agentBounds) , mAgentBounds(agentBounds)
@ -261,8 +261,7 @@ namespace DetourNavigator
} }
void AsyncNavMeshUpdater::post(const AgentBounds& agentBounds, const SharedNavMeshCacheItem& navMeshCacheItem, void AsyncNavMeshUpdater::post(const AgentBounds& agentBounds, const SharedNavMeshCacheItem& navMeshCacheItem,
const TilePosition& playerTile, std::string_view worldspace, const TilePosition& playerTile, ESM::RefId worldspace, const std::map<TilePosition, ChangeType>& changedTiles)
const std::map<TilePosition, ChangeType>& changedTiles)
{ {
bool playerTileChanged = false; bool playerTileChanged = false;
{ {

View file

@ -50,7 +50,7 @@ namespace DetourNavigator
const std::size_t mId; const std::size_t mId;
const AgentBounds mAgentBounds; const AgentBounds mAgentBounds;
const std::weak_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItem; const std::weak_ptr<GuardedNavMeshCacheItem> mNavMeshCacheItem;
const std::string mWorldspace; const ESM::RefId mWorldspace;
const TilePosition mChangedTile; const TilePosition mChangedTile;
std::chrono::steady_clock::time_point mProcessTime; std::chrono::steady_clock::time_point mProcessTime;
ChangeType mChangeType; ChangeType mChangeType;
@ -61,7 +61,7 @@ namespace DetourNavigator
std::unique_ptr<PreparedNavMeshData> mGeneratedNavMeshData; std::unique_ptr<PreparedNavMeshData> mGeneratedNavMeshData;
Job(const AgentBounds& agentBounds, std::weak_ptr<GuardedNavMeshCacheItem> navMeshCacheItem, Job(const AgentBounds& agentBounds, std::weak_ptr<GuardedNavMeshCacheItem> navMeshCacheItem,
std::string_view worldspace, const TilePosition& changedTile, ChangeType changeType, ESM::RefId worldspace, const TilePosition& changedTile, ChangeType changeType,
std::chrono::steady_clock::time_point processTime); std::chrono::steady_clock::time_point processTime);
}; };
@ -199,7 +199,7 @@ namespace DetourNavigator
~AsyncNavMeshUpdater(); ~AsyncNavMeshUpdater();
void post(const AgentBounds& agentBounds, const SharedNavMeshCacheItem& navMeshCacheItem, void post(const AgentBounds& agentBounds, const SharedNavMeshCacheItem& navMeshCacheItem,
const TilePosition& playerTile, std::string_view worldspace, const TilePosition& playerTile, ESM::RefId worldspace,
const std::map<TilePosition, ChangeType>& changedTiles); const std::map<TilePosition, ChangeType>& changedTiles);
void wait(WaitConditionType waitConditionType, Loading::Listener* listener); void wait(WaitConditionType waitConditionType, Loading::Listener* listener);

View file

@ -22,7 +22,7 @@ namespace DetourNavigator
{ {
struct Ignore struct Ignore
{ {
std::string_view mWorldspace; ESM::RefId mWorldspace;
const TilePosition& mTilePosition; const TilePosition& mTilePosition;
std::shared_ptr<NavMeshTileConsumer> mConsumer; std::shared_ptr<NavMeshTileConsumer> mConsumer;
@ -34,10 +34,10 @@ namespace DetourNavigator
}; };
} }
GenerateNavMeshTile::GenerateNavMeshTile(std::string worldspace, const TilePosition& tilePosition, GenerateNavMeshTile::GenerateNavMeshTile(ESM::RefId worldspace, const TilePosition& tilePosition,
RecastMeshProvider recastMeshProvider, const AgentBounds& agentBounds, RecastMeshProvider recastMeshProvider, const AgentBounds& agentBounds,
const DetourNavigator::Settings& settings, std::weak_ptr<NavMeshTileConsumer> consumer) const DetourNavigator::Settings& settings, std::weak_ptr<NavMeshTileConsumer> consumer)
: mWorldspace(std::move(worldspace)) : mWorldspace(worldspace)
, mTilePosition(tilePosition) , mTilePosition(tilePosition)
, mRecastMeshProvider(recastMeshProvider) , mRecastMeshProvider(recastMeshProvider)
, mAgentBounds(agentBounds) , mAgentBounds(agentBounds)

View file

@ -35,18 +35,18 @@ namespace DetourNavigator
virtual std::int64_t resolveMeshSource(const MeshSource& source) = 0; virtual std::int64_t resolveMeshSource(const MeshSource& source) = 0;
virtual std::optional<NavMeshTileInfo> find( virtual std::optional<NavMeshTileInfo> find(
std::string_view worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input) ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
= 0; = 0;
virtual void ignore(std::string_view worldspace, const TilePosition& tilePosition) = 0; virtual void ignore(ESM::RefId worldspace, const TilePosition& tilePosition) = 0;
virtual void identity(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t tileId) = 0; virtual void identity(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t tileId) = 0;
virtual void insert(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t version, virtual void insert(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t version,
const std::vector<std::byte>& input, PreparedNavMeshData& data) const std::vector<std::byte>& input, PreparedNavMeshData& data)
= 0; = 0;
virtual void update(std::string_view worldspace, const TilePosition& tilePosition, std::int64_t tileId, virtual void update(ESM::RefId worldspace, const TilePosition& tilePosition, std::int64_t tileId,
std::int64_t version, PreparedNavMeshData& data) std::int64_t version, PreparedNavMeshData& data)
= 0; = 0;
@ -56,14 +56,14 @@ namespace DetourNavigator
class GenerateNavMeshTile final : public SceneUtil::WorkItem class GenerateNavMeshTile final : public SceneUtil::WorkItem
{ {
public: public:
GenerateNavMeshTile(std::string worldspace, const TilePosition& tilePosition, GenerateNavMeshTile(ESM::RefId worldspace, const TilePosition& tilePosition,
RecastMeshProvider recastMeshProvider, const AgentBounds& agentBounds, const Settings& settings, RecastMeshProvider recastMeshProvider, const AgentBounds& agentBounds, const Settings& settings,
std::weak_ptr<NavMeshTileConsumer> consumer); std::weak_ptr<NavMeshTileConsumer> consumer);
void doWork() final; void doWork() final;
private: private:
const std::string mWorldspace; const ESM::RefId mWorldspace;
const TilePosition mTilePosition; const TilePosition mTilePosition;
const RecastMeshProvider mRecastMeshProvider; const RecastMeshProvider mRecastMeshProvider;
const AgentBounds mAgentBounds; const AgentBounds mAgentBounds;

View file

@ -520,9 +520,8 @@ namespace DetourNavigator
} }
} }
std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, ESM::RefId worldspace,
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds, const TilePosition& tilePosition, const AgentBounds& agentBounds, const RecastSettings& settings)
const RecastSettings& settings)
{ {
RecastContext context(worldspace, tilePosition, agentBounds); RecastContext context(worldspace, tilePosition, agentBounds);

View file

@ -4,6 +4,8 @@
#include "recastmesh.hpp" #include "recastmesh.hpp"
#include "tileposition.hpp" #include "tileposition.hpp"
#include <components/esm/refid.hpp>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -41,9 +43,8 @@ namespace DetourNavigator
&& recastMesh.getHeightfields().empty() && recastMesh.getFlatHeightfields().empty(); && recastMesh.getHeightfields().empty() && recastMesh.getFlatHeightfields().empty();
} }
std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, ESM::RefId worldspace,
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds, const TilePosition& tilePosition, const AgentBounds& agentBounds, const RecastSettings& settings);
const RecastSettings& settings);
NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data, NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data,
const std::vector<OffMeshConnection>& offMeshConnections, const AgentBounds& agentBounds, const std::vector<OffMeshConnection>& offMeshConnections, const AgentBounds& agentBounds,

View file

@ -91,7 +91,7 @@ namespace DetourNavigator
* @brief setWorldspace should be called before adding object from new worldspace * @brief setWorldspace should be called before adding object from new worldspace
* @param worldspace * @param worldspace
*/ */
virtual void setWorldspace(std::string_view worldspace, const UpdateGuard* guard) = 0; virtual void setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard) = 0;
/** /**
* @brief updateBounds should be called before adding object from loading cell * @brief updateBounds should be called before adding object from loading cell

View file

@ -33,7 +33,7 @@ namespace DetourNavigator
--it->second; --it->second;
} }
void NavigatorImpl::setWorldspace(std::string_view worldspace, const UpdateGuard* guard) void NavigatorImpl::setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard)
{ {
mNavMeshManager.setWorldspace(worldspace, guard); mNavMeshManager.setWorldspace(worldspace, guard);
} }

View file

@ -8,7 +8,6 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <string_view>
#include <unordered_map> #include <unordered_map>
namespace DetourNavigator namespace DetourNavigator
@ -28,7 +27,7 @@ namespace DetourNavigator
void removeAgent(const AgentBounds& agentBounds) override; void removeAgent(const AgentBounds& agentBounds) override;
void setWorldspace(std::string_view worldspace, const UpdateGuard* guard) override; void setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard) override;
void updateBounds(const osg::Vec3f& playerPosition, const UpdateGuard* guard) override; void updateBounds(const osg::Vec3f& playerPosition, const UpdateGuard* guard) override;

View file

@ -24,7 +24,7 @@ namespace DetourNavigator
void removeAgent(const AgentBounds& /*agentBounds*/) override {} void removeAgent(const AgentBounds& /*agentBounds*/) override {}
void setWorldspace(std::string_view /*worldspace*/, const UpdateGuard* /*guard*/) override {} void setWorldspace(ESM::RefId /*worldspace*/, const UpdateGuard* /*guard*/) override {}
void addObject(const ObjectId /*id*/, const ObjectShapes& /*shapes*/, const btTransform& /*transform*/, void addObject(const ObjectId /*id*/, const ObjectShapes& /*shapes*/, const btTransform& /*transform*/,
const UpdateGuard* /*guard*/) override const UpdateGuard* /*guard*/) override

View file

@ -200,34 +200,35 @@ namespace DetourNavigator
} }
std::optional<Tile> NavMeshDb::findTile( std::optional<Tile> NavMeshDb::findTile(
std::string_view worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input) ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
{ {
Tile result; Tile result;
auto row = std::tie(result.mTileId, result.mVersion); auto row = std::tie(result.mTileId, result.mVersion);
const std::vector<std::byte> compressedInput = Misc::compress(input); const std::vector<std::byte> compressedInput = Misc::compress(input);
if (&row == request(*mDb, mFindTile, &row, 1, worldspace, tilePosition, compressedInput)) if (&row == request(*mDb, mFindTile, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
return {}; return {};
return result; return result;
} }
std::optional<TileData> NavMeshDb::getTileData( std::optional<TileData> NavMeshDb::getTileData(
std::string_view worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input) ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input)
{ {
TileData result; TileData result;
auto row = std::tie(result.mTileId, result.mVersion, result.mData); auto row = std::tie(result.mTileId, result.mVersion, result.mData);
const std::vector<std::byte> compressedInput = Misc::compress(input); const std::vector<std::byte> compressedInput = Misc::compress(input);
if (&row == request(*mDb, mGetTileData, &row, 1, worldspace, tilePosition, compressedInput)) if (&row == request(*mDb, mGetTileData, &row, 1, worldspace.serializeText(), tilePosition, compressedInput))
return {}; return {};
result.mData = Misc::decompress(result.mData); result.mData = Misc::decompress(result.mData);
return result; return result;
} }
int NavMeshDb::insertTile(TileId tileId, std::string_view worldspace, const TilePosition& tilePosition, int NavMeshDb::insertTile(TileId tileId, ESM::RefId worldspace, const TilePosition& tilePosition,
TileVersion version, const std::vector<std::byte>& input, const std::vector<std::byte>& data) TileVersion version, const std::vector<std::byte>& input, const std::vector<std::byte>& data)
{ {
const std::vector<std::byte> compressedInput = Misc::compress(input); const std::vector<std::byte> compressedInput = Misc::compress(input);
const std::vector<std::byte> compressedData = Misc::compress(data); const std::vector<std::byte> compressedData = Misc::compress(data);
return execute(*mDb, mInsertTile, tileId, worldspace, tilePosition, version, compressedInput, compressedData); return execute(*mDb, mInsertTile, tileId, worldspace.serializeText(), tilePosition, version, compressedInput,
compressedData);
} }
int NavMeshDb::updateTile(TileId tileId, TileVersion version, const std::vector<std::byte>& data) int NavMeshDb::updateTile(TileId tileId, TileVersion version, const std::vector<std::byte>& data)
@ -236,20 +237,19 @@ namespace DetourNavigator
return execute(*mDb, mUpdateTile, tileId, version, compressedData); return execute(*mDb, mUpdateTile, tileId, version, compressedData);
} }
int NavMeshDb::deleteTilesAt(std::string_view worldspace, const TilePosition& tilePosition) int NavMeshDb::deleteTilesAt(ESM::RefId worldspace, const TilePosition& tilePosition)
{ {
return execute(*mDb, mDeleteTilesAt, worldspace, tilePosition); return execute(*mDb, mDeleteTilesAt, worldspace.serializeText(), tilePosition);
} }
int NavMeshDb::deleteTilesAtExcept( int NavMeshDb::deleteTilesAtExcept(ESM::RefId worldspace, const TilePosition& tilePosition, TileId excludeTileId)
std::string_view worldspace, const TilePosition& tilePosition, TileId excludeTileId)
{ {
return execute(*mDb, mDeleteTilesAtExcept, worldspace, tilePosition, excludeTileId); return execute(*mDb, mDeleteTilesAtExcept, worldspace.serializeText(), tilePosition, excludeTileId);
} }
int NavMeshDb::deleteTilesOutsideRange(std::string_view worldspace, const TilesPositionsRange& range) int NavMeshDb::deleteTilesOutsideRange(ESM::RefId worldspace, const TilesPositionsRange& range)
{ {
return execute(*mDb, mDeleteTilesOutsideRange, worldspace, range); return execute(*mDb, mDeleteTilesOutsideRange, worldspace.serializeText(), range);
} }
ShapeId NavMeshDb::getMaxShapeId() ShapeId NavMeshDb::getMaxShapeId()

View file

@ -2,10 +2,10 @@
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHDB_H #define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHDB_H
#include "tileposition.hpp" #include "tileposition.hpp"
#include "tilespositionsrange.hpp"
#include <components/detournavigator/tilespositionsrange.hpp> #include <components/esm/refid.hpp>
#include <components/misc/strongtypedef.hpp> #include <components/misc/strongtypedef.hpp>
#include <components/sqlite3/db.hpp> #include <components/sqlite3/db.hpp>
#include <components/sqlite3/statement.hpp> #include <components/sqlite3/statement.hpp>
#include <components/sqlite3/transaction.hpp> #include <components/sqlite3/transaction.hpp>
@ -13,13 +13,8 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <cstring>
#include <memory>
#include <optional> #include <optional>
#include <stdexcept>
#include <string_view> #include <string_view>
#include <tuple>
#include <utility>
#include <vector> #include <vector>
struct sqlite3; struct sqlite3;
@ -148,21 +143,21 @@ namespace DetourNavigator
TileId getMaxTileId(); TileId getMaxTileId();
std::optional<Tile> findTile( std::optional<Tile> findTile(
std::string_view worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input); ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input);
std::optional<TileData> getTileData( std::optional<TileData> getTileData(
std::string_view worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input); ESM::RefId worldspace, const TilePosition& tilePosition, const std::vector<std::byte>& input);
int insertTile(TileId tileId, std::string_view worldspace, const TilePosition& tilePosition, int insertTile(TileId tileId, ESM::RefId worldspace, const TilePosition& tilePosition, TileVersion version,
TileVersion version, const std::vector<std::byte>& input, const std::vector<std::byte>& data); const std::vector<std::byte>& input, const std::vector<std::byte>& data);
int updateTile(TileId tileId, TileVersion version, const std::vector<std::byte>& data); int updateTile(TileId tileId, TileVersion version, const std::vector<std::byte>& data);
int deleteTilesAt(std::string_view worldspace, const TilePosition& tilePosition); int deleteTilesAt(ESM::RefId worldspace, const TilePosition& tilePosition);
int deleteTilesAtExcept(std::string_view worldspace, const TilePosition& tilePosition, TileId excludeTileId); int deleteTilesAtExcept(ESM::RefId worldspace, const TilePosition& tilePosition, TileId excludeTileId);
int deleteTilesOutsideRange(std::string_view worldspace, const TilesPositionsRange& range); int deleteTilesOutsideRange(ESM::RefId worldspace, const TilesPositionsRange& range);
ShapeId getMaxShapeId(); ShapeId getMaxShapeId();

View file

@ -58,7 +58,7 @@ namespace DetourNavigator
{ {
} }
void NavMeshManager::setWorldspace(std::string_view worldspace, const UpdateGuard* guard) void NavMeshManager::setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard)
{ {
if (worldspace == mWorldspace) if (worldspace == mWorldspace)
return; return;

View file

@ -24,7 +24,7 @@ namespace DetourNavigator
ScopedUpdateGuard makeUpdateGuard() { return mRecastMeshManager.makeUpdateGuard(); } ScopedUpdateGuard makeUpdateGuard() { return mRecastMeshManager.makeUpdateGuard(); }
void setWorldspace(std::string_view worldspace, const UpdateGuard* guard); void setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard);
void updateBounds(const osg::Vec3f& playerPosition, const UpdateGuard* guard); void updateBounds(const osg::Vec3f& playerPosition, const UpdateGuard* guard);
@ -67,7 +67,7 @@ namespace DetourNavigator
private: private:
const Settings& mSettings; const Settings& mSettings;
std::string mWorldspace; ESM::RefId mWorldspace;
TileCachedRecastMeshManager mRecastMeshManager; TileCachedRecastMeshManager mRecastMeshManager;
OffMeshConnectionsManager mOffMeshConnectionsManager; OffMeshConnectionsManager mOffMeshConnectionsManager;
AsyncNavMeshUpdater mAsyncNavMeshUpdater; AsyncNavMeshUpdater mAsyncNavMeshUpdater;

View file

@ -24,7 +24,7 @@ namespace DetourNavigator
} }
std::string formatPrefix( std::string formatPrefix(
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds) ESM::RefId worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds)
{ {
std::ostringstream stream; std::ostringstream stream;
stream << "Worldspace: " << worldspace << "; tile position: " << tilePosition.x() << ", " stream << "Worldspace: " << worldspace << "; tile position: " << tilePosition.x() << ", "
@ -34,7 +34,7 @@ namespace DetourNavigator
} }
RecastContext::RecastContext( RecastContext::RecastContext(
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds) ESM::RefId worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds)
: mPrefix(formatPrefix(worldspace, tilePosition, agentBounds)) : mPrefix(formatPrefix(worldspace, tilePosition, agentBounds))
{ {
} }

View file

@ -3,6 +3,8 @@
#include "tileposition.hpp" #include "tileposition.hpp"
#include <components/esm/refid.hpp>
#include <string> #include <string>
#include <Recast.h> #include <Recast.h>
@ -14,8 +16,7 @@ namespace DetourNavigator
class RecastContext final : public rcContext class RecastContext final : public rcContext
{ {
public: public:
explicit RecastContext( explicit RecastContext(ESM::RefId worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds);
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds);
const std::string& getPrefix() const { return mPrefix; } const std::string& getPrefix() const { return mPrefix; }

View file

@ -20,7 +20,7 @@ namespace DetourNavigator
{ {
} }
std::shared_ptr<RecastMesh> getMesh(std::string_view worldspace, const TilePosition& tilePosition) const std::shared_ptr<RecastMesh> getMesh(ESM::RefId worldspace, const TilePosition& tilePosition) const
{ {
return mImpl.get().getNewMesh(worldspace, tilePosition); return mImpl.get().getNewMesh(worldspace, tilePosition);
} }

View file

@ -142,7 +142,7 @@ namespace DetourNavigator
return {}; return {};
} }
void TileCachedRecastMeshManager::setWorldspace(std::string_view worldspace, const UpdateGuard* guard) void TileCachedRecastMeshManager::setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard)
{ {
const MaybeLockGuard lock(mMutex, guard); const MaybeLockGuard lock(mMutex, guard);
if (mWorldspace == worldspace) if (mWorldspace == worldspace)
@ -351,7 +351,7 @@ namespace DetourNavigator
} }
std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getMesh( std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getMesh(
std::string_view worldspace, const TilePosition& tilePosition) ESM::RefId worldspace, const TilePosition& tilePosition)
{ {
{ {
const std::lock_guard lock(mMutex); const std::lock_guard lock(mMutex);
@ -375,7 +375,7 @@ namespace DetourNavigator
} }
std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getCachedMesh( std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getCachedMesh(
std::string_view worldspace, const TilePosition& tilePosition) const ESM::RefId worldspace, const TilePosition& tilePosition) const
{ {
const std::lock_guard lock(mMutex); const std::lock_guard lock(mMutex);
if (mWorldspace != worldspace) if (mWorldspace != worldspace)
@ -387,7 +387,7 @@ namespace DetourNavigator
} }
std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getNewMesh( std::shared_ptr<RecastMesh> TileCachedRecastMeshManager::getNewMesh(
std::string_view worldspace, const TilePosition& tilePosition) const ESM::RefId worldspace, const TilePosition& tilePosition) const
{ {
{ {
const std::lock_guard lock(mMutex); const std::lock_guard lock(mMutex);

View file

@ -25,8 +25,6 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <optional> #include <optional>
#include <string>
#include <string_view>
#include <unordered_map> #include <unordered_map>
namespace DetourNavigator namespace DetourNavigator
@ -49,7 +47,7 @@ namespace DetourNavigator
TilesPositionsRange getLimitedObjectsRange() const; TilesPositionsRange getLimitedObjectsRange() const;
void setWorldspace(std::string_view worldspace, const UpdateGuard* guard); void setWorldspace(ESM::RefId worldspace, const UpdateGuard* guard);
bool addObject(ObjectId id, const CollisionShape& shape, const btTransform& transform, AreaType areaType, bool addObject(ObjectId id, const CollisionShape& shape, const btTransform& transform, AreaType areaType,
const UpdateGuard* guard); const UpdateGuard* guard);
@ -67,11 +65,11 @@ namespace DetourNavigator
void removeHeightfield(const osg::Vec2i& cellPosition, const UpdateGuard* guard); void removeHeightfield(const osg::Vec2i& cellPosition, const UpdateGuard* guard);
std::shared_ptr<RecastMesh> getMesh(std::string_view worldspace, const TilePosition& tilePosition); std::shared_ptr<RecastMesh> getMesh(ESM::RefId worldspace, const TilePosition& tilePosition);
std::shared_ptr<RecastMesh> getCachedMesh(std::string_view worldspace, const TilePosition& tilePosition) const; std::shared_ptr<RecastMesh> getCachedMesh(ESM::RefId worldspace, const TilePosition& tilePosition) const;
std::shared_ptr<RecastMesh> getNewMesh(std::string_view worldspace, const TilePosition& tilePosition) const; std::shared_ptr<RecastMesh> getNewMesh(ESM::RefId worldspace, const TilePosition& tilePosition) const;
std::size_t getRevision() const { return mRevision; } std::size_t getRevision() const { return mRevision; }
@ -130,7 +128,7 @@ namespace DetourNavigator
const RecastSettings& mSettings; const RecastSettings& mSettings;
TilesPositionsRange mRange; TilesPositionsRange mRange;
std::string mWorldspace; ESM::RefId mWorldspace;
std::unordered_map<ObjectId, std::unique_ptr<ObjectData>> mObjects; std::unordered_map<ObjectId, std::unique_ptr<ObjectData>> mObjects;
boost::geometry::index::rtree<ObjectIndexValue, boost::geometry::index::quadratic<16>> mObjectIndex; boost::geometry::index::rtree<ObjectIndexValue, boost::geometry::index::quadratic<16>> mObjectIndex;
std::map<osg::Vec2i, WaterData> mWater; std::map<osg::Vec2i, WaterData> mWater;