Beispiel #1
0
void
FeatureModelGraph::checkForGlobalStyles( const Style& style )
{
    const AltitudeSymbol* alt = style.get<AltitudeSymbol>();
    if ( alt )
    {
        if (alt->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN || 
            alt->clamping() == AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN)
        {
            if ( alt->technique() == AltitudeSymbol::TECHNIQUE_GPU && !_clampable )
            {
                _clampable = new ClampableNode( 0L );
                _overlayChange = OVERLAY_INSTALL_CLAMPABLE;
            }

            else if ( alt->technique() == AltitudeSymbol::TECHNIQUE_DRAPE && !_drapeable )
            {
                _drapeable = new DrapeableNode( 0L );
                _overlayChange = OVERLAY_INSTALL_DRAPEABLE;
            }
        }
    }

    if ( _clampable )
    {
        // if we're using extrusion, don't perform depth offsetting:
        const ExtrusionSymbol* extrusion = style.get<ExtrusionSymbol>();
        if ( extrusion )
        {
            DepthOffsetOptions d = _clampable->getDepthOffsetOptions();
            d.enabled() = false;
            _clampable->setDepthOffsetOptions( d );
        }

        // check for explicit depth offset render settings (note, this could
        // override the automatic disable put in place by the presence of an
        // ExtrusionSymbol above)
        const RenderSymbol* render = style.get<RenderSymbol>();
        if ( render && render->depthOffset().isSet() )
        {
            _clampable->setDepthOffsetOptions(*render->depthOffset());
        }
    }

    else 
    {
        const RenderSymbol* render = style.get<RenderSymbol>();
        if ( render && render->depthOffset().isSet() )
        {
            _depthOffsetAdapter.setGraph( this );
            _depthOffsetAdapter.setDepthOffsetOptions( *render->depthOffset() );
        }
    }
}
Beispiel #2
0
void 
DepthOffsetAdapter::setDepthOffsetOptions(const DepthOffsetOptions& options)
{
    if ( !_supported ) return;

    // if "enabled" changed, reset the graph.
    bool reinitGraph = ( options.enabled() != _options.enabled() );

    _options = options;

    if ( reinitGraph )
    {
        setGraph( _graph.get() );
    }

    updateUniforms();

    _dirty = (options.automatic() == true);
}