1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:49:56 +00:00
openmw-tes3mp/components/detournavigator/cachedrecastmeshmanager.cpp

33 lines
864 B
C++
Raw Normal View History

2018-03-13 22:49:08 +00:00
#include "cachedrecastmeshmanager.hpp"
#include "debug.hpp"
namespace DetourNavigator
{
CachedRecastMeshManager::CachedRecastMeshManager(const Settings& settings)
: mImpl(settings)
2018-04-02 21:04:19 +00:00
{}
bool CachedRecastMeshManager::addObject(std::size_t id, const btCollisionShape& shape, const btTransform& transform)
2018-03-13 22:49:08 +00:00
{
2018-04-02 21:04:19 +00:00
if (!mImpl.addObject(id, shape, transform))
return false;
mCached.reset();
return true;
2018-03-13 22:49:08 +00:00
}
boost::optional<RecastMeshManager::Object> CachedRecastMeshManager::removeObject(std::size_t id)
2018-03-13 22:49:08 +00:00
{
const auto object = mImpl.removeObject(id);
if (object)
mCached.reset();
return object;
2018-03-13 22:49:08 +00:00
}
std::shared_ptr<RecastMesh> CachedRecastMeshManager::getMesh()
{
if (!mCached)
mCached = mImpl.getMesh();
return mCached;
2018-04-02 21:04:19 +00:00
}
2018-03-13 22:49:08 +00:00
}