#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H #define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H #include "recastmeshbuilder.hpp" #include "recastmeshobject.hpp" #include #include #include #include #include class btCollisionShape; namespace DetourNavigator { struct RemovedRecastMeshObject { std::reference_wrapper mShape; btTransform mTransform; }; class RecastMeshManager { public: struct Water { int mCellSize; btTransform mTransform; }; RecastMeshManager(const Settings& settings, const TileBounds& bounds); bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform, const AreaType areaType); bool updateObject(std::size_t id, const btTransform& transform, const AreaType areaType); bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const btTransform& transform); boost::optional removeWater(const osg::Vec2i& cellPosition); boost::optional removeObject(std::size_t id); std::shared_ptr getMesh(); bool isEmpty() const; private: bool mShouldRebuild; RecastMeshBuilder mMeshBuilder; std::unordered_map mObjects; std::map mWater; void rebuild(); }; } #endif