| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICK3DXRHANDINPUT_P_H |
| 5 | #define QQUICK3DXRHANDINPUT_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 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 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QQuick3DXrHandInput : public QObject |
| 27 | { |
| 28 | Q_OBJECT |
| 29 | |
| 30 | public: |
| 31 | enum class HandPoseSpace { |
| 32 | GripPose, |
| 33 | AimPose |
| 34 | }; |
| 35 | Q_ENUM(HandPoseSpace) |
| 36 | |
| 37 | |
| 38 | explicit QQuick3DXrHandInput(QObject *parent = nullptr); |
| 39 | |
| 40 | bool isActive() const; |
| 41 | void setIsActive(bool isActive); |
| 42 | |
| 43 | void setJointPositionsAndRotations(const QList<QVector3D> &newJointPositions, const QList<QQuaternion> &newJointRotations); |
| 44 | |
| 45 | QList<QVector3D> jointPositions() const; |
| 46 | |
| 47 | QList<QQuaternion> jointRotations() const; |
| 48 | |
| 49 | QVector3D pokePosition() const; |
| 50 | void setPokePosition(const QVector3D &newPokePosition); |
| 51 | |
| 52 | bool isHandTrackingActive() const; |
| 53 | void setIsHandTrackingActive(bool newIsHandTracking); |
| 54 | |
| 55 | Q_SIGNALS: |
| 56 | void isActiveChanged(); |
| 57 | |
| 58 | void poseSpaceChanged(); |
| 59 | void posePositionChanged(); |
| 60 | void poseRotationChanged(); |
| 61 | |
| 62 | void jointPositionsChanged(); |
| 63 | void jointRotationsChanged(); |
| 64 | void jointDataUpdated(); |
| 65 | |
| 66 | void pokePositionChanged(); |
| 67 | void isHandTrackingChanged(); |
| 68 | |
| 69 | private: |
| 70 | bool m_isActive = false; |
| 71 | |
| 72 | QList<QVector3D> m_jointPositions; |
| 73 | QList<QQuaternion> m_jointRotations; |
| 74 | QVector3D m_pokePosition; |
| 75 | bool m_isHandTracking; |
| 76 | }; |
| 77 | |
| 78 | QT_END_NAMESPACE |
| 79 | |
| 80 | #endif // QQUICK3DXRHANDINPUT_P_H |
| 81 | |