diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index d0abc9ead2..aabe07c866 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -254,9 +254,15 @@ void UVController::apply(osg::StateSet* stateset, osg::NodeVisitor* nv) float uScale = mUScale.interpKey(value); float vScale = mVScale.interpKey(value); + osg::Matrix flipMat; + flipMat.preMultTranslate(osg::Vec3f(0,1,0)); + flipMat.preMultScale(osg::Vec3f(1,-1,1)); + osg::Matrixf mat = osg::Matrixf::scale(uScale, vScale, 1); mat.setTrans(uTrans, vTrans, 0); + mat = flipMat * mat * flipMat; + // setting once is enough because all other texture units share the same TexMat (see setDefaults). if (!mTextureUnits.empty()) {