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
qquick3dprincipledmaterial_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGPRINCIPLEDMATERIAL_H
5#define QSSGPRINCIPLEDMATERIAL_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 <QtQuick3D/private/qquick3dmaterial_p.h>
19#include <QtQuick3D/private/qquick3dtexture_p.h>
20
21#include <QColor>
22#include <QHash>
23
25
26class Q_QUICK3D_EXPORT QQuick3DPrincipledMaterial : public QQuick3DMaterial
27{
29 Q_PROPERTY(Lighting lighting READ lighting WRITE setLighting NOTIFY lightingChanged)
30 Q_PROPERTY(BlendMode blendMode READ blendMode WRITE setBlendMode NOTIFY blendModeChanged)
31
32 Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged)
33 Q_PROPERTY(QQuick3DTexture *baseColorMap READ baseColorMap WRITE setBaseColorMap NOTIFY baseColorMapChanged)
34 Q_PROPERTY(bool baseColorSingleChannelEnabled READ baseColorSingleChannelEnabled WRITE setBaseColorSingleChannelEnabled NOTIFY baseColorSingleChannelEnabledChanged REVISION(6, 8))
35 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping baseColorChannel READ baseColorChannel WRITE setBaseColorChannel NOTIFY baseColorChannelChanged REVISION(6, 8))
36
37 Q_PROPERTY(float metalness READ metalness WRITE setMetalness NOTIFY metalnessChanged)
38 Q_PROPERTY(QQuick3DTexture *metalnessMap READ metalnessMap WRITE setMetalnessMap NOTIFY metalnessMapChanged)
39 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping metalnessChannel READ metalnessChannel WRITE setMetalnessChannel NOTIFY metalnessChannelChanged)
40
41 Q_PROPERTY(float specularAmount READ specularAmount WRITE setSpecularAmount NOTIFY specularAmountChanged)
42 Q_PROPERTY(QQuick3DTexture *specularMap READ specularMap WRITE setSpecularMap NOTIFY specularMapChanged)
43 Q_PROPERTY(float specularTint READ specularTint WRITE setSpecularTint NOTIFY specularTintChanged)
44 Q_PROPERTY(bool specularSingleChannelEnabled READ specularSingleChannelEnabled WRITE setSpecularSingleChannelEnabled NOTIFY specularSingleChannelEnabledChanged REVISION(6, 8))
45 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping specularChannel READ specularChannel WRITE setSpecularChannel NOTIFY specularChannelChanged REVISION(6, 8))
46
47 Q_PROPERTY(float roughness READ roughness WRITE setRoughness NOTIFY roughnessChanged)
48 Q_PROPERTY(QQuick3DTexture *roughnessMap READ roughnessMap WRITE setRoughnessMap NOTIFY roughnessMapChanged)
49 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping roughnessChannel READ roughnessChannel WRITE setRoughnessChannel NOTIFY roughnessChannelChanged)
50
51 Q_PROPERTY(QVector3D emissiveFactor READ emissiveFactor WRITE setEmissiveFactor NOTIFY emissiveFactorChanged)
52 Q_PROPERTY(QQuick3DTexture *emissiveMap READ emissiveMap WRITE setEmissiveMap NOTIFY emissiveMapChanged)
53 Q_PROPERTY(bool emissiveSingleChannelEnabled READ emissiveSingleChannelEnabled WRITE setEmissiveSingleChannelEnabled NOTIFY emissiveSingleChannelEnabledChanged REVISION(6, 8))
54 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping emissiveChannel READ emissiveChannel WRITE setEmissiveChannel NOTIFY emissiveChannelChanged REVISION(6, 8))
55
56 Q_PROPERTY(bool invertOpacityMapValue READ invertOpacityMapValue WRITE setInvertOpacityMapValue NOTIFY invertOpacityMapValueChanged REVISION(6, 8))
57 Q_PROPERTY(float opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
58 Q_PROPERTY(QQuick3DTexture *opacityMap READ opacityMap WRITE setOpacityMap NOTIFY opacityMapChanged)
59 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping opacityChannel READ opacityChannel WRITE setOpacityChannel NOTIFY opacityChannelChanged)
60
61 Q_PROPERTY(QQuick3DTexture *normalMap READ normalMap WRITE setNormalMap NOTIFY normalMapChanged)
62 Q_PROPERTY(float normalStrength READ normalStrength WRITE setNormalStrength NOTIFY normalStrengthChanged)
63
64 Q_PROPERTY(QQuick3DTexture *specularReflectionMap READ specularReflectionMap WRITE setSpecularReflectionMap NOTIFY specularReflectionMapChanged)
65
66 Q_PROPERTY(QQuick3DTexture *occlusionMap READ occlusionMap WRITE setOcclusionMap NOTIFY occlusionMapChanged)
67 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping occlusionChannel READ occlusionChannel WRITE setOcclusionChannel NOTIFY occlusionChannelChanged)
68 Q_PROPERTY(float occlusionAmount READ occlusionAmount WRITE setOcclusionAmount NOTIFY occlusionAmountChanged)
69
70 Q_PROPERTY(AlphaMode alphaMode READ alphaMode WRITE setAlphaMode NOTIFY alphaModeChanged)
71 Q_PROPERTY(float alphaCutoff READ alphaCutoff WRITE setAlphaCutoff NOTIFY alphaCutoffChanged)
72
73 Q_PROPERTY(float pointSize READ pointSize WRITE setPointSize NOTIFY pointSizeChanged)
74 Q_PROPERTY(float lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged)
75
76 Q_PROPERTY(QQuick3DTexture *heightMap READ heightMap WRITE setHeightMap NOTIFY heightMapChanged REVISION(6, 2))
77 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping heightChannel READ heightChannel WRITE setHeightChannel NOTIFY heightChannelChanged REVISION(6, 2))
78 Q_PROPERTY(float heightAmount READ heightAmount WRITE setHeightAmount NOTIFY heightAmountChanged REVISION(6, 2))
79 Q_PROPERTY(int minHeightMapSamples READ minHeightMapSamples WRITE setMinHeightMapSamples NOTIFY minHeightMapSamplesChanged REVISION(6, 2))
80 Q_PROPERTY(int maxHeightMapSamples READ maxHeightMapSamples WRITE setMaxHeightMapSamples NOTIFY maxHeightMapSamplesChanged REVISION(6, 2))
81
82 Q_PROPERTY(float clearcoatAmount READ clearcoatAmount WRITE setClearcoatAmount NOTIFY clearcoatAmountChanged REVISION(6, 3))
83 Q_PROPERTY(QQuick3DTexture *clearcoatMap READ clearcoatMap WRITE setClearcoatMap NOTIFY clearcoatMapChanged REVISION(6, 3))
84 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping clearcoatChannel READ clearcoatChannel WRITE setClearcoatChannel NOTIFY
85 clearcoatChannelChanged REVISION(6, 3))
86 Q_PROPERTY(float clearcoatRoughnessAmount READ clearcoatRoughnessAmount WRITE setClearcoatRoughnessAmount NOTIFY
87 clearcoatRoughnessAmountChanged REVISION(6, 3))
88 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping clearcoatRoughnessChannel READ clearcoatRoughnessChannel WRITE
89 setClearcoatRoughnessChannel NOTIFY clearcoatRoughnessChannelChanged REVISION(6, 3))
90 Q_PROPERTY(QQuick3DTexture *clearcoatRoughnessMap READ clearcoatRoughnessMap WRITE setClearcoatRoughnessMap NOTIFY
91 clearcoatRoughnessMapChanged REVISION(6, 3))
92 Q_PROPERTY(QQuick3DTexture *clearcoatNormalMap READ clearcoatNormalMap WRITE setClearcoatNormalMap NOTIFY
93 clearcoatNormalMapChanged REVISION(6, 3))
94 Q_PROPERTY(float clearcoatNormalStrength READ clearcoatNormalStrength WRITE setClearcoatNormalStrength NOTIFY clearcoatNormalStrengthChanged REVISION(6, 8))
95
96 Q_PROPERTY(float transmissionFactor READ transmissionFactor WRITE setTransmissionFactor NOTIFY transmissionFactorChanged)
97 Q_PROPERTY(QQuick3DTexture * transmissionMap READ transmissionMap WRITE setTransmissionMap NOTIFY transmissionMapChanged)
98 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping transmissionChannel READ transmissionChannel WRITE setTransmissionChannel NOTIFY transmissionChannelChanged)
99
100 Q_PROPERTY(float thicknessFactor READ thicknessFactor WRITE setThicknessFactor NOTIFY thicknessFactorChanged REVISION(6, 3))
101 Q_PROPERTY(QQuick3DTexture *thicknessMap READ thicknessMap WRITE setThicknessMap NOTIFY thicknessMapChanged REVISION(6, 3))
102 Q_PROPERTY(QQuick3DMaterial::TextureChannelMapping thicknessChannel READ thicknessChannel WRITE setThicknessChannel NOTIFY
103 thicknessChannelChanged REVISION(6, 3))
104 Q_PROPERTY(float attenuationDistance READ attenuationDistance WRITE setAttenuationDistance NOTIFY attenuationDistanceChanged REVISION(6, 3))
105 Q_PROPERTY(QColor attenuationColor READ attenuationColor WRITE setAttenuationColor NOTIFY attenuationColorChanged REVISION(6, 3))
106
107 Q_PROPERTY(float indexOfRefraction READ indexOfRefraction WRITE setIndexOfRefraction NOTIFY indexOfRefractionChanged REVISION(6, 3))
108
109 Q_PROPERTY(bool vertexColorsEnabled READ vertexColorsEnabled WRITE setVertexColorsEnabled NOTIFY vertexColorsEnabledChanged REVISION(6, 5))
110
111 Q_PROPERTY(bool fresnelScaleBiasEnabled READ fresnelScaleBiasEnabled WRITE setFresnelScaleBiasEnabled NOTIFY fresnelScaleBiasEnabledChanged REVISION(6, 8))
112 Q_PROPERTY(float fresnelScale READ fresnelScale WRITE setFresnelScale NOTIFY fresnelScaleChanged REVISION(6, 8))
113 Q_PROPERTY(float fresnelBias READ fresnelBias WRITE setFresnelBias NOTIFY fresnelBiasChanged REVISION(6, 8))
114 Q_PROPERTY(float fresnelPower READ fresnelPower WRITE setFresnelPower NOTIFY fresnelPowerChanged REVISION(6, 8))
115
116 Q_PROPERTY(bool clearcoatFresnelScaleBiasEnabled READ clearcoatFresnelScaleBiasEnabled WRITE setClearcoatFresnelScaleBiasEnabled NOTIFY clearcoatFresnelScaleBiasEnabledChanged REVISION(6, 8))
117 Q_PROPERTY(float clearcoatFresnelScale READ clearcoatFresnelScale WRITE setClearcoatFresnelScale NOTIFY clearcoatFresnelScaleChanged REVISION(6, 8))
118 Q_PROPERTY(float clearcoatFresnelBias READ clearcoatFresnelBias WRITE setClearcoatFresnelBias NOTIFY clearcoatFresnelBiasChanged REVISION(6, 8))
119 Q_PROPERTY(float clearcoatFresnelPower READ clearcoatFresnelPower WRITE setClearcoatFresnelPower NOTIFY clearcoatFresnelPowerChanged REVISION(6, 8))
120
121 Q_PROPERTY(bool vertexColorsMaskEnabled READ vertexColorsMaskEnabled WRITE setVertexColorsMaskEnabled NOTIFY vertexColorsMaskEnabledChanged REVISION(6, 8))
122 Q_PROPERTY(VertexColorMaskFlags vertexColorRedMask READ vertexColorRedMask WRITE setVertexColorRedMask NOTIFY vertexColorRedMaskChanged REVISION(6, 8))
123 Q_PROPERTY(VertexColorMaskFlags vertexColorGreenMask READ vertexColorGreenMask WRITE setVertexColorGreenMask NOTIFY vertexColorGreenMaskChanged REVISION(6, 8))
124 Q_PROPERTY(VertexColorMaskFlags vertexColorBlueMask READ vertexColorBlueMask WRITE setVertexColorBlueMask NOTIFY vertexColorBlueMaskChanged REVISION(6, 8))
125 Q_PROPERTY(VertexColorMaskFlags vertexColorAlphaMask READ vertexColorAlphaMask WRITE setVertexColorAlphaMask NOTIFY vertexColorAlphaMaskChanged REVISION(6, 8))
126
127 QML_NAMED_ELEMENT(PrincipledMaterial)
128
129public:
130 enum Lighting {
131 NoLighting = 0,
132 FragmentLighting
133 };
134 Q_ENUM(Lighting)
135
137 SourceOver = 0,
139 Multiply
140 };
141 Q_ENUM(BlendMode)
142
149 Q_ENUM(AlphaMode)
150
165 Q_ENUM(VertexColorMask)
166 Q_DECLARE_FLAGS(VertexColorMaskFlags, VertexColorMask)
167
168 explicit QQuick3DPrincipledMaterial(QQuick3DObject *parent = nullptr);
170
171 Lighting lighting() const;
172 BlendMode blendMode() const;
173 QColor baseColor() const;
174 QQuick3DTexture *baseColorMap() const;
175 bool baseColorSingleChannelEnabled() const;
176 TextureChannelMapping baseColorChannel() const;
177 bool specularSingleChannelEnabled() const;
178 TextureChannelMapping specularChannel() const;
179 bool emissiveSingleChannelEnabled() const;
180 TextureChannelMapping emissiveChannel() const;
181 QQuick3DTexture *emissiveMap() const;
182 QVector3D emissiveFactor() const;
183 QQuick3DTexture *specularReflectionMap() const;
184 QQuick3DTexture *specularMap() const;
185 float specularTint() const;
186 float specularAmount() const;
187 float roughness() const;
188 QQuick3DTexture *roughnessMap() const;
189 bool invertOpacityMapValue() const;
190 float opacity() const;
191 QQuick3DTexture *opacityMap() const;
192 QQuick3DTexture *normalMap() const;
193 float metalness() const;
194 QQuick3DTexture *metalnessMap() const;
195 float normalStrength() const;
196 QQuick3DTexture *occlusionMap() const;
197 float occlusionAmount() const;
198 AlphaMode alphaMode() const;
199 float alphaCutoff() const;
200 TextureChannelMapping metalnessChannel() const;
201 TextureChannelMapping roughnessChannel() const;
202 TextureChannelMapping opacityChannel() const;
203 TextureChannelMapping occlusionChannel() const;
204 float pointSize() const;
205 float lineWidth() const;
206 Q_REVISION(6, 2) QQuick3DTexture *heightMap() const;
207 Q_REVISION(6, 2) TextureChannelMapping heightChannel() const;
208 Q_REVISION(6, 2) float heightAmount() const;
209 Q_REVISION(6, 2) int minHeightMapSamples() const;
210 Q_REVISION(6, 2) int maxHeightMapSamples() const;
211
212 Q_REVISION(6, 3) float clearcoatAmount() const;
213 Q_REVISION(6, 3) QQuick3DTexture *clearcoatMap() const;
214 Q_REVISION(6, 3) TextureChannelMapping clearcoatChannel() const;
215 Q_REVISION(6, 3) float clearcoatRoughnessAmount() const;
216 Q_REVISION(6, 3) TextureChannelMapping clearcoatRoughnessChannel() const;
217 Q_REVISION(6, 3) QQuick3DTexture *clearcoatRoughnessMap() const;
218 Q_REVISION(6, 3) QQuick3DTexture *clearcoatNormalMap() const;
219 Q_REVISION(6, 8) float clearcoatNormalStrength() const;
220
221 Q_REVISION(6, 3) float transmissionFactor() const;
222 Q_REVISION(6, 3) QQuick3DTexture *transmissionMap() const;
223 Q_REVISION(6, 3) TextureChannelMapping transmissionChannel() const;
224
225 Q_REVISION(6, 3) float thicknessFactor() const;
226 Q_REVISION(6, 3) QQuick3DTexture *thicknessMap() const;
227 Q_REVISION(6, 3) const TextureChannelMapping &thicknessChannel() const;
228 Q_REVISION(6, 3) float attenuationDistance() const;
229 Q_REVISION(6, 3) const QColor &attenuationColor() const;
230
231 Q_REVISION(6, 3) float indexOfRefraction() const;
232 Q_REVISION(6, 8) bool fresnelScaleBiasEnabled() const;
233 Q_REVISION(6, 8) float fresnelScale() const;
234 Q_REVISION(6, 8) float fresnelBias() const;
235 Q_REVISION(6, 8) float fresnelPower() const;
236
237 Q_REVISION(6, 8) bool clearcoatFresnelScaleBiasEnabled() const;
238 Q_REVISION(6, 8) float clearcoatFresnelScale() const;
239 Q_REVISION(6, 8) float clearcoatFresnelBias() const;
240 Q_REVISION(6, 8) float clearcoatFresnelPower() const;
241
242 Q_REVISION(6, 5) bool vertexColorsEnabled() const;
243
244 Q_REVISION(6, 8) bool vertexColorsMaskEnabled() const;
245
246 Q_REVISION(6, 8) VertexColorMaskFlags vertexColorRedMask() const;
247 Q_REVISION(6, 8) VertexColorMaskFlags vertexColorGreenMask() const;
248 Q_REVISION(6, 8) VertexColorMaskFlags vertexColorBlueMask() const;
249 Q_REVISION(6, 8) VertexColorMaskFlags vertexColorAlphaMask() const;
250
251public Q_SLOTS:
252 void setLighting(QQuick3DPrincipledMaterial::Lighting lighting);
253 void setBlendMode(QQuick3DPrincipledMaterial::BlendMode blendMode);
254 void setBaseColor(QColor baseColor);
255 void setBaseColorMap(QQuick3DTexture *baseColorMap);
256 void setBaseColorSingleChannelEnabled(bool baseColorSingleChannelEnabled);
257 void setBaseColorChannel(QQuick3DMaterial::TextureChannelMapping channel);
258 void setSpecularSingleChannelEnabled(bool specularSingleChannelEnabled);
259 void setSpecularChannel(QQuick3DMaterial::TextureChannelMapping channel);
260 void setEmissiveSingleChannelEnabled(bool emissiveSingleChannelEnabled);
261 void setEmissiveChannel(QQuick3DMaterial::TextureChannelMapping channel);
262 void setEmissiveMap(QQuick3DTexture *emissiveMap);
263 void setEmissiveFactor(QVector3D emissiveFactor);
264 void setSpecularReflectionMap(QQuick3DTexture *specularReflectionMap);
265 void setSpecularMap(QQuick3DTexture *specularMap);
266 void setSpecularTint(float specularTint);
267 void setSpecularAmount(float specularAmount);
268 void setRoughness(float roughness);
269 void setRoughnessMap(QQuick3DTexture *roughnessMap);
270 void setInvertOpacityMapValue(bool invertOpacityMapValue);
271 void setOpacity(float opacity);
272 void setOpacityMap(QQuick3DTexture *opacityMap);
273 void setNormalMap(QQuick3DTexture *normalMap);
274 void setMetalness(float metalnessAmount);
275 void setMetalnessMap(QQuick3DTexture *metalnessMap);
276 void setNormalStrength(float normalStrength);
277 void setOcclusionMap(QQuick3DTexture *occlusionMap);
278 void setOcclusionAmount(float occlusionAmount);
279 void setAlphaMode(QQuick3DPrincipledMaterial::AlphaMode alphaMode);
280 void setAlphaCutoff(float alphaCutoff);
281 void setMetalnessChannel(QQuick3DMaterial::TextureChannelMapping channel);
282 void setRoughnessChannel(QQuick3DMaterial::TextureChannelMapping channel);
283 void setOpacityChannel(QQuick3DMaterial::TextureChannelMapping channel);
284 void setOcclusionChannel(QQuick3DMaterial::TextureChannelMapping channel);
285 void setPointSize(float size);
286 void setLineWidth(float width);
287 Q_REVISION(6, 2) void setHeightMap(QQuick3DTexture *heightMap);
288 Q_REVISION(6, 2) void setHeightChannel(QQuick3DMaterial::TextureChannelMapping channel);
289 Q_REVISION(6, 2) void setHeightAmount(float heightAmount);
290 Q_REVISION(6, 2) void setMinHeightMapSamples(int samples);
291 Q_REVISION(6, 2) void setMaxHeightMapSamples(int samples);
292
293 Q_REVISION(6, 3) void setClearcoatAmount(float newClearcoatAmount);
294 Q_REVISION(6, 3) void setClearcoatMap(QQuick3DTexture *newClearcoatMap);
295 Q_REVISION(6, 3) void setClearcoatChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatChannel);
296 Q_REVISION(6, 3) void setClearcoatRoughnessAmount(float newClearcoatRoughnessAmount);
297 Q_REVISION(6, 3) void setClearcoatRoughnessChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatRoughnessChannel);
298 Q_REVISION(6, 3) void setClearcoatRoughnessMap(QQuick3DTexture *newClearcoatRoughnessMap);
299 Q_REVISION(6, 3) void setClearcoatNormalMap(QQuick3DTexture *newClearcoatNormalMap);
300 Q_REVISION(6, 8) void setClearcoatNormalStrength(float clearcoatNormalStrength);
301
302 Q_REVISION(6, 3) void setTransmissionFactor(float newTransmissionFactor);
303 Q_REVISION(6, 3) void setTransmissionMap(QQuick3DTexture *newTransmissionMap);
304 Q_REVISION(6, 3) void setTransmissionChannel(QQuick3DMaterial::TextureChannelMapping newTransmissionChannel);
305
306 Q_REVISION(6, 3) void setThicknessFactor(float newThicknessFactor);
307 Q_REVISION(6, 3) void setThicknessMap(QQuick3DTexture *newThicknessMap);
308 Q_REVISION(6, 3) void setThicknessChannel(const QQuick3DMaterial::TextureChannelMapping &newThicknessChannel);
309 Q_REVISION(6, 3) void setAttenuationDistance(float newAttenuationDistance);
310 Q_REVISION(6, 3) void setAttenuationColor(const QColor &newAttenuationColor);
311
312 Q_REVISION(6, 3) void setIndexOfRefraction(float indexOfRefraction);
313 Q_REVISION(6, 8) void setFresnelScaleBiasEnabled(bool fresnelScaleBias);
314 Q_REVISION(6, 8) void setFresnelScale(float fresnelScale);
315 Q_REVISION(6, 8) void setFresnelBias(float fresnelBias);
316 Q_REVISION(6, 8) void setFresnelPower(float fresnelPower);
317
318 Q_REVISION(6, 8) void setClearcoatFresnelScaleBiasEnabled(bool clearcoatFresnelScaleBias);
319 Q_REVISION(6, 8) void setClearcoatFresnelScale(float clearcoatFresnelScale);
320 Q_REVISION(6, 8) void setClearcoatFresnelBias(float clearcoatFresnelBias);
321 Q_REVISION(6, 8) void setClearcoatFresnelPower(float clearcoatFresnelPower);
322
323 Q_REVISION(6, 5) void setVertexColorsEnabled(bool vertexColorsEnabled);
324
325 Q_REVISION(6, 8) void setVertexColorsMaskEnabled(bool vertexColorsMaskEnabled);
326 Q_REVISION(6, 8) void setVertexColorRedMask(VertexColorMaskFlags vertexColorRedMask);
327 Q_REVISION(6, 8) void setVertexColorGreenMask(VertexColorMaskFlags vertexColorGreenMask);
328 Q_REVISION(6, 8) void setVertexColorBlueMask(VertexColorMaskFlags vertexColorBlueMask);
329 Q_REVISION(6, 8) void setVertexColorAlphaMask(VertexColorMaskFlags vertexColorAlphaMask);
330
332 void lightingChanged(QQuick3DPrincipledMaterial::Lighting lighting);
333 void blendModeChanged(QQuick3DPrincipledMaterial::BlendMode blendMode);
334 void baseColorChanged(QColor baseColor);
335 void baseColorMapChanged(QQuick3DTexture *baseColorMap);
336 void baseColorSingleChannelEnabledChanged(bool baseColorSingleChannelEnabled);
337 void baseColorChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
338 void specularSingleChannelEnabledChanged(bool specularColorSingleChannelEnabled);
339 void specularChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
340 void emissiveSingleChannelEnabledChanged(bool emissiveColorSingleChannelEnabled);
341 void emissiveChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
342 void emissiveMapChanged(QQuick3DTexture *emissiveMap);
343 void emissiveFactorChanged(QVector3D emissiveFactor);
344 void specularReflectionMapChanged(QQuick3DTexture *specularReflectionMap);
345 void specularMapChanged(QQuick3DTexture *specularMap);
346 void specularTintChanged(float specularTint);
347 void specularAmountChanged(float specularAmount);
348 void roughnessChanged(float roughness);
349 void roughnessMapChanged(QQuick3DTexture *roughnessMap);
350 void invertOpacityMapValueChanged(bool invertOpacityMapValue);
351 void opacityChanged(float opacity);
352 void opacityMapChanged(QQuick3DTexture *opacityMap);
353 void normalMapChanged(QQuick3DTexture *normalMap);
354 void metalnessChanged(float metalness);
355 void metalnessMapChanged(QQuick3DTexture *metalnessMap);
356 void normalStrengthChanged(float normalStrength);
357 void occlusionMapChanged(QQuick3DTexture *occlusionMap);
358 void occlusionAmountChanged(float occlusionAmount);
359 void alphaModeChanged(QQuick3DPrincipledMaterial::AlphaMode alphaMode);
360 void alphaCutoffChanged(float alphaCutoff);
361 void metalnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
362 void roughnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
363 void opacityChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
364 void occlusionChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
365 void pointSizeChanged();
366 void lineWidthChanged();
367 Q_REVISION(6, 2) void heightMapChanged(QQuick3DTexture *heightMap);
368 Q_REVISION(6, 2) void heightChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
369 Q_REVISION(6, 2) void heightAmountChanged(float heightAmount);
370 Q_REVISION(6, 2) void minHeightMapSamplesChanged(int samples);
371 Q_REVISION(6, 2) void maxHeightMapSamplesChanged(int samples);
372
373 Q_REVISION(6, 3) void clearcoatAmountChanged(float amount);
374 Q_REVISION(6, 3) void clearcoatMapChanged(QQuick3DTexture *texture);
375 Q_REVISION(6, 3) void clearcoatChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
376 Q_REVISION(6, 3) void clearcoatRoughnessAmountChanged(float amount);
377 Q_REVISION(6, 3) void clearcoatRoughnessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
378 Q_REVISION(6, 3) void clearcoatRoughnessMapChanged(QQuick3DTexture *texture);
379 Q_REVISION(6, 3) void clearcoatNormalMapChanged(QQuick3DTexture *texture);
380 Q_REVISION(6, 8) void clearcoatNormalStrengthChanged(float clearcoatNormalStrength);
381
382 Q_REVISION(6, 3) void transmissionFactorChanged(float amount);
383 Q_REVISION(6, 3) void transmissionMapChanged(QQuick3DTexture *texture);
384 Q_REVISION(6, 3) void transmissionChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
385
386 Q_REVISION(6, 3) void thicknessFactorChanged(float amount);
387 Q_REVISION(6, 3) void thicknessMapChanged(QQuick3DTexture *texture);
388 Q_REVISION(6, 3) void thicknessChannelChanged(QQuick3DMaterial::TextureChannelMapping channel);
389 Q_REVISION(6, 3) void attenuationDistanceChanged(float distance);
390 Q_REVISION(6, 3) void attenuationColorChanged(QColor color);
391
392 Q_REVISION(6, 3) void indexOfRefractionChanged(float indexOfRefraction);
393 Q_REVISION(6, 8) void fresnelScaleBiasEnabledChanged(bool fresnelScaleBiasEnabled);
394 Q_REVISION(6, 8) void fresnelScaleChanged(float fresnelScale);
395 Q_REVISION(6, 8) void fresnelBiasChanged(float fresnelBias);
396 Q_REVISION(6, 8) void fresnelPowerChanged(float fresnelPower);
397
398 Q_REVISION(6, 8) void clearcoatFresnelScaleBiasEnabledChanged(bool clearcoatFresnelScaleBiasEnabled);
399 Q_REVISION(6, 8) void clearcoatFresnelScaleChanged(float clearcoatFresnelScale);
400 Q_REVISION(6, 8) void clearcoatFresnelBiasChanged(float clearcoatFresnelBias);
401 Q_REVISION(6, 8) void clearcoatFresnelPowerChanged(float clearcoatFresnelPower);
402
403 Q_REVISION(6, 5) void vertexColorsEnabledChanged(bool vertexColorsEnabled);
404
405 Q_REVISION(6, 8) void vertexColorsMaskEnabledChanged();
406 Q_REVISION(6, 8) void vertexColorRedMaskChanged();
407 Q_REVISION(6, 8) void vertexColorGreenMaskChanged();
408 Q_REVISION(6, 8) void vertexColorBlueMaskChanged();
409 Q_REVISION(6, 8) void vertexColorAlphaMaskChanged();
410
411protected:
412 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
413 void markAllDirty() override;
414 void itemChange(ItemChange, const ItemChangeData &) override;
415private:
416 enum DirtyType {
417 LightingModeDirty = 0x00000001,
418 BlendModeDirty = 0x00000002,
419 BaseColorDirty = 0x00000004,
420 EmissiveDirty = 0x00000008,
421 SpecularDirty = 0x00000010,
422 OpacityDirty = 0x00000020,
423 NormalDirty = 0x00000040,
424 MetalnessDirty = 0x00000080,
425 RoughnessDirty = 0x00000100,
426 OcclusionDirty = 0x00000200,
427 AlphaModeDirty = 0x00000400,
428 PointSizeDirty = 0x00000800,
429 LineWidthDirty = 0x00001000,
430 HeightDirty = 0x00002000,
431 ClearcoatDirty = 0x00004000,
432 TransmissionDirty = 0x00008000,
433 VolumeDirty = 0x00010000,
434 VertexColorsDirty = 0x00020000
435 };
436
437 void updateSceneManager(QQuick3DSceneManager *window);
438
439 // Note: The default values for properties that are also present in
440 // QSSGShaderCustomMaterialAdapter must match the values there, because a
441 // PrincipledMaterial { } and CustomMaterial { } must be identical. Same
442 // goes for the custom shader defaults in generateFragmentShader(), keep
443 // them in sync.
444
445 Lighting m_lighting = FragmentLighting;
446 BlendMode m_blendMode = SourceOver;
447 AlphaMode m_alphaMode = Default;
448 QColor m_baseColor = Qt::white;
449 QQuick3DTexture *m_baseColorMap = nullptr;
450 bool m_baseColorSingleChannelEnabled = false;
451 TextureChannelMapping m_baseColorChannel = QQuick3DMaterial::R;
452 bool m_specularSingleChannelEnabled = false;
453 TextureChannelMapping m_specularChannel = QQuick3DMaterial::R;
454 TextureChannelMapping m_emissiveChannel = QQuick3DMaterial::R;
455 bool m_emissiveSingleChannelEnabled = false;
456 QVector3D m_emissiveFactor;
457 QQuick3DTexture *m_emissiveMap = nullptr;
458
459 QQuick3DTexture *m_specularReflectionMap = nullptr;
460 QQuick3DTexture *m_specularMap = nullptr;
461 QQuick3DTexture *m_roughnessMap = nullptr;
462 QQuick3DTexture *m_opacityMap = nullptr;
463 QQuick3DTexture *m_normalMap = nullptr;
464 QQuick3DTexture *m_metalnessMap = nullptr;
465 QQuick3DTexture *m_occlusionMap = nullptr;
466 float m_specularTint = 0.0f;
467 float m_specularAmount = 1.0f;
468 float m_roughness = 0.0f;
469 bool m_invertOpacityMapValue = false;
470 float m_opacity = 1.0f;
471 float m_metalnessAmount = 0.0f;
472 float m_normalStrength = 1.0f;
473 float m_occlusionAmount = 1.0f;
474 float m_alphaCutoff = 0.5f;
475 TextureChannelMapping m_metalnessChannel = QQuick3DMaterial::B;
476 TextureChannelMapping m_roughnessChannel = QQuick3DMaterial::G;
477 TextureChannelMapping m_opacityChannel = QQuick3DMaterial::A;
478 TextureChannelMapping m_occlusionChannel = QQuick3DMaterial::R;
479 float m_pointSize = 1.0f;
480 float m_lineWidth = 1.0f;
481 QQuick3DTexture *m_heightMap = nullptr;
482 TextureChannelMapping m_heightChannel = QQuick3DMaterial::R;
483 float m_heightAmount = 0.0f;
484 int m_minHeightMapSamples = 8;
485 int m_maxHeightMapSamples = 32;
486 float m_clearcoatAmount = 0.0f;
487 QQuick3DTexture *m_clearcoatMap = nullptr;
488 TextureChannelMapping m_clearcoatChannel = QQuick3DMaterial::R;
489 float m_clearcoatRoughnessAmount = 0.0f;
490 float m_clearcoatNormalStrength = 1.0f;
491 TextureChannelMapping m_clearcoatRoughnessChannel = QQuick3DMaterial::G;
492 QQuick3DTexture *m_clearcoatRoughnessMap = nullptr;
493 QQuick3DTexture *m_clearcoatNormalMap = nullptr;
494 float m_transmissionFactor = 0.0f;
495 QQuick3DTexture *m_transmissionMap = nullptr;
496 TextureChannelMapping m_transmissionChannel = QQuick3DMaterial::R;
497 float m_thicknessFactor = 0.0f;
498 QQuick3DTexture *m_thicknessMap = nullptr;
499 TextureChannelMapping m_thicknessChannel = QQuick3DMaterial::G;
500 float m_attenuationDistance = std::numeric_limits<float>::infinity();
501 QColor m_attenuationColor = Qt::white;
502 float m_indexOfRefraction = 1.5f;
503 bool m_fresnelScaleBiasEnabled = false;
504 float m_fresnelScale = 1.0f;
505 float m_fresnelBias = 0.0f;
506 float m_fresnelPower = 5.0f;
507 bool m_clearcoatFresnelScaleBiasEnabled = false;
508 float m_clearcoatFresnelScale = 1.0f;
509 float m_clearcoatFresnelBias = 0.0f;
510 float m_clearcoatFresnelPower = 5.0f;
511 bool m_vertexColorsEnabled = true;
512
513 bool m_vertexColorsMaskEnabled = false;
514 VertexColorMaskFlags m_vertexColorRedMask = NoMask;
515 VertexColorMaskFlags m_vertexColorGreenMask = NoMask;
516 VertexColorMaskFlags m_vertexColorBlueMask = NoMask;
517 VertexColorMaskFlags m_vertexColorAlphaMask = NoMask;
518
519 quint32 m_dirtyAttributes = 0xffffffff; // all dirty by default
520 void markDirty(DirtyType type);
521
522 static constexpr float ensureNormalized(float val) { return qBound(0.0f, val, 1.0f); }
523};
524
526
527#endif // QSSGPRINCIPLEDMATERIAL_H
IOBluetoothL2CAPChannel * channel
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
Q_REVISION(6, 2) QQuick3DTexture *heightMap() const
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
@ white
Definition qnamespace.h:31
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
GLsizei samples
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLsizei GLfloat distance
GLint GLsizei width
GLuint color
[2]
GLenum type
GLenum GLuint texture
GLuint GLfloat * val
#define QML_NAMED_ELEMENT(NAME)
static QT_BEGIN_NAMESPACE const uint Default
Definition qsplitter_p.h:27
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_SLOTS
#define Q_SIGNALS
unsigned int quint32
Definition qtypes.h:50
aWidget window() -> setWindowTitle("New Window Title")
[2]
label setLineWidth(2)