From f721be90aa87a0d5424ae5360cca502f2299c90a Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 24 Apr 2023 22:07:46 +0100 Subject: [PATCH] Swap matrix order It still doesn't work, but I think this is more likely to be right. --- apps/openmw/mwrender/groundcover.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/groundcover.cpp b/apps/openmw/mwrender/groundcover.cpp index 21627bfee0..9ab9033a7d 100644 --- a/apps/openmw/mwrender/groundcover.cpp +++ b/apps/openmw/mwrender/groundcover.cpp @@ -36,8 +36,8 @@ namespace MWRender inline osg::Matrix computeInstanceMatrix(const Groundcover::GroundcoverEntry& entry) { - return osg::Matrix::translate(entry.mPos.asVec3()) * osg::Matrix(Misc::Convert::makeOsgQuat(entry.mPos)) - * osg::Matrix::scale(entry.mScale, entry.mScale, entry.mScale); + return osg::Matrix::scale(entry.mScale, entry.mScale, entry.mScale) * osg::Matrix(Misc::Convert::makeOsgQuat(entry.mPos)) + * osg::Matrix::translate(entry.mPos.asVec3()); } class InstancedComputeNearFarCullCallback : public osg::DrawableCullCallback @@ -100,7 +100,7 @@ namespace MWRender { osg::Matrix instanceMatrix = computeInstanceMatrix(entry); value_type newNear = cullVisitor.computeNearestPointInFrustum( - matrix * instanceMatrix, planes, *drawable); + instanceMatrix * matrix, planes, *drawable); dNear = std::min(dNear, newNear); } if (dNear < computedZNear) @@ -114,7 +114,7 @@ namespace MWRender { osg::Matrix instanceMatrix = computeInstanceMatrix(entry); value_type newFar = cullVisitor.computeFurthestPointInFrustum( - matrix * instanceMatrix, planes, *drawable); + instanceMatrix * matrix, planes, *drawable); dFar = std::max(dFar, newFar); } if (dFar > computedZFar)