Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrenderlayer_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSG_RENDER_LAYER_H
6#define QSSG_RENDER_LAYER_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/qssgrendernode_p.h>
20#include <QtQuick3DRuntimeRender/private/qssglightmapper_p.h>
21#include <QtCore/qvarlengtharray.h>
22#include <QtCore/qlist.h>
23
26struct QSSGRenderPresentation;
27struct QSSGRenderEffect;
28struct QSSGRenderImage;
31
32class QQuick3DObject;
34
36
37// A layer is a special node. It *always* presents its global transform
38// to children as the identity. It also can optionally have a width or height
39// different than the overlying context. You can think of layers as the transformation
40// between a 3d scene graph and a 2D texture.
41struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderLayer : public QSSGRenderNode
42{
43 enum class AAMode : quint8
44 {
45 NoAA = 0,
46 SSAA,
47 MSAA,
48 ProgressiveAA
49 };
50
51 enum class AAQuality : quint8
52 {
53 Normal = 2,
54 High = 4,
55 VeryHigh = 8
56 };
57
59 {
60 LeftWidth = 0,
61 LeftRight,
62 WidthRight
63 };
64
65 enum class VerticalField : quint8
66 {
67 TopHeight = 0,
68 TopBottom,
69 HeightBottom
70 };
71
72 enum class UnitType : quint8
73 {
74 Percent = 0,
75 Pixels
76 };
77
78 enum class Background : quint8
79 {
80 Transparent = 0,
82 Color,
83 SkyBox,
84 SkyBoxCubeMap
85 };
86
87 enum class TonemapMode : quint8
88 {
89 None = 0, // Bypass mode
90 Linear,
91 Aces,
92 HejlDawson,
93 Filmic
94 };
95
96 enum class LayerFlag
97 {
98 EnableDepthTest = 0x1,
99 EnableDepthPrePass = 0x2,
100 RenderToTarget = 0x3
101 };
102 Q_DECLARE_FLAGS(LayerFlags, LayerFlag)
103
105 {
106 None = 0, // Bypass
107 BaseColor = 1,
108 Roughness,
109 Metalness,
110 Diffuse,
111 Specular,
112 ShadowOcclusion,
113 Emission,
114 AmbientOcclusion,
115 Normal,
116 Tangent,
117 Binormal,
118 F0
119 };
120
121 // First effect in a list of effects.
123 QSSGLayerRenderData *renderData = nullptr;
124 enum RenderExtensionMode { Underlay, Overlay, Count };
125 QList<QSSGRenderExtension *> renderExtensions[RenderExtensionMode::Count];
126
127 // If a layer has a valid texture path (one that resolves to either a
128 // an on-disk image or a offscreen renderer), then it does not render its
129 // own source path. Instead, it renders the offscreen renderer. Used in this manner,
130 // offscreen renderer's also have the option (if they support it) to render directly to the
131 // render target given a specific viewport (that is also scissored if necessary).
133
136
139
140 // Ambient occlusion
141 float aoStrength = 0.0f;
142 float aoDistance = 5.0f;
143 float aoSoftness = 50.0f;
144 float aoBias = 0.0f;
145 qint32 aoSamplerate = 2;
146 bool aoDither = false;
147 bool aoEnabled = false;
148
149 constexpr bool ssaoEnabled() const { return aoEnabled && (aoStrength > 0.0f && aoDistance > 0.0f); }
150
151 // IBL
157
158 QSSGRenderImage *skyBoxCubeMap = nullptr;
159
165
166 //TODO: move render state somewhere more suitable
171
172 // The camera explicitly set on the view by the user.
174 // The camera used for rendering (explicitCamera, nullptr or first usable camera).
176
177 // Tonemapping
179
180 LayerFlags layerFlags { LayerFlag::RenderToTarget,
181 LayerFlag::EnableDepthTest,
182 LayerFlag::EnableDepthPrePass };
183
184 // references to objects owned by the QSSGRhiContext
185 QRhiShaderResourceBindings *skyBoxSrb = nullptr;
187 bool skyBoxIsRgbe8 = false;
188
189 // Skybox
190 float skyboxBlurAmount = 0.0f;
191
192 // Grid
193 bool gridEnabled = false;
194 float gridScale = 1.0f;
195 quint32 gridFlags = 0;
196 QRhiShaderResourceBindings *gridSrb = nullptr;
197
198 // Lightmapper config
200
201 // Scissor
203
204 // Fog
205 struct FogOptions {
206 bool enabled = false;
207 QVector3D color = QVector3D(0.5f, 0.6f, 0.7f);
208 float density = 1.0f;
209 bool depthEnabled = false;
210 float depthBegin = 10.0f;
211 float depthEnd = 1000.0f;
212 float depthCurve = 1.0f;
213 bool heightEnabled = false;
214 float heightMin = 10.0f;
215 float heightMax = 0.0f;
216 float heightCurve = 1.0f;
217 bool transmitEnabled = false;
218 float transmitCurve = 1.0f;
219 } fog;
220
222
223 MaterialDebugMode debugMode = MaterialDebugMode::None;
224
225 bool wireframeMode = false;
226
229
230 void setProbeOrientation(const QVector3D &angles);
231
232 void addEffect(QSSGRenderEffect &inEffect);
233 bool hasEffect(QSSGRenderEffect *inEffect) const;
234
235 QSSGRenderNode *importSceneNode = nullptr;
236
237 // Special function(s) for importScene
238 void setImportScene(QSSGRenderNode &rootNode);
239 void removeImportScene(QSSGRenderNode &rootNode);
240
241};
243
244#endif
Definition qlist.h:74
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtGui
Definition qrhi.h:1190
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
GLenum GLenum GLsizei const GLuint GLboolean enabled
unsigned int quint32
Definition qtypes.h:45
int qint32
Definition qtypes.h:44
unsigned int uint
Definition qtypes.h:29
unsigned char quint8
Definition qtypes.h:41
QSSGRenderCamera * explicitCamera
QSSGLightmapperOptions lmOptions
QMatrix3x3 probeOrientation
QSSGRenderCamera * renderedCamera
QVector< QSSGRenderGraphObject * > resourceLoaders
QSSGRenderImage * lightProbe
QSSGRenderLayer::AAMode antialiasingMode
QSSGRenderLayer::Background background
constexpr bool ssaoEnabled() const
TonemapMode tonemapMode
QSSGRenderLayer::AAQuality antialiasingQuality
QVector3D probeOrientationAngles
QVarLengthArray< QRhiShaderResourceBindings *, 4 > item2DSrbs
QSSGRenderEffect * firstEffect