本文整理汇总了C++中osg::Group::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::addChild方法的具体用法?C++ Group::addChild怎么用?C++ Group::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Group
的用法示例。
在下文中一共展示了Group::addChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/** Attacca al/ai nodi che corrispondono a nodeName */
void LoadThreadsHandler::AttachNodeToSceneByName::apply(osg::Group& grp)
{
if (grp.getName() == _nodeName)
{
if(!_attached || _multipleattach)
{
if(_ranged)
{
osg::ref_ptr<osg::LOD> newlod = new osg::LOD;
newlod->setName("RangedLOD_" + _attachNode->getName());
newlod->addChild(_attachNode.get(), _min, _max);
grp.addChild(newlod.get());
}
else
{
grp.addChild(_attachNode.get());
}
_attached = true;
}
}
traverse(grp);
}
示例2: 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);
}
示例3: readChildren
static bool readChildren( osgDB::InputStream& is, osg::Group& node )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
if ( child ) node.addChild( child );
}
is >> osgDB::END_BRACKET;
return true;
}
示例4: nave
torreta(int x, int y, int z,int tamaño)
{
Torreta = new osg::Group();
material = new osg::Material;
stateset =new osg::StateSet;
//Configurar_Material();
boton=y;
left=x;
//top=(8*tamaño)+z;
//right=(11*tamaño);
int tamaño_cubo_grade=tamaño*5;
nave* cubomio=new nave (x,y,z,tamaño_cubo_grade);
int puntopunta=tamaño_cubo_grade;
puntopunta=puntopunta/2;
puntopunta=puntopunta-(tamaño/2);
nave* cubomio2=new nave(x+puntopunta,y,tamaño_cubo_grade+z,tamaño);
Torreta->addChild(cubomio->getNave());
Torreta->addChild(cubomio2->getNave());
top=tamaño_cubo_grade+tamaño+y;
right=tamaño_cubo_grade+x;
yDisparo=top;
xDisparo=x+puntopunta;
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF);
};