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
qquick3dxranchormanager_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 QQUICK3DXRANCHORMANAGER_VISIONOS_P_H
5#define QQUICK3DXRANCHORMANAGER_VISIONOS_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 <QtQuick3DXr/private/qtquick3dxrglobal_p.h>
19
20#include <QtCore/quuid.h>
21
22#ifdef __OBJC__
23#import <ARKit/ARKit.h>
24#else
25typedef struct ar_data_providers_s *ar_data_providers_t;
26typedef struct ar_plane_detection_provider_s *ar_plane_detection_provider_t;
27typedef struct ar_plane_anchors_s *ar_plane_anchors_t;
28#endif
29
30QT_BEGIN_NAMESPACE
31
32class QVector2D;
33class QVector3D;
34
36
38{
40public:
42
43 // Note: There's only one "space" in the VisionOS world, so we always return 1 (0 equals invalid).
44 QtQuick3DXr::XrSpaceId getCurrentSpaceId() const { return QtQuick3DXr::XrSpaceId(1); }
45
48
49 void teardown();
50
53
54 bool getBoundingBox3D(QtQuick3DXr::XrSpaceId space, QVector3D &offset, QVector3D &extent);
55 bool getBoundingBox2D(QtQuick3DXr::XrSpaceId space, QVector2D &offset, QVector2D &extent);
56
57 bool setupSpatialAnchor(QtQuick3DXr::XrSpaceId space, QQuick3DXrSpatialAnchor &anchor);
58
60 void removeAnchor(QUuid uuid);
62
64
67 void anchorRemoved(QUuid uuid);
69
71
72private:
74
75 explicit QQuick3DXrAnchorManager(QObject *parent = nullptr);
76 ~QQuick3DXrAnchorManager() override;
77
78 void prepareAnchorManager(ar_data_providers_t dataProviders);
79 void initAnchorManager();
80
81 static void planeUpdateHandler(void *, ar_plane_anchors_t, ar_plane_anchors_t, ar_plane_anchors_t);
82
83 ar_plane_detection_provider_t m_planeDetectionProvider;
84
85 mutable QReadWriteLock m_anchorsLock;
86 QList<QQuick3DXrSpatialAnchor *> m_anchors;
87 QHash<QUuid, QQuick3DXrSpatialAnchor *> m_anchorsByUuid;
88
89 enum class AnchorType {
90 Plane,
91 };
92
93 AnchorType m_requestedAnchorType = AnchorType::Plane;
94
95 bool m_isInitialized = false;
96 bool m_isPlaneDetectionSupported = false;
97};
98
99QT_END_NAMESPACE
100
101#endif // QQUICK3DXRANCHORMANAGER_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)
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
QQuick3DXrSpatialAnchor::Classification label