1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/components/detournavigator/cachedrecastmeshmanager.cpp
2018-10-13 22:16:30 +03:00

39 lines
998 B
C++

#include "cachedrecastmeshmanager.hpp"
#include "debug.hpp"
namespace DetourNavigator
{
CachedRecastMeshManager::CachedRecastMeshManager(const Settings& settings, const TileBounds& bounds)
: mImpl(settings, bounds)
{
}
bool CachedRecastMeshManager::addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform)
{
if (!mImpl.addObject(id, shape, transform))
return false;
mCached.reset();
return true;
}
boost::optional<RecastMeshManager::Object> CachedRecastMeshManager::removeObject(std::size_t id)
{
const auto object = mImpl.removeObject(id);
if (object)
mCached.reset();
return object;
}
std::shared_ptr<RecastMesh> CachedRecastMeshManager::getMesh()
{
if (!mCached)
mCached = mImpl.getMesh();
return mCached;
}
bool CachedRecastMeshManager::isEmpty() const
{
return mImpl.isEmpty();
}
}