[osg-users] [Question about StateSet.cpp] truncated attribute override value?

Julien Valentin julienvalentin51 at gmail.com
Thu Sep 10 04:35:29 PDT 2015


I think you misread the question:
You can't know if the flags is ON/OFF as the bit seams ignored and then not stored...
Using the posted code, it never returns 1.




Voerman, L. wrote:
> 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 (http://forum.openscenegraph.org/viewtopic.php?p=65081#65081)
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65095#65095








More information about the osg-users mailing list