当前位置: 首页>>代码示例>>C++>>正文


C++ Group::getNumParents方法代码示例

本文整理汇总了C++中osg::Group::getNumParents方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::getNumParents方法的具体用法?C++ Group::getNumParents怎么用?C++ Group::getNumParents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Group的用法示例。


在下文中一共展示了Group::getNumParents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: traverse

void
OcclusionQueryVisitor::apply( osg::Group& group )
{
    if (group.getNumParents() == 0)
    {
        // Can't add an OQN above a root node.
        traverse( group );
        return;
    }

    int preTraverseOQNCount = getNameIdx();
    traverse( group );

    if (getNameIdx() > preTraverseOQNCount)
        // A least one OQN was added below the current node.
        //   Don't add one here to avoid hierarchical nesting.
        return;
    
    // There are no OQNs below this group. If the vertex
    //   count exceeds the threshold, add an OQN here.
    addOQN( group );
}
开发者ID:joevandyk,项目名称:osg,代码行数:22,代码来源:osgocclusionquery.cpp

示例2: apply

void AddQueries::apply( osg::Group& node )
{
    if( node.getName() == std::string( "__QueryStats" ) )
        // This is the QueryStats subtree. Don't instrument it with any OQ stuff.
        return;

    if( node.getCullCallback() != NULL )
    {
        traverse( node );
        return;
    }

    // Do not add callbacks to redundant Groups because the parent Group's
    // bounding volume (and query geometry) would also be redundant.
    // This Group is not redundant if it has no parents, or if its parents
    // are all Cameras, or if any one of its non-Camera parents has
    // more than one child. Otherwise, it's redundant.
    bool redundantGroup( false );
    unsigned int parentsWithOneChild( 0 );
    const unsigned int numParents( node.getNumParents() );
    unsigned int idx;
    for( idx=0; idx < numParents; idx++ )
    {
        osg::Group* parent = node.getParent( idx );
        bool parentIsCamera = ( dynamic_cast< osg::Camera* >( parent ) != NULL );
        if( parentIsCamera )
            continue;
        if( parent->getNumChildren() == 1 )
        {
            parentsWithOneChild++;
            // If all parents have one child, then we are redundant.
            if( numParents == parentsWithOneChild )
                redundantGroup = true;
        }
    }
    if( redundantGroup )
    {
        if( ( _qs != NULL ) && ( &node == _qs->getNode() ) )
            osg::notify( osg::ALWAYS ) << "Debug: Unable to add QueryStats to redundant Group \"" << node.getName() << "\"." << std::endl;
        traverse( node );
        return;
    }

    // Create QueryComputation for this node.
    // Add a QueryStats only if a) we have one and
    // b) the node addresses match.
    osgwQuery::QueryStats* debugStats( NULL );
    if( ( _qs != NULL ) && ( &node == _qs->getNode() ) )
    {
        osg::notify( osg::ALWAYS ) << "Debug: Adding QueryStats to node \"" << node.getName() << "\"." << std::endl;
        debugStats = _qs;
    }
    QueryComputation* nd = new QueryComputation( debugStats );

    QueryCullCallback* qcc = new QueryCullCallback();
    qcc->setName( node.getName() );
    qcc->attach( &node, nd );
    node.setCullCallback( qcc );

    _queryCount++;

    traverse( node );
}
开发者ID:AdriCS,项目名称:osgWorks-mirror,代码行数:63,代码来源:QueryUtils.cpp


注:本文中的osg::Group::getNumParents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。