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// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DXRANCHORMANAGER_VISIONOS_P_H
7#define QQUICK3DXRANCHORMANAGER_VISIONOS_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DXr/private/qtquick3dxrglobal_p.h>
21
22#include <QtCore/quuid.h>
23
24#ifdef __OBJC__
25#import <ARKit/ARKit.h>
26#else
27typedef struct ar_data_providers_s *ar_data_providers_t;
28typedef struct ar_plane_detection_provider_s *ar_plane_detection_provider_t;
29typedef struct ar_plane_anchors_s *ar_plane_anchors_t;
30#endif
31
32QT_BEGIN_NAMESPACE
33
34class QVector2D;
35class QVector3D;
36
38
40{
42public:
44
45 // Note: There's only one "space" in the VisionOS world, so we always return 1 (0 equals invalid).
46 QtQuick3DXr::XrSpaceId getCurrentSpaceId() const { return QtQuick3DXr::XrSpaceId(1); }
47
50
51 void teardown();
52
55
56 bool getBoundingBox3D(QtQuick3DXr::XrSpaceId space, QVector3D &offset, QVector3D &extent);
57 bool getBoundingBox2D(QtQuick3DXr::XrSpaceId space, QVector2D &offset, QVector2D &extent);
58
59 bool setupSpatialAnchor(QtQuick3DXr::XrSpaceId space, QQuick3DXrSpatialAnchor &anchor);
60
62 void removeAnchor(QUuid uuid);
64
66
69 void anchorRemoved(QUuid uuid);
71
73
74private:
76
77 explicit QQuick3DXrAnchorManager(QObject *parent = nullptr);
78 ~QQuick3DXrAnchorManager() override;
79
80 void prepareAnchorManager(ar_data_providers_t dataProviders);
81 void initAnchorManager();
82
83 static void planeUpdateHandler(void *, ar_plane_anchors_t, ar_plane_anchors_t, ar_plane_anchors_t);
84
85 ar_plane_detection_provider_t m_planeDetectionProvider;
86
87 mutable QReadWriteLock m_anchorsLock;
88 QList<QQuick3DXrSpatialAnchor *> m_anchors;
89 QHash<QUuid, QQuick3DXrSpatialAnchor *> m_anchorsByUuid;
90
91 enum class AnchorType {
92 Plane,
93 };
94
95 AnchorType m_requestedAnchorType = AnchorType::Plane;
96
97 bool m_isInitialized = false;
98 bool m_isPlaneDetectionSupported = false;
99};
100
101QT_END_NAMESPACE
102
103#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
Combined button and popup list for selecting options.
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