From 6d0b8c4693cd89e825d41955fbc4231e92748489 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 8 Aug 2018 07:34:14 +0100 Subject: [PATCH] Tightened up the setting of the Member property of Texture attributes --- src/osg/StateSet.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/osg/StateSet.cpp b/src/osg/StateSet.cpp index fb8b79dd2..8f26484d4 100644 --- a/src/osg/StateSet.cpp +++ b/src/osg/StateSet.cpp @@ -1459,10 +1459,10 @@ void StateSet::setTextureAttribute(unsigned int unit,StateAttribute *attribute, { if (attribute->isTextureAttribute()) { - setAttribute(getOrCreateTextureAttributeList(unit),attribute,value); - TextureAttribute* ta = dynamic_cast(attribute); if (ta) ta->setTextureUnit(unit); + + setAttribute(getOrCreateTextureAttributeList(unit),attribute,value); } else { @@ -1488,11 +1488,11 @@ void StateSet::setTextureAttributeAndModes(unsigned int unit,StateAttribute *att } else { - setAttribute(getOrCreateTextureAttributeList(unit),attribute,value); - setAssociatedTextureModes(unit,attribute,value); - TextureAttribute* ta = dynamic_cast(attribute); if (ta) ta->setTextureUnit(unit); + + setAttribute(getOrCreateTextureAttributeList(unit),attribute,value); + setAssociatedTextureModes(unit,attribute,value); } } else @@ -1565,27 +1565,27 @@ void StateSet::removeTextureAttribute(unsigned int unit, StateAttribute* attribu StateAttribute* StateSet::getTextureAttribute(unsigned int unit,StateAttribute::Type type) { if (unit>=_textureAttributeList.size()) return 0; - return getAttribute(_textureAttributeList[unit],type,0); + return getAttribute(_textureAttributeList[unit],type,unit); } const StateAttribute* StateSet::getTextureAttribute(unsigned int unit,StateAttribute::Type type) const { if (unit>=_textureAttributeList.size()) return 0; - return getAttribute(_textureAttributeList[unit],type,0); + return getAttribute(_textureAttributeList[unit],type,unit); } StateSet::RefAttributePair* StateSet::getTextureAttributePair(unsigned int unit, StateAttribute::Type type) { if (unit>=_textureAttributeList.size()) return 0; - return getAttributePair(_textureAttributeList[unit],type,0); + return getAttributePair(_textureAttributeList[unit],type,unit); } const StateSet::RefAttributePair* StateSet::getTextureAttributePair(unsigned int unit, StateAttribute::Type type) const { if (unit>=_textureAttributeList.size()) return 0; - return getAttributePair(_textureAttributeList[unit],type,0); + return getAttributePair(_textureAttributeList[unit],type,unit); } bool StateSet::checkValidityOfAssociatedModes(osg::State& state) const