Hi Paul,

I'm just online briefly so I'll give you my first thought as what is
amiss.  Optimizer::optimize() method takes a reference to the scene
graph to optimize, this means that it can't change it's type, so it
can't flatten it.  If you place a Group above it and then optimize
it'll be able to optimize the node away.

One could possibly write an additional method that takes a pointer to
a scene graph node and then return the new scene graph with
potentially a new root node.  For compatibility we'd need to keep the
present one.

Robert.

On Fri, Oct 24, 2008 at 8:24 PM, Paul Martz <[EMAIL PROTECTED]> wrote:
> Hi all -- I have a scene graph containing multiple static transforms. My
> application runs the osgUtil::Optimizer on this scene graph. This should
> flatten all the static transforms. Unfortunately, the result is that all the
> transforms flatten _except_ for the top level transform. If I do an osgconv
> on this same scene graph, all the static transforms flatten -- they are
> converted to Group nodes, and their transformations are folded into the
> geometry. Clearly, the issue isn't with the scene graph itself, but it's
> something my app is doing wrong when it invokes the Optimizer. My dilemma:
> why doesn't this work properly for osgconv, but not for my app?
>
> I have dug into thisu  for quite some time now, trying to uncover the
> difference between osgconv (which works) and my code (which doesn't work).
> Here's what I know so far:
>
> * I've written a small test app to try to reproduce the problem. It loads
> the scene graph, runs the Optimizer, and writes the scene graph back out.
> Unfortunately, it works properly, just like osgconv. It flattens all the
> transforms. I'm unable to reproduce the problem in anything other than my
> (larger) application. This must be a bug in my code, I must be doing
> something wrong.
>
> * I have verified that the problem is not non-STATIC transforms, multiple
> parents, or ProxyNodes. The same scene graph works fine in osgconv and my
> little test app, so it isn't a scene graph issue. I believe my app handles
> the scene graph the same as in these other two apps, which work.
>
> * Yes I'm invoking the Optimizer the same way, with no flags. I'm sure that
> the OSG_OPTIMIZER variable is not set in the environment. I get the same
> behavior if I just pass the FLATTEN_STATIC_TRANSFORMS flag (top level node
> fails to flatten). If I set OSG_OPTIMIZER=FLATTEN_STATIC_TRANSFORMS and run
> osgconv, it still works properly and flattens all transforms.
>
> * ObjectStruct has a Boolean called _moreThanOneMatrixRequired. In my app,
> this gets set to true at Optimizer.cpp line 826. This doesn't happen when
> running osgconv or my small test code. This seems to be part of the problem,
> but the root cause that triggers this event is still unknown to me.
>
> I'll attach the scene graph in question, though I doubt it will do anyone
> much good, because it works fine in osgconv and my simple test app. It only
> fails in my larger app. Note the top level Node named "CenterOfMassOffset";
> this is the transform that refuses to flatten.
>
> I'm wondering if anyone has encountered the same issue before, has any info
> on how to resolve the issue, or might know how to proceed with debugging it.
> Notify level DEBUG_INFO does not produce any enlightening information.
>
> I admit I'm stumped on this one. It's extremely out of the ordinary when OSG
> doesn't just do what I expect it to. I appreciate any info.
>
> Thanks,
>
> Paul Martz
> Skew Matrix Software LLC
> http://www.skew-matrix.com
> +1 303 859 9466
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to