summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/blendedclipanimator_p.h
diff options
context:
space:
mode:
authorJuan José Casafranca <juan.casafranca@kdab.com>2017-09-10 14:52:46 +0200
committerSean Harmer <sean.harmer@kdab.com>2017-10-06 12:10:05 +0000
commitf0153ae8b12cc68ed6e38a1d93b83bb235b5e501 (patch)
tree311ec5c364d87ffc36b567986af3ff9823b3bbf1 /src/animation/backend/blendedclipanimator_p.h
parentc9bc1d866d69092f4fafe626687fe0f5746c829a (diff)
Fix animation local time calculation when changing playbackRate
Animation local time was computed in absolute mode, as a scale of the global time that has passed since the start of the animation. Now is computed relative to the last local time, as the last local time + a scale of the elapsed global time. Change-Id: I5c29002602a5184174618ac7755ec94f5c7a328f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/blendedclipanimator_p.h')
-rw-r--r--src/animation/backend/blendedclipanimator_p.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/animation/backend/blendedclipanimator_p.h b/src/animation/backend/blendedclipanimator_p.h
index d9f89b5f9..dd99c4274 100644
--- a/src/animation/backend/blendedclipanimator_p.h
+++ b/src/animation/backend/blendedclipanimator_p.h
@@ -79,8 +79,7 @@ public:
void setClockId(Qt3DCore::QNodeId clockId);
void setRunning(bool running);
- void setStartTime(qint64 globalTime) { m_startGlobalTime = globalTime; }
- qint64 startTime() const { return m_startGlobalTime; }
+ void setStartTime(qint64 globalTime) { m_lastGlobalTimeNS = globalTime; }
void setLoops(int loops) { m_loops = loops; }
int loops() const { return m_loops; }
@@ -96,6 +95,12 @@ public:
void animationClipMarkedDirty() { setDirty(Handler::BlendedClipAnimatorDirty); }
+ qint64 nsSincePreviousFrame(qint64 currentGlobalTimeNS);
+ void setLastGlobalTimeNS(const qint64 &lastGlobalTimeNS);
+
+ double lastLocalTime() const;
+ void setLastLocalTime(double lastLocalTime);
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
Qt3DCore::QNodeId m_blendTreeRootId;
@@ -103,7 +108,9 @@ private:
Qt3DCore::QNodeId m_clockId;
bool m_running;
- qint64 m_startGlobalTime;
+ qint64 m_lastGlobalTimeNS;
+ double m_lastLocalTime;
+
int m_currentLoop;
int m_loops;