From: Torsten Dreyer Date: Wed, 17 Dec 2014 08:45:59 +0000 (+0100) Subject: Allow easing of setting the time-offset X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6f54ffc947b50f383340e2da730f05f3c4596884;p=flightgear.git Allow easing of setting the time-offset Configurable with properties: /sim/time/warp-easing == false ? jump to new time offset (orig. behaviour) /sim/time/warp-easing == true ? use easing parameter to adjust warp /sim/time/warp-easing-duration-secs: time in seconds to reach the new value /sim/time/warp-easing-method: easing method to apply. default: swing --- diff --git a/src/Time/TimeManager.cxx b/src/Time/TimeManager.cxx index fa6727063..72b9c8f9e 100644 --- a/src/Time/TimeManager.cxx +++ b/src/Time/TimeManager.cxx @@ -372,7 +372,15 @@ void TimeManager::setTimeOffset(const std::string& offset_type, long int offset) warp = 0; } - _warp->setIntValue( orig_warp + warp ); + if( fgGetBool("/sim/time/warp-easing", false) ) { + double duration = fgGetDouble("/sim/time/warp-easing-duration-secs", 5.0 ); + const string easing = fgGetString("/sim/time/warp-easing-method", "swing" ); + SGPropertyNode n; + n.setDoubleValue( orig_warp + warp ); + _warp->interpolate( "numeric", n, duration, easing ); + } else { + _warp->setIntValue( orig_warp + warp ); + } SG_LOG( SG_GENERAL, SG_INFO, "After TimeManager::setTimeOffset(): warp = " << _warp->getIntValue() );