Beispiel #1
0
void ShapeToGeometryVisitor::apply(const osg::CompositeShape& group)
{
    for(unsigned int i=0;i<group.getNumChildren();++i)
    {
        group.getChild(i)->accept(*this);
    }
}
static bool writeChildren( osgDB::OutputStream& os, const osg::CompositeShape& shape )
{
    unsigned int size = shape.getNumChildren();
    os << size << os.BEGIN_BRACKET << std::endl;
    for ( unsigned int i=0; i<size; ++i )
    {
        os << shape.getChild(i);
    }
    os << os.END_BRACKET << std::endl;
    return true;
}
static bool readChildren( osgDB::InputStream& is, osg::CompositeShape& shape )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osg::ref_ptr<osg::Shape> child = is.readObjectOfType<osg::Shape>();
        if ( child ) shape.addChild( child );
    }
    is >> is.END_BRACKET;
    return true;
}
Beispiel #4
0
static bool readChildren( osgDB::InputStream& is, osg::CompositeShape& shape )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osg::Shape* child = dynamic_cast<osg::Shape*>( is.readObject() );
        if ( child ) shape.addChild( child );
    }
    is >> is.END_BRACKET;
    return true;
}
static bool checkChildren( const osg::CompositeShape& shape )
{
    return shape.getNumChildren()>0;
}