1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "clock_p.h"
5#include <Qt3DAnimation/qclock.h>
6#include <Qt3DAnimation/private/qclock_p.h>
7#include <Qt3DAnimation/private/animationutils_p.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace Qt3DAnimation {
12namespace Animation {
13
14Clock::Clock()
15 : BackendNode(ReadOnly)
16 , m_playbackRate(1.f)
17{
18}
19
20void Clock::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
21{
22 BackendNode::syncFromFrontEnd(frontEnd, firstTime);
23 const QClock *node = qobject_cast<const QClock *>(object: frontEnd);
24 if (!node)
25 return;
26
27 if (!qFuzzyCompare(p1: m_playbackRate, p2: node->playbackRate())) {
28 m_playbackRate = node->playbackRate();
29 }
30}
31
32void Clock::cleanup()
33{
34 m_playbackRate = 1.f;
35}
36
37} // namespace Animation
38} // namespace Qt3DAnimation
39
40QT_END_NAMESPACE
41

source code of qt3d/src/animation/backend/clock.cpp