Hi Sukender,

Indeed this is really a qustion for osg-users.  The use of
DataVariance()==STATIC is there to ensure that that objects that might
be modified during the life of the application will be modified away.

Robert.

On 27 March 2013 15:19, Sukender <[email protected]> wrote:
> Hi all,
>
> (That's not really a "true" submission but I guess this is more appropriate 
> than in osg-users)
>
> Optimizer::StateVisitor::apply() methods always check it statesets 
> datavariance is static (ss->getDataVariance()==osg::Object::STATIC) whatever 
> the _optimize[] parameters are. However, in optimize(), the test is always 
> "if (optimize(.....->getDataVariance()))".
>
> Is this intended? Should apply() methods be modified?
>
>
>
> Just for future reference, here is the code I guess to be good:
> "
> void Optimizer::StateVisitor::apply(osg::Node& node)
> {
>
>     osg::StateSet* ss = node.getStateSet();
>     if (ss && optimize(ss->getDataVariance()))
>     {
>         if (isOperationPermissibleForObject(&node) &&
>             isOperationPermissibleForObject(ss))
>         {
>             addStateSet(ss,&node);
>         }
>     }
>
>     traverse(node);
> }
>
> void Optimizer::StateVisitor::apply(osg::Geode& geode)
> {
>     if (!isOperationPermissibleForObject(&geode)) return;
>
>     osg::StateSet* ss = geode.getStateSet();
>
>
>     if (ss && optimize(ss->getDataVariance()))
>     {
>         if (isOperationPermissibleForObject(ss))
>         {
>             addStateSet(ss,&geode);
>         }
>     }
>     for(unsigned int i=0;i<geode.getNumDrawables();++i)
>     {
>         osg::Drawable* drawable = geode.getDrawable(i);
>         if (drawable)
>         {
>             ss = drawable->getStateSet();
>             if (ss && optimize(ss->getDataVariance()))
>             {
>                 if (isOperationPermissibleForObject(drawable) &&
>                     isOperationPermissibleForObject(ss))
>                 {
>                     addStateSet(ss,drawable);
>                 }
>             }
>         }
>     }
> }
> "
>
> Cheers,
>
> Sukender
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to