1 | // Copyright (C) 2024 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICK3DXRHANDTRACKERINPUT_H |
5 | #define QQUICK3DXRHANDTRACKERINPUT_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 <QObject> |
19 | #include <QVector2D> |
20 | #include <QVector3D> |
21 | #include <QQuaternion> |
22 | #include <QtQml/qqml.h> |
23 | #include <private/qquick3dmodel_p.h> |
24 | |
25 | #include <QQuick3DGeometry> |
26 | #include <QtQuick3DXr/private/qtquick3dxrglobal_p.h> |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class QQuick3DXrHandInput; |
31 | |
32 | class QQuick3DXrHandModel : public QQuick3DModel |
33 | { |
34 | Q_OBJECT |
35 | |
36 | Q_PROPERTY(Hand hand READ hand WRITE setHand NOTIFY handChanged FINAL) |
37 | QML_NAMED_ELEMENT(XrHandModel) |
38 | QML_ADDED_IN_VERSION(6, 8) |
39 | |
40 | public: |
41 | enum Hand : quint8 { |
42 | LeftHand = 0, |
43 | RightHand, |
44 | Unknown, |
45 | }; |
46 | Q_ENUM(Hand) |
47 | |
48 | QQuick3DXrHandModel(QQuick3DNode *parent = nullptr); |
49 | |
50 | void componentComplete() override; |
51 | |
52 | Hand hand() const; |
53 | void setHand(Hand newHand); |
54 | |
55 | Q_SIGNALS: |
56 | void handChanged(); |
57 | void handTrackerChanged(); |
58 | |
59 | private Q_SLOTS: |
60 | void updatePose(); |
61 | |
62 | private: |
63 | void setupModel(); |
64 | QQuick3DXrHandInput *m_handTracker = nullptr; |
65 | bool m_initialized = false; |
66 | Hand m_hand; |
67 | }; |
68 | |
69 | QT_END_NAMESPACE |
70 | |
71 | #endif // QQUICK3DXRHANDTRACKERINPUT_H |
72 | |