Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrendercustommaterial_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_CUSTOM_MATERIAL_H
6#define QSSG_RENDER_CUSTOM_MATERIAL_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/qssgrenderimage_p.h>
20
21#include <QtCore/qurl.h>
22#include <QtCore/qvariant.h>
23#include <QtCore/qvector.h>
24#include <rhi/qrhi.h>
25
27
30class QQuick3DTexture;
31
32struct Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRenderCustomMaterial : public QSSGRenderGraphObject
33{
36
38 {
40 QSSGRenderImage *texImage = nullptr;
48 QQuick3DTexture *lastConnectedTexture = nullptr;
54 };
56
57 struct Property
58 {
59 Property() = default;
60 Property(const QByteArray &name, const QVariant &value, QSSGRenderShaderDataType shaderDataType, int pid = -1)
61 : name(name), value(value), shaderDataType(shaderDataType), pid(pid)
62 { }
66 int pid;
67 };
69
70 enum class Flags : quint8
71 {
72 Dirty = 0x1,
73 AlwaysDirty = 0x2
74 };
75 using FlagT = std::underlying_type_t<Flags>;
76
77 enum class ShadingMode // must match QQuick3DCustomMaterial::ShadingMode
78 {
79 Unshaded,
80 Shaded
81 };
82
84 Vertex = 1 << 0,
85 Fragment = 1 << 1
86 };
87 Q_DECLARE_FLAGS(CustomShaderPresence, CustomShaderPresenceFlag)
88
89 enum class RenderFlag {
90 Blending = 1 << 0,
91 ScreenTexture = 1 << 1,
92 DepthTexture = 1 << 2,
93 AoTexture = 1 << 3,
94 OverridesPosition = 1 << 4,
95 ProjectionMatrix = 1 << 5,
96 InverseProjectionMatrix = 1 << 6,
97 ScreenMipTexture = 1 << 7,
98 VarColor = 1 << 8,
99 IblOrientation = 1 << 9,
100 Lightmap = 1 << 10,
101 Skinning = 1 << 11,
102 Morphing = 1 << 12
103 };
104 Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
105
106 QByteArray m_shaderPathKey;
107 CustomShaderPresence m_customShaderPresence;
108
109 TexturePropertyList m_textureProperties;
110 PropertyList m_properties;
111
112 QSSGRenderImage *m_iblProbe = nullptr;
113 QSSGRenderImage *m_emissiveMap = nullptr;
116 RenderFlags m_renderFlags;
117 QRhiGraphicsPipeline::BlendFactor m_srcBlend;
118 QRhiGraphicsPipeline::BlendFactor m_dstBlend;
119 float m_lineWidth = 1.0f;
120
121 QSSGRenderGraphObject *m_nextSibling = nullptr;
122
123 ShadingMode m_shadingMode = ShadingMode::Shaded;
124
125 FlagT m_flags { FlagT(Flags::Dirty) };
126 bool incompleteBuildTimeObject = false; // Used by the shadergen tool
127 bool m_usesSharedVariables = false;
128
129 void markDirty();
130 void clearDirty();
131 void setAlwaysDirty(bool v);
132 [[nodiscard]] inline bool isDirty() const { return ((m_flags & (FlagT(Flags::Dirty) | FlagT(Flags::AlwaysDirty))) != 0); }
133
134 QSSGShaderMaterialAdapter *adapter = nullptr;
135
137};
138
139
140
141Q_DECLARE_OPERATORS_FOR_FLAGS(QSSGRenderCustomMaterial::CustomShaderPresence)
142
144
145#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
\inmodule QtGui
Definition qrhi.h:1241
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLsizei const GLfloat * v
[13]
GLfloat GLfloat f
GLuint name
QSSGRenderTextureCoordOp
QSSGRenderShaderDataType
QSSGRenderTextureFilterOp
unsigned char quint8
Definition qtypes.h:41
Property(const QByteArray &name, const QVariant &value, QSSGRenderShaderDataType shaderDataType, int pid=-1)
std::underlying_type_t< Flags > FlagT
\qmltype MapCircle \instantiates QDeclarativeCircleMapItem \inqmlmodule QtLocation