1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 16:19:54 +00:00
openmw-tes3mp/components/detournavigator/cachedrecastmeshmanager.hpp
elsid 82cff1abf8
Create RecastMesh outside critical section
To not lock main thread when it tries to update objects.
2021-08-04 13:16:55 +02:00

41 lines
1.3 KiB
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_CACHEDRECASTMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_CACHEDRECASTMESHMANAGER_H
#include "recastmeshmanager.hpp"
#include "version.hpp"
#include <components/misc/guarded.hpp>
namespace DetourNavigator
{
class CachedRecastMeshManager
{
public:
CachedRecastMeshManager(const Settings& settings, const TileBounds& bounds, std::size_t generation);
bool addObject(const ObjectId id, const CollisionShape& shape, const btTransform& transform,
const AreaType areaType);
bool updateObject(const ObjectId id, const btTransform& transform, const AreaType areaType);
bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const btTransform& transform);
std::optional<RecastMeshManager::Water> removeWater(const osg::Vec2i& cellPosition);
std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id);
std::shared_ptr<RecastMesh> getMesh();
bool isEmpty() const;
void reportNavMeshChange(Version recastMeshVersion, Version navMeshVersion);
Version getVersion() const;
private:
RecastMeshManager mImpl;
Misc::ScopeGuarded<std::shared_ptr<RecastMesh>> mCached;
};
}
#endif