Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dxrinputmanager_visionos_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DXINPUTMANAGER_VISIONOS_P_H
5#define QQUICK3DXINPUTMANAGER_VISIONOS_P_H
6
7#include <QtQuick3DXr/private/qtquick3dxrglobal_p.h>
8
9#include <QtGui/qquaternion.h>
10
11#ifdef __OBJC__
12#import <ARKit/ARKit.h>
13#else
15typedef struct ar_hand_tracking_provider_s *ar_hand_tracking_provider_t;
16typedef struct ar_data_providers_s *ar_data_providers_t;
17#endif
18
19//
20// W A R N I N G
21// -------------
22//
23// This file is not part of the Qt API. It exists purely as an
24// implementation detail. This header file may change from version to
25// version without notice, or even be removed.
26//
27// We mean it.
28//
29
30QT_BEGIN_NAMESPACE
31
32class QQuick3DXrHandInput;
35class QQuick3DXrController;
36class QQuick3DViewport;
37
39{
40 Q_DECLARE_PUBLIC(QQuick3DXrInputManager)
41public:
44
47
48 // Two step process
49 // 1.
50 void prepareHandtracking(ar_data_providers_t dataProviders);
51 // 2.
52 void initHandtracking();
53
54 void teardown();
55
56 bool isValid() const { return m_initialized; }
57
59
60 void setPosePositionAndRotation(Hand hand, HandPoseSpace poseSpace, const QVector3D &position, const QQuaternion &rotation);
61
62 void registerController(QQuick3DXrController *controller);
63 void unregisterController(QQuick3DXrController *controller);
64
65 bool isPoseInUse(Hand hand, HandPoseSpace poseSpace);
66
69
71
73
74 void updateHandtracking();
75
76 static void processSpatialEvents(const QQuick3DViewport &vrViewport, const QJsonObject &events);
77
78private:
79 QQuick3DXrInputManager *q_ptr = nullptr;
80 QQuick3DXrHandInput *m_handInputState[2] {};
81
82 QSet<QQuick3DXrController *> m_controllers;
83 bool m_poseInUse[2][2] = {};
84 bool m_poseUsageDirty = true;
85
86 ar_hand_tracking_provider_t m_handTrackingProvider;
87 ar_hand_anchor_t m_handAnchors[2] {};
88
89 bool m_isHandTrackingSupported = false;
90 bool m_initialized = false;
91
92 struct JointCache {
93 QList<QVector3D> positions;
94 QList<QQuaternion> rotations;
95 } jcache[2];
96};
97
98QT_END_NAMESPACE
99
100#endif // QQUICK3DXINPUTMANAGER_VISIONOS_P_H
QtQuick3DXr::XrSpaceId getCurrentSpaceId() const
void updateAnchor(QQuick3DXrSpatialAnchor *anchor)
void anchorRemoved(QUuid uuid)
const QList< QQuick3DXrSpatialAnchor * > & anchors() const
void addAnchor(QQuick3DXrSpatialAnchor *anchor)
bool getBoundingBox2D(QtQuick3DXr::XrSpaceId space, QVector2D &offset, QVector2D &extent)
void anchorUpdated(QQuick3DXrSpatialAnchor *anchor)
bool setupSpatialAnchor(QtQuick3DXr::XrSpaceId space, QQuick3DXrSpatialAnchor &anchor)
bool getBoundingBox3D(QtQuick3DXr::XrSpaceId space, QVector3D &offset, QVector3D &extent)
static void processSpatialEvents(const QQuick3DViewport &vrViewport, const QJsonObject &events)
bool isPoseInUse(Hand hand, HandPoseSpace poseSpace)
void prepareHandtracking(ar_data_providers_t dataProviders)
void setPosePositionAndRotation(Hand hand, HandPoseSpace poseSpace, const QVector3D &position, const QQuaternion &rotation)
QQuick3DXrHandInput * rightHandInput() const
static QQuick3DXrInputManagerPrivate * get(QQuick3DXrInputManager *inputManager)
QQuick3DXrInputManagerPrivate(QQuick3DXrInputManager &manager)
void setupHandModel(QQuick3DXrHandModel *model)
void registerController(QQuick3DXrController *controller)
QQuick3DXrHandInput * leftHandInput() const
void unregisterController(QQuick3DXrController *controller)
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
static const AnchorClassificationMap & getAnchorClassificationName(ar_plane_classification_t classification, bool *identified=nullptr)
static const AnchorClassificationMap anchorClassificationMap[]
static constexpr size_t anchorClassificationStart
static void updateAnchorProperties(QQuick3DXrSpatialAnchor &anchor, ar_plane_anchor_t planeAnchor)
struct ar_data_providers_s * ar_data_providers_t
struct ar_plane_anchors_s * ar_plane_anchors_t
struct ar_plane_detection_provider_s * ar_plane_detection_provider_t
struct ar_hand_tracking_provider_s * ar_hand_tracking_provider_t
struct ar_hand_anchor_s * ar_hand_anchor_t
QQuick3DXrSpatialAnchor::Classification label