Ejemplo n.º 1
0
static bool readFileNames( osgDB::InputStream& is, osg::ImageSequence& image )
{
    unsigned int files = 0; is >> files >> is.BEGIN_BRACKET;
    if (is.getOptions()) image.setReadOptions(new osgDB::Options(*is.getOptions()));
    for ( unsigned int i=0; i<files; ++i )
    {
        std::string filename; is.readWrappedString( filename );
        image.addImageFile( filename );
    }
    is >> is.END_BRACKET;
    return true;
}
Ejemplo n.º 2
0
    virtual void objectRead(osgDB::InputStream& is, osg::Object& obj)
    {
        osg::ProxyNode& proxyNode = static_cast<osg::ProxyNode&>(obj);

        if (proxyNode.getLoadingExternalReferenceMode() == osg::ProxyNode::LOAD_IMMEDIATELY)
        {
            for(unsigned int i=0; i<proxyNode.getNumFileNames(); i++)
            {
                if(i >= proxyNode.getNumChildren() && !proxyNode.getFileName(i).empty())
                {
                    osgDB::FilePathList& fpl = ((osgDB::ReaderWriter::Options*)is.getOptions())->getDatabasePathList();
                    fpl.push_front( fpl.empty() ? osgDB::getFilePath(proxyNode.getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(proxyNode.getFileName(i)));
                    osg::Node* node = osgDB::readNodeFile(proxyNode.getFileName(i), is.getOptions());
                    fpl.pop_front();
                    if(node)
                        proxyNode.insertChild(i, node);
                }
            }
        }
    }