aboutsummaryrefslogtreecommitdiffstats
path: root/src/xr/quick3dxr/qquick3dxrhandmodel_p.h
blob: 1bc2cb710eb1853aa6ce1280197b4a9e98ab888d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QQUICK3DXRHANDTRACKERINPUT_H
#define QQUICK3DXRHANDTRACKERINPUT_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QObject>
#include <QVector2D>
#include <QVector3D>
#include <QQuaternion>
#include <QtQml/qqml.h>
#include <private/qquick3dmodel_p.h>

#include <QQuick3DGeometry>
#include <QtQuick3DXr/private/qtquick3dxrglobal_p.h>

QT_BEGIN_NAMESPACE

class QQuick3DXrHandInput;

class QQuick3DXrHandModel : public QQuick3DModel
{
    Q_OBJECT

    Q_PROPERTY(Hand hand READ hand WRITE setHand NOTIFY handChanged FINAL)
    QML_NAMED_ELEMENT(XrHandModel)
    QML_ADDED_IN_VERSION(6, 8)

public:
    enum Hand : quint8 {
        LeftHand = 0,
        RightHand,
        Unknown,
    };
    Q_ENUM(Hand)

    QQuick3DXrHandModel(QQuick3DNode *parent = nullptr);

    void componentComplete() override;

    Hand hand() const;
    void setHand(Hand newHand);

Q_SIGNALS:
    void handChanged();
    void handTrackerChanged();

private Q_SLOTS:
    void updatePose();

private:
    void setupModel();
    QQuick3DXrHandInput *m_handTracker = nullptr;
    bool m_initialized = false;
    Hand m_hand;
};

QT_END_NAMESPACE

#endif // QQUICK3DXRHANDTRACKERINPUT_H