本文整理汇总了C++中osg::Group::getNumChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::getNumChildren方法的具体用法?C++ Group::getNumChildren怎么用?C++ Group::getNumChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Group
的用法示例。
在下文中一共展示了Group::getNumChildren方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverse
void
ShaderGenerator::apply(osg::Group& group)
{
if ( !_active ) return;
traverse(group);
#if 0
std::set<VirtualProgram*> childVPs;
unsigned childrenWithVP = 0;
for(unsigned i=0; i<group.getNumChildren(); ++i)
{
osg::StateSet* stateset = group.getChild(i)->getStateSet();
if ( !stateset )
break;
VirtualProgram* vp = dynamic_cast<VirtualProgram*>(stateset->getAttribute(VirtualProgram::SA_TYPE));
if ( vp )
{
childVPs.insert( vp );
childrenWithVP++;
}
}
if ( childrenWithVP == group.getNumChildren() && childVPs.size() == 1 )
{
group.getOrCreateStateSet()->setAttributeAndModes( *childVPs.begin(), 1 );
for(unsigned i=0; i<group.getNumChildren(); ++i)
{
group.getChild(i)->getStateSet()->removeAttribute(VirtualProgram::SA_TYPE);
}
}
#endif
}
示例2: apply
// apply method for groups
void GeometryExtractorVisitor::apply( osg::Group& group ) {
// call the appropriate apply method for all children
if( group.getNumChildren() > 0 ) {
for( unsigned int i = 0; i < group.getNumChildren(); i++) {
osg::Node* node = group.getChild( i );
apply( *node );
}
}
}
示例3: if
void CVRCullVisitor::PreCullVisitor::apply(osg::Group& group)
{
bool setMask = false;
for(int i = 0; i < group.getNumChildren(); i++)
{
_setMask = false;
group.getChild(i)->accept(*this);
if(_setMask)
{
setMask = true;
}
}
if(group.getNodeMask() & FIRST_CULL_STATUS)
{
_setMask = true;
}
else if(setMask)
{
//std::cerr << "Pulling up node mask." << std::endl;
_setMask = true;
group.setNodeMask(group.getNodeMask() | FIRST_CULL_STATUS);
}
}
示例4: while
void
RemoveEmptyGroupsVisitor::apply( osg::Group& group )
{
bool removed = true;
while( removed )
{
removed = false;
for( unsigned i = 0; i < group.getNumChildren(); ++i )
{
osg::Group* child = group.getChild(i)->asGroup();
if ( child )
{
if (child->className() == std::string("Group") &&
child->getStateSet() == 0L &&
child->getCullCallback() == 0L &&
child->getUpdateCallback() == 0L &&
child->getUserData() == 0L &&
child->getName().empty() &&
child->getDescriptions().size() == 0 )
{
for( unsigned j = 0; j < child->getNumChildren(); ++j )
{
group.addChild( child->getChild( j ) );
}
group.removeChild( i-- );
removed = true;
}
}
}
}
traverse(group);
}
示例5: writeChildren
static bool writeChildren( osgDB::OutputStream& os, const osg::Group& node )
{
unsigned int size = node.getNumChildren();
os << size << osgDB::BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << node.getChild(i);
}
os << osgDB::END_BRACKET << std::endl;
return true;
}
示例6: apply
virtual void apply(osg::Group &group ) {
for (unsigned int i = 0; i<group.getNumChildren(); ) {
if( dynamic_cast<osgAL::SoundRoot*>(group.getChild(i)) && _mode==SEARCH_AND_DESTROY ) {
group.removeChild(i);
} else {
if (dynamic_cast<osgAL::SoundRoot*>(group.getChild(i)) && _mode==SEARCH)
_found_count++;
group.getChild(i)->accept(*this);
i++;
}
}
}
示例7: apply
virtual void apply(osg::Group& group)
{
for (unsigned int i = 0; i < group.getNumChildren(); i++)
{
osg::Node* child = group.getChild(i);
osg::Node* seam = seamReplacement(child);
if (child != seam)
{
group.replaceChild(child,seam);
}
else
{
child->accept(*this);
}
}
}
示例8: apply
void
GeometryValidator::apply(osg::Group& group)
{
for(unsigned i=0; i<group.getNumChildren(); ++i)
{
osg::Geometry* geom = group.getChild(i)->asGeometry();
if ( geom )
{
apply( *geom );
if ( geom->getVertexArray() == 0L )
{
OE_NOTICE << "removing " << geom->getName() << " b/c of null vertex array\n";
group.removeChild(geom);
--i;
}
}
}
}
示例9: pushStateSet
void
CountsVisitor::apply(osg::Group& node)
{
pushStateSet(node.getStateSet());
_groups++;
osg::ref_ptr<osg::Object> rp = (osg::Object*)&node;
_uGroups.insert(rp);
_totalChildren += node.getNumChildren();
apply(node.getStateSet());
if (++_depth > _maxDepth)
_maxDepth = _depth;
traverse((osg::Node&)node);
_depth--;
popStateSet();
}
示例10: checkChildren
static bool checkChildren( const osg::Group& node )
{
return node.getNumChildren()>0;
}