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
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
5#ifndef QSSG_RENDER_SHADOW_MAP_H
6#define QSSG_RENDER_SHADOW_MAP_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/qtquick3druntimerenderglobal_p.h>
20#include <QtGui/QMatrix4x4>
21#include <QtGui/QVector3D>
22#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
23
25
26class QSSGRhiContext;
28
32class QRhiTexture;
33
35{
36 VSM,
37 CUBE,
38};
39
41{
43
46 QRhiTexture *depthMap,
47 QRhiTexture *depthCopy,
48 QRhiRenderBuffer *depthStencil);
49
52 QRhiTexture *depthCube,
53 QRhiTexture *cubeCopy,
54 QRhiRenderBuffer *depthStencil);
55
57
60
61 // RHI resources
62 QRhiTexture *m_rhiDepthMap = nullptr; // shadow map (VSM)
63 QRhiTexture *m_rhiDepthCopy = nullptr; // for blur pass (VSM)
64 QRhiTexture *m_rhiDepthCube = nullptr; // shadow cube map (CUBE)
65 QRhiTexture *m_rhiCubeCopy = nullptr; // for blur pass (CUBE)
66 QRhiRenderBuffer *m_rhiDepthStencil = nullptr; // depth/stencil
67 QVarLengthArray<QRhiTextureRenderTarget *, 6> m_rhiRenderTargets; // texture RT
68 QRhiRenderPassDescriptor *m_rhiRenderPassDesc = nullptr; // texture RT renderpass descriptor
69 QRhiTextureRenderTarget *m_rhiBlurRenderTarget0 = nullptr; // texture RT for blur X (targets depthCopy or cubeCopy)
70 QRhiTextureRenderTarget *m_rhiBlurRenderTarget1 = nullptr; // texture RT for blur Y (targets depthMap or depthCube)
71 QRhiRenderPassDescriptor *m_rhiBlurRenderPassDesc = nullptr; // blur needs its own because no depth/stencil
72
76};
77
78class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderShadowMap
79{
80 typedef QVector<QSSGShadowMapEntry> TShadowMapEntryList;
81 Q_DISABLE_COPY(QSSGRenderShadowMap)
82
83public:
85
86 explicit QSSGRenderShadowMap(const QSSGRenderContextInterface &inContext);
88 void releaseCachedResources();
89
90 void addShadowMapEntry(qint32 lightIdx,
94 const QString &renderNodeObjName);
95
96 QSSGShadowMapEntry *shadowMapEntry(int lightIdx);
97
98 qint32 shadowMapEntryCount() { return m_shadowMapList.size(); }
99
100private:
101 TShadowMapEntryList m_shadowMapList;
102};
103
104using QSSGRenderShadowMapPtr = std::shared_ptr<QSSGRenderShadowMap>;
105
107
108#endif
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
Definition qrhi.h:1094
\inmodule QtGui
Definition qrhi.h:1142
\inmodule QtGui
Definition qrhi.h:1184
\inmodule QtGui
Definition qrhi.h:895
const QSSGRenderContextInterface & m_context
\inmodule QtQuick3D
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
GLenum mode
GLint GLsizei GLsizei height
GLint GLsizei width
std::shared_ptr< QSSGRenderShadowMap > QSSGRenderShadowMapPtr
@ VSM
variance shadow mapping
@ CUBE
cubemap omnidirectional shadows
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
QMatrix4x4 m_lightVP
light view projection matrix
QRhiTextureRenderTarget * m_rhiBlurRenderTarget0
QRhiRenderPassDescriptor * m_rhiRenderPassDesc
QVarLengthArray< QRhiTextureRenderTarget *, 6 > m_rhiRenderTargets
static QSSGShadowMapEntry withRhiDepthCubeMap(quint32 lightIdx, ShadowMapModes mode, QRhiTexture *depthCube, QRhiTexture *cubeCopy, QRhiRenderBuffer *depthStencil)
QRhiRenderBuffer * m_rhiDepthStencil
QRhiRenderPassDescriptor * m_rhiBlurRenderPassDesc
ShadowMapModes m_shadowMapMode
shadow map method
QMatrix4x4 m_lightCubeView[6]
light cubemap view matrices
QRhiTextureRenderTarget * m_rhiBlurRenderTarget1
static QSSGShadowMapEntry withRhiDepthMap(quint32 lightIdx, ShadowMapModes mode, QRhiTexture *depthMap, QRhiTexture *depthCopy, QRhiRenderBuffer *depthStencil)
quint32 m_lightIndex
the light index it belongs to
QMatrix4x4 m_lightView
light view transform