示例#1
0
void
ShaderGenerator::apply(osg::ClipNode& node)
{
    static const char* s_clip_source =
        "#version " GLSL_VERSION_STR "\n"
        "void sg_set_clipvertex(inout vec4 vertexVIEW)\n"
        "{\n"
        "    gl_ClipVertex = vertexVIEW; \n"
        "}\n";

    if ( !_active ) return;

    VirtualProgram* vp = VirtualProgram::getOrCreate(node.getOrCreateStateSet());
    vp->setFunction( "sg_set_clipvertex", s_clip_source, ShaderComp::LOCATION_VERTEX_VIEW );

    apply( static_cast<osg::Group&>(node) );
}
示例#2
0
void
ShaderGenerator::apply(osg::ClipNode& node)
{
    static const char* s_clip_source =
        "#version " GLSL_VERSION_STR "\n"
        "void oe_sg_set_clipvertex(inout vec4 vertexVIEW)\n"
        "{\n"
        "    gl_ClipVertex = vertexVIEW; \n"
        "}\n";

    if ( !_active )
        return;

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

    VirtualProgram* vp = VirtualProgram::getOrCreate(node.getOrCreateStateSet());
    if ( vp->referenceCount() == 1 ) vp->setName( _name );
    vp->setFunction( "oe_sg_set_clipvertex", s_clip_source, ShaderComp::LOCATION_VERTEX_VIEW );

    apply( static_cast<osg::Group&>(node) );
}