Re: [osg-users] [Questio nabout StateSet.cpp] truncated attribute override value?
Hi Julien, I don't recall the why and wherefores of this particular bit of code in StateSet.cpp (i.e. line 1662 and associated code) but it's a lng time since I wrote it ;-) My best guess right now is that the ON/OFF for StateAttribute doesn't affect anything, a StateAttribute isn't like a GL Mode that can be switched on/off. All you can do with a StateAttribute is call it or not, and if you don't want to call it you remove it from the StateSet. This means all StateAttribute attached to StateSet are implicitly ON if you wanted to think it about a mode but in the end it's not a mode so it's probably best not to try and treat it like one. In the case of the StateSet API we reuse the OverrideValue as a bit mask so it's used for the mode ON/OFF and the OVERRIDE and PROTECTED switches. The ON/OFF is only relevant to store for the Mode which StateAttribute and Uniform's only the OVERRIDE and PROTECTED are significant to store. Does this make sense? Robert. On 9 September 2015 at 18:45, Julien Valentin wrote: > Hi, > Iwould like to introspect StateSet in order to know which override value > is activated for a particular stateset. > I parse AttributeList for this > > Code: > for( osg::StateSet::AttributeList::const_iterator > it=ss->getAttributeList().begin();it!=ss->getAttributeList().end() ; it++) > { > if((*it).second.first ==stateattribute) > { > if( (*it).second.second & osg::StateAttribute::ON) > return(1); > else return(0); > } > > > > but according to StateSet.cpp l.1662 > > Code: > attributeList[attribute->getTypeMemberPair()] = > RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED)); > > > > the ON OFF bit is removed from the given user value. So I can't determine > if an osg::Attribute is ON or OFF but only if it's OVERRIDE or PROTECTED > I would like to know if there's a known reason behind this logic & and > further if you know a mean to retrieve the ON/OFF bit. > > Thank you! > > Cheers, > Julien > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=65081#65081 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [Questio nabout StateSet.cpp] truncated attribute override value?
Hi Julien, it's OFF, the enum for StateAttribute::OFF is 0x0, so anything not ON has value OFF. Regards, Laurens. On Wed, Sep 9, 2015 at 7:45 PM, Julien Valentin wrote: > Hi, > Iwould like to introspect StateSet in order to know which override value > is activated for a particular stateset. > I parse AttributeList for this > > Code: > for( osg::StateSet::AttributeList::const_iterator > it=ss->getAttributeList().begin();it!=ss->getAttributeList().end() ; it++) > { > if((*it).second.first ==stateattribute) > { > if( (*it).second.second & osg::StateAttribute::ON) > return(1); > else return(0); > } > > > > but according to StateSet.cpp l.1662 > > Code: > attributeList[attribute->getTypeMemberPair()] = > RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED)); > > > > the ON OFF bit is removed from the given user value. So I can't determine > if an osg::Attribute is ON or OFF but only if it's OVERRIDE or PROTECTED > I would like to know if there's a known reason behind this logic & and > further if you know a mean to retrieve the ON/OFF bit. > > Thank you! > > Cheers, > Julien > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=65081#65081 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [Questio nabout StateSet.cpp] truncated attribute override value?
Hi, Iwould like to introspect StateSet in order to know which override value is activated for a particular stateset. I parse AttributeList for this Code: for( osg::StateSet::AttributeList::const_iterator it=ss->getAttributeList().begin();it!=ss->getAttributeList().end() ; it++) { if((*it).second.first ==stateattribute) { if( (*it).second.second & osg::StateAttribute::ON) return(1); else return(0); } but according to StateSet.cpp l.1662 Code: attributeList[attribute->getTypeMemberPair()] = RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED)); the ON OFF bit is removed from the given user value. So I can't determine if an osg::Attribute is ON or OFF but only if it's OVERRIDE or PROTECTED I would like to know if there's a known reason behind this logic & and further if you know a mean to retrieve the ON/OFF bit. Thank you! Cheers, Julien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=65081#65081 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org