39 QSSGRenderCustomMaterial();
40 ~QSSGRenderCustomMaterial();
42 struct TextureProperty
44 QQuick3DShaderUtilsTextureInput *texInput =
nullptr;
45 QSSGRenderImage *texImage =
nullptr;
47 QSSGRenderShaderValue::Type shaderDataType;
48 QSSGRenderTextureFilterOp minFilterType = QSSGRenderTextureFilterOp::Linear;
49 QSSGRenderTextureFilterOp magFilterType = QSSGRenderTextureFilterOp::Linear;
50 QSSGRenderTextureFilterOp mipFilterType = QSSGRenderTextureFilterOp::Linear;
51 QSSGRenderTextureCoordOp horizontalClampType = QSSGRenderTextureCoordOp::ClampToEdge;
52 QSSGRenderTextureCoordOp verticalClampType = QSSGRenderTextureCoordOp::ClampToEdge;
53 QSSGRenderTextureCoordOp zClampType = QSSGRenderTextureCoordOp::ClampToEdge;
54 QQuick3DTexture *lastConnectedTexture =
nullptr;
55 QMetaObject::Connection minFilterChangedConn;
56 QMetaObject::Connection magFilterChangedConn;
57 QMetaObject::Connection mipFilterChangedConn;
58 QMetaObject::Connection horizontalTilingChangedConn;
59 QMetaObject::Connection verticalTilingChangedConn;
60 QMetaObject::Connection depthTilingChangedConn;
62 using TexturePropertyList = QList<TextureProperty>;
63 using Property = QSSGBaseTypeProperty;
64 using PropertyUniformsList = QList<Property>;
66 enum class Flags : quint8
71 using FlagT = std::underlying_type_t<Flags>;
73 enum class ShadingMode
79 enum class CustomShaderPresenceFlag {
83 Q_DECLARE_FLAGS(CustomShaderPresence, CustomShaderPresenceFlag)
85 enum class RenderFlag {
87 ScreenTexture = 1 << 1,
88 DepthTexture = 1 << 2,
90 OverridesPosition = 1 << 4,
91 ProjectionMatrix = 1 << 5,
92 InverseProjectionMatrix = 1 << 6,
93 ScreenMipTexture = 1 << 7,
95 IblOrientation = 1 << 9,
101 ClearcoatFresnelScaleBias = 1 << 15,
102 FresnelScaleBias = 1 << 16,
103 Transmission = 1 << 17,
104 NormalTexture = 1 << 18,
105 MotionVectorTexture = 1 << 19,
107 Anisotropy = 1 << 21,
108 Iridescence = 1 << 22,
111 Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
114 RegularShaderPathKeyIndex = 0,
115 MultiViewShaderPathKeyIndex = 1
117 QByteArray m_shaderPathKey[2];
118 CustomShaderPresence m_customShaderPresence;
120 TexturePropertyList m_textureProperties;
121 PropertyUniformsList m_properties;
123 QSSGRenderImage *m_iblProbe =
nullptr;
124 QSSGRenderImage *m_emissiveMap =
nullptr;
125 QSSGCullFaceMode m_cullMode = QSSGCullFaceMode::Back;
126 QSSGDepthDrawMode m_depthDrawMode = QSSGDepthDrawMode::OpaqueOnly;
127 RenderFlags m_renderFlags;
128 QRhiGraphicsPipeline::BlendFactor m_srcBlend;
129 QRhiGraphicsPipeline::BlendFactor m_dstBlend;
130 QRhiGraphicsPipeline::BlendFactor m_srcAlphaBlend;
131 QRhiGraphicsPipeline::BlendFactor m_dstAlphaBlend;
132 float m_lineWidth = 1.0f;
134 QSSGRenderGraphObject *m_nextSibling =
nullptr;
136 ShadingMode m_shadingMode = ShadingMode::Shaded;
138 FlagT m_flags { FlagT(Flags::Dirty) };
139 bool incompleteBuildTimeObject =
false;
140 bool m_usesSharedVariables =
false;
144 void setAlwaysDirty(
bool v);
145 [[nodiscard]]
inline bool isDirty()
const {
return ((m_flags & (FlagT(Flags::Dirty) | FlagT(Flags::AlwaysDirty))) != 0); }
147 QSSGShaderMaterialAdapter *adapter =
nullptr;
149 QString debugObjectName;
static QVector3D closestPointOnTriangle(const QVector3D &p, const QVector3D &a, const QVector3D &b, const QVector3D &c, const Dot &dot, float &u, float &v, float &w)