Example #1
0
//------------------------------------------------------------------------------
static bool readResources( osgDB::InputStream& is, osgCuda::Computation& computation )
{
    unsigned int numRes = 0;
    is >> numRes >> osgDB::BEGIN_BRACKET;

    for( unsigned int i=0; i<numRes; ++i )
    {
        osg::Object* newRes = is.readObject();
        if( newRes != NULL )
        {
            osgCompute::GLMemoryAdapter* ioo = dynamic_cast<osgCompute::GLMemoryAdapter*>( newRes );
            if( ioo != NULL )
            {
                computation.addResource( *ioo->getMemory() );
            }
            else
            {
                osgCompute::Resource* curRes = dynamic_cast<osgCompute::Resource*>( newRes );
                if( curRes != NULL ) computation.addResource( *curRes );
            }

        }
    }

    is >> osgDB::END_BRACKET;
    return true;
}
Example #2
0
static bool readShaders( osgDB::InputStream& is, osg::Program& attr )
{
    unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osg::Shader* shader = dynamic_cast<osg::Shader*>( is.readObject() );
        if ( shader ) attr.addShader( shader );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #3
0
static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image )
{
    unsigned int images = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<images; ++i )
    {
        osg::Image* img = dynamic_cast<osg::Image*>( is.readObject() );
        if ( img ) image.addImage( img );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #4
0
static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManagerBase& manager )
{
    unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( is.readObject() );
        if ( ani ) manager.registerAnimation( ani );
    }
    is >> osgDB::END_BRACKET;
    return true;
}
Example #5
0
static bool readOperators( osgDB::InputStream& is, osgParticle::ModularProgram& prog )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgParticle::Operator* op = dynamic_cast<osgParticle::Operator*>( is.readObject() );
        if ( op ) prog.addOperator( op );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #6
0
static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( is.readObject() );
        if ( child ) layer.addLayer( child );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #7
0
File: Group.cpp Project: aalex/osg
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;
}
Example #8
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;
}
Example #9
0
static bool readDraggers( osgDB::InputStream& is, osgManipulator::CompositeDragger& dragger )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgManipulator::Dragger* child = dynamic_cast<osgManipulator::Dragger*>( is.readObject() );
        if ( child ) dragger.addDragger( child );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #10
0
static bool readPlacers( osgDB::InputStream& is, osgParticle::CompositePlacer& cp )
{
    unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgParticle::Placer* p = dynamic_cast<osgParticle::Placer*>( is.readObject() );
        if ( p ) cp.addPlacer( p );
    }
    is >> osgDB::END_BRACKET;
    return true;
}
Example #11
0
static bool readProperties( osgDB::InputStream& is, osgVolume::CompositeProperty& prop )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgVolume::Property* child = dynamic_cast<osgVolume::Property*>( is.readObject() );
        if ( child ) prop.addProperty( child );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #12
0
File: Locator.cpp Project: 3dcl/osg
static bool readLocatorCallbacks( osgDB::InputStream& is, osgVolume::Locator& locator )
{
    unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgVolume::Locator::LocatorCallback* cb =
            dynamic_cast<osgVolume::Locator::LocatorCallback*>( is.readObject() );
        if ( cb ) locator.addCallback( cb );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #13
0
static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateMatrixTransform& obj )
{
    osgAnimation::StackedTransform& transform = obj.getStackedTransforms();
    unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgAnimation::StackedTransformElement* element =
            dynamic_cast<osgAnimation::StackedTransformElement*>( is.readObject() );
        if ( element ) transform.push_back( element );
    }
    is >> is.END_BRACKET;
    return true;
}
Example #14
0
static bool readDrawables( osgDB::InputStream& is, osg::Geode& node )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osg::Drawable* drawable = dynamic_cast<osg::Drawable*>( is.readObject() );
        if ( drawable ) 
        {
            node.addDrawable( drawable );
        }
    }
    is >> is.END_BRACKET;
    return true;
}
static bool readEventHandlers(osgDB::InputStream &is, gsc::CaptureSettings &cs)
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;

    for (unsigned int i = 0; i < size; ++i)
    {
        osg::ref_ptr<osg::Object> obj = is.readObject();
        gsc::UpdateProperty       *up = dynamic_cast<gsc::UpdateProperty*>(obj.get());
        if (up)
            cs.addUpdateProperty(up);
    }

    is >> is.END_BRACKET;
    return true;
}
Example #16
0
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
{
    unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        std::string name; is >> name >> osgDB::BEGIN_BRACKET;
        if ( name=="DraggerTransformCallback" )
        {
            osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( is.readObject() );
            if ( transform ) dragger.addTransformUpdating( transform );
        }
        is >> osgDB::END_BRACKET;
    }
    is >> osgDB::END_BRACKET;
    return true;
}
Example #17
0
static bool readLayers( osgDB::InputStream& is, osgTerrain::CompositeLayer& layer )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        std::string type;
        is >> type;
        if ( type=="Object" )
        {
            osgTerrain::Layer* child = dynamic_cast<osgTerrain::Layer*>( is.readObject() );
            if ( child ) layer.addLayer( child );
        }
        else if ( type=="File" )
        {
            std::string compoundname;
            is.readWrappedString( compoundname );
            layer.addLayer( compoundname );
        }
    }
    is >> is.END_BRACKET;
    return true;
}
Example #18
0
static bool readParticleSystems( osgDB::InputStream& is, osgParticle::ParticleSystemUpdater& updater )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgParticle::ParticleSystem* ps = dynamic_cast<osgParticle::ParticleSystem*>( is.readObject() );
        if ( ps ) updater.addParticleSystem( ps );
    }
    is >> is.END_BRACKET;
    return true;
}