summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsslideplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/q3dsslideplayer.cpp')
-rw-r--r--src/runtime/q3dsslideplayer.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/runtime/q3dsslideplayer.cpp b/src/runtime/q3dsslideplayer.cpp
index faec815..33f068a 100644
--- a/src/runtime/q3dsslideplayer.cpp
+++ b/src/runtime/q3dsslideplayer.cpp
@@ -105,8 +105,10 @@ static void updatePosition(Q3DSSlide *slide, float pos, float duration)
if (!animator)
return;
- const float f = qBound(0.0f, pos / duration, 1.0f);
- animator->setNormalizedTime(f);
+ const float nt = qBound(0.0f, pos / duration, 1.0f);
+ // NOTE!!!: This is a bit funky, but it means we can avoid tracking the normalized values in the
+ // frontend node. This of course assumes that the limit in the fuzzy compare doesn't change!
+ animator->setNormalizedTime(qFuzzyCompare(nt, animator->normalizedTime()) ? (nt + (1.0f / 100000.0f)) : nt);
};
const auto updateAnimators = [&updateAnimator](const QVector<Qt3DAnimation::QClipAnimator *> &animators) {
for (auto animator : animators) {
@@ -140,8 +142,12 @@ static void updateAnimators(Q3DSSlide *slide, bool running, bool restart, float
if (!animator)
return;
- if (restart)
- animator->setNormalizedTime(0.0f);
+ if (restart) {
+ // NOTE!!!: This is a bit funky, but it means we can avoid tracking the normalized values in the
+ // frontend node. This of course assumes that the limit in the fuzzy compare doesn't change!
+ const float nt = qFuzzyCompare(animator->normalizedTime(), 0.0f) ? (0.0f + (1.f / 100000.f)) : 0.0f;
+ animator->setNormalizedTime(nt);
+ }
animator->clock()->setPlaybackRate(double(rate));
animator->setRunning(running);
};