コード例 #1
0
void InventorLoader::checkForRedundancy( osg::NodePtr OSGGroup )
{
  return;
  
    // TODO: Check the type of the node and return, if it's not a node
    // that should be discarded (discardable: group, not discardable: geometry)

    // If the group node has no children, then let's kick it !
    if( OSGGroup->getNChildren() == 0 )
    {
        if(OSGGroup->getParent() != NullFC)
        {
            OSGGroup->getParent()->subChild(OSGGroup);
        }
        else
        {
            subRefCP(OSGGroup);
        }
    }
    // If there's only one child, then add it to the parent of the group,
    // copy the name and remove the group
    else if ( OSGGroup->getNChildren() == 1 )
    {
        // Get parent and child
        osg::NodePtr _Child = OSGGroup->getChild(0);
        osg::NodePtr _Parent = OSGGroup->getParent();

        // Copy the name
        const char* _Name = getName(OSGGroup);
        if( _Name )
            setName( _Child, _Name );

        // Add the child to the parent
        _Parent->addChild( _Child );

        // Remove the group node
        _Parent->subChild( OSGGroup );
    }
}