1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DQUATERNIONANIMATION_H
5#define QQUICK3DQUATERNIONANIMATION_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 purely as an
12// implementation detail. 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 <QtGui/qquaternion.h>
19
20#include <QtQuick3D/private/qquick3dobject_p.h>
21#include <QtQuick/private/qquickanimation_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuick3DQuaternionAnimationPrivate;
26
27class Q_QUICK3D_EXPORT QQuick3DQuaternionAnimation : public QQuickPropertyAnimation
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QQuick3DQuaternionAnimation)
31 Q_PROPERTY(QQuaternion from READ from WRITE setFrom)
32 Q_PROPERTY(QQuaternion to READ to WRITE setTo)
33 Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged)
34
35 Q_PROPERTY(float fromXRotation READ fromXRotation WRITE setFromXRotation NOTIFY fromXRotationChanged)
36 Q_PROPERTY(float fromYRotation READ fromYRotation WRITE setFromYRotation NOTIFY fromYRotationChanged)
37 Q_PROPERTY(float fromZRotation READ fromZRotation WRITE setFromZRotation NOTIFY fromZRotationChanged)
38 Q_PROPERTY(float toXRotation READ toXRotation WRITE setToXRotation NOTIFY toXRotationChanged)
39 Q_PROPERTY(float toYRotation READ toYRotation WRITE setToYRotation NOTIFY toYRotationChanged)
40 Q_PROPERTY(float toZRotation READ toZRotation WRITE setToZRotation NOTIFY toZRotationChanged)
41
42 QML_NAMED_ELEMENT(QuaternionAnimation)
43
44public:
45 enum Type {
46 Slerp = 0,
47 Nlerp
48 };
49 Q_ENUM(Type)
50
51 QQuick3DQuaternionAnimation(QObject *parent = nullptr);
52
53 QQuaternion from() const;
54 void setFrom(const QQuaternion &f);
55
56 QQuaternion to() const;
57 void setTo(const QQuaternion &t);
58
59 Type type() const;
60 void setType(Type type);
61
62 float fromXRotation() const;
63 void setFromXRotation(float f);
64
65 float fromYRotation() const;
66 void setFromYRotation(float f);
67
68 float fromZRotation() const;
69 void setFromZRotation(float f);
70
71 float toXRotation() const;
72 void setToXRotation(float f);
73
74 float toYRotation() const;
75 void setToYRotation(float f);
76
77 float toZRotation() const;
78 void setToZRotation(float f);
79
80Q_SIGNALS:
81 void typeChanged(QQuick3DQuaternionAnimation::Type type);
82 void fromXRotationChanged(float value);
83 void fromYRotationChanged(float value);
84 void fromZRotationChanged(float value);
85 void toXRotationChanged(float value);
86 void toYRotationChanged(float value);
87 void toZRotationChanged(float value);
88};
89
90Q_QUICK3D_EXPORT QVariant q_quaternionInterpolator(const QQuaternion &from, const QQuaternion &to, qreal progress);
91
92QT_END_NAMESPACE
93
94#endif // QQUICK3DQUATERNIONANIMATION_H
95

source code of qtquick3d/src/quick3d/qquick3dquaternionanimation_p.h