42 Q_PROPERTY(QQuick3DXrOrigin *xrOrigin READ xrOrigin WRITE setXROrigin NOTIFY xrOriginChanged)
43 Q_PROPERTY(QQuick3DSceneEnvironment *environment READ environment WRITE setEnvironment NOTIFY environmentChanged)
44 Q_PROPERTY(
bool passthroughSupported READ passthroughSupported CONSTANT)
45 Q_PROPERTY(
bool passthroughEnabled READ passthroughEnabled WRITE setPassthroughEnabled NOTIFY passthroughEnabledChanged FINAL)
46 Q_PROPERTY(QQuick3DXrRuntimeInfo *runtimeInfo READ runtimeInfo CONSTANT)
47 Q_PROPERTY(
bool quitOnSessionEnd READ isQuitOnSessionEndEnabled WRITE setQuitOnSessionEnd NOTIFY quitOnSessionEndChanged FINAL)
48 Q_PROPERTY(QQuick3DRenderStats *renderStats READ renderStats CONSTANT)
49 Q_PROPERTY(FoveationLevel fixedFoveation READ fixedFoveation WRITE setFixedFoveation NOTIFY fixedFoveationChanged FINAL)
50 Q_PROPERTY(ReferenceSpace referenceSpace READ referenceSpace WRITE setReferenceSpace NOTIFY referenceSpaceChanged FINAL)
51 Q_PROPERTY(
bool depthSubmissionEnabled READ depthSubmissionEnabled WRITE setDepthSubmissionEnabled NOTIFY depthSubmissionEnabledChanged FINAL)
52 Q_PROPERTY(
bool multiViewRenderingSupported READ isMultiViewRenderingSupported CONSTANT)
53 Q_PROPERTY(
bool multiViewRenderingEnabled READ multiViewRenderingEnabled NOTIFY multiViewRenderingEnabledChanged FINAL)
54 QML_NAMED_ELEMENT(XrView)
55 QML_ADDED_IN_VERSION(6, 8)
64 Q_ENUM(FoveationLevel)
66 enum class ReferenceSpace {
67 ReferenceSpaceUnknown,
70 ReferenceSpaceLocalFloor
72 Q_ENUM(ReferenceSpace)
74 using TouchTarget = std::variant<std::monostate, QQuick3DXrItem*, QQuick3DModel*>;
81 qreal touchDistance = 1e6;
86 QVector3D surfacePoint;
91 explicit QQuick3DXrView();
94 QQuick3DXrOrigin *xrOrigin()
const;
95 QQuick3DSceneEnvironment *environment()
const;
97 bool passthroughSupported()
const;
98 bool passthroughEnabled()
const;
100 FoveationLevel fixedFoveation()
const;
101 void setFixedFoveation(FoveationLevel level);
103 QQuick3DXrRuntimeInfo *runtimeInfo()
const;
105 bool isQuitOnSessionEndEnabled()
const;
107 QQuick3DRenderStats *renderStats()
const;
109 Q_INVOKABLE QQuick3DPickResult rayPick(
const QVector3D &origin,
const QVector3D &direction)
const;
110 Q_INVOKABLE QList<QQuick3DPickResult> rayPickAll(
const QVector3D &origin,
const QVector3D &direction)
const;
111 Q_REVISION(6, 11) Q_INVOKABLE QQuick3DPickResult rayPick(
const QVector3D &origin,
const QVector3D &direction, QQuick3DModel *model)
const;
112 Q_REVISION(6, 11) Q_INVOKABLE QQuick3DPickResult closestPointPick(
const QVector3D &origin,
float radius, QQuick3DModel *model =
nullptr)
const;
114 Q_INVOKABLE
void setTouchpoint(QQuickItem *target,
const QPointF &position,
int pointId,
bool active);
115 Q_INVOKABLE QVector3D processTouch(
const QVector3D &pos,
int pointId);
116 Q_INVOKABLE QVariantMap touchpointState(
int pointId)
const;
118 ReferenceSpace referenceSpace()
const;
119 void setReferenceSpace(ReferenceSpace newReferenceSpace);
121 bool depthSubmissionEnabled()
const;
123 void registerXrItem(QQuick3DXrItem *newXrItem);
124 void unregisterXrItem(QQuick3DXrItem *xrItem);
126 bool isMultiViewRenderingSupported()
const;
127 bool multiViewRenderingEnabled()
const;
129 QQuick3DXrManager *xrManager() {
return &m_xrManager; }
132 void setEnvironment(QQuick3DSceneEnvironment * environment);
133 void setPassthroughEnabled(
bool enable);
134 void setQuitOnSessionEnd(
bool enable);
135 void setDepthSubmissionEnabled(
bool enable);
136 void setXROrigin(QQuick3DXrOrigin *newXrOrigin);
139 void updateViewportGeometry();
140 void handleSessionEnded();
141 void handleClearColorChanged();
142 void handleAAChanged();
146 void initializeFailed(
const QString &errorString);
148 void xrOriginChanged();
149 void environmentChanged(QQuick3DSceneEnvironment * environment);
150 void passthroughEnabledChanged();
151 void quitOnSessionEndChanged();
152 void fixedFoveationChanged();
154 void referenceSpaceChanged();
155 void depthSubmissionEnabledChanged();
156 void multiViewRenderingEnabledChanged();
159 friend class QQuick3DXrViewPrivate;
161 QQuick3DViewport *view3d()
const;
163 bool handleVirtualTouch(TouchTarget target,
const QVector3D &pos, TouchState *touchState, QVector3D *offset);
165 QPointer<QQuick3DSceneEnvironment> m_pendingSceneEnvironment;
166 QQuick3DXrManager m_xrManager;
167 mutable QQuick3DXrRuntimeInfo m_xrRuntimeInfo;
168 bool m_quitOnSessionEnd =
true;
169 bool m_inDestructor =
false;
170 bool m_isInitialized =
false;
172 friend class QQuick3DXrVirtualMouse;
173 QList<QQuick3DXrItem *> m_xrItems;
174 struct XrTouchStates;
175 XrTouchStates *m_touchStates =
nullptr;
176 QQuick3DXrOrigin *m_xrOrigin =
nullptr;