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