openmw/components/detournavigator/cachedrecastmeshmanager.cpp

47 lines
1.3 KiB
C++
Raw Normal View History

2018-03-14 01:49:08 +03:00
#include "cachedrecastmeshmanager.hpp"
#include "debug.hpp"
namespace DetourNavigator
{
2018-04-16 01:07:18 +03:00
CachedRecastMeshManager::CachedRecastMeshManager(const Settings& settings, const TileBounds& bounds)
: mImpl(settings, bounds)
2018-07-12 11:44:11 +03:00
{}
2018-04-03 00:04:19 +03:00
2018-07-12 11:44:11 +03:00
bool CachedRecastMeshManager::addObject(std::size_t id, const btCollisionShape& shape,
2018-07-18 22:09:50 +03:00
const btTransform& transform, const AreaType areaType)
2018-03-14 01:49:08 +03:00
{
2018-07-18 22:09:50 +03:00
if (!mImpl.addObject(id, shape, transform, areaType))
2018-04-03 00:04:19 +03:00
return false;
mCached.reset();
return true;
2018-03-14 01:49:08 +03:00
}
2018-07-18 22:09:50 +03:00
bool CachedRecastMeshManager::updateObject(std::size_t id, const btTransform& transform, const AreaType areaType)
2018-05-26 17:44:25 +03:00
{
2018-07-18 22:09:50 +03:00
if (!mImpl.updateObject(id, transform, areaType))
2018-05-26 17:44:25 +03:00
return false;
mCached.reset();
return true;
}
boost::optional<RemovedRecastMeshObject> CachedRecastMeshManager::removeObject(std::size_t id)
2018-03-14 01:49:08 +03:00
{
const auto object = mImpl.removeObject(id);
if (object)
mCached.reset();
return object;
2018-03-14 01:49:08 +03:00
}
std::shared_ptr<RecastMesh> CachedRecastMeshManager::getMesh()
{
if (!mCached)
mCached = mImpl.getMesh();
return mCached;
2018-04-03 00:04:19 +03:00
}
2018-04-16 01:07:18 +03:00
bool CachedRecastMeshManager::isEmpty() const
{
return mImpl.isEmpty();
}
2018-03-14 01:49:08 +03:00
}