mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Remove duplicated implementation of Misc::Convert::toOsg
This commit is contained in:
parent
b6d2c57de2
commit
3f80725ebe
@ -147,12 +147,12 @@ namespace
|
||||
transform.getOrigin()
|
||||
);
|
||||
|
||||
const auto start = Misc::Convert::makeOsgVec3f(closedDoorTransform(center + toPoint));
|
||||
const auto start = Misc::Convert::toOsg(closedDoorTransform(center + toPoint));
|
||||
const auto startPoint = physics.castRay(start, start - osg::Vec3f(0, 0, 1000), ptr, {},
|
||||
MWPhysics::CollisionType_World | MWPhysics::CollisionType_HeightMap | MWPhysics::CollisionType_Water);
|
||||
const auto connectionStart = startPoint.mHit ? startPoint.mHitPos : start;
|
||||
|
||||
const auto end = Misc::Convert::makeOsgVec3f(closedDoorTransform(center - toPoint));
|
||||
const auto end = Misc::Convert::toOsg(closedDoorTransform(center - toPoint));
|
||||
const auto endPoint = physics.castRay(end, end - osg::Vec3f(0, 0, 1000), ptr, {},
|
||||
MWPhysics::CollisionType_World | MWPhysics::CollisionType_HeightMap | MWPhysics::CollisionType_Water);
|
||||
const auto connectionEnd = endPoint.mHit ? endPoint.mHitPos : end;
|
||||
|
@ -46,13 +46,15 @@ namespace DetourNavigator
|
||||
btVector3 aabbMax;
|
||||
shape.getAabb(transform, aabbMin, aabbMax);
|
||||
|
||||
getTilesPositions(Misc::Convert::makeOsgVec3f(aabbMin), Misc::Convert::makeOsgVec3f(aabbMax), settings, std::forward<Callback>(callback));
|
||||
getTilesPositions(Misc::Convert::toOsg(aabbMin), Misc::Convert::toOsg(aabbMax), settings, std::forward<Callback>(callback));
|
||||
}
|
||||
|
||||
template <class Callback>
|
||||
void getTilesPositions(const int cellSize, const osg::Vec3f& shift,
|
||||
const Settings& settings, Callback&& callback)
|
||||
{
|
||||
using Misc::Convert::toOsg;
|
||||
|
||||
const auto halfCellSize = cellSize / 2;
|
||||
const btTransform transform(btMatrix3x3::getIdentity(), Misc::Convert::toBullet(shift));
|
||||
auto aabbMin = transform(btVector3(-halfCellSize, -halfCellSize, 0));
|
||||
@ -64,7 +66,7 @@ namespace DetourNavigator
|
||||
aabbMax.setX(std::max(aabbMin.x(), aabbMax.x()));
|
||||
aabbMax.setY(std::max(aabbMin.y(), aabbMax.y()));
|
||||
|
||||
getTilesPositions(Misc::Convert::makeOsgVec3f(aabbMin), Misc::Convert::makeOsgVec3f(aabbMax), settings, std::forward<Callback>(callback));
|
||||
getTilesPositions(toOsg(aabbMin), toOsg(aabbMax), settings, std::forward<Callback>(callback));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace DetourNavigator
|
||||
RecastMeshTriangle result;
|
||||
result.mAreaType = areaType;
|
||||
for (std::size_t i = 0; i < 3; ++i)
|
||||
result.mVertices[i] = Misc::Convert::makeOsgVec3f(vertices[i]);
|
||||
result.mVertices[i] = Misc::Convert::toOsg(vertices[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,6 @@ namespace Convert
|
||||
return osg::Vec3f(values[0], values[1], values[2]);
|
||||
}
|
||||
|
||||
inline osg::Vec3f makeOsgVec3f(const btVector3& value)
|
||||
{
|
||||
return osg::Vec3f(value.x(), value.y(), value.z());
|
||||
}
|
||||
|
||||
inline osg::Vec3f makeOsgVec3f(const ESM::Pathgrid::Point& value)
|
||||
{
|
||||
return osg::Vec3f(value.mX, value.mY, value.mZ);
|
||||
|
Loading…
Reference in New Issue
Block a user