Thanks, I see the light now.

I wrote my own FlattenStaticTransforms NodeVisitor to just fold the
transform into the geometry and set the transformation to identity; It works
great as long as all Transforms are MatrixTransforms.

(It'd be nice if there were a virtual osg::Transform::setIdentity() method
to easily allow code to set any Transform Node to the identity. For example,
see Optimizer.cpp starting at line 1080. It makes sense for PATs and
DOFTransforms, but maybe not for Camera...)
   -Paul


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Jolley, Thomas P
> Sent: Friday, October 24, 2008 3:09 PM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Problems flattening static transforms
> 
> Hi Paul,
> 
> I'm not sure it's a bug.  I think the Optimizer is playing it 
> safe when there are two scene graphs sharing a common graph.  
> You have two scene graphs sharing a graph even though one 
> graph doesn't have a parent as in your second ref_ptr.  The 
> result would be optimize one graph and the other graph 
> changes when it shouldn't.
> 
> If you don't think the above is correct and the decision to 
> optimize should be based on whether there is more than one 
> parent, create a custom Optimizer.  I think what you will 
> find is the second ref_ptr which was pointing to a graph with 
> lots of geometry may end up as an empty group node.  
> Something that might be unexpected if it was the top node of 
> something you're rendering.  That may not be a problem in 
> your application.
> 
> 
> > -----Original Message-----
> > From: Paul Martz [mailto:[EMAIL PROTECTED]
> > Sent: Friday, October 24, 2008 3:32 PM
> > To: 'OpenSceneGraph Users'
> > Subject: Re: [osg-users] Problems flattening static transforms
> > 
> > Interesting... Multiple references _does_ seem to be the cause!
> > 
> > I modified my simple test app to make a second ref_ptr to 
> the loaded 
> > scene graph. So the pseudocode is:
> > 
> >   Load scene graph into first ref_ptr.
> >   Create a second ref_ptr and make it reference the first ref_ptr's 
> > child 0.
> >   Run the Optimizer
> >   Write the scene graph
> > 
> > (Code attached. Run it with my previous "opt1.osg" file to 
> reproduce 
> > the
> > problem.)
> > 
> > With the second ref_ptr pointing to the child of the top level 
> > Transform, the top level Transform does not flatten.
> > 
> > Is this a bug? Why does the Optimizer (apparently) not flatten a 
> > transform if it has a child with reference count greater than 1?
> >    -Paul
> > 
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce
negraph.org
> 

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to