void apply(Atmosphere& atmo)
    {
        if (visibility.isSet())
        {
            atmo.GetConditions().SetVisibility(visibility.get());
            visibility.clear();
        }

        if (rain.isSet())
        {
            atmo.GetConditions().SetPrecipitation(CloudLayer::NONE, 0.0);
            atmo.GetConditions().SetPrecipitation(CloudLayer::RAIN, rain.get());
            rain.clear();
        }

        if (snow.isSet())
        {
            atmo.GetConditions().SetPrecipitation(CloudLayer::NONE, 0.0);
            atmo.GetConditions().SetPrecipitation(CloudLayer::DRY_SNOW, snow.get());
            snow.clear();
        }

        if (lighting.isSet())
        {
            sky->setLighting(lighting.get());
            lighting.clear();
        }
    }
    void apply(Environment& env, Ocean& ocean)
    {
        if (chop.isSet())
        {
            ocean.SetChoppiness(chop.get());
            chop.clear();
        }

        if (seaState.isSet())
        {
            env.SimulateSeaState(seaState.get(), 0.0);
            seaState.clear();
        }

        //if (alpha.isSet())
        //{
        //    triton->setAlpha( alpha.get() );
        //}
    }
    void apply(Environment& env, Ocean& ocean)
    {
        if (chop.isSet())
        {
            ocean.SetChoppiness(chop.get());
            chop.clear();
        }

        if (seaState.isSet())
        {
            env.SimulateSeaState(seaState.get(), 0.0);
            seaState.clear();
        }

        osg::ref_ptr<TritonLayer> layer;
        if (alpha.isSet() && tritonLayer.lock(layer))
        {
            layer->setOpacity(alpha.value());
            alpha.clear();
        }
    }
Beispiel #4
0
 void swap (optional& other) {
     if(empty_ && other.empty_) return;
     
     if(empty_) {
         *this = std::move(other);
         other.clear();
         return;
     }
     if(other.empty_) {
         other = std::move(*this);
         this->clear();
         return;
     }
     swap(**this, *other); 
 }