1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 18:18:52 +00:00
OpenMW/components/detournavigator/commulativeaabb.cpp
elsid d15e1dca84
Use R-tree for objects to be used for navmesh generation
Instead of storing a set of objects per tile.
2022-09-07 22:51:56 +02:00

28 lines
775 B
C++

#include "commulativeaabb.hpp"
#include <components/bullethelpers/aabb.hpp>
namespace DetourNavigator
{
CommulativeAabb::CommulativeAabb(std::size_t lastChangeRevision, const btAABB& aabb)
: mLastChangeRevision(lastChangeRevision)
, mAabb(aabb)
{
}
bool CommulativeAabb::update(std::size_t lastChangeRevision, const btAABB& aabb)
{
if (mLastChangeRevision != lastChangeRevision)
{
mLastChangeRevision = lastChangeRevision;
// btAABB doesn't have copy-assignment operator
mAabb.m_min = aabb.m_min;
mAabb.m_max = aabb.m_max;
return true;
}
const btAABB currentAabb = mAabb;
mAabb.merge(aabb);
return currentAabb != mAabb;
}
}