[osg-users] [osgPlugins] How to read/write/access OpenFlight Surface Material Code (SMC) and Feature ID (FID) ?

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Thu Apr 14 09:19:36 PDT 2011


Hi Paul,

>     One of the default osgUtil::Optimizer flags is
>     SHARE_DUPLICATE_STATE. So if two StateSets are otherwise identical
>     and would be shared under this optimization, adding a different
>     material code to the description list of the two StateSets would
>     impair that optimization.

 From what I can see, the StateSet comparison only compares Uniforms and 
StateAttributes (both normal and texture attributes). See 
Optimizer::StateVisitor::optimize() in osgUtil/Optimizer.cpp.

So adding different descriptions to two StateSets that are otherwise 
identical will actually result in only one of the sets of descriptions 
"winning" once the stateset is shared. So if, as I said, the SMC is 
associated to a texture or a material (in the sense of an 
osg::Material), then that's fine, there will never be a different SMC 
when the textures/materials are identical.

Anyways, if adding it to the nodes is fine, go with that, I was just 
saying that it sounded natural to me (anything textured as concrete 
should have the SMC of concrete, and setting the SMC in the descriptions 
of the stateset gives you this sharing for free) but I don't know how it 
actually works in the OpenFlight format, so if what I say is nonsense, 
then just disregard it. Then again no one has yet said that this 
association is not actually the case, if that had been said I would just 
have dropped the subject altogether :-)

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                     http://whitestar02.dyndns-web.com/



More information about the osg-users mailing list