diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-07-15 12:05:18 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-07-16 11:08:13 +0200 |
commit | 44470868450c440ca874ba585e2b71dfc8e89f1d (patch) | |
tree | f671879ee042f2942ca63a96ca2a3d1ee8fc5116 /src/animation/backend/animationutils.cpp | |
parent | 79aa74b5d9df52605a8833e3853b422ca8e7a651 (diff) | |
parent | b972202feb4e69764122f6f469fe1a1cad01957a (diff) |
Merge "Merge remote-tracking branch 'qt-gerrit/dev' into wip/refactor"
Diffstat (limited to 'src/animation/backend/animationutils.cpp')
-rw-r--r-- | src/animation/backend/animationutils.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index 01484476d..29de69df6 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -253,10 +253,9 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) } } else { // There's only one keyframe. We cant compute omega. Interpolate per component - const int lowerKeyframeBound = channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime); - if (lowerKeyframeBound + 1 >= channel.channelComponents[0].fcurve.keyframeCount()) { + if (channel.channelComponents[0].fcurve.keyframeCount() == 1) { for (const auto &channelComponent : qAsConst(channel.channelComponents)) - channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime, lowerKeyframeBound); + channelResults[i++] = channelComponent.fcurve.keyframe(0).value; } else { auto quaternionFromChannel = [channel](const int keyframe) { const float w = channel.channelComponents[0].fcurve.keyframe(keyframe).value; @@ -268,6 +267,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) return quat; }; + const int lowerKeyframeBound = channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime); const auto lowerQuat = quaternionFromChannel(lowerKeyframeBound); const auto higherQuat = quaternionFromChannel(lowerKeyframeBound + 1); const float omega = std::acos(qBound(-1.0f, QQuaternion::dotProduct(lowerQuat, higherQuat), 1.0f)); |