From 6f54ffc947b50f383340e2da730f05f3c4596884 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Wed, 17 Dec 2014 09:45:59 +0100 Subject: [PATCH] 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 --- src/Time/TimeManager.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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() ); -- 2.39.5