[osg-users] Problem with Optimizer - FLATTEN_STATIC_TRANSFORMS

Robert Osfield robert.osfield at gmail.com
Sun Sep 14 07:45:46 PDT 2008


Hi Brian,

The isOperatoinPermissible() methods are part of mechinism that allows
users to control which objects in the scene graph are optimized - for
instance if they want to disable the optimization of particular nodes,
geometry.  The usage outlined looks reasonable w.r.t usage is
OperationPermissable.

Robert.

On Sun, Sep 14, 2008 at 3:19 PM, Brian <osgscene at gmail.com> wrote:
> I ran the problem through a debugger.  It looks like you are right that it
> has to do with shared vertex arrays.  The problem occurs in the file
> Optimizer.cpp.  In the function void
> Optimizer::FlattenStaticTransformsVisitor::apply(osg::Geode& geode)
>
> It looks like there is some code to deal with this problem.
>
>
> if((geometry)&&isOperationPermissibleForObject(&geode)&&(isOperationPermissibleForObject(geometry)))
>    {
>       if ((b)&&(b2))
>            {
>                         if(geometry->getVertexArray() &&
> geometry->getVertexArray()->referenceCount() > 1) {
>
> geometry->setVertexArray(dynamic_cast<osg::Array*>(geometry->getVertexArray()->clone(osg::CopyOp::DEEP_COPY_ALL)));
>                         }
>                         if(geometry->getNormalArray() &&
> geometry->getNormalArray()->referenceCount() > 1) {
>
> geometry->setNormalArray(dynamic_cast<osg::Array*>(geometry->getNormalArray()->clone(osg::CopyOp::DEEP_COPY_ALL)));
>                         }
>                     }
>             }
>
> It makes a copy of the vertex array for shared vertex arrays but there is a
> call to the funciton isOperationPermissibleForObject(&geode) that returns
> false in my case because there is a stateset attached to the geode.  I don't
> understand why should it block the copy/clone if a stateset is attached to
> the geode.  Is the isOperationPermissibleForObject(&geode) really needed?
> We are cloning the verexarray not the geode.
>
> Brian
>
>> >From you accounts, my guess is that the .dae plugin is loading
>> geometry with shared vertex arrays, then the
>> FlattenStaticTransformVisitor is flattening the geometry but not
>> properly recognizing that fact that shared vertices straddle two
>> separately transformed subgraphs.
>>
>> I recall this problem arising before and think that a fix was
>> submitted and checked in for it, but perhaps this wasn't resolved.
>> Have a look through the svn log for Optimizer.cpp.
>>
>> Robert.
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list