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
qt3dxr.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
/*!
4
\page qt-quick-3d-xr.html
5
\title \qxr
6
\image xr_development.webp
7
\brief The \qxr module provides APIs for developing XR applications.
8
9
\section1 Introduction
10
11
Extended Reality (XR) is a term that includes Virtual Reality (VR), Augmented Reality (AR),
12
and Mixed Reality (MR). These technologies create immersive experiences that can
13
alter a user's perception of the world around them. The \qxr module provides APIs for developing
14
XR applications with Qt Quick 3D across a variety of devices and platforms.
15
16
\section1 Difference between Qt Quick 3D and \qxr applications
17
18
\section2 The entry point
19
20
The main difference between a Qt Quick 3D and a \qxr application, from a developer's perspective,
21
is the scene's entry point, and being aware of real-world units and tracking data is essential.
22
23
In Qt Quick 3D, a minimal application would consist of a camera, light, and a 3D model. The positioning
24
and size of these elements are defined in the scene's coordinate system, which is arbitrary and can be
25
defined by the developer to fit the needs of the application.
26
27
\qml
28
View3D {
29
width: 1280
30
height: 720
31
32
PerspectiveCamera {
33
position: Qt.vector3d(0, 200, 300)
34
}
35
36
DirectionalLight {
37
}
38
39
Node {
40
id: sceneRoot
41
Model {
42
id: model
43
position: Qt.vector3d(0, -200, 0)
44
source: "#Cylinder"
45
materials: [ PrincipledMaterial {
46
baseColor: "red"
47
}]
48
}
49
}
50
}
51
\endqml
52
53
In an XR application, consider real-world units and tracking data when defining the scene.
54
The camera's position and orientation are defined by the device's, or in the case of
55
head-mounted displays (HMD), the user's head position and orientation. The scene's units should
56
match the real-world unit. For example, you'd want a door or a desk to be the same
57
size in the real world as in the virtual world.
58
59
\note The entry point in an \qxr application is not a \l View3D but the \l XrView. In addition,
60
an \l XrOrigin defines the scene's origin, which tracked items are placed relative to.
61
62
\qml
63
XrView {
64
DirectionalLight {
65
}
66
67
xrOrigin: XrOrigin {
68
XrController {
69
id: rightController
70
controller: XrController.ControllerRight
71
}
72
XrController {
73
id: leftController
74
controller: XrController.ControllerLeft
75
}
76
}
77
78
Node {
79
id: sceneRoot
80
Model {
81
id: floor
82
source: ":meshes/floor.mesh"
83
materials: [ PrincipledMaterial {
84
baseColor: "green"
85
}]
86
}
87
88
Model {
89
id: table
90
property real height: 0.7
91
position: Qt.vector3d(0, height - 2.5, 0)
92
source: ":meshes/table.mesh"
93
materials: PrincipledMaterial {
94
baseColor: "white"
95
}
96
}
97
98
Model {
99
id: monitor
100
source: ":meshes/monitor.mesh"
101
y: table.height
102
XrItem {
103
id: theScreen
104
y: monitor.yOffset + height
105
x: -width / 2
106
width: monitor.width
107
height: monitor.height
108
contentItem: ScreenContent {}
109
}
110
}
111
}
112
}
113
\endqml
114
115
\section2 Additional CMake functions
116
117
As can be seen in the \c CmakeLists.txt file for all the \l{\qxr Examples}, you need to add
118
some functions to your project's top-level CMakeLists file.
119
120
To specify a custom \c AndroidManifest.xml and to make sure it gets used by adding this line
121
to your project's CMakeLists file:
122
123
\quotefromfile xr_simple/CMakeLists.txt
124
\skipto if(ANDROID)
125
\printuntil endif()
126
127
For more details about setting up your \c AndroidManifest.xml, see the relevant section of
128
the \l{Getting Started With Meta Quest 3} page.
129
130
CMakeLists.txt changes also apply to visionOS, where we include the \c MacOSXBundleInfo.plist.in file:
131
132
\printto qt_finalize_executable(xr_simple)
133
134
\section1 Where to go from here?
135
136
Take a look at \l{Getting Started With Meta Quest 3} or \l{Getting Started With Apple Vision Pro}
137
for more information about how to get started with your specific device. See the
138
\l{Supported Platforms} page for more information about platforms and devices supported.
139
140
If you are looking for a specific \qxr API, take a look at the \l{\qxr QML Types}{API Reference},
141
or try out one of the \l{\qxr Examples}, which demonstrate how the \qxr APIs can be used.
142
143
\section1 Quick Links
144
145
\list
146
\include qt3dxr-toc.qdoc listitems-quick-links
147
\endlist
148
149
//! NOTE: This table refers to list items in qt3dxr-toc.qdoc - add new items there
150
//! Using existing placeholder images for now
151
\table
152
\row
153
\include qt3dxr-toc.qdoc listitems-platforms-and-toolchains
154
\include qt3dxr-toc.qdoc listitems-getting-started
155
\include qt3dxr-toc.qdoc listitems-api-reference
156
\row
157
\include qt3dxr-toc.qdoc listitems-examples
158
\include qt3dxr-toc.qdoc tools-ide
159
\include qt3dxr-toc.qdoc developing-applications
160
\endtable
161
162
*/
qtquick3d
src
quick3d
doc
src
xr
qt3dxr.qdoc
Generated on
for Qt by
1.14.0