|
|
|
@ -11,7 +11,7 @@ namespace DetourNavigator
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
bool updateCompoundObject(const btCompoundShape& shape, const AreaType areaType,
|
|
|
|
|
std::vector<RecastMeshObject>& children)
|
|
|
|
|
std::vector<ChildRecastMeshObject>& children)
|
|
|
|
|
{
|
|
|
|
|
assert(static_cast<std::size_t>(shape.getNumChildShapes()) == children.size());
|
|
|
|
|
bool result = false;
|
|
|
|
@ -23,39 +23,33 @@ namespace DetourNavigator
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<RecastMeshObject> makeChildrenObjects(const osg::ref_ptr<const osg::Referenced>& holder,
|
|
|
|
|
const btCompoundShape& shape, const AreaType areaType)
|
|
|
|
|
std::vector<ChildRecastMeshObject> makeChildrenObjects(const btCompoundShape& shape, const AreaType areaType)
|
|
|
|
|
{
|
|
|
|
|
std::vector<RecastMeshObject> result;
|
|
|
|
|
std::vector<ChildRecastMeshObject> result;
|
|
|
|
|
for (int i = 0, num = shape.getNumChildShapes(); i < num; ++i)
|
|
|
|
|
{
|
|
|
|
|
const CollisionShape collisionShape {holder, *shape.getChildShape(i)};
|
|
|
|
|
result.emplace_back(collisionShape, shape.getChildTransform(i), areaType);
|
|
|
|
|
}
|
|
|
|
|
result.emplace_back(*shape.getChildShape(i), shape.getChildTransform(i), areaType);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<RecastMeshObject> makeChildrenObjects(const osg::ref_ptr<const osg::Referenced>& holder,
|
|
|
|
|
const btCollisionShape& shape, const AreaType areaType)
|
|
|
|
|
std::vector<ChildRecastMeshObject> makeChildrenObjects(const btCollisionShape& shape, const AreaType areaType)
|
|
|
|
|
{
|
|
|
|
|
if (shape.isCompound())
|
|
|
|
|
return makeChildrenObjects(holder, static_cast<const btCompoundShape&>(shape), areaType);
|
|
|
|
|
return std::vector<RecastMeshObject>();
|
|
|
|
|
return makeChildrenObjects(static_cast<const btCompoundShape&>(shape), areaType);
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecastMeshObject::RecastMeshObject(const CollisionShape& shape, const btTransform& transform,
|
|
|
|
|
ChildRecastMeshObject::ChildRecastMeshObject(const btCollisionShape& shape, const btTransform& transform,
|
|
|
|
|
const AreaType areaType)
|
|
|
|
|
: mHolder(shape.getHolder())
|
|
|
|
|
, mShape(shape.getShape())
|
|
|
|
|
: mShape(shape)
|
|
|
|
|
, mTransform(transform)
|
|
|
|
|
, mAreaType(areaType)
|
|
|
|
|
, mLocalScaling(mShape.get().getLocalScaling())
|
|
|
|
|
, mChildren(makeChildrenObjects(mHolder, mShape.get(), mAreaType))
|
|
|
|
|
, mLocalScaling(shape.getLocalScaling())
|
|
|
|
|
, mChildren(makeChildrenObjects(shape, mAreaType))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RecastMeshObject::update(const btTransform& transform, const AreaType areaType)
|
|
|
|
|
bool ChildRecastMeshObject::update(const btTransform& transform, const AreaType areaType)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
if (!(mTransform == transform))
|
|
|
|
@ -78,4 +72,11 @@ namespace DetourNavigator
|
|
|
|
|
|| result;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecastMeshObject::RecastMeshObject(const CollisionShape& shape, const btTransform& transform,
|
|
|
|
|
const AreaType areaType)
|
|
|
|
|
: mHolder(shape.getHolder())
|
|
|
|
|
, mImpl(shape.getShape(), transform, areaType)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|