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
qssgrenderreflectionmap_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSG_RENDER_REFLECTION_MAP_H
5#define QSSG_RENDER_REFLECTION_MAP_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
19#include <QtQuick3DRuntimeRender/private/qssgrenderreflectionprobe_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QRhi;
24class QRhiCommandBuffer;
25class QSSGRhiContext;
27
28class QRhiRenderBuffer;
29class QRhiTextureRenderTarget;
30class QRhiRenderPassDescriptor;
31class QRhiTexture;
32class QRhiGraphicsPipeline;
33class QRhiShaderResourceBindings;
34class QRhiBuffer;
35
37{
39
40 static QSSGReflectionMapEntry withRhiTexturedCubeMap(quint32 probeIdx,
41 QRhiTexture *preFiltered);
42 static QSSGReflectionMapEntry withRhiCubeMap(quint32 probeIdx,
43 QRhiTexture *cube,
44 QRhiTexture *prefiltered,
45 QRhiRenderBuffer *depthStencil);
46
47 void renderMips(QSSGRhiContext *rhiCtx);
49
51
52 // RHI resources
53 QRhiTexture *m_rhiCube = nullptr;
54 QRhiTexture *m_rhiPrefilteredCube = nullptr;
55 QRhiRenderBuffer *m_rhiDepthStencil = nullptr;
57 QRhiRenderPassDescriptor *m_rhiRenderPassDesc = nullptr;
58
59 QRhiGraphicsPipeline *m_prefilterPipeline = nullptr;
60 QRhiGraphicsPipeline *m_irradiancePipeline = nullptr;
61 QRhiShaderResourceBindings *m_prefilterSrb = nullptr;
62 QRhiShaderResourceBindings *m_irradianceSrb = nullptr;
63 QRhiBuffer *m_prefilterVertBuffer = nullptr;
64 QRhiBuffer *m_prefilterFragBuffer = nullptr;
65 QRhiBuffer *m_irradianceFragBuffer = nullptr;
67 QRhiRenderPassDescriptor *m_rhiPrefilterRenderPassDesc = nullptr;
69
71
73
74 bool m_needsRender = false;
75 bool m_rendered = false;
76
81};
82
83class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderReflectionMap
84{
85 typedef QVector<QSSGReflectionMapEntry> TReflectionMapEntryList;
86 Q_DISABLE_COPY(QSSGRenderReflectionMap)
87
88public:
89 const QSSGRenderContextInterface &m_context;
90
91 explicit QSSGRenderReflectionMap(const QSSGRenderContextInterface &inContext);
92 ~QSSGRenderReflectionMap();
93 void releaseCachedResources();
94
95 void addReflectionMapEntry(qint32 probeIdx, const QSSGRenderReflectionProbe &probe);
96 void addTexturedReflectionMapEntry(qint32 probeIdx, const QSSGRenderReflectionProbe &probe);
97
98 QSSGReflectionMapEntry *reflectionMapEntry(int probeIdx);
99
100 qint32 reflectionMapEntryCount() { return m_reflectionMapList.size(); }
101
102private:
103 TReflectionMapEntryList m_reflectionMapList;
104};
105
106using QSSGRenderReflectionMapPtr = std::shared_ptr<QSSGRenderReflectionMap>;
107
108QT_END_NAMESPACE
109
110#endif
friend class QSSGRenderContextInterface
QVarLengthArray< QRhiTextureRenderTarget *, 6 > m_rhiRenderTargets
QSSGRenderReflectionProbe::ReflectionTimeSlicing m_timeSlicing
QVarLengthArray< QRhiShaderResourceBindings *, 6 > m_skyBoxSrbs
static QSSGReflectionMapEntry withRhiTexturedCubeMap(quint32 probeIdx, QRhiTexture *preFiltered)
QRhiRenderPassDescriptor * m_rhiRenderPassDesc
static QSSGReflectionMapEntry withRhiCubeMap(quint32 probeIdx, QRhiTexture *cube, QRhiTexture *prefiltered, QRhiRenderBuffer *depthStencil)
QRhiShaderResourceBindings * m_irradianceSrb
QRhiShaderResourceBindings * m_prefilterSrb
QMap< int, QSize > m_prefilterMipLevelSizes
QRhiRenderPassDescriptor * m_rhiPrefilterRenderPassDesc
QRhiGraphicsPipeline * m_irradiancePipeline
QRhiGraphicsPipeline * m_prefilterPipeline
QMap< int, QVarLengthArray< QRhiTextureRenderTarget *, 6 > > m_rhiPrefilterRenderTargetsMap
void renderMips(QSSGRhiContext *rhiCtx)
QSSGRenderTextureCubeFace m_timeSliceFace