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 | #ifndef QT3DANIMATION_ANIMATION_LERPCLIPBLEND_P_H |
5 | #define QT3DANIMATION_ANIMATION_LERPCLIPBLEND_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DAnimation/private/clipblendnode_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | namespace Qt3DAnimation { |
23 | |
24 | namespace Animation { |
25 | |
26 | class Q_AUTOTEST_EXPORT LerpClipBlend : public ClipBlendNode |
27 | { |
28 | public: |
29 | LerpClipBlend(); |
30 | ~LerpClipBlend(); |
31 | |
32 | inline float blendFactor() const { return m_blendFactor; } |
33 | void setBlendFactor(float blendFactor) { m_blendFactor = blendFactor; } // For unit tests |
34 | |
35 | inline Qt3DCore::QNodeId startClipId() const { return m_startClipId; } |
36 | void setStartClipId(Qt3DCore::QNodeId startClipId) { m_startClipId = startClipId; } // For unit tests |
37 | |
38 | inline Qt3DCore::QNodeId endClipId() const { return m_endClipId; } |
39 | void setEndClipId(Qt3DCore::QNodeId endClipId) { m_endClipId = endClipId; } // For unit tests |
40 | |
41 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) final; |
42 | |
43 | inline QList<Qt3DCore::QNodeId> allDependencyIds() const override |
44 | { |
45 | return currentDependencyIds(); |
46 | } |
47 | |
48 | inline QList<Qt3DCore::QNodeId> currentDependencyIds() const override |
49 | { |
50 | return { m_startClipId, m_endClipId }; |
51 | } |
52 | |
53 | double duration() const override; |
54 | |
55 | protected: |
56 | ClipResults doBlend(const QList<ClipResults> &blendData) const final; |
57 | |
58 | private: |
59 | Qt3DCore::QNodeId m_startClipId; |
60 | Qt3DCore::QNodeId m_endClipId; |
61 | float m_blendFactor; |
62 | }; |
63 | |
64 | } // Animation |
65 | |
66 | } // Qt3DAnimation |
67 | |
68 | QT_END_NAMESPACE |
69 | |
70 | #endif // QT3DANIMATION_ANIMATION_LERPCLIPBLEND_P_H |
71 | |