Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qssgrendershadowmap_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
// Qt-Security score:significant reason:default
5
6
7
#
ifndef
QSSG_RENDER_SHADOW_MAP_H
8
#
define
QSSG_RENDER_SHADOW_MAP_H
9
10
//
11
// W A R N I N G
12
// -------------
13
//
14
// This file is not part of the Qt API. It exists purely as an
15
// implementation detail. This header file may change from version to
16
// version without notice, or even be removed.
17
//
18
// We mean it.
19
//
20
21
#
include
<
QtQuick3DRuntimeRender
/
private
/
qtquick3druntimerenderglobal_p
.
h
>
22
#
include
<
QtGui
/
QMatrix4x4
>
23
#
include
<
QtGui
/
QVector3D
>
24
#
include
<
QtQuick3DUtils
/
private
/
qssgrenderbasetypes_p
.
h
>
25
#
include
<
QtQuick3DRuntimeRender
/
private
/
qssgrenderableobjects_p
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
QSSGRhiContext;
30
class
QSSGRenderContextInterface
;
31
32
class
QRhiRenderBuffer;
33
class
QRhiTextureRenderTarget;
34
class
QRhiRenderPassDescriptor;
35
class
QRhiTexture;
36
37
struct
QSSGShadowMapEntry
38
{
39
QSSGShadowMapEntry
();
40
41
static
QSSGShadowMapEntry
withAtlas
(quint32 lightIdx);
42
bool
hasActiveCascades
()
const
;
43
44
void
destroyRhiResources
();
45
46
quint32
m_lightIndex
;
///< the light index it belongs to
47
quint32
m_depthArrayIndex
= 0;
///< shadow map texture array index
48
49
// Owned RHI Resoruces (just for point lights)
50
QRhiTexture *
m_rhiDepthCube
=
nullptr
;
// shadow cube map
51
QRhiRenderBuffer *
m_rhiDepthStencilCube
=
nullptr
;
52
QRhiRenderPassDescriptor *
m_rhiRenderPassDescCube
=
nullptr
;
53
std
::
array
<
QRhiTextureRenderTarget
*, 6>
m_rhiRenderTargetCube
= {};
54
QRhiShaderResourceBindings
*
m_cubeToAtlasFrontSrb
=
nullptr
;
55
QRhiShaderResourceBindings
*
m_cubeToAtlasBackSrb
=
nullptr
;
56
57
// Shared RHI Resources
58
std
::
array
<
QRhiTextureRenderTarget
*, 4>
m_rhiRenderTargets
= {};
59
std
::
array
<
QRhiRenderPassDescriptor
*, 4>
m_rhiRenderPassDesc
= {};
60
61
QMatrix4x4
m_lightViewProjection
[4];
///< light view projection matrix
62
QMatrix4x4
m_lightCubeView
[6];
///< light cubemap view matrices
63
QMatrix4x4
m_lightView
;
///< light view transform
64
quint32
m_csmNumSplits
= 0;
65
float
m_csmSplits
[4] = {};
66
float
m_csmActive
[4] = {};
67
float
m_shadowMapFar
= 0.f;
68
QMatrix4x4
m_fixedScaleBiasMatrix
[4];
69
QVector4D
m_dimensionsInverted
[4];
///< (x, y, z, 0) 4 vec4
70
71
struct
AtlasEntry
{
72
int
layerIndex
= 0;
73
float
uOffset
= 0.0f;
74
float
vOffset
= 0.0f;
75
float
uvScale
= 1.0f;
76
} m_atlasInfo[4];
77
};
78
79
class
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGRenderShadowMap
80
{
81
Q_DISABLE_COPY(QSSGRenderShadowMap)
82
83
public
:
84
const
QSSGRenderContextInterface &m_context;
85
86
explicit
QSSGRenderShadowMap
(
const
QSSGRenderContextInterface
&inContext);
87
~QSSGRenderShadowMap();
88
void
releaseCachedResources();
89
void
addShadowMaps
(
const
QSSGShaderLightList &renderableLights);
90
91
QSSGShadowMapEntry
*
shadowMapEntry
(
int
lightIdx);
92
QRhiTextureRenderTarget *
layerRenderTarget
(
int
layerIndex);
93
QRhiRenderPassDescriptor *
layerRenderPassDescriptor
(
int
layerIndex);
94
QRhiTexture *
shadowMapAtlasTexture
()
const
;
95
QRhiTexture *
shadowMapBlueNoiseTexture
()
const
;
96
97
qsizetype
shadowMapEntryCount
() {
return
m_shadowMapList.size(); }
98
99
QRhiShaderResourceBindings
*
shadowClearSrb
()
const
{
return
m_shadowClearSrb.get(); }
100
101
private
:
102
QSSGShadowMapEntry *addShadowMap(quint32 lightIdx,
103
QSize size,
104
QVector<QSSGShadowMapEntry::AtlasEntry> atlasEntries,
105
quint32 csmNumSplits,
106
QRhiTexture::Format format,
107
bool
isPointLight,
108
const
QString &renderNodeObjName);
109
110
QVector<QSSGShadowMapEntry> m_shadowMapList;
111
std::unique_ptr<QRhiTexture> m_shadowMapAtlasTexture;
112
std::unique_ptr<QRhiTexture> m_shadowMapBlueNoiseTexture;
113
std::unique_ptr<QRhiSampler> m_sharedCubeToAtlasSampler;
114
std::unique_ptr<QRhiBuffer> m_sharedFrontCubeToAtlasUniformBuffer;
115
std::unique_ptr<QRhiBuffer> m_sharedBackCubeToAtlasUniformBuffer;
116
std::unique_ptr<QRhiShaderResourceBindings> m_shadowClearSrb;
117
QVector<QRhiRenderBuffer *> m_layerDepthStencilBuffers;
118
QVector<QRhiTextureRenderTarget *> m_layerRenderTargets;
119
QVector<QRhiRenderPassDescriptor *> m_layerRenderPassDescriptors;
120
};
121
122
using
QSSGRenderShadowMapPtr = std::shared_ptr<QSSGRenderShadowMap>;
123
124
QT_END_NAMESPACE
125
126
#
endif
QSSGRenderShadowMap
Definition
qssgrendershadowmap_p.h:80
QSSGRenderShadowMap::QSSGRenderShadowMap
QSSGRenderShadowMap(const QSSGRenderContextInterface &inContext)
Definition
qssgrendershadowmap.cpp:188
QSSGRenderShadowMap::shadowClearSrb
QRhiShaderResourceBindings * shadowClearSrb() const
Definition
qssgrendershadowmap_p.h:99
QSSGRenderShadowMap::layerRenderPassDescriptor
QRhiRenderPassDescriptor * layerRenderPassDescriptor(int layerIndex)
Definition
qssgrendershadowmap.cpp:533
QSSGRenderShadowMap::layerRenderTarget
QRhiTextureRenderTarget * layerRenderTarget(int layerIndex)
Definition
qssgrendershadowmap.cpp:526
QSSGRenderShadowMap::shadowMapEntry
QSSGShadowMapEntry * shadowMapEntry(int lightIdx)
Definition
qssgrendershadowmap.cpp:513
QSSGRenderShadowMap::shadowMapEntryCount
qsizetype shadowMapEntryCount()
Definition
qssgrendershadowmap_p.h:97
QSSGRenderShadowMap::addShadowMaps
void addShadowMaps(const QSSGShaderLightList &renderableLights)
Definition
qssgrendershadowmap.cpp:219
QSSGRenderer::QSSGRenderContextInterface
friend class QSSGRenderContextInterface
Definition
qssgrenderer_p.h:105
QSSGRhiShaderPipeline::shadowMapAtlasTexture
QRhiTexture * shadowMapAtlasTexture() const
Definition
qssgrhicontext_p.h:566
QSSGRhiShaderPipeline::shadowMapBlueNoiseTexture
QRhiTexture * shadowMapBlueNoiseTexture() const
Definition
qssgrhicontext_p.h:569
QSSGShadowMapEntry::AtlasEntry
Definition
qssgrendershadowmap_p.h:71
QSSGShadowMapEntry::AtlasEntry::uOffset
float uOffset
Definition
qssgrendershadowmap_p.h:73
QSSGShadowMapEntry::AtlasEntry::layerIndex
int layerIndex
Definition
qssgrendershadowmap_p.h:72
QSSGShadowMapEntry::AtlasEntry::vOffset
float vOffset
Definition
qssgrendershadowmap_p.h:74
QSSGShadowMapEntry::AtlasEntry::uvScale
float uvScale
Definition
qssgrendershadowmap_p.h:75
QSSGShadowMapEntry
Definition
qssgrendershadowmap_p.h:38
QSSGShadowMapEntry::hasActiveCascades
bool hasActiveCascades() const
Definition
qssgrendershadowmap.cpp:562
QSSGShadowMapEntry::m_rhiRenderPassDesc
std::array< QRhiRenderPassDescriptor *, 4 > m_rhiRenderPassDesc
Definition
qssgrendershadowmap_p.h:59
QSSGShadowMapEntry::m_rhiRenderTargetCube
std::array< QRhiTextureRenderTarget *, 6 > m_rhiRenderTargetCube
Definition
qssgrendershadowmap_p.h:53
QSSGShadowMapEntry::m_depthArrayIndex
quint32 m_depthArrayIndex
shadow map texture array index
Definition
qssgrendershadowmap_p.h:47
QSSGShadowMapEntry::m_csmSplits
float m_csmSplits[4]
Definition
qssgrendershadowmap_p.h:65
QSSGShadowMapEntry::m_rhiDepthStencilCube
QRhiRenderBuffer * m_rhiDepthStencilCube
Definition
qssgrendershadowmap_p.h:51
QSSGShadowMapEntry::m_fixedScaleBiasMatrix
QMatrix4x4 m_fixedScaleBiasMatrix[4]
Definition
qssgrendershadowmap_p.h:68
QSSGShadowMapEntry::m_lightViewProjection
QMatrix4x4 m_lightViewProjection[4]
light view projection matrix
Definition
qssgrendershadowmap_p.h:61
QSSGShadowMapEntry::m_cubeToAtlasFrontSrb
QRhiShaderResourceBindings * m_cubeToAtlasFrontSrb
Definition
qssgrendershadowmap_p.h:54
QSSGShadowMapEntry::m_csmActive
float m_csmActive[4]
Definition
qssgrendershadowmap_p.h:66
QSSGShadowMapEntry::QSSGShadowMapEntry
QSSGShadowMapEntry()
Definition
qssgrendershadowmap.cpp:550
QSSGShadowMapEntry::destroyRhiResources
void destroyRhiResources()
Definition
qssgrendershadowmap.cpp:568
QSSGShadowMapEntry::m_rhiRenderTargets
std::array< QRhiTextureRenderTarget *, 4 > m_rhiRenderTargets
Definition
qssgrendershadowmap_p.h:58
QSSGShadowMapEntry::m_cubeToAtlasBackSrb
QRhiShaderResourceBindings * m_cubeToAtlasBackSrb
Definition
qssgrendershadowmap_p.h:55
QSSGShadowMapEntry::m_csmNumSplits
quint32 m_csmNumSplits
Definition
qssgrendershadowmap_p.h:64
QSSGShadowMapEntry::m_lightCubeView
QMatrix4x4 m_lightCubeView[6]
light cubemap view matrices
Definition
qssgrendershadowmap_p.h:62
QSSGShadowMapEntry::withAtlas
static QSSGShadowMapEntry withAtlas(quint32 lightIdx)
Definition
qssgrendershadowmap.cpp:555
QSSGShadowMapEntry::m_rhiRenderPassDescCube
QRhiRenderPassDescriptor * m_rhiRenderPassDescCube
Definition
qssgrendershadowmap_p.h:52
QSSGShadowMapEntry::m_rhiDepthCube
QRhiTexture * m_rhiDepthCube
Definition
qssgrendershadowmap_p.h:50
QSSGShadowMapEntry::m_dimensionsInverted
QVector4D m_dimensionsInverted[4]
(x, y, z, 0) 4 vec4
Definition
qssgrendershadowmap_p.h:69
QSSGShadowMapEntry::m_shadowMapFar
float m_shadowMapFar
Definition
qssgrendershadowmap_p.h:67
QSSGShadowMapEntry::m_lightIndex
quint32 m_lightIndex
the light index it belongs to
Definition
qssgrendershadowmap_p.h:46
QSSGShadowMapEntry::m_lightView
QMatrix4x4 m_lightView
light view transform
Definition
qssgrendershadowmap_p.h:63
qtquick3d
src
runtimerender
qssgrendershadowmap_p.h
Generated on
for Qt by
1.18.0