#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H #define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H #include "asyncnavmeshupdater.hpp" #include "cachedrecastmeshmanager.hpp" #include "sharednavmesh.hpp" #include #include #include #include #include class dtNavMesh; namespace DetourNavigator { class NavMeshManager { public: NavMeshManager(const Settings& settings); bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform); bool removeObject(std::size_t id); void addAgent(const osg::Vec3f& agentHalfExtents); void reset(const osg::Vec3f& agentHalfExtents); void update(osg::Vec3f playerPosition, const osg::Vec3f& agentHalfExtents); void wait(); SharedNavMesh getNavMesh(const osg::Vec3f& agentHalfExtents) const; std::map> getNavMeshes() const; private: const Settings& mSettings; TileCachedRecastMeshManager mRecastMeshManager; std::map> mCache; std::map> mChangedTiles; AsyncNavMeshUpdater mAsyncNavMeshUpdater; std::size_t mGenerationCounter = 0; boost::optional mPlayerTile; std::size_t mLastRecastMeshManagerRevision = 0; void addChangedTiles(const btCollisionShape& shape, const btTransform& transform); const std::shared_ptr& getCached(const osg::Vec3f& agentHalfExtents) const; }; } #endif