Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrhicustommaterialsystem_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_RHI_CUSTOM_MATERIAL_SYSTEM_H
6#define QSSG_RHI_CUSTOM_MATERIAL_SYSTEM_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 <QtQuick3DRuntimeRender/private/qssgrendershaderlibrarymanager_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgvertexpipelineimpl_p.h>
22#include <QtQuick3DRuntimeRender/private/qssgrenderableobjects_p.h>
23#include <QtQuick3DRuntimeRender/private/qssgrendercustommaterial_p.h>
24#include <QtQuick3DRuntimeRender/private/qssgrendershaderkeys_p.h>
25#include <QtQuick3DRuntimeRender/private/qssgshadermapkey_p.h>
26#include <QtCore/qhash.h>
27#include <QtGui/QMatrix4x4>
28
30
32struct QSSGRenderSubset;
33struct QSSGRenderModel;
36struct QSSGRenderLayer;
37struct QSSGRenderLight;
38struct QSSGRenderCamera;
40class QRhiTexture;
41
42
43class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGCustomMaterialSystem
44{
45 Q_DISABLE_COPY(QSSGCustomMaterialSystem)
46 typedef QPair<QByteArray, QByteArray> TStrStrPair;
48
50 TShaderMap shaderMap;
51
52 void setShaderResources(char *ubufData,
53 const QSSGRenderCustomMaterial &inMaterial,
54 const QByteArray &inPropertyName,
55 const QVariant &propertyValue,
56 QSSGRenderShaderDataType inPropertyType,
57 QSSGRhiShaderPipeline &shaderPipeline);
58
59public:
62
63 void setRenderContextInterface(QSSGRenderContextInterface *inContext);
64
65 void releaseCachedResources();
66
67 // Returns true if the material is dirty and thus will produce a different render result
68 // than previously. This effects things like progressive AA.
69 bool prepareForRender(const QSSGRenderModel &inModel,
70 const QSSGRenderSubset &inSubset,
71 QSSGRenderCustomMaterial &inMaterial);
72
73 QSSGRhiShaderPipelinePtr shadersForCustomMaterial(QSSGRhiGraphicsPipelineState *ps,
74 const QSSGRenderCustomMaterial &material,
75 QSSGSubsetRenderable &renderable,
76 const QSSGShaderFeatures &featureSet);
77
78 void updateUniformsForCustomMaterial(QSSGRhiShaderPipeline &shaderPipeline,
79 QSSGRhiContext *rhiCtx,
80 const QSSGLayerRenderData &inData,
81 char *ubufData,
83 const QSSGRenderCustomMaterial &material,
84 QSSGSubsetRenderable &renderable,
86 const QVector2D *depthAdjust,
87 const QMatrix4x4 *alteredModelViewProjection);
88
89 void rhiPrepareRenderable(QSSGRhiGraphicsPipelineState *ps, QSSGPassKey passKey,
90 QSSGSubsetRenderable &renderable,
91 const QSSGShaderFeatures &featureSet,
92 const QSSGRenderCustomMaterial &material,
93 const QSSGLayerRenderData &layerData,
94 QRhiRenderPassDescriptor *renderPassDescriptor,
95 int samples,
96 QSSGRenderCamera *camera = nullptr,
97 int cubeFace = -1,
98 QMatrix4x4 *modelViewProjection = nullptr,
99 QSSGReflectionMapEntry *entry = nullptr);
100 void applyRhiShaderPropertyValues(char *ubufData,
101 const QSSGRenderCustomMaterial &inMaterial,
102 QSSGRhiShaderPipeline &shaderPipeline);
103 void rhiRenderRenderable(QSSGRhiContext *rhiCtx,
104 QSSGSubsetRenderable &renderable,
105 bool *needsSetViewport,
106 int cubeFace,
108};
109
111
112#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qhash.h:818
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtGui
Definition qrhi.h:1119
\inmodule QtGui
Definition qrhi.h:883
\inmodule QtCore
Definition qvariant.h:64
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
QCamera * camera
Definition camera.cpp:19
else opt state
[0]
Combined button and popup list for selecting options.
static void * context
std::pair< T1, T2 > QPair
GLsizei samples
GLuint entry
QSSGRenderShaderDataType
std::shared_ptr< QSSGRhiShaderPipeline > QSSGRhiShaderPipelinePtr
const void * QSSGPassKey