1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 17:49:55 +00:00
openmw-tes3mp/components/detournavigator/navmeshmanager.hpp

57 lines
1.6 KiB
C++
Raw Normal View History

2018-03-13 22:49:08 +00:00
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHMANAGER_H
#include "asyncnavmeshupdater.hpp"
#include "cachedrecastmeshmanager.hpp"
#include "sharednavmesh.hpp"
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
2018-03-13 22:49:08 +00:00
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
2018-03-13 22:49:08 +00:00
#include <osg/Vec3f>
#include <map>
#include <memory>
class dtNavMesh;
namespace DetourNavigator
{
class NavMeshManager
{
public:
NavMeshManager(const Settings& settings);
2018-04-02 21:04:19 +00:00
bool addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform);
2018-03-13 22:49:08 +00:00
bool removeObject(std::size_t id);
void addAgent(const osg::Vec3f& agentHalfExtents);
2018-03-13 22:49:08 +00:00
void reset(const osg::Vec3f& agentHalfExtents);
void update(osg::Vec3f playerPosition, const osg::Vec3f& agentHalfExtents);
2018-03-13 22:49:08 +00:00
void wait();
SharedNavMesh getNavMesh(const osg::Vec3f& agentHalfExtents) const;
2018-03-13 22:49:08 +00:00
std::map<osg::Vec3f, std::shared_ptr<NavMeshCacheItem>> getNavMeshes() const;
2018-03-13 22:49:08 +00:00
private:
std::size_t mRevision = 0;
const Settings& mSettings;
2018-03-13 22:49:08 +00:00
CachedRecastMeshManager mRecastMeshManager;
std::map<osg::Vec3f, std::shared_ptr<NavMeshCacheItem>> mCache;
std::map<osg::Vec3f, std::set<TilePosition>> mChangedTiles;
2018-03-13 22:49:08 +00:00
AsyncNavMeshUpdater mAsyncNavMeshUpdater;
void addChangedTiles(const btCollisionShape& shape, const btTransform& transform);
const std::shared_ptr<NavMeshCacheItem>& getCached(const osg::Vec3f& agentHalfExtents) const;
2018-03-13 22:49:08 +00:00
};
}
#endif