[osg-users] Optimizer::RemoveLoadedProxyNodesVisitor + NO_AUTOMATIC_LOADING

Robert Osfield robert.osfield at gmail.com
Fri Apr 28 11:05:55 PDT 2017

Hi Guy,

The visitor in question is meant to just remove loading ProxyNode's
it's not meant to remove nodes that haven't yet been loaded, doing so
would potentially break applications where nodes disappear that are
still needed.

What you describe is a special case - there are problems loading
external nodes and you still want to get rid of them.  This is an
application specific decision you are prepared to make but isn't a
general solution.  My recommendation would be to just write a visitor
that you run on the loaded subgraphs and cleans up items like
ProxuNode's that have failed.  There may be other platform specific
scene graph optimizations you can do that the OSG can do because it
can't assume that it's safe.


On 28 April 2017 at 18:10, Guy Volckaert <guy.volckaert at meggitt.com> wrote:
> Hi,
> I was wondering if someone could explain why the Optimizer::RemoveLoadedProxyNodesVisitor is not removing ProxyNodes with NO_AUTOMATIC_LOADING set?
> Here is the motivation behind my question... We often need to load relatively large openflight terrains that contains a significant number external references. In fact, on some terrains, each single tree is an external reference - so you can image how many external references that makes!!! Unfortunately, many of these terrains are provided to us AS IS and we don't have the necessary rights to modify them.
> What we discovered is that, sometimes, many of those external reference files are missing, thus leading to poor performance. For example, if we simply delete all the external references for a terrains, I would expect better performance (since I don't need to render all those trees), but that's not the case.
> To resolve this poor performance problem, I modified the following optimizer function to consider the NO_AUTOMATIC_LOADING. Can you tell me if what I did makes sense? If so, then I could propose this as a change in the osg-submission.
> Code:
> void Optimizer::RemoveLoadedProxyNodesVisitor::apply(osg::ProxyNode& proxyNode)
> {
>     if (proxyNode.getNumParents()>0
>         && ( proxyNode.getNumFileNames()==proxyNode.getNumChildren()
>             || ( proxyNode.getLoadingExternalReferenceMode() == osg::ProxyNode::NO_AUTOMATIC_LOADING && proxyNode.getNumChildren() == 0 ) ) )
>     {
>         if (isOperationPermissibleForObject(&proxyNode))
>         {
>             _redundantNodeList.insert(&proxyNode);
>         }
>     }
>     traverse(proxyNode);
> }
> Thank you!
> Cheers,
> Guy
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70857#70857
> _______________________________________________
> 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