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_ADDITIVECLIPBLEND_P_H |
5 | #define QT3DANIMATION_ANIMATION_ADDITIVECLIPBLEND_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 AdditiveClipBlend : public ClipBlendNode |
27 | { |
28 | public: |
29 | AdditiveClipBlend(); |
30 | ~AdditiveClipBlend(); |
31 | |
32 | inline Qt3DCore::QNodeId baseClipId() const { return m_baseClipId; } |
33 | void setBaseClipId(Qt3DCore::QNodeId baseClipId) { m_baseClipId = baseClipId; } // For unit tests |
34 | |
35 | inline Qt3DCore::QNodeId additiveClipId() const { return m_additiveClipId; } |
36 | void setAdditiveClipId(Qt3DCore::QNodeId additiveClipId) { m_additiveClipId = additiveClipId; } // For unit tests |
37 | |
38 | inline float additiveFactor() const { return m_additiveFactor; } |
39 | void setAdditiveFactor(float additiveFactor) { m_additiveFactor = additiveFactor; } // 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_baseClipId, m_additiveClipId }; |
51 | } |
52 | |
53 | inline double duration() const override |
54 | { |
55 | ClipBlendNode *node = clipBlendNodeManager()->lookupNode(id: m_baseClipId); |
56 | Q_ASSERT(node); |
57 | return node->duration(); |
58 | } |
59 | |
60 | protected: |
61 | ClipResults doBlend(const QList<ClipResults> &blendData) const final; |
62 | |
63 | private: |
64 | Qt3DCore::QNodeId m_baseClipId; |
65 | Qt3DCore::QNodeId m_additiveClipId; |
66 | float m_additiveFactor; |
67 | }; |
68 | |
69 | } // Animation |
70 | |
71 | } // Qt3DAnimation |
72 | |
73 | QT_END_NAMESPACE |
74 | |
75 | #endif // QT3DANIMATION_ANIMATION_ADDITIVECLIPBLEND_P_H |
76 |