|
|
@ -1,9 +1,23 @@
|
|
|
|
#include "oscillatingrecastmeshobject.hpp"
|
|
|
|
#include "oscillatingrecastmeshobject.hpp"
|
|
|
|
|
|
|
|
#include "tilebounds.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/bullethelpers/aabb.hpp>
|
|
|
|
#include <components/bullethelpers/aabb.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DetourNavigator
|
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
void limitBy(btAABB& aabb, const TileBounds& bounds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
aabb.m_min.setX(std::max(aabb.m_min.x(), static_cast<btScalar>(bounds.mMin.x())));
|
|
|
|
|
|
|
|
aabb.m_min.setY(std::max(aabb.m_min.y(), static_cast<btScalar>(bounds.mMin.y())));
|
|
|
|
|
|
|
|
aabb.m_max.setX(std::min(aabb.m_max.x(), static_cast<btScalar>(bounds.mMax.x())));
|
|
|
|
|
|
|
|
aabb.m_max.setY(std::min(aabb.m_max.y(), static_cast<btScalar>(bounds.mMax.y())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OscillatingRecastMeshObject::OscillatingRecastMeshObject(RecastMeshObject&& impl, std::size_t lastChangeRevision)
|
|
|
|
OscillatingRecastMeshObject::OscillatingRecastMeshObject(RecastMeshObject&& impl, std::size_t lastChangeRevision)
|
|
|
|
: mImpl(std::move(impl))
|
|
|
|
: mImpl(std::move(impl))
|
|
|
|
, mLastChangeRevision(lastChangeRevision)
|
|
|
|
, mLastChangeRevision(lastChangeRevision)
|
|
|
@ -19,7 +33,7 @@ namespace DetourNavigator
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool OscillatingRecastMeshObject::update(const btTransform& transform, const AreaType areaType,
|
|
|
|
bool OscillatingRecastMeshObject::update(const btTransform& transform, const AreaType areaType,
|
|
|
|
std::size_t lastChangeRevision)
|
|
|
|
std::size_t lastChangeRevision, const TileBounds& bounds)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const btTransform oldTransform = mImpl.getTransform();
|
|
|
|
const btTransform oldTransform = mImpl.getTransform();
|
|
|
|
if (!mImpl.update(transform, areaType))
|
|
|
|
if (!mImpl.update(transform, areaType))
|
|
|
@ -37,6 +51,7 @@ namespace DetourNavigator
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const btAABB currentAabb = mAabb;
|
|
|
|
const btAABB currentAabb = mAabb;
|
|
|
|
mAabb.merge(BulletHelpers::getAabb(mImpl.getShape(), transform));
|
|
|
|
mAabb.merge(BulletHelpers::getAabb(mImpl.getShape(), transform));
|
|
|
|
|
|
|
|
limitBy(mAabb, bounds);
|
|
|
|
return currentAabb != mAabb;
|
|
|
|
return currentAabb != mAabb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|