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
qssgrenderskymaterial_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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#ifndef QSSG_RENDER_SKY_MATERIAL_H
6#define QSSG_RENDER_SKY_MATERIAL_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrenderhelpers_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgshadermaterialadapter_p.h>
22#include <QtQuick3DRuntimeRender/private/qssgrendershadercache_p.h>
23
25
26class QSSGRhiEffectSystem;
27
28struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderSkyMaterial : public QSSGRenderGraphObject
29{
30 // Background source: Cubemap samples the IBL radiance cube; ScreenSpace* evaluate the
31 // sky shader directly on screen at the given scale. See the SkyMaterial QML docs.
32 enum class SkyboxMode { Cubemap, ScreenSpaceFull, ScreenSpaceHalf, ScreenSpaceQuarter };
33
34 int radianceMapSize = 512;
35 int iblSampleCount = 16;
36 int iblSamplesPerFrame = 0;
37 int iblRenderFrames = 0;
38 SkyboxMode skyboxMode = SkyboxMode::Cubemap;
39 bool wantsMoreFrames = false;
40 bool enableIBL = false;
41
42 QSSGRenderSkyMaterial();
43 ~QSSGRenderSkyMaterial();
44
45 QList<QSSGBaseTypeProperty> propertyUniforms;
46
47 // Cube-face pipeline used to render the procedural sky into the IBL environment cube.
48 QSSGRhiShaderPipelinePtr iblPassPipeline;
49 // Screen-space pipeline used to evaluate the sky shader directly into the visible
50 // background (fullscreen quad), decoupled from the IBL cube.
51 QSSGRhiShaderPipelinePtr backgroundPipeline;
52
53 QSSGRhiShaderPipelinePtr ensurePipeline(const QSSGRenderContextInterface &sgContext);
54 QSSGRhiShaderPipelinePtr ensureBackgroundPipeline(const QSSGRenderContextInterface &sgContext,
55 const QSSGShaderFeatures &tonemapFeatures,
56 quint32 tonemapKey,
57 int viewCount);
58
59 // returns uniform stride per face
60 quint32 updateUniforms(const QSSGRenderContextInterface &sgContext, const QMatrix4x4 &mvp, const QVarLengthArray<QMatrix4x4, 6> views);
61 void updateBackgroundUniforms(const QSSGRenderContextInterface &sgContext,
62 const QVarLengthArray<QMatrix4x4, 2> &inverseProjections,
63 const QVarLengthArray<QMatrix4x4, 2> &viewRotations,
64 float adjustY,
65 float exposure);
66
67 QByteArray fragmentShaderSource;
68
69 QByteArray shaderPathKey = "sky material --";
70
71 bool isDirty = true;
72 bool isFragmentShaderDirty = true;
73 bool isBackgroundShaderDirty = true;
74
75 QSSGRhiShaderResourceBindingList bindings;
76 QSSGRhiShaderResourceBindingList backgroundBindings;
77
78private:
79 QSSGRhiShaderPipelinePtr buildPipeline(const QSSGRenderContextInterface &sgContext,
80 QByteArray vertexShader,
81 const QSSGShaderCustomMaterialAdapter::StringPairList &vertexViewDependentUniforms,
82 const QSSGShaderCustomMaterialAdapter::StringPairList &vertexUniforms,
83 const QByteArray &fragmentMainSnippet,
84 const QSSGShaderCustomMaterialAdapter::StringPairList &fragmentUniforms,
85 const QSSGShaderFeatures &features,
86 int viewCount,
87 const QByteArray &cacheKeyTag);
88
89 quint32 m_backgroundTonemapKey = quint32(-1);
90 int m_backgroundViewCount = 0;
91};
92
93QT_END_NAMESPACE
94
95#endif // QSSG_RENDER_SKY_MATERIAL_H
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
static constexpr int MaxBuckets
QSSGRenderCamera * camera
void resetForFrame() final
void resetForFrame() final
QRhiTexture * readbackImage
bool linkedListRequiresResize(QSize dim)
Type passType() const final
void resetForFrame() final
virtual ~QSSGRenderPass()
friend class QSSGRenderContextInterface
void resetForFrame() final
void resetForFrame() final
const QSSGRenderCamera * camera
void resetForFrame() final
QSSGRenderCamera * camera
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
void resetForFrame() final
Combined button and popup list for selecting options.
void rhiPrepareGrid(QSSGRhiContext *rhiCtx, QSSGPassKey passKey, QSSGRenderLayer &layer, QSSGRenderCameraList &cameras, QSSGRenderer &renderer)
void rhiPrepareSkyBox(const QSSGRenderContextInterface &context, QSSGPassKey passKey, QSSGRenderLayer &layer, QSSGRenderCameraList &cameras, QSSGRenderer &renderer, uint tonemapMode=0)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
#define QSSG_ASSERT_X(cond, msg, action)
#define QSSG_CHECK(cond)
#define QSSG_ASSERT(cond, action)
#define QSSG_GUARD(cond)
static void skyMaterialTonemapFeatures(QSSGRenderLayer::TonemapMode mode, QSSGShaderFeatures &features, quint32 &key)
static QMatrix4x4 correctMVPForScissor(QRectF viewportRect, QRect scissorRect, bool isYUp)
static quint32 ensureFreeNodes(quint32 value, quint32 multiple)
static QT_BEGIN_NAMESPACE const char defaultFragOutputs[][12]
static QByteArrayView getDefaultOutputName(size_t index)
static quint32 nextMultipleOf(quint32 value, quint32 multiple)