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
qssglightmapper_p.h
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
6#ifndef QSSGLIGHTMAPPER_P_H
7#define QSSGLIGHTMAPPER_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
21#include <rhi/qrhi.h>
22#include <ssg/qssglightmapper.h>
23
24#include <QString>
25
27
28struct QSSGLightmapperPrivate;
30class QSSGRhiContext;
31class QSSGRenderer;
32struct QSSGRenderModel;
33class QOffscreenSurface;
34
36{
37public:
47
49 bool cancelled = false;
50 };
51
52 /*
53 * Payload:
54 * int status (BakingStatus)
55 * string stage
56 * string message
57 * qint64 totalTimeRemaining (in ms)
58 * double totalProgress (Range 0 - 1)
59 */
60 typedef std::function<void(const QVariantMap &payload, BakingControl*)> Callback;
61
64 void reset();
65
66 bool setupLights(const QSSGRenderer &renderer);
67 void setOptions(const QSSGLightmapperOptions &options);
68 void setOutputCallback(Callback callback);
70 void setRhiBackend(QRhi::Implementation backend);
71 void setDenoiseOnly(bool value);
72
73 // NOTE: since add() contains references to objects in the
74 // running scene we need to call the functions in the following order:
75 // add(), run(), waitForInit().
76 // OpenGL requires a fallback surface created on the main thread to create the
77 // RHI object, so it is provided as a pointer.
78 void run(QOffscreenSurface *fallbackSurface);
79 // waitForInit() waits until all models have been processed and are therefore
80 // not referenced anymore and it is safe to go back to rendering the scene.
81 // This should be called after run(), otherwise it will be stuck in a deadlock.
82 void waitForInit();
83
84private:
85#ifdef QT_QUICK3D_HAS_LIGHTMAPPER
86 QSSGLightmapperPrivate *d = nullptr;
87#endif
88 bool bake();
89 bool denoise();
90};
91
92QT_END_NAMESPACE
93
94#endif
void setRhiBackend(QRhi::Implementation backend)
bool setupLights(const QSSGRenderer &renderer)
qsizetype add(const QSSGBakedLightingModel &model)
void setOptions(const QSSGLightmapperOptions &options)
std::function< void(const QVariantMap &payload, BakingControl *)> Callback
void setDenoiseOnly(bool value)
void run(QOffscreenSurface *fallbackSurface)
void setOutputCallback(Callback callback)
Combined button and popup list for selecting options.