]> git.mxchange.org Git - flightgear.git/commitdiff
Allow easing of setting the time-offset
authorTorsten Dreyer <torsten@ŧ3r.de>
Wed, 17 Dec 2014 08:45:59 +0000 (09:45 +0100)
committerTorsten Dreyer <torsten@ŧ3r.de>
Wed, 17 Dec 2014 08:52:09 +0000 (09:52 +0100)
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

index fa67270635971464e24ce8e3daa2446893091ed5..72b9c8f9e8740e619340e45ddbf3d9c892ff5837 100644 (file)
@@ -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() );