1 | // Copyright (C) 2020 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICK3DQUATERNIONUTILS_H |
5 | #define QQUICK3DQUATERNIONUTILS_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 <QtQuick3D/private/qtquick3dglobal_p.h> |
19 | |
20 | #include <QtCore/QObject> |
21 | #include <QtGui/QQuaternion> |
22 | #include <QtGui/QVector3D> |
23 | #include <QtQml/qqml.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class Q_QUICK3D_EXPORT QQuick3DQuaternionUtils : public QObject |
28 | { |
29 | Q_OBJECT |
30 | |
31 | QML_NAMED_ELEMENT(Quaternion) |
32 | QML_SINGLETON |
33 | |
34 | public: |
35 | explicit QQuick3DQuaternionUtils(QObject *parent = nullptr); |
36 | |
37 | Q_INVOKABLE static QQuaternion fromAxesAndAngles(const QVector3D &axis1, |
38 | float angle1, |
39 | const QVector3D &axis2, |
40 | float angle2, |
41 | const QVector3D &axis3, |
42 | float angle3); |
43 | Q_INVOKABLE static QQuaternion fromAxesAndAngles(const QVector3D &axis1, |
44 | float angle1, |
45 | const QVector3D &axis2, |
46 | float angle2); |
47 | Q_INVOKABLE static QQuaternion fromAxisAndAngle(float x, float y, float z, float angle); |
48 | Q_INVOKABLE static QQuaternion fromAxisAndAngle(const QVector3D &axis, float angle); |
49 | Q_INVOKABLE static QQuaternion fromEulerAngles(float x, float y, float z); |
50 | Q_INVOKABLE static QQuaternion fromEulerAngles(const QVector3D &eulerAngles); |
51 | |
52 | Q_INVOKABLE static QQuaternion lookAt(const QVector3D &sourcePosition, |
53 | const QVector3D &targetPosition, |
54 | const QVector3D &forwardDirection = QVector3D(0, 0, -1), |
55 | const QVector3D &upDirection = QVector3D(0, 1, 0)); |
56 | |
57 | }; |
58 | |
59 | QT_END_NAMESPACE |
60 | |
61 | #endif // QQUICK3DQUATERNIONUTILS_H |
62 | |