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
qquick3dbakedlightmap.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
7
9
10/*!
11 \qmltype BakedLightmap
12 \inherits QtObject
13 \inqmlmodule QtQuick3D
14 \brief Specifies baked lightmap settings for a model.
15 \since 6.4
16
17 A BakedLightmap object can be used to enable:
18
19 \list
20 \li persistently storing the baked lightmap data - during baking, or
21 \li loading the previously generated and stored lightmaps - at run time.
22 \endlist
23
24 A Model with \l{Model::usedInBakedLighting}{usedInBakedLighting} set to
25 true is considered to be part of the raytraced scene when baking lightmaps,
26 meaning the model's geometry and material contribute to direct and indirect
27 lighting. This on its own does not however enable generating, including
28 full calculation of bounced indirect lighting, and finally saving a
29 lightmap for the model. To do that, the model also needs to be associated
30 with an \l enabled BakedLightmap object with a unique key set.
31
32 When running in normal mode, the same BakedLightmap object indicates that
33 the Model has lightmap data, and that the engine should attempt to load
34 this data (based on the unique key) and use it when rendering.
35
36 For more information on how to bake lightmaps, see the \l Lightmapper
37 documentation.
38
39 \note As of Qt 6.4, lightmap baking is in an early technical preview state.
40 Changes to features, quality, and API are likely happen in future releases.
41
42 \sa Lightmapper, Model::usedInBakedLighting
43 */
44
45/*!
46 \qmlproperty bool BakedLightmap::enabled
47
48 When false, the lightmap generated for the model is not stored during
49 lightmap baking, even though \l key is set to a non-empty value.
50
51 The default value is true.
52 */
53
54/*!
55 \qmlproperty string BakedLightmap::key
56
57 When non-empty and \l enabled is true, the lightmap generated for the model
58 is stored persistently during lightmap baking.
59 No other Model in the scene must use the same key.
60
61 The default value is empty.
62 */
63
64/*!
65 \qmlproperty string BakedLightmap::loadPrefix
66 \deprecated [6.10] This has no effect. See \l Lightmapper documentation.
67 */
68
69bool QQuick3DBakedLightmap::isEnabled() const
70{
71 return m_enabled;
72}
73
74void QQuick3DBakedLightmap::setEnabled(bool enabled)
75{
76 if (m_enabled == enabled)
77 return;
78
79 m_enabled = enabled;
80 emit enabledChanged();
81 emit changed();
82}
83
84QString QQuick3DBakedLightmap::key() const
85{
86 return m_key;
87}
88
89void QQuick3DBakedLightmap::setKey(const QString &key)
90{
91 if (m_key == key)
92 return;
93
94 m_key = key;
95 emit keyChanged();
96 emit changed();
97}
98
99QString QQuick3DBakedLightmap::loadPrefix() const
100{
101 return m_loadPrefix;
102}
103
104void QQuick3DBakedLightmap::setLoadPrefix(const QString &loadPrefix)
105{
106 if (m_loadPrefix == loadPrefix)
107 return;
108
109 m_loadPrefix = loadPrefix;
110 emit loadPrefixChanged();
111 emit changed();
112}
113
114QT_END_NAMESPACE
Combined button and popup list for selecting options.