summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-06-03 12:29:29 +0200
committerLiang Qi <liang.qi@qt.io>2019-06-03 12:29:52 +0200
commit4eee1ab5a51ac482e2252e2e85c0fe624d5d4bad (patch)
tree71fb24fc69b2f77e08a57c56011ee5b72f23a52a /src/animation
parent79aa74b5d9df52605a8833e3853b422ca8e7a651 (diff)
parent666a645d1edc98dfea92fdaf7eaeed10c86dbc56 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/render/renderers/opengl/renderer/renderer.cpp tests/auto/render/textures/tst_textures.cpp Change-Id: I4da0eafe7ddd4dd822c3dcb5f5fa826653a335b4
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/animationutils.cpp6
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));