1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/components/detournavigator/cachedrecastmeshmanager.cpp

64 lines
1.8 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-09-22 18:36:57 +03:00
bool CachedRecastMeshManager::addObject(const ObjectId 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-09-22 18:36:57 +03:00
bool CachedRecastMeshManager::updateObject(const ObjectId 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;
}
2018-09-22 18:36:57 +03:00
boost::optional<RemovedRecastMeshObject> CachedRecastMeshManager::removeObject(const ObjectId 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
}
2018-07-20 22:11:34 +03:00
bool CachedRecastMeshManager::addWater(const osg::Vec2i& cellPosition, const int cellSize,
const btTransform& transform)
{
if (!mImpl.addWater(cellPosition, cellSize, transform))
return false;
mCached.reset();
return true;
}
boost::optional<RecastMeshManager::Water> CachedRecastMeshManager::removeWater(const osg::Vec2i& cellPosition)
{
const auto water = mImpl.removeWater(cellPosition);
if (water)
mCached.reset();
return water;
}
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
}