Пример #1
0
static bool writeImages( osgDB::OutputStream& os, const osg::ImageSequence& image)
{
    const osg::ImageSequence::ImageDataList& imageDataList = image.getImageDataList();
    os.writeSize(imageDataList.size()); os << os.BEGIN_BRACKET << std::endl;
    for ( osg::ImageSequence::ImageDataList::const_iterator itr=imageDataList.begin();
          itr!=imageDataList.end();
          ++itr )
    {
        os.writeObject( (*itr)._image.get() );
    }
    os << os.END_BRACKET << std::endl;
    return true;
}
Пример #2
0
//------------------------------------------------------------------------------
static bool writeResources( osgDB::OutputStream& os, const osgCuda::Computation& computation )
{
    const osgCompute::ResourceHandleList resList = computation.getResources();

    // Count attached resources
    unsigned int numRes = 0;
    for( osgCompute::ResourceHandleListCnstItr resItr = resList.begin();
            resItr != resList.end();
            ++resItr )
        if( resItr->_serialize )
            numRes++;

    // Write attached resources
    os << numRes << osgDB::BEGIN_BRACKET << std::endl;

    for( osgCompute::ResourceHandleListCnstItr resItr = resList.begin();
            resItr != resList.end();
            ++resItr )
    {
        if( resItr->_serialize )
        {
            osgCompute::GLMemory* iom = dynamic_cast<osgCompute::GLMemory*>( (*resItr)._resource.get() );
            if( iom != NULL )
            {   // if layered interoperability object then store the interoperability object
                osg::Object* ioo = dynamic_cast<osg::Object*>( iom->getAdapter() );
                if( ioo ) os.writeObject( ioo );
            }
            else
            {
                os.writeObject( (*resItr)._resource.get() );
            }
        }
    }

    os << osgDB::END_BRACKET << std::endl;
    return true;
}