1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 15:19:55 +00:00
openmw-tes3mp/components/detournavigator/navmeshmanager.hpp
2018-10-13 22:16:25 +03:00

48 lines
1.1 KiB
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H
#include "asyncnavmeshupdater.hpp"
#include "cachedrecastmeshmanager.hpp"
#include <osg/Vec3f>
#include <map>
#include <memory>
class dtNavMesh;
namespace DetourNavigator
{
class NavMeshManager
{
public:
NavMeshManager(const Settings& settings);
template <class T>
bool addObject(std::size_t id, const T& shape, const btTransform& transform)
{
if (!mRecastMeshManager.addObject(id, shape, transform))
return false;
++mRevision;
return true;
}
bool removeObject(std::size_t id);
void reset(const osg::Vec3f& agentHalfExtents);
void update(const osg::Vec3f& agentHalfExtents);
void wait();
NavMeshConstPtr getNavMesh(const osg::Vec3f& agentHalfExtents) const;
private:
std::size_t mRevision = 0;
CachedRecastMeshManager mRecastMeshManager;
std::map<osg::Vec3f, std::shared_ptr<NavMeshCacheItem>> mCache;
AsyncNavMeshUpdater mAsyncNavMeshUpdater;
};
}
#endif