コード例 #1
0
void
ShaderGenerator::apply(osg::ProxyNode& node)
{
    if ( !_active )
        return;

    if ( ignore(&node) )
        return;

    if ( node.getLoadingExternalReferenceMode() != osg::ProxyNode::LOAD_IMMEDIATELY )
    {
        // rewrite the filenames to include the shadergen pseudo-loader extension so
        // that dynamically loaded children will have the same shadergen applied.
        for( unsigned i=0; i<node.getNumFileNames(); ++i )
        {
            const std::string& filename = node.getFileName( i );
            if (!filename.empty() && 
                osgDB::getLowerCaseFileExtension(filename).compare(SHADERGEN_PL_EXTENSION) != 0 )
            {
                node.setFileName( i, Stringify() << filename << "." << SHADERGEN_PL_EXTENSION );
            }
        }
    }

    apply( static_cast<osg::Group&>(node) );
}
コード例 #2
0
ファイル: LayerCompiler.cpp プロジェクト: aarnchng/osggis
 virtual void apply( osg::ProxyNode& proxy )
 {
     proxy.setDatabasePath( archive_name );
     std::string name = proxy.getFileName( 0 );
     std::string simple = osgDB::getSimpleFileName( name );
     proxy.setFileName( 0, simple );
     osgGIS::notify( osg::INFO ) << "  Rewrote " << name << " as " << simple << std::endl;
     osg::NodeVisitor::apply( proxy );
 }
コード例 #3
0
static bool readFileNames( osgDB::InputStream& is, osg::ProxyNode& node )
{
    unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        std::string value;
        is.readWrappedString( value );
        node.setFileName( i, value );
    }
    is >> is.END_BRACKET;
    return true;
}