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
qtquick3d-cmake-macros.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qt-add-materials.html
6
\ingroup cmake-commands-qtquick3d
7
8
\title qt_add_materials
9
\keyword qt6_add_materials
10
\deprecated
11
12
\summary {Generates shaders from files, adding them as Qt resources.}
13
14
\preliminarycmakecommand
15
16
The command is defined in the \c Quick3D component of the \c Qt6 package, which can
17
be loaded like this:
18
19
\badcode
20
find_package(Qt6 REQUIRED COMPONENTS Quick3D)
21
\endcode
22
23
\cmakecommandsince 6.2
24
25
\section1 Synopsis
26
27
\badcode
28
qt_add_materials(target resource_name
29
[PREFIX prefix]
30
FILES file1.qml, file2.qml ...)
31
\endcode
32
33
\versionlessCMakeCommandsNote qt6_add_materials()
34
35
\section1 Description
36
37
Use the command to pre-generate the material shaders used in a \l{Qt Quick 3D} scene
38
at compile time, for a certain \c target.
39
40
Use \c FILES to list the QML files that are part of the project. The command will call
41
the \l{Shadergen Tool} at build time to extract and generate material shaders,
42
making them available in the Qt resource system. \l{Qt Quick 3D} will automatically
43
load these at runtime.
44
45
Using \c RESOURCES is currently not supported.
46
47
\section1 Example
48
49
The following autogenerates the lightprobe map at build time and
50
includes it in the executable under \c{:/maps/OpenfootageNET_garage-1024.ktx}:
51
52
\badcode
53
qt6_add_materials(offlineshaders "shaders"
54
PREFIX
55
"/"
56
FILES
57
MaterialRed.qml
58
MaterialRedExtended.qml
59
main.qml
60
)
61
\endcode
62
63
\section1 Caveats
64
65
Shadergen uses a heuristic to determine the shaders it generates, which might not
66
always be the ones that are actually used at runtime. See the \l{Shadergen Tool}
67
documentation on further details.
68
69
When adding multiple resources, \c resource_name must be unique across
70
all resources linked into the final target. This especially affects static builds.
71
There, the same resource name in different static libraries conflict in the consuming
72
target.
73
74
\sa {Shadergen Tool}, {Qt Quick 3D - Offline Shaders Example}
75
*/
76
77
/*!
78
\page qt-add-lightprobe-images.html
79
\ingroup cmake-commands-qtquick3d
80
81
\title qt_add_lightprobe_images
82
\keyword qt6_add_lightprobe_images
83
84
\summary {Bakes HDRI map files to KTX files, adding them as Qt resouces.}
85
86
\preliminarycmakecommand
87
88
The command is defined in the \c Quick3D component of the \c Qt6 package, which can
89
be loaded like this:
90
91
\badcode
92
find_package(Qt6 REQUIRED COMPONENTS Quick3D)
93
\endcode
94
95
\cmakecommandsince 6.2
96
97
\section1 Synopsis
98
99
\badcode
100
qt_add_lightprobe_images(target resource_name
101
[PREFIX prefix]
102
[BASE base]
103
FILES file1.hdr, file2.hdr ..
104
[OUTPUTS file1.ktx, file2.ktx ..]
105
)
106
\endcode
107
108
\versionlessCMakeCommandsNote qt6_add_lightprobe_images()
109
110
\section1 Description
111
112
Use the command to bake \c{.hdr} files listed under \c FILES
113
to \c{.ktx} files. The files will be included under in the binary
114
or library \c target.
115
116
\c FILES should list paths to local HDRI map files. Each file must have either
117
the suffix \c{.hdr}, or \c{.exr}. These files will be converted at build time
118
to \c .ktx files, using the \l{Balsam Asset Import Tool}.
119
120
By default, the \c .ktx files will show up in embedded Qt resources of
121
the target binary under the same base name and relative path. Use \c BASE
122
to remove a common directory from the relative paths at runtime. That is, if all
123
the file paths under \c FILES point to a common directory \c maps/, then you
124
can use \c{BASE maps/} to hide the directory in the Qt resource system. In a similar
125
vein, you can use \c PREFIX to add a common prefix directory in the Qt resource
126
system.
127
128
While \c BASE and \c PREFIX allow you to change the comon relative paths of
129
the \c .ktx files in the Qt resource system, \c OUTPUTS allow you to control
130
the full path of the \c .ktx files, including the file name. If you use \c OUTPUTS,
131
the number of paths have to match the number of paths to \c FILES.
132
133
134
\section1 Example
135
136
The following autogenerates the lightprobe map at build time and
137
includes it in the executable under \c{:/maps/OpenfootageNET_garage-1024.ktx}:
138
139
\badcode
140
qt_add_lightprobe_images(principledmaterial "ibl_assets"
141
PREFIX
142
"/"
143
FILES
144
"maps/OpenfootageNET_garage-1024.hdr"
145
)
146
\endcode
147
148
\section1 Caveats
149
150
When adding multiple resources, \c resource_name must be unique across
151
all resources linked into the final target.
152
153
This especially affects static builds. There, the same resource name in
154
different static libraries conflict in the consuming target.
155
156
\sa{Pre-generating IBL cubemap}
157
*/
qtquick3d
src
quick3d
doc
src
qtquick3d-cmake-macros.qdoc
Generated on
for Qt by
1.16.1