Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquick3dxranchormanager_openxr_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_OPENXR_P_H
5#define QQUICK3DXRANCHORMANAGER_OPENXR_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 <openxr/openxr.h>
19
20#if __has_include(<openxr/fb_spatial_entity.h>) && __has_include(<openxr/fb_scene.h>)
21#include <openxr/fb_spatial_entity.h>
22#if __has_include(<openxr/fb_spatial_entity_query.h>) && __has_include(<openxr/fb_spatial_entity_storage.h>) && __has_include(<openxr/fb_spatial_entity_container.h>)
23#include <openxr/fb_spatial_entity_query.h>
24#include <openxr/fb_spatial_entity_storage.h>
25#include <openxr/fb_spatial_entity_container.h>
26#endif
27#include <openxr/fb_scene.h>
28#if __has_include(<openxr/fb_scene_capture.h>)
29#include <openxr/fb_scene_capture.h>
30#endif
31#endif
32// Otherwise, these may be all provided in openxr.h, if it is new enough, no
33// need for the Mobile SDK specific headers anymore. If that's not the case
34// (too old openxr.h), compilation will fail.
35
36#include <QList>
37#include <QSet>
38#include <QUuid>
39
40#include <QObject>
41
42#include <QtQuick3DXr/private/qtquick3dxrglobal_p.h>
43
45
47
49{
51public:
53
54 void initialize(XrInstance instance, XrSession session);
55 void teardown();
56
57 QList<const char*> requiredExtensions() const;
58
59 void handleEvent(const XrEventDataBaseHeader* event);
60
62 bool queryAllAnchors();
63 const QList<QQuick3DXrSpatialAnchor *> &anchors() const;
64 qsizetype anchorCount() const;
65
66 void updateAnchors(XrTime predictedDisplayTime, XrSpace appSpace);
67 QString getSemanticLabels(const XrSpace space);
68 QSet<QUuid> collectRoomLayoutUuids(XrSpace space);
69 QSet<QUuid> collectSpaceContainerUuids(XrSpace space);
70
71 bool isComponentSupported(XrSpace space, XrSpaceComponentTypeFB type);
72 bool isComponentEnabled(XrSpace space, XrSpaceComponentTypeFB type);
73
74 bool getBoundingBox3D(XrSpace space, QVector3D &offset, QVector3D &extent);
75 bool getBoundingBox2D(XrSpace space, QVector2D &offset, QVector2D &extent);
76
77 bool setupSpatialAnchor(XrSpace space, QQuick3DXrSpatialAnchor &anchor);
78
81 void anchorRemoved(QUuid uuid);
84
85private:
88
89 XrInstance m_instance{XR_NULL_HANDLE};
90 XrSession m_session{XR_NULL_HANDLE};
91
92 [[nodiscard]] bool checkXrResult(const XrResult &result);
93 bool resolveXrFunction(const char *name, PFN_xrVoidFunction *function);
94
95 bool queryAllAnchorsWithSpecificComponentEnabled(const XrSpaceComponentTypeFB componentType);
96 bool queryAnchorsByUuids(const QSet<QUuid>& uuidSet);
97
98 void addAnchor(XrSpace space, XrUuidEXT uuid);
99
100 // API Wrappers
101 XrResult enumerateSpaceSupportedComponents(XrSpace space,
102 uint32_t componentTypeCapacityInput,
103 uint32_t* componentTypeCountOutput,
104 XrSpaceComponentTypeFB* componentTypes);
105 XrResult getSpaceComponentStatus(XrSpace space,
106 XrSpaceComponentTypeFB componentType,
107 XrSpaceComponentStatusFB* status);
108 XrResult setSpaceComponentStatus(XrSpace space,
109 const XrSpaceComponentStatusSetInfoFB* info,
110 XrAsyncRequestIdFB* requestId);
111 XrResult getSpaceUuid(XrSpace space, XrUuidEXT *uuid);
112 XrResult querySpaces(const XrSpaceQueryInfoBaseHeaderFB* info, XrAsyncRequestIdFB* requestId);
113 XrResult retrieveSpaceQueryResults(XrAsyncRequestIdFB requestId, XrSpaceQueryResultsFB* results);
114 XrResult getSpaceBoundingBox2D(XrSpace space, XrRect2Df* boundingBox2DOutput);
115 XrResult getSpaceBoundingBox3D(XrSpace space, XrRect3DfFB* boundingBox3DOutput);
116 XrResult getSpaceSemanticLabels(XrSpace space, XrSemanticLabelsFB* semanticLabelsOutput);
117 XrResult getSpaceBoundary2D(XrSpace space, XrBoundary2DFB* boundary2DOutput);
118 XrResult getSpaceRoomLayout(XrSpace space, XrRoomLayoutFB* roomLayoutOutput);
119 XrResult getSpaceContainer(XrSpace space, XrSpaceContainerFB* spaceContainerOutput);
120 XrResult requestSceneCapture(const XrSceneCaptureRequestInfoFB* info, XrAsyncRequestIdFB* requestId);
121
122 PFN_xrEnumerateSpaceSupportedComponentsFB xrEnumerateSpaceSupportedComponentsFB = nullptr;
123 PFN_xrGetSpaceComponentStatusFB xrGetSpaceComponentStatusFB = nullptr;
124 PFN_xrSetSpaceComponentStatusFB xrSetSpaceComponentStatusFB = nullptr;
125 PFN_xrGetSpaceUuidFB xrGetSpaceUuidFB = nullptr;
126 PFN_xrQuerySpacesFB xrQuerySpacesFB = nullptr;
127 PFN_xrRetrieveSpaceQueryResultsFB xrRetrieveSpaceQueryResultsFB = nullptr;
128 PFN_xrGetSpaceBoundingBox2DFB xrGetSpaceBoundingBox2DFB = nullptr;
129 PFN_xrGetSpaceBoundingBox3DFB xrGetSpaceBoundingBox3DFB = nullptr;
130 PFN_xrGetSpaceSemanticLabelsFB xrGetSpaceSemanticLabelsFB = nullptr;
131 PFN_xrGetSpaceBoundary2DFB xrGetSpaceBoundary2DFB = nullptr;
132 PFN_xrGetSpaceRoomLayoutFB xrGetSpaceRoomLayoutFB = nullptr;
133 PFN_xrGetSpaceContainerFB xrGetSpaceContainerFB = nullptr;
134 PFN_xrRequestSceneCaptureFB xrRequestSceneCaptureFB = nullptr;
135
136 QList<QQuick3DXrSpatialAnchor *> m_anchors;
137 QHash<QUuid,QQuick3DXrSpatialAnchor *> m_anchorsByUuid;
138};
139
141
142#endif // QQUICK3DXRANCHORMANAGER_OPENXR_P_H
\inmodule QtCore
Definition qobject.h:103
static QQuick3DXrAnchorManager * instance()
QList< const char * > requiredExtensions() const
void anchorRemoved(QUuid uuid)
bool getBoundingBox2D(XrSpace space, QVector2D &offset, QVector2D &extent)
const QList< QQuick3DXrSpatialAnchor * > & anchors() const
bool isComponentEnabled(XrSpace space, XrSpaceComponentTypeFB type)
bool getBoundingBox3D(XrSpace space, QVector3D &offset, QVector3D &extent)
void updateAnchors(XrTime predictedDisplayTime, XrSpace appSpace)
void handleEvent(const XrEventDataBaseHeader *event)
void anchorAdded(QQuick3DXrSpatialAnchor *anchor)
bool isComponentSupported(XrSpace space, XrSpaceComponentTypeFB type)
bool setupSpatialAnchor(XrSpace space, QQuick3DXrSpatialAnchor &anchor)
void anchorUpdated(QQuick3DXrSpatialAnchor *anchor)
QSet< QUuid > collectRoomLayoutUuids(XrSpace space)
QString getSemanticLabels(const XrSpace space)
QSet< QUuid > collectSpaceContainerUuids(XrSpace space)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition quuid.h:32
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 bool initialize()
Definition qctf.cpp:94
QNearFieldTarget::RequestId requestId
GLenum type
GLenum GLuint GLintptr offset
GLuint name
struct _cl_event * event
GLuint64EXT * result
[6]
#define Q_OBJECT
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
QHostInfo info
[0]