Account for UV coordinate flip in UVController (Fixes #3203)

pull/779/merge
scrawl 9 years ago
parent 6bfeb118d7
commit be6ea3d607

@ -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())
{

Loading…
Cancel
Save