Example #1
0
void
ContourMap::onUninstall(TerrainEngineNode* engine)
{
    if ( engine )
    {
        osg::StateSet* stateset = engine->getStateSet();
        if ( stateset )
        {
            stateset->removeUniform( _xferMin.get() );
            stateset->removeUniform( _xferRange.get() );
            stateset->removeUniform( _xferSampler.get() );
            stateset->removeUniform( _opacityUniform.get() );

            stateset->removeTextureAttribute( _unit, osg::StateAttribute::TEXTURE );

            VirtualProgram* vp = VirtualProgram::get(stateset);
            if ( vp )
            {
                Shaders pkg;
                pkg.unload(vp, pkg.ContourMap_Vertex);
                pkg.unload(vp, pkg.ContourMap_Fragment);
            }
        }

        if ( _unit >= 0 )
        {
            engine->getResources()->releaseTextureImageUnit( _unit );
            _unit = -1;
        }
    }
}
Example #2
0
void FogEffect::detach( osg::StateSet* stateSet )
{
    VirtualProgram* vp = VirtualProgram::get(stateSet);
    if ( vp )
    {
        Shaders pkg;
        pkg.unload( vp, pkg.Fog_Vertex );
        pkg.unload( vp, pkg.Fog_Fragment );
    }
}
Example #3
0
void
GeodeticGraticule::removeEffect()
{
    if (_mapNode.valid() == false)
        return;

    osg::StateSet* stateset = _mapNode->getTerrainEngine()->getSurfaceStateSet();
    if ( stateset )
    {
        VirtualProgram* vp = VirtualProgram::get(stateset);
        if ( vp )
        {
            Shaders package;
            package.unload( vp, package.Graticule_Vertex );
            package.unload( vp, package.Graticule_Fragment );

            stateset->removeUniform( COLOR_UNIFORM );
            stateset->removeUniform( WIDTH_UNIFORM );
        }
    }
}
Example #4
0
void
AlphaEffect::detach(osg::StateSet* stateset)
{
    if ( stateset && _installed )
    {
        stateset->removeUniform( _alphaUniform.get() );
        VirtualProgram* vp = VirtualProgram::get( stateset );
        if ( vp )
        {
            Shaders pkg;
            pkg.unload( vp, pkg.AlphaEffectFragment );
        }
    }
}
Example #5
0
void
DrawInstanced::remove(osg::StateSet* stateset)
{
    if ( !stateset )
        return;

    VirtualProgram* vp = VirtualProgram::get(stateset);
    if ( !vp )
        return;

    Shaders pkg;
    pkg.unload( vp, pkg.InstancingVertex );

    stateset->removeUniform("oe_di_postex_TBO");
}