From 85e8b2bdb78bf2c09642cd6f1eb4ed5b809d6ef7 Mon Sep 17 00:00:00 2001 From: Julien Gouesse Date: Wed, 24 Apr 2013 22:03:06 +0200 Subject: Fixes the bug in KeyframeController, keeps the current time inside a reasonable frame to avoid weird morphing --- .../extension/model/util/KeyframeController.java | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java index 1df05a6..e413aa8 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java @@ -213,18 +213,18 @@ public class KeyframeController extends ComplexSpatialControl /** * This function will do a smooth translation between a keframe's current look, to the look directly at - * newTimeToReach. It takes translationLen time (in sec) to do that translation, and once translated will animate - * like normal between newBeginTime and newEndTime
+ * newTimeToReach. It takes translationLen time (in seconds) to do that translation, and once translated will + * animate like normal between newBeginTime and newEndTime
*
- * This would be usefull for example when a figure stops running and tries to raise an arm. Instead of "teleporting" - * to the raise-arm animation begining, a smooth translation can occur. + * This would be useful for example when a figure stops running and tries to raise an arm. Instead of "teleporting" + * to the raise-arm animation beginning, a smooth translation can occur. * * @param newTimeToReach * The time to reach. * @param translationLen * How long it takes * @param newBeginTime - * The new cycle begining time + * The new cycle beginning time * @param newEndTime * The new cycle ending time. */ @@ -434,17 +434,23 @@ public class KeyframeController extends ComplexSpatialControl findFrame(); _before = _keyframes.get(_curFrame); // Change this bit so the next frame we're heading towards isn't always going - // to be one frame ahead since now we coule be animating from the last to first + // to be one frame ahead since now we could be animating from the last to first // frames. // after = keyframes.get(curFrame + 1)); _after = _keyframes.get(_nextFrame); - double delta = (_curTime - _before._time) / (_after._time - _before._time); + final double localMinTime = Math.min(_before._time, _after._time); + final double localMaxTime = Math.max(_before._time, _after._time); + final double clampedCurTime = Math.max(localMinTime, Math.min(_curTime, localMaxTime)); + final double delta; - // If we doing that wrapping bit then delta should be caculated based + // If we doing that wrapping bit then delta should be calculated based // on the time before the start of the animation we are. if (_nextFrame < _curFrame) { - delta = blendTime - (getMinTime() - _curTime); + delta = blendTime - (getMinTime() - clampedCurTime); + } else { + // general case + delta = (clampedCurTime - _before._time) / (_after._time - _before._time); } final Mesh oldShape = _before._newShape; -- cgit v1.2.3 From e48f8e09478ea0e1378f415b9c0d19c97cb9a3f9 Mon Sep 17 00:00:00 2001 From: Julien Gouesse Date: Wed, 24 Apr 2013 22:16:45 +0200 Subject: The keys KANA and KANJI are not supported any more by NEWT --- ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java index 837e338..73c5684 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java @@ -70,8 +70,8 @@ public enum JoglNewtKey { INSERT(KeyEvent.VK_INSERT, Key.INSERT), // J(KeyEvent.VK_J, Key.J), // K(KeyEvent.VK_K, Key.K), // - KANA(KeyEvent.VK_KANA, Key.KANA), // - KANJI(KeyEvent.VK_KANJI, Key.KANJI), // + // KANA(KeyEvent.VK_KANA, Key.KANA), // + // KANJI(KeyEvent.VK_KANJI, Key.KANJI), // L(KeyEvent.VK_L, Key.L), // OPEN_BRACKET(KeyEvent.VK_OPEN_BRACKET, Key.LBRACKET), // CONTROL(KeyEvent.VK_CONTROL, Key.LCONTROL), // -- cgit v1.2.3