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