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