#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_TILECACHEDRECASTMESHMANAGER_H #define OPENMW_COMPONENTS_DETOURNAVIGATOR_TILECACHEDRECASTMESHMANAGER_H #include "cachedrecastmeshmanager.hpp" #include "tileposition.hpp" #include #include namespace DetourNavigator { class TileCachedRecastMeshManager { public: TileCachedRecastMeshManager(const Settings& settings); bool addObject(const ObjectId id, const btCollisionShape& shape, const btTransform& transform, const AreaType areaType); bool updateObject(const ObjectId id, const btTransform& transform, const AreaType areaType); boost::optional removeObject(const ObjectId id); bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const btTransform& transform); boost::optional removeWater(const osg::Vec2i& cellPosition); std::shared_ptr getMesh(const TilePosition& tilePosition); bool hasTile(const TilePosition& tilePosition); template void forEachTilePosition(Function&& function) { const std::lock_guard lock(mTilesMutex); for (const auto& tile : mTiles) function(tile.first); } std::size_t getRevision() const; private: const Settings& mSettings; std::mutex mTilesMutex; std::map mTiles; std::unordered_map> mObjectsTilesPositions; std::map> mWaterTilesPositions; std::size_t mRevision = 0; }; } #endif