Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 <QtCore/qvarlengtharray.h>
21#include <QtCore/qlist.h>
22#include <ssg/qssglightmapper.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 Custom
95 };
96 static size_t constexpr TonemapModeCount = 6;
97
98 enum class LayerFlag
99 {
100 EnableDepthTest = 0x1,
101 EnableDepthPrePass = 0x2,
102 RenderToTarget = 0x3
103 };
104 Q_DECLARE_FLAGS(LayerFlags, LayerFlag)
105
107 {
108 None = 0, // Bypass
109 BaseColor = 1,
110 Roughness,
111 Metalness,
112 Diffuse,
113 Specular,
114 ShadowOcclusion,
115 Emission,
116 AmbientOcclusion,
117 Normal,
118 Tangent,
119 Binormal,
120 F0
121 };
122
123 // First effect in a list of effects.
125 QSSGLayerRenderData *renderData = nullptr;
126 enum class RenderExtensionStage { Underlay, Overlay, Count };
127 QList<QSSGRenderExtension *> renderExtensions[size_t(RenderExtensionStage::Count)];
128
131
134
135 // Ambient occlusion
136 float aoStrength = 0.0f;
137 float aoDistance = 5.0f;
138 float aoSoftness = 50.0f;
139 float aoBias = 0.0f;
140 qint32 aoSamplerate = 2;
141 bool aoDither = false;
142 bool aoEnabled = false;
143
144 constexpr bool ssaoEnabled() const { return aoEnabled && (aoStrength > 0.0f && aoDistance > 0.0f); }
145
146 // IBL
147 QSSGRenderImage *lightProbe { nullptr };
149 float probeExposure { 1.0f };
150 float probeHorizon { -1.0f };
153 } lightProbeSettings;
154
155 QSSGRenderImage *skyBoxCubeMap = nullptr;
156
162
163 //TODO: move render state somewhere more suitable
168
169 // The camera explicitly set on the view by the user. (backend node can be null)
170 QVarLengthArray<QSSGRenderCamera *, 2> explicitCameras;
171 // The camera used for rendering, multiple ones with multiview.
172 QVarLengthArray<QSSGRenderCamera *, 2> renderedCameras;
173
174 // Tonemapping
176
177 LayerFlags layerFlags { LayerFlag::RenderToTarget,
178 LayerFlag::EnableDepthTest,
179 LayerFlag::EnableDepthPrePass };
180
181 // references to objects owned by the QSSGRhiContext
182 QRhiShaderResourceBindings *skyBoxSrb = nullptr;
183 QVarLengthArray<QRhiShaderResourceBindings *, 4> item2DSrbs;
184 bool skyBoxIsRgbe8 = false;
185
186 // Skybox
187 float skyboxBlurAmount = 0.0f;
188
189 // Grid
190 bool gridEnabled = false;
191 float gridScale = 1.0f;
192 quint32 gridFlags = 0;
193 QRhiShaderResourceBindings *gridSrb = nullptr;
194
195 // Lightmapper config
197
198 // Scissor
200
201 // Fog
202 struct FogOptions {
203 bool enabled = false;
204 QVector3D color = QVector3D(0.5f, 0.6f, 0.7f);
205 float density = 1.0f;
206 bool depthEnabled = false;
207 float depthBegin = 10.0f;
208 float depthEnd = 1000.0f;
209 float depthCurve = 1.0f;
210 bool heightEnabled = false;
211 float heightMin = 10.0f;
212 float heightMax = 0.0f;
213 float heightCurve = 1.0f;
214 bool transmitEnabled = false;
215 float transmitCurve = 1.0f;
216 } fog;
217
218 QVector<QSSGRenderGraphObject *> resourceLoaders;
219
220 MaterialDebugMode debugMode = MaterialDebugMode::None;
221
222 bool wireframeMode = false;
223
226
227 void setProbeOrientation(const QVector3D &angles);
228
229 void addEffect(QSSGRenderEffect &inEffect);
230 bool hasEffect(QSSGRenderEffect *inEffect) const;
231
232 QSSGRenderNode *importSceneNode = nullptr;
233
234 // Special function(s) for importScene
235 void setImportScene(QSSGRenderNode &rootNode);
236 void removeImportScene(QSSGRenderNode &rootNode);
237
238};
240
241#endif
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtGui
Definition qrhi.h:1214
\inmodule QtQuick3D
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
@ None
Definition qhash.cpp:531
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint color
[2]
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
unsigned int uint
Definition qtypes.h:34
unsigned char quint8
Definition qtypes.h:46
QSSGLightmapperOptions lmOptions
QVector< QSSGRenderGraphObject * > resourceLoaders
QVarLengthArray< QSSGRenderCamera *, 2 > renderedCameras
QSSGRenderLayer::AAMode antialiasingMode
QSSGRenderLayer::Background background
constexpr bool ssaoEnabled() const
TonemapMode tonemapMode
QSSGRenderLayer::AAQuality antialiasingQuality
QVarLengthArray< QSSGRenderCamera *, 2 > explicitCameras
QVarLengthArray< QRhiShaderResourceBindings *, 4 > item2DSrbs
QSSGRenderEffect * firstEffect