1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 13:15:35 +00:00

Swap matrix order

It still doesn't work, but I think this is more likely to be right.
This commit is contained in:
AnyOldName3 2023-04-24 22:07:46 +01:00
parent 42711089e7
commit f721be90aa

View file

@ -36,8 +36,8 @@ namespace MWRender
inline osg::Matrix computeInstanceMatrix(const Groundcover::GroundcoverEntry& entry) inline osg::Matrix computeInstanceMatrix(const Groundcover::GroundcoverEntry& entry)
{ {
return osg::Matrix::translate(entry.mPos.asVec3()) * osg::Matrix(Misc::Convert::makeOsgQuat(entry.mPos)) return osg::Matrix::scale(entry.mScale, entry.mScale, entry.mScale) * osg::Matrix(Misc::Convert::makeOsgQuat(entry.mPos))
* osg::Matrix::scale(entry.mScale, entry.mScale, entry.mScale); * osg::Matrix::translate(entry.mPos.asVec3());
} }
class InstancedComputeNearFarCullCallback : public osg::DrawableCullCallback class InstancedComputeNearFarCullCallback : public osg::DrawableCullCallback
@ -100,7 +100,7 @@ namespace MWRender
{ {
osg::Matrix instanceMatrix = computeInstanceMatrix(entry); osg::Matrix instanceMatrix = computeInstanceMatrix(entry);
value_type newNear = cullVisitor.computeNearestPointInFrustum( value_type newNear = cullVisitor.computeNearestPointInFrustum(
matrix * instanceMatrix, planes, *drawable); instanceMatrix * matrix, planes, *drawable);
dNear = std::min(dNear, newNear); dNear = std::min(dNear, newNear);
} }
if (dNear < computedZNear) if (dNear < computedZNear)
@ -114,7 +114,7 @@ namespace MWRender
{ {
osg::Matrix instanceMatrix = computeInstanceMatrix(entry); osg::Matrix instanceMatrix = computeInstanceMatrix(entry);
value_type newFar = cullVisitor.computeFurthestPointInFrustum( value_type newFar = cullVisitor.computeFurthestPointInFrustum(
matrix * instanceMatrix, planes, *drawable); instanceMatrix * matrix, planes, *drawable);
dFar = std::max(dFar, newFar); dFar = std::max(dFar, newFar);
} }
if (dFar > computedZFar) if (dFar > computedZFar)