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
qopenxrspaceextension_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QOPENXRSPACEEXTENSION_H
5#define QOPENXRSPACEEXTENSION_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
43
45
47{
49public:
51
52 void initialize(XrInstance instance, XrSession session);
53 void teardown();
54
55 QList<const char*> requiredExtensions() const;
56
57 void handleEvent(const XrEventDataBaseHeader* event);
58
60 bool queryAllAnchors();
61 const QList<QOpenXRSpatialAnchor *> &anchors() const;
62
63 void updateAnchors(XrTime predictedDisplayTime, XrSpace appSpace);
64 QString getSemanticLabels(const XrSpace space);
65 QSet<QUuid> collectRoomLayoutUuids(XrSpace space);
66 QSet<QUuid> collectSpaceContainerUuids(XrSpace space);
67
68 bool isComponentSupported(XrSpace space, XrSpaceComponentTypeFB type);
69 bool isComponentEnabled(XrSpace space, XrSpaceComponentTypeFB type);
70
71 bool getBoundingBox3D(XrSpace space, QVector3D &offset, QVector3D &extent);
72 bool getBoundingBox2D(XrSpace space, QVector2D &offset, QVector2D &extent);
73
77
78private:
81
82 XrInstance m_instance{XR_NULL_HANDLE};
83 XrSession m_session{XR_NULL_HANDLE};
84
85 bool checkXrResult(const XrResult &result);
86
87 bool queryAllAnchorsWithSpecificComponentEnabled(const XrSpaceComponentTypeFB componentType);
88 bool queryAnchorsByUuids(const QSet<QUuid>& uuidSet);
89
90 void addAnchor(XrSpace space, XrUuidEXT uuid);
91
92 // API Wrappers
93 XrResult enumerateSpaceSupportedComponents(XrSpace space,
94 uint32_t componentTypeCapacityInput,
95 uint32_t* componentTypeCountOutput,
96 XrSpaceComponentTypeFB* componentTypes);
97 XrResult getSpaceComponentStatus(XrSpace space,
98 XrSpaceComponentTypeFB componentType,
99 XrSpaceComponentStatusFB* status);
100 XrResult setSpaceComponentStatus(XrSpace space,
101 const XrSpaceComponentStatusSetInfoFB* info,
102 XrAsyncRequestIdFB* requestId);
103 XrResult getSpaceUuid(XrSpace space, XrUuidEXT *uuid);
104 XrResult querySpaces(const XrSpaceQueryInfoBaseHeaderFB* info, XrAsyncRequestIdFB* requestId);
105 XrResult retrieveSpaceQueryResults(XrAsyncRequestIdFB requestId, XrSpaceQueryResultsFB* results);
106 XrResult getSpaceBoundingBox2D(XrSpace space, XrRect2Df* boundingBox2DOutput);
107 XrResult getSpaceBoundingBox3D(XrSpace space, XrRect3DfFB* boundingBox3DOutput);
108 XrResult getSpaceSemanticLabels(XrSpace space, XrSemanticLabelsFB* semanticLabelsOutput);
109 XrResult getSpaceBoundary2D(XrSpace space, XrBoundary2DFB* boundary2DOutput);
110 XrResult getSpaceRoomLayout(XrSpace space, XrRoomLayoutFB* roomLayoutOutput);
111 XrResult getSpaceContainer(XrSpace space, XrSpaceContainerFB* spaceContainerOutput);
112 XrResult requestSceneCapture(const XrSceneCaptureRequestInfoFB* info, XrAsyncRequestIdFB* requestId);
113
114 PFN_xrEnumerateSpaceSupportedComponentsFB xrEnumerateSpaceSupportedComponentsFB = nullptr;
115 PFN_xrGetSpaceComponentStatusFB xrGetSpaceComponentStatusFB = nullptr;
116 PFN_xrSetSpaceComponentStatusFB xrSetSpaceComponentStatusFB = nullptr;
117 PFN_xrGetSpaceUuidFB xrGetSpaceUuidFB = nullptr;
118 PFN_xrQuerySpacesFB xrQuerySpacesFB = nullptr;
119 PFN_xrRetrieveSpaceQueryResultsFB xrRetrieveSpaceQueryResultsFB = nullptr;
120 PFN_xrGetSpaceBoundingBox2DFB xrGetSpaceBoundingBox2DFB = nullptr;
121 PFN_xrGetSpaceBoundingBox3DFB xrGetSpaceBoundingBox3DFB = nullptr;
122 PFN_xrGetSpaceSemanticLabelsFB xrGetSpaceSemanticLabelsFB = nullptr;
123 PFN_xrGetSpaceBoundary2DFB xrGetSpaceBoundary2DFB = nullptr;
124 PFN_xrGetSpaceRoomLayoutFB xrGetSpaceRoomLayoutFB = nullptr;
125 PFN_xrGetSpaceContainerFB xrGetSpaceContainerFB = nullptr;
126 PFN_xrRequestSceneCaptureFB xrRequestSceneCaptureFB = nullptr;
127
128 QList<QOpenXRSpatialAnchor *> m_anchors;
129 QHash<QUuid,QOpenXRSpatialAnchor *> m_anchorsByUuid;
130};
131
133
134#endif // QOPENXRSPACEEXTENSION_H
\inmodule QtCore
Definition qobject.h:103
QSet< QUuid > collectSpaceContainerUuids(XrSpace space)
QList< const char * > requiredExtensions() const
bool getBoundingBox2D(XrSpace space, QVector2D &offset, QVector2D &extent)
bool isComponentSupported(XrSpace space, XrSpaceComponentTypeFB type)
void updateAnchors(XrTime predictedDisplayTime, XrSpace appSpace)
QString getSemanticLabels(const XrSpace space)
void handleEvent(const XrEventDataBaseHeader *event)
const QList< QOpenXRSpatialAnchor * > & anchors() const
bool getBoundingBox3D(XrSpace space, QVector3D &offset, QVector3D &extent)
QSet< QUuid > collectRoomLayoutUuids(XrSpace space)
static QOpenXRSpaceExtension * instance()
void anchorAdded(QOpenXRSpatialAnchor *anchor)
bool isComponentEnabled(XrSpace space, XrSpaceComponentTypeFB type)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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
struct _cl_event * event
GLuint64EXT * result
[6]
#define Q_OBJECT
#define Q_SIGNALS
QHostInfo info
[0]