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 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | namespace Qt3DAnimation { |
12 | namespace Animation { |
13 | |
14 | Clock::Clock() |
15 | : BackendNode(ReadOnly) |
16 | , m_playbackRate(1.f) |
17 | { |
18 | } |
19 | |
20 | void 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 | |
32 | void Clock::cleanup() |
33 | { |
34 | m_playbackRate = 1.f; |
35 | } |
36 | |
37 | } // namespace Animation |
38 | } // namespace Qt3DAnimation |
39 | |
40 | QT_END_NAMESPACE |
41 |