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
qquick3dxrview_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 QQUICK3DXRVIEW_P_H
5#define QQUICK3DXRVIEW_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
19#include <QtCore/QObject>
20#include <QtQml/QQmlEngine>
21#include <QtQml/qqml.h>
22
23#include <QtQuick3D/private/qquick3dviewport_p.h>
24#include <QtQuick3D/private/qquick3dnode_p.h>
25#include <QtQuick3D/private/qquick3dsceneenvironment_p.h>
26#include <QtQuick3D/private/qquick3dpickresult_p.h>
27
28#include <QtQuick3DXr/private/qquick3dxrmanager_p.h>
29#include <QtQuick3DXr/private/qquick3dxrorigin_p.h>
30#include <QtQuick3DXr/private/qquick3dxrruntimeinfo_p.h>
31
33
34class QQuick3DXrItem;
35
36class Q_QUICK3DXR_EXPORT QQuick3DXrView : public QQuick3DNode
37{
39
40 Q_PROPERTY(QQuick3DXrOrigin *xrOrigin READ xrOrigin NOTIFY xrOriginChanged)
41 Q_PROPERTY(QQuick3DSceneEnvironment *environment READ environment WRITE setEnvironment NOTIFY environmentChanged)
42 Q_PROPERTY(bool passthroughSupported READ passthroughSupported CONSTANT)
43 Q_PROPERTY(bool passthroughEnabled READ passthroughEnabled WRITE setPassthroughEnabled NOTIFY passthroughEnabledChanged FINAL)
44 Q_PROPERTY(QOpenXRRuntimeInfo *runtimeInfo READ runtimeInfo CONSTANT)
45 Q_PROPERTY(bool quitOnSessionEnd READ isQuitOnSessionEndEnabled WRITE setQuitOnSessionEnd NOTIFY quitOnSessionEndChanged FINAL)
46 Q_PROPERTY(QQuick3DRenderStats *renderStats READ renderStats CONSTANT)
47 Q_PROPERTY(FoveationLevel fixedFoveation READ fixedFoveation WRITE setFixedFoveation NOTIFY fixedFoveationChanged FINAL)
48 Q_PROPERTY(ReferenceSpace referenceSpace READ referenceSpace WRITE setReferenceSpace NOTIFY referenceSpaceChanged FINAL)
49 Q_PROPERTY(bool depthSubmissionEnabled READ depthSubmissionEnabled WRITE setDepthSubmissionEnabled NOTIFY depthSubmissionEnabledChanged FINAL)
50 Q_PROPERTY(bool multiViewRenderingSupported READ isMultiViewRenderingSupported CONSTANT)
51 Q_PROPERTY(bool multiviewRenderingEnabled READ multiviewRenderingEnabled WRITE setMultiviewRenderingEnabled NOTIFY multiviewRenderingEnabledChanged FINAL)
52 QML_NAMED_ELEMENT(XrView)
54
55public:
57 NoFoveation = 0,
58 LowFoveation = 1,
59 MediumFoveation = 2,
60 HighFoveation = 3
61 };
62 Q_ENUM(FoveationLevel)
63
64 enum class ReferenceSpace {
65 ReferenceSpaceUnknown,
66 ReferenceSpaceLocal,
67 ReferenceSpaceStage,
68 ReferenceSpaceLocalFloor
69 };
70 Q_ENUM(ReferenceSpace)
71
72 explicit QQuick3DXrView();
74
75 QQuick3DXrOrigin *xrOrigin() const;
76 QQuick3DSceneEnvironment *environment() const;
77
78 bool passthroughSupported() const;
79 bool passthroughEnabled() const;
80
81 FoveationLevel fixedFoveation() const;
82 void setFixedFoveation(FoveationLevel level);
83
84 QOpenXRRuntimeInfo *runtimeInfo() const;
85
86 bool isQuitOnSessionEndEnabled() const;
87
88 QQuick3DRenderStats *renderStats() const;
89
90 Q_INVOKABLE QQuick3DPickResult rayPick(const QVector3D &origin, const QVector3D &direction) const;
91 Q_INVOKABLE QList<QQuick3DPickResult> rayPickAll(const QVector3D &origin, const QVector3D &direction) const;
92
93 Q_INVOKABLE void setTouchpoint(QQuickItem *target, const QPointF &position, int pointId, bool active);
94 Q_INVOKABLE QVector3D processTouch(const QVector3D &pos, int pointId);
95 Q_INVOKABLE QVariantMap touchpointState(int pointId) const;
96
97 ReferenceSpace referenceSpace() const;
98 void setReferenceSpace(ReferenceSpace newReferenceSpace);
99
100 bool depthSubmissionEnabled() const;
101
102 void registerXrItem(QQuick3DXrItem *newXrItem);
103 void unregisterXrItem(QQuick3DXrItem *xrItem);
104
105 bool isMultiViewRenderingSupported() const;
106 bool multiviewRenderingEnabled() const;
107
108public Q_SLOTS:
109 void setEnvironment(QQuick3DSceneEnvironment * environment);
110 void setPassthroughEnabled(bool enable);
111 void setQuitOnSessionEnd(bool enable);
112 void setDepthSubmissionEnabled(bool enable);
113 void setMultiviewRenderingEnabled(bool enable);
114
115private Q_SLOTS:
116 void updateViewportGeometry();
117 void handleSessionEnded();
118 void handleClearColorChanged();
119 void handleAAChanged();
120 bool init();
121
123 void initializeFailed(const QString &errorString);
130 void frameReady(); // tooling
134
135private:
136 // The XrView does not expose the View3D in its public interface. This is intentional.
137 QQuick3DViewport *view3d() const;
138
139 QPointer<QQuick3DSceneEnvironment> m_sceneEnvironment;
140 QQuick3DXrManager m_openXRManager;
141 mutable QOpenXRRuntimeInfo m_openXRRuntimeInfo;
142 bool m_quitOnSessionEnd = true;
143 bool m_inDestructor = false;
144 bool m_isInitialized = false;
145
147 QList<QQuick3DXrItem *> m_xrItems;
148 struct XrTouchState;
149 XrTouchState *m_touchState = nullptr;
150};
151
153
154#endif // QQUICK3DXRVIEW_P_H
\inmodule QtCore\reentrant
Definition qpoint.h:217
void xrOriginChanged(QQuick3DXrOrigin *xrOrigin)
void sessionEnded()
void passthroughEnabledChanged()
void environmentChanged(QQuick3DSceneEnvironment *environment)
void quitOnSessionEndChanged()
void referenceSpaceChanged()
void initializeFailed(const QString &errorString)
void multiviewRenderingEnabledChanged()
void depthSubmissionEnabledChanged()
void fixedFoveationChanged()
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
direction
Combined button and popup list for selecting options.
GLenum GLuint GLint level
GLenum target
GLboolean enable
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS