[osg-users] Optimizer::RemoveLoadedProxyNodesVisitor + NO_AUTOMATIC_LOADING

Guy Volckaert guy.volckaert at meggitt.com
Fri Apr 28 10:10:08 PDT 2017


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() 
//MTSI_BEGIN
            || ( proxyNode.getLoadingExternalReferenceMode() == osg::ProxyNode::NO_AUTOMATIC_LOADING && proxyNode.getNumChildren() == 0 ) ) )
//MTSI_END
    {
        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








More information about the osg-users mailing list