Beispiel #1
0
 virtual void apply(osg::Node& node)
 {
     int index;
     osg::ref_ptr<osg::Node> nodePtr(&node);
     if (node.getUserValue("overrideFx", index))
     {
         if (index == 1) 
             overrideTexture(mTexture, mResourcesystem, nodePtr);
     }
     traverse(node);
 }
void 
ShaderGenerator::apply( osg::Node& node )
{
    if ( !_active )
        return;

    bool ignore;
    if ( node.getUserValue(SHADERGEN_HINT_IGNORE, ignore) && ignore )
        return;

    osg::ref_ptr<osg::StateSet> stateset = node.getStateSet();
    if ( stateset.valid() )
    {
        _state->pushStateSet( stateset.get() );
    }

    traverse(node);

    if ( stateset.valid() )
    {
        _state->popStateSet();
    }
}