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
qquick3dspecularglossymaterial.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
8
9#include <QtQuick3DRuntimeRender/private/qssgrenderdefaultmaterial_p.h>
10#include <QtQuick3DUtils/private/qssgutils_p.h>
11#include <QtQuick3D/private/qquick3dviewport_p.h>
12
14
15/*!
16 \qmltype SpecularGlossyMaterial
17 \inherits Material
18 \inqmlmodule QtQuick3D
19 \brief Lets you define a material for 3D items using the specular/glossiness workflow.
20
21 Before a Model can be rendered in a scene, it must have at least one material attached
22 to it that describes how the mesh should be shaded. The SpecularGlossyMaterial is a PBR
23 specular/glossiness material that aims at being an easy to use material with a minimal
24 set of parameters.
25 In addition to having few parameters, all input values are strictly normalized
26 between 0 and 1 and have sensible defaults, meaning even without changing any values,
27 the material can be used to shader a model. For an introduction on how the
28 different properties of the SpecularGlossyMaterial affects how a model is shaded,
29 see the \l{Qt Quick 3D - Principled Material Example}{Principled Material example} which
30 provides a mode for using the Specular/Glossy workflow.
31
32 Alternatively to use the metallic/roughness workflow instead use \l {PrincipledMaterial}.
33
34 \section1 Specular/Glossiness workflow
35
36 The SpecularGlossyMaterial provides a way to create materials using a specular/glossiness
37 type workflow. The main properties of the material is controlled through
38 the \l {SpecularGlossyMaterial::specularMap} {specular},
39 \l {SpecularGlossyMaterial::glossinessMap} {glossiness},
40 and \l {SpecularGlossyMaterial::albedoMap} {albedo} properties.
41
42 \section2 Specular
43
44 The \l {SpecularGlossyMaterial::specularMap} {specularColor} property describes the specular
45 amount and color of an object's surface. For reflective materials the main color
46 contribution, comes from this property.
47
48 \section2 Glossiness
49
50 The \l {SpecularGlossyMaterial::glossinessMap} {glossiness} of a material describes the
51 condition of an object's surface. A high \c glossiness value means the object has a smooth
52 surface and therefore be more reflective then a material with a lower \c glossiness value.
53
54 \section2 Albedo
55
56 The \l {SpecularGlossyMaterial::albedoMap} {albedoColor} property describes the diffuse color
57 of the material, and unlike the \l {PrincipledMaterial}'s base color, the albedo
58 does not contain any information about the material reflectance. That means that for
59 reflective surfaces the albedo's color value should be set to a black tint, as that
60 will allow for the specular color to contribute.
61*/
62
63/*!
64 \qmlproperty enumeration SpecularGlossyMaterial::lighting
65
66 This property defines which lighting method is used when generating this
67 material.
68
69 The default value is \c SpecularGlossyMaterial.FragmentLighting
70
71 \value SpecularGlossyMaterial.FragmentLighting Diffuse and specular lighting is
72 calculated for each rendered pixel. Certain effects (such as a Fresnel or normal map) require
73 \c SpecularGlossyMaterial.FragmentLighting to work.
74
75 \value SpecularGlossyMaterial.NoLighting No lighting is calculated. This
76 mode is (predictably) very fast, and is quite effective when image maps are
77 used that you do not need to be shaded by lighting. All other shading
78 properties except albedo values, alpha values, and vertex colors will be
79 ignored.
80*/
81
82/*!
83 \qmlproperty enumeration SpecularGlossyMaterial::blendMode
84
85 This property determines how the colors of the model rendered blends with
86 those behind it.
87
88 \value SpecularGlossyMaterial.SourceOver Default blend mode. Opaque objects
89 occlude objects behind them. This default mode does not guarantee alpha
90 blending in the rendering pipeline on its own for models that use this
91 material, but rather makes the decision dependent on a number of factors:
92 if the object's and material's total opacity is \c{1.0}, there is no
93 opacity map in the material, and \l alphaMode is not set to a value that
94 enforces alpha blending, then the model is treated as opaque, meaning it is
95 rendered with depth testing and depth write enabled, together with other
96 opaque objects, with blending disabled. Otherwise the model is treated as
97 semi-transparent, and is rendered after the opaque objects, together with
98 other semi-transparent objects in a back-to-front order based on their
99 center's distance from the camera, with alpha blending enabled.
100
101 \value SpecularGlossyMaterial.Screen Colors are blended using an inverted
102 multiply, producing a lighter result. This blend mode is order-independent;
103 if you are using semi-opaque objects and experiencing 'popping' as faces or
104 models sort differently, using Screen blending is one way to produce
105 results without popping.
106
107 \value SpecularGlossyMaterial.Multiply Colors are blended using a multiply,
108 producing a darker result. This blend mode is also order-independent.
109
110 \sa alphaMode, {Qt Quick 3D Architecture}
111*/
112
113/*!
114 \qmlproperty color SpecularGlossyMaterial::albedoColor
115
116 This property sets the albedo color for the material. Setting the
117 diffuse color to a black tint will create a purely-specular material
118 (e.g. metals or mirrors).
119
120 \sa albedoMap, alphaMode
121*/
122
123/*!
124 \qmlproperty Texture SpecularGlossyMaterial::albedoMap
125
126 This property defines the texture used to set the albedo color of the material.
127
128 \sa albedo, alphaMode
129*/
130
131/*!
132 \qmlproperty bool SpecularGlossyMaterial::albedoSingleChannelEnabled
133 \since 6.8
134
135 When this property is enabled, the material will use the single value of the albedoChannel from
136 the albedoMap as RGB value and use 1.0 as alpha value.
137 The default value is false.
138*/
139
140/*!
141 \qmlproperty enumeration SpecularGlossyMaterial::albedoChannel
142 \since 6.8
143
144 This property defines the texture channel used to read the albedo color value from albedoMap.
145 In order to use a single texture channel as color you have to enable the albedoSingleChannelEnabled
146 The default value is \c Material.R.
147
148 \value Material.R Read value from texture R channel.
149 \value Material.G Read value from texture G channel.
150 \value Material.B Read value from texture B channel.
151 \value Material.A Read value from texture A channel.
152*/
153
154/*!
155 \qmlproperty color SpecularGlossyMaterial::specularColor
156
157 This property defines the specular RGB color. If an alpha value is provided it
158 will be ignored.
159
160 The default value is \c Qt.White
161*/
162
163/*!
164 \qmlproperty Texture SpecularGlossyMaterial::specularMap
165
166 This property sets a Texture to be used to set the specular color for the
167 different parts of the material. Only the RGB channels are used.
168*/
169
170/*!
171 \qmlproperty bool SpecularGlossyMaterial::specularSingleChannelEnabled
172 \since 6.8
173
174 When this property is enabled, the material will use the single value of the specularChannel from
175 the specularMap as RGB value.
176 The default value is false.
177*/
178
179/*!
180 \qmlproperty enumeration SpecularGlossyMaterial::specularChannel
181 \since 6.8
182
183 This property defines the texture channel used to read the specular color value from specularMap.
184 In order to use a single texture channel as color you have to enable the specularSingleChannelEnabled
185 The default value is \c Material.R.
186
187 \value Material.R Read value from texture R channel.
188 \value Material.G Read value from texture G channel.
189 \value Material.B Read value from texture B channel.
190 \value Material.A Read value from texture A channel.
191*/
192
193/*!
194 \qmlproperty real SpecularGlossyMaterial::glossiness
195
196 This property controls the size of the specular highlight generated from
197 lights, and the clarity of reflections in general. Smaller values increase
198 the roughness, softening specular highlights and blurring reflections.
199 The range is [0.0, 1.0]. The default value is \c 1.0.
200*/
201
202/*!
203 \qmlproperty Texture SpecularGlossyMaterial::glossinessMap
204
205 This property defines a Texture to control the glossiness of the
206 material.
207*/
208
209/*!
210 \qmlproperty enumeration SpecularGlossyMaterial::glossinessChannel
211
212 This property defines the texture channel used to read the glossiness value
213 from glossinessMap.
214 The default value is \c Material.A.
215
216 \value Material.R Read value from texture R channel.
217 \value Material.G Read value from texture G channel.
218 \value Material.B Read value from texture B channel.
219 \value Material.A Read value from texture A channel.
220*/
221
222/*!
223 \qmlproperty bool SpecularGlossyMaterial::emissiveSingleChannelEnabled
224 \since 6.8
225
226 When this property is enabled, the material will use the single value of the emissiveChannel from
227 the emissiveMap as RGB value.
228 The default value is false.
229*/
230
231/*!
232 \qmlproperty enumeration SpecularGlossyMaterial::emissiveChannel
233 \since 6.8
234
235 This property defines the texture channel used to read the emissive color value from emissiveMap.
236 In order to use a single texture channel as color you have to enable the emissiveSingleChannelEnabled
237 The default value is \c Material.R.
238
239 \value Material.R Read value from texture R channel.
240 \value Material.G Read value from texture G channel.
241 \value Material.B Read value from texture B channel.
242 \value Material.A Read value from texture A channel.
243*/
244
245/*!
246 \qmlproperty Texture SpecularGlossyMaterial::emissiveMap
247
248 This property sets a RGB Texture to be used to specify the intensity of the
249 emissive color.
250*/
251
252/*!
253 \qmlproperty vector3d SpecularGlossyMaterial::emissiveFactor
254
255 This property determines the color of self-illumination for this material.
256 If an emissive map is set, the x, y, and z components are used as factors
257 (multipliers) for the R, G and B channels of the texture, respectively.
258 The default value is (0, 0, 0) and it means no emissive contribution at all.
259
260 \note Setting the lightingMode to DefaultMaterial.NoLighting means emissive
261 Factor does not have an effect on the scene.
262*/
263
264/*!
265 \qmlproperty real SpecularGlossyMaterial::opacity
266
267 This property drops the opacity of just this material, separate from the
268 model.
269*/
270
271/*!
272 \qmlproperty Texture SpecularGlossyMaterial::opacityMap
273
274 This property defines a Texture used to control the opacity differently for
275 different parts of the material.
276*/
277
278/*!
279 \qmlproperty real SpecularGlossyMaterial::invertOpacityMapValue
280 \since 6.8
281
282 This property inverts the opacity value of the opacityMap.
283 The default value is \c false.
284*/
285
286/*!
287 \qmlproperty enumeration SpecularGlossyMaterial::opacityChannel
288
289 This property defines the texture channel used to read the opacity value from opacityMap.
290 The default value is \c Material.A.
291
292 \value Material.R Read value from texture R channel.
293 \value Material.G Read value from texture G channel.
294 \value Material.B Read value from texture B channel.
295 \value Material.A Read value from texture A channel.
296*/
297
298/*!
299 \qmlproperty Texture SpecularGlossyMaterial::normalMap
300
301 This property defines an RGB image used to simulate fine geometry
302 displacement across the surface of the material. The RGB channels indicate
303 XYZ normal deviations.
304
305 \note Normal maps will not affect the silhouette of a model.
306*/
307
308/*!
309 \qmlproperty real SpecularGlossyMaterial::normalStrength
310
311 This property controls the amount of simulated displacement for the normalMap.
312*/
313
314/*!
315 \qmlproperty real SpecularGlossyMaterial::occlusionAmount
316
317 This property contains the factor used to modify the values from the \l occlusionMap texture.
318 The value should be between 0.0 to 1.0. The default is 1.0
319*/
320
321/*!
322 \qmlproperty Texture SpecularGlossyMaterial::occlusionMap
323
324 This property defines a texture used to determine how much indirect light the different areas of the
325 material should receive. Values are expected to be linear from 0.0 to 1.0, where 0.0 means no indirect lighting
326 and 1.0 means the effect of the indirect lighting is left unchanged.
327
328 \sa occlusionAmount
329*/
330
331/*!
332 \qmlproperty enumeration SpecularGlossyMaterial::occlusionChannel
333
334 This property defines the texture channel used to read the occlusion value from occlusionMap.
335 The default value is \c Material.R.
336
337 \value Material.R Read value from texture R channel.
338 \value Material.G Read value from texture G channel.
339 \value Material.B Read value from texture B channel.
340 \value Material.A Read value from texture A channel.
341*/
342
343/*!
344 \qmlproperty enumeration SpecularGlossyMaterial::alphaMode
345
346 This property specifies how the alpha color value from \l albedoColor and the
347 alpha channel of a \l{albedoMap}{albedo map} are used.
348
349 \note The alpha cutoff test only considers the albedo color alpha. \l opacity
350 and \l [QtQuick3D] {Node::opacity} are not taken into account there.
351
352 \note When sampling an albedo color map, the effective alpha value is the
353 sampled alpha multiplied by the \l albedoColor alpha.
354
355 \value SpecularGlossyMaterial.Default No test is applied, the effective alpha
356 value is passed on as-is. Note that a \l albedoColor or \l albedoMap alpha
357 less than \c 1.0 does not automatically imply alpha blending, the object
358 with the material may still be treated as opaque, if no other relevant
359 properties (such as, an opacity less than 1, the presence of an opacity
360 map, or a non-default \l blendMode value) trigger treating the object as
361 semi-transparent. To ensure alpha blending happens regardless of any other
362 object or material property, set \c Blend instead.
363
364 \value SpecularGlossyMaterial.Blend No cutoff test is applied, but guarantees
365 that alpha blending happens. The object with this material will therefore
366 never be treated as opaque by the renderer.
367
368 \value SpecularGlossyMaterial.Opaque No cutoff test is applied and the rendered
369 object is assumed to be fully opaque, meaning the alpha values in the
370 vertex color, albedo color, and albedo color map are ignored and a value of 1.0
371 is substituted instead. This mode does not guarantee alpha blending does
372 not happen. If relevant properties (such as, an opacity less than 1, an
373 opacity map, or a non-default \l blendMode) say so, then the object will
374 still be treated as semi-transparent by the rendering pipeline, just like
375 with the \c Default alphaMode.
376
377 \value SpecularGlossyMaterial.Mask A test based on \l alphaCutoff is applied.
378 If the effective alpha value falls below \l alphaCutoff, the fragment is
379 changed to fully transparent and is discarded (with all implications of
380 discarding: the depth buffer is not written for that fragment). Otherwise
381 the alpha is changed to 1.0, so that the fragment will become fully opaque.
382 When it comes to alpha blending, the behavior of this mode is identical to
383 \c Opaque, regardless of the cutoff test's result. This means that the
384 \l{https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#alpha-coverage}{glTF
385 2 spec's alpha coverage} Implementation Notes are fulfilled. Objects with
386 alpha cutoff tests can also cast shadows since they behave like opaque
387 objects by default, unless the relevant properties (such as, an opacity
388 less than 1, an opacity map, or a non-default \l blendMode) imply otherwise
389 (in which case casting shadows will not be possible).
390
391 \sa alphaCutoff, blendMode
392*/
393
394/*!
395 \qmlproperty real SpecularGlossyMaterial::alphaCutoff
396
397 The alphaCutoff property can be used to specify the cutoff value when using
398 the \l{alphaMode}{Mask alphaMode}. Fragments where the alpha value falls
399 below the threshold will be rendered fully transparent (\c{0.0} for all
400 color channels). When the alpha value is equal or greater than the cutoff
401 value, the color will not be affected in any way.
402
403 The default value is 0.5.
404
405 \sa alphaMode
406*/
407
408/*!
409 \qmlproperty real SpecularGlossyMaterial::pointSize
410
411 This property determines the size of the points rendered, when the geometry
412 is using a primitive type of points. The default value is 1.0. This
413 property is not relevant when rendering other types of geometry, such as,
414 triangle meshes.
415
416 \warning Point sizes other than 1 may not be supported at run time,
417 depending on the underyling graphics API. For example, setting a size other
418 than 1 has no effect with Direct 3D.
419*/
420
421/*!
422 \qmlproperty real SpecularGlossyMaterial::lineWidth
423
424 This property determines the width of the lines rendered, when the geometry
425 is using a primitive type of lines or line strips. The default value is
426 1.0. This property is not relevant when rendering other types of geometry,
427 such as, triangle meshes.
428
429 \warning Line widths other than 1 may not be suported at run time,
430 depending on the underlying graphics API. When that is the case, the
431 request to change the width is ignored. For example, none of the following
432 can be expected to support wide lines: Direct3D, Metal, OpenGL with core
433 profile contexts.
434*/
435
436/*!
437 \qmlproperty Texture SpecularGlossyMaterial::heightMap
438
439 This property defines a texture used to determine the height the texture
440 will be displaced when rendered through the use of Parallax Mapping. Values
441 are expected to be linear from 0.0 to 1.0, where 0.0 means no displacement
442 and 1.0 means means maximum displacement.
443
444*/
445
446/*!
447 \qmlproperty enumeration SpecularGlossyMaterial::heightChannel
448
449 This property defines the texture channel used to read the height value
450 from heightMap. The default value is \c Material.R.
451
452 \value Material.R Read value from texture R channel.
453 \value Material.G Read value from texture G channel.
454 \value Material.B Read value from texture B channel.
455 \value Material.A Read value from texture A channel.
456
457*/
458
459/*!
460 \qmlproperty real SpecularGlossyMaterial::heightAmount
461
462 This property contains the factor used to modify the values from the
463 \l heightMap texture. The value should be between 0.0 to 1.0. The default
464 value is 0.0 which means that height displacement will be disabled, even
465 if a height map set.
466*/
467
468/*!
469 \qmlproperty int SpecularGlossyMaterial::minHeightMapSamples
470
471 This property defines the minimum number of samples used for performing
472 Parallex Occlusion Mapping using the \l heightMap. The minHeightMapSamples
473 value is the number of samples of the heightMap are used when looking directly
474 at a surface (when the camera view is perpendicular to the fragment).
475 The default value is 8.
476
477 The actual number of samples used for each fragment will be between
478 \l minHeightMapSamples and \l maxHeightMapSamples depending on the angle of
479 the camera relative to the surface being rendered.
480
481 \note This value should only be adjusted to fine tune materials using a
482 \l heightMap in the case undesired artifacts are present.
483*/
484
485/*!
486 \qmlproperty int SpecularGlossyMaterial::maxHeightMapSamples
487
488 This property defines the maximum number of samples used for performing
489 Parallex Occlusion Mapping using the \l heightMap. The maxHeightMapSamples
490 value is the number of samples of the heightMap are used when looking
491 parallel to a surface.
492 The default value is 32.
493
494 The actual number of samples used for each fragment will be between
495 \l minHeightMapSamples and \l maxHeightMapSamples depending on the angle of
496 the camera relative to the surface being rendered.
497
498 \note This value should only be adjusted to fine tune materials using a
499 \l heightMap in the case undesired artifacts are present.
500*/
501
502/*!
503 \qmlproperty real SpecularGlossyMaterial::clearcoatAmount
504
505 This property defines the intensity of the clearcoat layer.
506
507 The default value is \c 0.0
508*/
509
510/*!
511 \qmlproperty Texture SpecularGlossyMaterial::clearcoatMap
512
513 This property defines a texture used to determine the intensity of the
514 clearcoat layer. The value of\l clearcoatAmount will be multiplied by
515 the value read from this texture.
516
517*/
518
519/*!
520 \qmlproperty enumeration SpecularGlossyMaterial::clearcoatChannel
521
522 This property defines the texture channel used to read the clearcoat amount
523 value from \l clearcoatMap. The default value is \c Material.R.
524
525 \value Material.R Read value from texture R channel.
526 \value Material.G Read value from texture G channel.
527 \value Material.B Read value from texture B channel.
528 \value Material.A Read value from texture A channel.
529
530*/
531
532/*!
533 \qmlproperty real SpecularGlossyMaterial::clearcoatRoughnessAmount
534
535 This property defines the roughness of the clearcoat layer.
536 The default value is \c 0.0
537*/
538
539/*!
540 \qmlproperty Texture SpecularGlossyMaterial::clearcoatRoughnessMap
541
542 This property defines a texture used to determine the roughness of the
543 clearcoat layer. The value of\l clearcoatRoughnessAmount will be
544 multiplied by the value read from this texture.
545
546*/
547
548/*!
549 \qmlproperty enumeration SpecularGlossyMaterial::clearcoatRoughnessChannel
550
551 This property defines the texture channel used to read the clearcoat
552 roughness amount from \l clearcoatRoughnessMap.
553 The default value is \c Material.G.
554
555 \value Material.R Read value from texture R channel.
556 \value Material.G Read value from texture G channel.
557 \value Material.B Read value from texture B channel.
558 \value Material.A Read value from texture A channel.
559
560*/
561
562/*!
563 \qmlproperty Texture SpecularGlossyMaterial::clearcoatNormalMap
564
565 This property defines a texture used to determine the normal mapping
566 applied to the clearcoat layer.
567
568*/
569
570/*!
571 \qmlproperty real SpecularGlossyMaterial::transmissionFactor
572
573 This property defines the percentage of light that is transmitted through
574 the material's surface.
575 The default value is \c 0.0
576*/
577
578/*!
579 \qmlproperty Texture SpecularGlossyMaterial::transmissionMap
580
581 This property defines a texture used to determine percentage of light that
582 is transmitted through the surface.. The value of
583 \l transmissionFactor will be multiplied by the value read from this
584 texture.
585
586*/
587
588/*!
589 \qmlproperty enumeration SpecularGlossyMaterial::transmissionChannel
590
591 This property defines the texture channel used to read the transmission
592 percentage from \l transmissionMap.
593 The default value is \c Material.R.
594
595 \value Material.R Read value from texture R channel.
596 \value Material.G Read value from texture G channel.
597 \value Material.B Read value from texture B channel.
598 \value Material.A Read value from texture A channel.
599
600*/
601
602/*!
603 \qmlproperty real SpecularGlossyMaterial::thicknessFactor
604
605 This property defines the thickness of the volume beneath the surface.
606 Unlike many other properties of SpecularGlossyMaterial, the value in defined
607 in thicknessFactor is a value from 0.0 to +infinity for thickness in the
608 models coordinate space. A value of 0.0 means that the material is
609 thin-walled.
610 The default value is \c 0.0
611*/
612
613/*!
614 \qmlproperty Texture SpecularGlossyMaterial::thicknessMap
615
616 This property defines a texture used to define the thickness of a
617 material volume. The value of \l thicknessFactor will be multiplied by the
618 value read from this texture.
619
620*/
621
622/*!
623 \qmlproperty enumeration SpecularGlossyMaterial::thicknessChannel
624
625 This property defines the texture channel used to read the thickness
626 amount from \l transmissionMap.
627 The default value is \c Material.G.
628
629 \value Material.R Read value from texture R channel.
630 \value Material.G Read value from texture G channel.
631 \value Material.B Read value from texture B channel.
632 \value Material.A Read value from texture A channel.
633
634*/
635
636/*!
637 \qmlproperty real SpecularGlossyMaterial::attenuationDistance
638
639 This property defines the Density of the medium given as the average
640 distance that light travels in the medium before interacting with a
641 particle. The value is given in world space.
642 The default value is \c +infinity.
643*/
644
645/*!
646 \qmlproperty color SpecularGlossyMaterial::attenuationColor
647
648 This property defines the color that white lights turns into due to
649 absorption when reaching the attenuation distance.
650 The default value is \c Qt.White
651
652*/
653
654/*!
655 \qmlproperty real SpecularGlossyMaterial::fresnelScaleBiasEnabled
656
657 By Setting the value to true the material will take Fresnel Scale and Fresnel Bias into account.
658 The default value is \c false.
659*/
660
661/*!
662 \qmlproperty real SpecularGlossyMaterial::fresnelScale
663
664 This property scale head-on reflections (looking directly at the
665 surface) while maintaining reflections seen at grazing angles.
666 In order to affect changes to the material you have to enable fresnelScaleBiasEnabled.
667 The default value is \c 1.0.
668*/
669
670/*!
671 \qmlproperty real SpecularGlossyMaterial::fresnelBias
672
673 This property push forward head-on reflections (looking directly at the
674 surface) while maintaining reflections seen at grazing angles.
675 In order to affect changes to the material you have to enable fresnelScaleBiasEnabled.
676 The default value is \c 0.0.
677*/
678
679/*!
680 \qmlproperty real SpecularGlossyMaterial::fresnelPower
681
682 This property decreases head-on reflections (looking directly at the
683 surface) while maintaining reflections seen at grazing angles.
684 The default value is \c 5.0.
685*/
686
687/*!
688 \qmlproperty real SpecularGlossyMaterial::clearcoatFresnelScaleBiasEnabled
689
690 By Setting the value to true the material will take Clearcoat Fresnel Scale and Clearcoat Fresnel Bias into account.
691 The default value is \c false.
692*/
693
694/*!
695 \qmlproperty real SpecularGlossyMaterial::clearcoatFresnelScale
696
697 This property scale head-on reflections (looking directly at the
698 surface) while maintaining reflections seen at grazing angles.
699 In order to affect changes to the material you have to enable clearcoatFresnelScaleBiasEnabled.
700 The default value is \c 1.0.
701*/
702
703/*!
704 \qmlproperty real SpecularGlossyMaterial::clearcoatFresnelBias
705
706 This property push forward head-on reflections (looking directly at the
707 surface) while maintaining reflections seen at grazing angles.
708 In order to affect changes to the material you have to enable clearcoatFresnelScaleBiasEnabled.
709 The default value is \c 0.0.
710*/
711
712/*!
713 \qmlproperty real SpecularGlossyMaterial::clearcoatFresnelPower
714
715 This property decreases head-on reflections (looking directly at the
716 surface) while maintaining reflections seen at grazing angles.
717 The default value is \c 5.0.
718*/
719
720/*!
721 \qmlproperty bool SpecularGlossyMaterial::vertexColorsEnabled
722 \since 6.5
723
724 When this property is enabled, the material will use vertex colors from the
725 mesh. These will be multiplied by any other colors specified for the
726 material. The default value is true.
727*/
728
729/*!
730 \qmlproperty bool SpecularGlossyMaterial::vertexColorsMaskEnabled
731 \since 6.8
732
733 When this property is enabled, the material will use vertex colors from the
734 mesh as mask of various properties e.g Glossiness, OcclusionAmount, ... .
735 The default value is false.
736*/
737
738/*!
739 \qmlproperty enumeration SpecularGlossyMaterial::vertexColorRedMask
740 \since 6.8
741
742 This property defines the vertex color red channel used as the specifies mask.
743 The value is a bit-wise combination of flags.
744 The default value is \c SpecularGlossyMaterial.NoMask.
745
746 \value SpecularGlossyMaterial.NoMask.
747 \value SpecularGlossyMaterial.GlossinessMask.
748 \value SpecularGlossyMaterial.NormalStrengthMask.
749 \value SpecularGlossyMaterial.ClearcoatAmountMask.
750 \value SpecularGlossyMaterial.ClearcoatRoughnessAmountMask.
751 \value SpecularGlossyMaterial.ClearcoatNormalStrengthMask.
752 \value SpecularGlossyMaterial.HeightAmountMask.
753 \value SpecularGlossyMaterial.OcclusionAmountMask.
754 \value SpecularGlossyMaterial.ThicknessFactorMask.
755 \value SpecularGlossyMaterial.TransmissionFactorMask.
756
757*/
758
759/*!
760 \qmlproperty enumeration SpecularGlossyMaterial::vertexColorGreenMask
761 \since 6.8
762
763 This property defines the vertex color green channel used as the specifies mask.
764 The value is a bit-wise combination of flags.
765 The default value is \c SpecularGlossyMaterial.NoMask.
766
767 \value SpecularGlossyMaterial.NoMask.
768 \value SpecularGlossyMaterial.GlossinessMask.
769 \value SpecularGlossyMaterial.NormalStrengthMask.
770 \value SpecularGlossyMaterial.ClearcoatAmountMask.
771 \value SpecularGlossyMaterial.ClearcoatRoughnessAmountMask.
772 \value SpecularGlossyMaterial.ClearcoatNormalStrengthMask.
773 \value SpecularGlossyMaterial.HeightAmountMask.
774 \value SpecularGlossyMaterial.OcclusionAmountMask.
775 \value SpecularGlossyMaterial.ThicknessFactorMask.
776 \value SpecularGlossyMaterial.TransmissionFactorMask.
777*/
778
779/*!
780 \qmlproperty enumeration SpecularGlossyMaterial::vertexColorBlueMask
781 \since 6.8
782
783 This property defines the vertex color blue channel used as the specifies mask.
784 The value is a bit-wise combination of flags.
785 The default value is \c SpecularGlossyMaterial.NoMask.
786
787 \value SpecularGlossyMaterial.NoMask.
788 \value SpecularGlossyMaterial.GlossinessMask.
789 \value SpecularGlossyMaterial.NormalStrengthMask.
790 \value SpecularGlossyMaterial.ClearcoatAmountMask.
791 \value SpecularGlossyMaterial.ClearcoatRoughnessAmountMask.
792 \value SpecularGlossyMaterial.ClearcoatNormalStrengthMask.
793 \value SpecularGlossyMaterial.HeightAmountMask.
794 \value SpecularGlossyMaterial.OcclusionAmountMask.
795 \value SpecularGlossyMaterial.ThicknessFactorMask.
796 \value SpecularGlossyMaterial.TransmissionFactorMask.
797*/
798
799/*!
800 \qmlproperty enumeration SpecularGlossyMaterial::vertexColorAlphaMask
801 \since 6.8
802
803 This property defines the vertex color alpha channel used as the specifies mask.
804 The value is a bit-wise combination of flags.
805 The default value is \c SpecularGlossyMaterial.NoMask.
806
807 \value SpecularGlossyMaterial.NoMask.
808 \value SpecularGlossyMaterial.GlossinessMask.
809 \value SpecularGlossyMaterial.NormalStrengthMask.
810 \value SpecularGlossyMaterial.ClearcoatAmountMask.
811 \value SpecularGlossyMaterial.ClearcoatRoughnessAmountMask.
812 \value SpecularGlossyMaterial.ClearcoatNormalStrengthMask.
813 \value SpecularGlossyMaterial.HeightAmountMask.
814 \value SpecularGlossyMaterial.OcclusionAmountMask.
815 \value SpecularGlossyMaterial.ThicknessFactorMask.
816 \value SpecularGlossyMaterial.TransmissionFactorMask.
817*/
818
819QQuick3DSpecularGlossyMaterial::QQuick3DSpecularGlossyMaterial(QQuick3DObject *parent)
820 : QQuick3DMaterial(*(new QQuick3DObjectPrivate(QQuick3DObjectPrivate::Type::SpecularGlossyMaterial)), parent)
821{}
822
823QQuick3DSpecularGlossyMaterial::~QQuick3DSpecularGlossyMaterial()
824{
825}
826
827QQuick3DSpecularGlossyMaterial::Lighting QQuick3DSpecularGlossyMaterial::lighting() const
828{
829 return m_lighting;
830}
831
832QQuick3DSpecularGlossyMaterial::BlendMode QQuick3DSpecularGlossyMaterial::blendMode() const
833{
834 return m_blendMode;
835}
836
837QColor QQuick3DSpecularGlossyMaterial::albedoColor() const
838{
839 return m_albedo;
840}
841
842QQuick3DTexture *QQuick3DSpecularGlossyMaterial::albedoMap() const
843{
844 return m_albedoMap;
845}
846
847bool QQuick3DSpecularGlossyMaterial::albedoSingleChannelEnabled() const
848{
849 return m_albedoSingleChannelEnabled;
850}
851
852QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::albedoChannel() const
853{
854 return m_albedoChannel;
855}
856
857bool QQuick3DSpecularGlossyMaterial::specularSingleChannelEnabled() const
858{
859 return m_specularSingleChannelEnabled;
860}
861
862QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::specularChannel() const
863{
864 return m_specularChannel;
865}
866
867bool QQuick3DSpecularGlossyMaterial::emissiveSingleChannelEnabled() const
868{
869 return m_emissiveSingleChannelEnabled;
870}
871
872QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::emissiveChannel() const
873{
874 return m_emissiveChannel;
875}
876
877QQuick3DTexture *QQuick3DSpecularGlossyMaterial::emissiveMap() const
878{
879 return m_emissiveMap;
880}
881
882QVector3D QQuick3DSpecularGlossyMaterial::emissiveFactor() const
883{
884 return m_emissiveFactor;
885}
886
887float QQuick3DSpecularGlossyMaterial::glossiness() const
888{
889 return m_glossiness;
890}
891
892QQuick3DTexture *QQuick3DSpecularGlossyMaterial::glossinessMap() const
893{
894 return m_glossinessMap;
895}
896
897bool QQuick3DSpecularGlossyMaterial::invertOpacityMapValue() const
898{
899 return m_invertOpacityMapValue;
900}
901
902float QQuick3DSpecularGlossyMaterial::opacity() const
903{
904 return m_opacity;
905}
906
907QQuick3DTexture *QQuick3DSpecularGlossyMaterial::opacityMap() const
908{
909 return m_opacityMap;
910}
911
912QQuick3DTexture *QQuick3DSpecularGlossyMaterial::normalMap() const
913{
914 return m_normalMap;
915}
916
917QColor QQuick3DSpecularGlossyMaterial::specularColor() const
918{
919 return m_specular;
920}
921
922QQuick3DTexture *QQuick3DSpecularGlossyMaterial::specularMap() const
923{
924 return m_specularMap;
925}
926
927float QQuick3DSpecularGlossyMaterial::normalStrength() const
928{
929 return m_normalStrength;
930}
931
932QQuick3DTexture *QQuick3DSpecularGlossyMaterial::occlusionMap() const
933{
934 return m_occlusionMap;
935}
936
937float QQuick3DSpecularGlossyMaterial::occlusionAmount() const
938{
939 return m_occlusionAmount;
940}
941
942QQuick3DSpecularGlossyMaterial::AlphaMode QQuick3DSpecularGlossyMaterial::alphaMode() const
943{
944 return m_alphaMode;
945}
946
947float QQuick3DSpecularGlossyMaterial::alphaCutoff() const
948{
949 return m_alphaCutoff;
950}
951
952QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::glossinessChannel() const
953{
954 return m_glossinessChannel;
955}
956
957QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::opacityChannel() const
958{
959 return m_opacityChannel;
960}
961
962QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::occlusionChannel() const
963{
964 return m_occlusionChannel;
965}
966
967float QQuick3DSpecularGlossyMaterial::pointSize() const
968{
969 return m_pointSize;
970}
971
972float QQuick3DSpecularGlossyMaterial::lineWidth() const
973{
974 return m_lineWidth;
975}
976
977QQuick3DTexture *QQuick3DSpecularGlossyMaterial::heightMap() const
978{
979 return m_heightMap;
980}
981
982QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::heightChannel() const
983{
984 return m_heightChannel;
985}
986
987float QQuick3DSpecularGlossyMaterial::heightAmount() const
988{
989 return m_heightAmount;
990}
991
992int QQuick3DSpecularGlossyMaterial::minHeightMapSamples() const
993{
994 return m_minHeightMapSamples;
995}
996
997int QQuick3DSpecularGlossyMaterial::maxHeightMapSamples() const
998{
999 return m_maxHeightMapSamples;
1000}
1001
1002void QQuick3DSpecularGlossyMaterial::markAllDirty()
1003{
1004 m_dirtyAttributes = 0xffffffff;
1005 QQuick3DMaterial::markAllDirty();
1006}
1007
1008void QQuick3DSpecularGlossyMaterial::setLighting(QQuick3DSpecularGlossyMaterial::Lighting lighting)
1009{
1010 if (m_lighting == lighting)
1011 return;
1012
1013 m_lighting = lighting;
1014 emit lightingChanged();
1015 markDirty(LightingModeDirty);
1016}
1017
1018void QQuick3DSpecularGlossyMaterial::setBlendMode(QQuick3DSpecularGlossyMaterial::BlendMode blendMode)
1019{
1020 if (m_blendMode == blendMode)
1021 return;
1022
1023 m_blendMode = blendMode;
1024 emit blendModeChanged();
1025 markDirty(BlendModeDirty);
1026}
1027
1028void QQuick3DSpecularGlossyMaterial::setAlbedoColor(const QColor &diffuseColor)
1029{
1030 if (m_albedo == diffuseColor)
1031 return;
1032
1033 m_albedo = diffuseColor;
1034 emit albedoColorChanged();
1035 markDirty(AlbedoDirty);
1036}
1037
1038void QQuick3DSpecularGlossyMaterial::setAlbedoMap(QQuick3DTexture *albedoMap)
1039{
1040 if (m_albedoMap == albedoMap)
1041 return;
1042
1043 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setAlbedoMap, albedoMap, m_albedoMap);
1044
1045 m_albedoMap = albedoMap;
1046 emit albedoMapChanged();
1047 markDirty(AlbedoDirty);
1048}
1049
1050void QQuick3DSpecularGlossyMaterial::setAlbedoSingleChannelEnabled(bool albedoSingleChannelEnabled)
1051{
1052 if (m_albedoSingleChannelEnabled == albedoSingleChannelEnabled)
1053 return;
1054
1055 m_albedoSingleChannelEnabled = albedoSingleChannelEnabled;
1056 emit albedoSingleChannelEnabledChanged();
1057 markDirty(AlbedoDirty);
1058}
1059
1060void QQuick3DSpecularGlossyMaterial::setAlbedoChannel(TextureChannelMapping channel)
1061{
1062 if (m_albedoChannel == channel)
1063 return;
1064
1065 m_albedoChannel = channel;
1066 emit albedoChannelChanged();
1067 markDirty(AlbedoDirty);
1068}
1069
1070void QQuick3DSpecularGlossyMaterial::setSpecularSingleChannelEnabled(bool specularSingleChannelEnabled)
1071{
1072 if (m_specularSingleChannelEnabled == specularSingleChannelEnabled)
1073 return;
1074
1075 m_specularSingleChannelEnabled = specularSingleChannelEnabled;
1076 emit specularSingleChannelEnabledChanged();
1077 markDirty(SpecularDirty);
1078}
1079
1080void QQuick3DSpecularGlossyMaterial::setSpecularChannel(TextureChannelMapping channel)
1081{
1082 if (m_specularChannel == channel)
1083 return;
1084
1085 m_specularChannel = channel;
1086 emit specularChannelChanged();
1087 markDirty(SpecularDirty);
1088}
1089
1090void QQuick3DSpecularGlossyMaterial::setEmissiveSingleChannelEnabled(bool emissiveSingleChannelEnabled)
1091{
1092 if (m_emissiveSingleChannelEnabled == emissiveSingleChannelEnabled)
1093 return;
1094
1095 m_emissiveSingleChannelEnabled = emissiveSingleChannelEnabled;
1096 emit emissiveSingleChannelEnabledChanged();
1097 markDirty(EmissiveDirty);
1098}
1099
1100void QQuick3DSpecularGlossyMaterial::setEmissiveChannel(TextureChannelMapping channel)
1101{
1102 if (m_emissiveChannel == channel)
1103 return;
1104
1105 m_emissiveChannel = channel;
1106 emit emissiveChannelChanged();
1107 markDirty(EmissiveDirty);
1108}
1109
1110void QQuick3DSpecularGlossyMaterial::setEmissiveMap(QQuick3DTexture *emissiveMap)
1111{
1112 if (m_emissiveMap == emissiveMap)
1113 return;
1114
1115 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setEmissiveMap, emissiveMap, m_emissiveMap);
1116
1117 m_emissiveMap = emissiveMap;
1118 emit emissiveMapChanged();
1119 markDirty(EmissiveDirty);
1120}
1121
1122void QQuick3DSpecularGlossyMaterial::setEmissiveFactor(const QVector3D &emissiveFactor)
1123{
1124 if (m_emissiveFactor == emissiveFactor)
1125 return;
1126
1127 m_emissiveFactor = emissiveFactor;
1128 emit emissiveFactorChanged();
1129 markDirty(EmissiveDirty);
1130}
1131
1132void QQuick3DSpecularGlossyMaterial::setGlossiness(float glossiness)
1133{
1134 glossiness = ensureNormalized(glossiness);
1135 if (qFuzzyCompare(m_glossiness, glossiness))
1136 return;
1137
1138 m_glossiness = glossiness;
1139 emit glossinessChanged();
1140 markDirty(GlossyDirty);
1141}
1142
1143void QQuick3DSpecularGlossyMaterial::setGlossinessMap(QQuick3DTexture *glossinessMap)
1144{
1145 if (m_glossinessMap == glossinessMap)
1146 return;
1147
1148 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setGlossinessMap, glossinessMap, m_glossinessMap);
1149
1150 m_glossinessMap = glossinessMap;
1151 emit glossinessMapChanged();
1152 markDirty(GlossyDirty);
1153}
1154
1155void QQuick3DSpecularGlossyMaterial::setInvertOpacityMapValue(bool invertOpacityMapValue)
1156{
1157 if (invertOpacityMapValue == m_invertOpacityMapValue)
1158 return;
1159
1160 m_invertOpacityMapValue = invertOpacityMapValue;
1161 emit invertOpacityMapValueChanged();
1162 markDirty(OpacityDirty);
1163}
1164
1165void QQuick3DSpecularGlossyMaterial::setOpacity(float opacity)
1166{
1167 opacity = ensureNormalized(opacity);
1168 if (qFuzzyCompare(m_opacity, opacity))
1169 return;
1170
1171 m_opacity = opacity;
1172 emit opacityChanged();
1173 markDirty(OpacityDirty);
1174}
1175
1176void QQuick3DSpecularGlossyMaterial::setOpacityMap(QQuick3DTexture *opacityMap)
1177{
1178 if (m_opacityMap == opacityMap)
1179 return;
1180
1181 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setOpacityMap, opacityMap, m_opacityMap);
1182
1183 m_opacityMap = opacityMap;
1184 emit opacityMapChanged();
1185 markDirty(OpacityDirty);
1186}
1187
1188void QQuick3DSpecularGlossyMaterial::setNormalMap(QQuick3DTexture *normalMap)
1189{
1190 if (m_normalMap == normalMap)
1191 return;
1192
1193 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setNormalMap, normalMap, m_normalMap);
1194
1195 m_normalMap = normalMap;
1196 emit normalMapChanged();
1197 markDirty(NormalDirty);
1198}
1199
1200void QQuick3DSpecularGlossyMaterial::setSpecularColor(const QColor &specular)
1201{
1202 if (m_specular == specular)
1203 return;
1204
1205 m_specular = specular;
1206 emit specularColorChanged();
1207 markDirty(SpecularDirty);
1208}
1209
1210void QQuick3DSpecularGlossyMaterial::setSpecularMap(QQuick3DTexture *specularMap)
1211{
1212 if (m_specularMap == specularMap)
1213 return;
1214
1215 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setSpecularMap, specularMap, m_specularMap);
1216
1217 m_specularMap = specularMap;
1218 emit specularMapChanged();
1219 markDirty(SpecularDirty);
1220}
1221
1222void QQuick3DSpecularGlossyMaterial::setNormalStrength(float factor)
1223{
1224 factor = ensureNormalized(factor);
1225 if (qFuzzyCompare(m_normalStrength, factor))
1226 return;
1227
1228 m_normalStrength = factor;
1229 emit normalStrengthChanged();
1230 markDirty(NormalDirty);
1231}
1232
1233void QQuick3DSpecularGlossyMaterial::setOcclusionMap(QQuick3DTexture *occlusionMap)
1234{
1235 if (m_occlusionMap == occlusionMap)
1236 return;
1237
1238 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setOcclusionMap, occlusionMap, m_occlusionMap);
1239
1240 m_occlusionMap = occlusionMap;
1241 emit occlusionMapChanged();
1242 markDirty(OcclusionDirty);
1243}
1244
1245void QQuick3DSpecularGlossyMaterial::setOcclusionAmount(float occlusionAmount)
1246{
1247 if (qFuzzyCompare(m_occlusionAmount, occlusionAmount))
1248 return;
1249
1250 m_occlusionAmount = occlusionAmount;
1251 emit occlusionAmountChanged();
1252 markDirty(OcclusionDirty);
1253}
1254
1255void QQuick3DSpecularGlossyMaterial::setAlphaMode(QQuick3DSpecularGlossyMaterial::AlphaMode alphaMode)
1256{
1257 if (m_alphaMode == alphaMode)
1258 return;
1259
1260 m_alphaMode = alphaMode;
1261 emit alphaModeChanged();
1262 markDirty(AlphaModeDirty);
1263}
1264
1265void QQuick3DSpecularGlossyMaterial::setAlphaCutoff(float alphaCutoff)
1266{
1267 if (qFuzzyCompare(m_alphaCutoff, alphaCutoff))
1268 return;
1269
1270 m_alphaCutoff = alphaCutoff;
1271 emit alphaCutoffChanged();
1272 markDirty(AlphaModeDirty);
1273}
1274
1275void QQuick3DSpecularGlossyMaterial::setGlossinessChannel(TextureChannelMapping channel)
1276{
1277 if (m_glossinessChannel == channel)
1278 return;
1279
1280 m_glossinessChannel = channel;
1281 emit glossinessChannelChanged();
1282 markDirty(GlossyDirty);
1283}
1284
1285void QQuick3DSpecularGlossyMaterial::setOpacityChannel(TextureChannelMapping channel)
1286{
1287 if (m_opacityChannel == channel)
1288 return;
1289
1290 m_opacityChannel = channel;
1291 emit opacityChannelChanged();
1292 markDirty(OpacityDirty);
1293}
1294
1295void QQuick3DSpecularGlossyMaterial::setOcclusionChannel(TextureChannelMapping channel)
1296{
1297 if (m_occlusionChannel == channel)
1298 return;
1299
1300 m_occlusionChannel = channel;
1301 emit occlusionChannelChanged();
1302 markDirty(OcclusionDirty);
1303}
1304
1305void QQuick3DSpecularGlossyMaterial::setPointSize(float size)
1306{
1307 if (qFuzzyCompare(m_pointSize, size))
1308 return;
1309 m_pointSize = size;
1310 emit pointSizeChanged();
1311 markDirty(PointSizeDirty);
1312}
1313
1314void QQuick3DSpecularGlossyMaterial::setLineWidth(float width)
1315{
1316 if (qFuzzyCompare(m_lineWidth, width))
1317 return;
1318 m_lineWidth = width;
1319 emit lineWidthChanged();
1320 markDirty(LineWidthDirty);
1321}
1322
1323void QQuick3DSpecularGlossyMaterial::setHeightMap(QQuick3DTexture *heightMap)
1324{
1325 if (m_heightMap == heightMap)
1326 return;
1327
1328 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setHeightMap, heightMap, m_heightMap);
1329
1330 m_heightMap = heightMap;
1331 emit heightMapChanged();
1332 markDirty(HeightDirty);
1333}
1334
1335void QQuick3DSpecularGlossyMaterial::setHeightChannel(QQuick3DMaterial::TextureChannelMapping channel)
1336{
1337 if (m_heightChannel == channel)
1338 return;
1339
1340 m_heightChannel = channel;
1341 emit heightChannelChanged();
1342 markDirty(HeightDirty);
1343}
1344
1345void QQuick3DSpecularGlossyMaterial::setHeightAmount(float heightAmount)
1346{
1347 if (qFuzzyCompare(m_heightAmount, heightAmount))
1348 return;
1349
1350 m_heightAmount = heightAmount;
1351 emit heightAmountChanged();
1352 markDirty(HeightDirty);
1353}
1354
1355void QQuick3DSpecularGlossyMaterial::setMinHeightMapSamples(int samples)
1356{
1357 if (m_minHeightMapSamples == samples)
1358 return;
1359
1360 m_minHeightMapSamples = samples;
1361 emit minHeightMapSamplesChanged();
1362 markDirty(HeightDirty);
1363}
1364
1365void QQuick3DSpecularGlossyMaterial::setMaxHeightMapSamples(int samples)
1366{
1367 if (m_maxHeightMapSamples == samples)
1368 return;
1369
1370 m_maxHeightMapSamples = samples;
1371 emit maxHeightMapSamplesChanged();
1372 markDirty(HeightDirty);
1373}
1374
1375QSSGRenderGraphObject *QQuick3DSpecularGlossyMaterial::updateSpatialNode(QSSGRenderGraphObject *node)
1376{
1377 static const auto channelMapping = [](TextureChannelMapping mapping) {
1378 return QSSGRenderDefaultMaterial::TextureChannelMapping(mapping);
1379 };
1380
1381 if (!node) {
1382 markAllDirty();
1383 node = new QSSGRenderDefaultMaterial(QSSGRenderGraphObject::Type::SpecularGlossyMaterial);
1384 }
1385
1386 // Set common material properties
1387 QQuick3DMaterial::updateSpatialNode(node);
1388
1389 QSSGRenderDefaultMaterial *material = static_cast<QSSGRenderDefaultMaterial *>(node);
1390
1391 material->specularModel = QSSGRenderDefaultMaterial::MaterialSpecularModel::SchlickGGX;
1392
1393 if (m_dirtyAttributes & LightingModeDirty)
1394 material->lighting = QSSGRenderDefaultMaterial::MaterialLighting(m_lighting);
1395
1396 if (m_dirtyAttributes & BlendModeDirty)
1397 material->blendMode = QSSGRenderDefaultMaterial::MaterialBlendMode(m_blendMode);
1398
1399 if (m_dirtyAttributes & AlbedoDirty) {
1400 if (!m_albedoMap)
1401 material->colorMap = nullptr;
1402 else
1403 material->colorMap = m_albedoMap->getRenderImage();
1404
1405 material->color = QSSGUtils::color::sRGBToLinear(m_albedo);
1406 material->baseColorSingleChannelEnabled = m_albedoSingleChannelEnabled;
1407 material->baseColorChannel = channelMapping(m_albedoChannel);
1408 }
1409
1410 if (m_dirtyAttributes & EmissiveDirty) {
1411 if (!m_emissiveMap)
1412 material->emissiveMap = nullptr;
1413 else
1414 material->emissiveMap = m_emissiveMap->getRenderImage();
1415
1416 material->emissiveColor = m_emissiveFactor;
1417 material->emissiveSingleChannelEnabled = m_emissiveSingleChannelEnabled;
1418 material->emissiveChannel = channelMapping(m_emissiveChannel);
1419 }
1420
1421 if (m_dirtyAttributes & GlossyDirty) {
1422 if (!m_glossinessMap)
1423 material->roughnessMap = nullptr;
1424 else
1425 material->roughnessMap = m_glossinessMap->getRenderImage();
1426
1427 material->specularRoughness = m_glossiness;
1428 material->roughnessChannel = channelMapping(m_glossinessChannel);
1429 }
1430
1431 if (m_dirtyAttributes & SpecularDirty) {
1432 if (!m_specularMap)
1433 material->specularMap = nullptr;
1434 else
1435 material->specularMap = m_specularMap->getRenderImage();
1436
1437 material->specularTint = QSSGUtils::color::sRGBToLinear(m_specular).toVector3D();
1438 material->fresnelScaleBiasEnabled = m_fresnelScaleBiasEnabled;
1439 material->fresnelScale = m_fresnelScale;
1440 material->fresnelBias = m_fresnelBias;
1441 material->fresnelPower = m_fresnelPower;
1442 material->specularAmountSingleChannelEnabled = m_specularSingleChannelEnabled;
1443 material->specularAmountChannel = channelMapping(m_specularChannel);
1444 }
1445
1446 if (m_dirtyAttributes & OpacityDirty) {
1447 if (!m_opacityMap)
1448 material->opacityMap = nullptr;
1449 else
1450 material->opacityMap = m_opacityMap->getRenderImage();
1451
1452 material->invertOpacityMapValue = m_invertOpacityMapValue;
1453 material->opacity = m_opacity;
1454 material->opacityChannel = channelMapping(m_opacityChannel);
1455 }
1456
1457 if (m_dirtyAttributes & NormalDirty) {
1458 if (!m_normalMap)
1459 material->normalMap = nullptr;
1460 else
1461 material->normalMap = m_normalMap->getRenderImage();
1462
1463 material->bumpAmount = m_normalStrength;
1464 }
1465
1466 if (m_dirtyAttributes & OcclusionDirty) {
1467 if (!m_occlusionMap)
1468 material->occlusionMap = nullptr;
1469 else
1470 material->occlusionMap = m_occlusionMap->getRenderImage();
1471 material->occlusionAmount = m_occlusionAmount;
1472 material->occlusionChannel = channelMapping(m_occlusionChannel);
1473 }
1474
1475 if (m_dirtyAttributes & AlphaModeDirty) {
1476 material->alphaMode = QSSGRenderDefaultMaterial::MaterialAlphaMode(m_alphaMode);
1477 material->alphaCutoff = m_alphaCutoff;
1478 }
1479
1480 if (m_dirtyAttributes & PointSizeDirty)
1481 material->pointSize = m_pointSize;
1482
1483 if (m_dirtyAttributes & LineWidthDirty)
1484 material->lineWidth = m_lineWidth;
1485
1486 if (m_dirtyAttributes & HeightDirty) {
1487 if (!m_heightMap)
1488 material->heightMap = nullptr;
1489 else
1490 material->heightMap = m_heightMap->getRenderImage();
1491 material->heightAmount = m_heightAmount;
1492 material->minHeightSamples = m_minHeightMapSamples;
1493 material->maxHeightSamples = m_maxHeightMapSamples;
1494 material->heightChannel = channelMapping(m_heightChannel);
1495 }
1496
1497 if (m_dirtyAttributes & ClearcoatDirty) {
1498 material->clearcoatAmount = m_clearcoatAmount;
1499 if (!m_clearcoatMap)
1500 material->clearcoatMap = nullptr;
1501 else
1502 material->clearcoatMap = m_clearcoatMap->getRenderImage();
1503 material->clearcoatChannel = channelMapping(m_clearcoatChannel);
1504 material->clearcoatRoughnessAmount = m_clearcoatRoughnessAmount;
1505 if (!m_clearcoatRoughnessMap)
1506 material->clearcoatRoughnessMap = nullptr;
1507 else
1508 material->clearcoatRoughnessMap = m_clearcoatRoughnessMap->getRenderImage();
1509 material->clearcoatRoughnessChannel = channelMapping(m_clearcoatRoughnessChannel);
1510 if (!m_clearcoatNormalMap)
1511 material->clearcoatNormalMap = nullptr;
1512 else
1513 material->clearcoatNormalMap = m_clearcoatNormalMap->getRenderImage();
1514 material->clearcoatNormalStrength = m_clearcoatNormalStrength;
1515 material->clearcoatFresnelScaleBiasEnabled = m_clearcoatFresnelScaleBiasEnabled;
1516 material->clearcoatFresnelScale = m_clearcoatFresnelScale;
1517 material->clearcoatFresnelBias = m_clearcoatFresnelBias;
1518 material->clearcoatFresnelPower = m_clearcoatFresnelPower;
1519 }
1520
1521 if (m_dirtyAttributes & TransmissionDirty) {
1522 material->transmissionFactor = m_transmissionFactor;
1523 if (!m_transmissionMap)
1524 material->transmissionMap = nullptr;
1525 else
1526 material->transmissionMap = m_transmissionMap->getRenderImage();
1527 material->transmissionChannel = channelMapping(m_transmissionChannel);
1528 }
1529
1530 if (m_dirtyAttributes & VolumeDirty) {
1531 material->thicknessFactor = m_thicknessFactor;
1532 if (!m_thicknessMap)
1533 material->thicknessMap = nullptr;
1534 else
1535 material->thicknessMap = m_thicknessMap->getRenderImage();
1536 material->thicknessChannel = channelMapping(m_thicknessChannel);
1537
1538 material->attenuationDistance = m_attenuationDistance;
1539 material->attenuationColor = QSSGUtils::color::sRGBToLinear(m_attenuationColor).toVector3D();
1540 }
1541
1542 if (m_dirtyAttributes & VertexColorsDirty) {
1543 material->vertexColorsEnabled = m_vertexColorsEnabled;
1544 material->vertexColorsMaskEnabled = m_vertexColorsMaskEnabled;
1545 material->vertexColorRedMask = QSSGRenderDefaultMaterial::VertexColorMaskFlags::fromInt(m_vertexColorRedMask);
1546 material->vertexColorGreenMask = QSSGRenderDefaultMaterial::VertexColorMaskFlags::fromInt(m_vertexColorGreenMask);
1547 material->vertexColorBlueMask = QSSGRenderDefaultMaterial::VertexColorMaskFlags::fromInt(m_vertexColorBlueMask);
1548 material->vertexColorAlphaMask = QSSGRenderDefaultMaterial::VertexColorMaskFlags::fromInt(m_vertexColorAlphaMask);
1549 }
1550
1551 m_dirtyAttributes = 0;
1552
1553 return node;
1554}
1555
1556void QQuick3DSpecularGlossyMaterial::itemChange(QQuick3DObject::ItemChange change, const QQuick3DObject::ItemChangeData &value)
1557{
1558 if (change == QQuick3DObject::ItemSceneChange)
1559 updateSceneManager(value.sceneManager);
1560}
1561
1562void QQuick3DSpecularGlossyMaterial::updateSceneManager(QQuick3DSceneManager *sceneManager)
1563{
1564 // Check all the resource value's scene manager, and update as necessary.
1565 if (sceneManager) {
1566 QQuick3DObjectPrivate::refSceneManager(m_albedoMap, *sceneManager);
1567 QQuick3DObjectPrivate::refSceneManager(m_emissiveMap, *sceneManager);
1568 QQuick3DObjectPrivate::refSceneManager(m_glossinessMap, *sceneManager);
1569 QQuick3DObjectPrivate::refSceneManager(m_opacityMap, *sceneManager);
1570 QQuick3DObjectPrivate::refSceneManager(m_normalMap, *sceneManager);
1571 QQuick3DObjectPrivate::refSceneManager(m_specularMap, *sceneManager);
1572 QQuick3DObjectPrivate::refSceneManager(m_occlusionMap, *sceneManager);
1573 QQuick3DObjectPrivate::refSceneManager(m_heightMap, *sceneManager);
1574 QQuick3DObjectPrivate::refSceneManager(m_clearcoatMap, *sceneManager);
1575 QQuick3DObjectPrivate::refSceneManager(m_clearcoatRoughnessMap, *sceneManager);
1576 QQuick3DObjectPrivate::refSceneManager(m_clearcoatNormalMap, *sceneManager);
1577 QQuick3DObjectPrivate::refSceneManager(m_transmissionMap, *sceneManager);
1578 QQuick3DObjectPrivate::refSceneManager(m_thicknessMap, *sceneManager);
1579 } else {
1580 QQuick3DObjectPrivate::derefSceneManager(m_albedoMap);
1581 QQuick3DObjectPrivate::derefSceneManager(m_emissiveMap);
1582 QQuick3DObjectPrivate::derefSceneManager(m_glossinessMap);
1583 QQuick3DObjectPrivate::derefSceneManager(m_opacityMap);
1584 QQuick3DObjectPrivate::derefSceneManager(m_normalMap);
1585 QQuick3DObjectPrivate::derefSceneManager(m_specularMap);
1586 QQuick3DObjectPrivate::derefSceneManager(m_occlusionMap);
1587 QQuick3DObjectPrivate::derefSceneManager(m_heightMap);
1588 QQuick3DObjectPrivate::derefSceneManager(m_clearcoatMap);
1589 QQuick3DObjectPrivate::derefSceneManager(m_clearcoatRoughnessMap);
1590 QQuick3DObjectPrivate::derefSceneManager(m_clearcoatNormalMap);
1591 QQuick3DObjectPrivate::derefSceneManager(m_transmissionMap);
1592 QQuick3DObjectPrivate::derefSceneManager(m_thicknessMap);
1593 }
1594}
1595
1596void QQuick3DSpecularGlossyMaterial::markDirty(QQuick3DSpecularGlossyMaterial::DirtyType type)
1597{
1598 if (!(m_dirtyAttributes & quint32(type))) {
1599 m_dirtyAttributes |= quint32(type);
1600 update();
1601 }
1602}
1603
1604float QQuick3DSpecularGlossyMaterial::clearcoatAmount() const
1605{
1606 return m_clearcoatAmount;
1607}
1608
1609void QQuick3DSpecularGlossyMaterial::setClearcoatAmount(float newClearcoatAmount)
1610{
1611 if (qFuzzyCompare(m_clearcoatAmount, newClearcoatAmount))
1612 return;
1613 m_clearcoatAmount = newClearcoatAmount;
1614 emit clearcoatAmountChanged();
1615 markDirty(ClearcoatDirty);
1616}
1617
1618QQuick3DTexture *QQuick3DSpecularGlossyMaterial::clearcoatMap() const
1619{
1620 return m_clearcoatMap;
1621}
1622
1623void QQuick3DSpecularGlossyMaterial::setClearcoatMap(QQuick3DTexture *newClearcoatMap)
1624{
1625 if (m_clearcoatMap == newClearcoatMap)
1626 return;
1627
1628 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setClearcoatMap, newClearcoatMap, m_clearcoatMap);
1629
1630 m_clearcoatMap = newClearcoatMap;
1631 emit clearcoatMapChanged();
1632 markDirty(ClearcoatDirty);
1633}
1634
1635QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::clearcoatChannel() const
1636{
1637 return m_clearcoatChannel;
1638}
1639
1640void QQuick3DSpecularGlossyMaterial::setClearcoatChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatChannel)
1641{
1642 if (m_clearcoatChannel == newClearcoatChannel)
1643 return;
1644 m_clearcoatChannel = newClearcoatChannel;
1645 emit clearcoatChannelChanged();
1646 markDirty(ClearcoatDirty);
1647}
1648
1649float QQuick3DSpecularGlossyMaterial::clearcoatRoughnessAmount() const
1650{
1651 return m_clearcoatRoughnessAmount;
1652}
1653
1654void QQuick3DSpecularGlossyMaterial::setClearcoatRoughnessAmount(float newClearcoatRoughnessAmount)
1655{
1656 if (qFuzzyCompare(m_clearcoatRoughnessAmount, newClearcoatRoughnessAmount))
1657 return;
1658 m_clearcoatRoughnessAmount = newClearcoatRoughnessAmount;
1659 emit clearcoatRoughnessAmountChanged();
1660 markDirty(ClearcoatDirty);
1661}
1662
1663QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::clearcoatRoughnessChannel() const
1664{
1665 return m_clearcoatRoughnessChannel;
1666}
1667
1668void QQuick3DSpecularGlossyMaterial::setClearcoatRoughnessChannel(QQuick3DMaterial::TextureChannelMapping newClearcoatRoughnessChannel)
1669{
1670 if (m_clearcoatRoughnessChannel == newClearcoatRoughnessChannel)
1671 return;
1672 m_clearcoatRoughnessChannel = newClearcoatRoughnessChannel;
1673 emit clearcoatRoughnessChannelChanged();
1674 markDirty(ClearcoatDirty);
1675}
1676
1677QQuick3DTexture *QQuick3DSpecularGlossyMaterial::clearcoatRoughnessMap() const
1678{
1679 return m_clearcoatRoughnessMap;
1680}
1681
1682void QQuick3DSpecularGlossyMaterial::setClearcoatRoughnessMap(QQuick3DTexture *newClearcoatRoughnessMap)
1683{
1684 if (m_clearcoatRoughnessMap == newClearcoatRoughnessMap)
1685 return;
1686
1687 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setClearcoatRoughnessMap, newClearcoatRoughnessMap, m_clearcoatRoughnessMap);
1688
1689 m_clearcoatRoughnessMap = newClearcoatRoughnessMap;
1690 emit clearcoatRoughnessMapChanged();
1691 markDirty(ClearcoatDirty);
1692}
1693
1694QQuick3DTexture *QQuick3DSpecularGlossyMaterial::clearcoatNormalMap() const
1695{
1696 return m_clearcoatNormalMap;
1697}
1698
1699void QQuick3DSpecularGlossyMaterial::setClearcoatNormalMap(QQuick3DTexture *newClearcoatNormalMap)
1700{
1701 if (m_clearcoatNormalMap == newClearcoatNormalMap)
1702 return;
1703
1704 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setClearcoatNormalMap, newClearcoatNormalMap, m_clearcoatNormalMap);
1705
1706 m_clearcoatNormalMap = newClearcoatNormalMap;
1707 emit clearcoatNormalMapChanged();
1708 markDirty(ClearcoatDirty);
1709}
1710
1711float QQuick3DSpecularGlossyMaterial::clearcoatNormalStrength() const
1712{
1713 return m_clearcoatNormalStrength;
1714}
1715
1716
1717void QQuick3DSpecularGlossyMaterial::setClearcoatNormalStrength(float newClearcoatNormalStrength)
1718{
1719 if (qFuzzyCompare(m_clearcoatNormalStrength, newClearcoatNormalStrength))
1720 return;
1721 m_clearcoatNormalStrength = newClearcoatNormalStrength;
1722 emit clearcoatNormalStrengthChanged();
1723 markDirty(ClearcoatDirty);
1724}
1725
1726float QQuick3DSpecularGlossyMaterial::transmissionFactor() const
1727{
1728 return m_transmissionFactor;
1729}
1730
1731void QQuick3DSpecularGlossyMaterial::setTransmissionFactor(float newTransmissionFactor)
1732{
1733 if (qFuzzyCompare(m_transmissionFactor, newTransmissionFactor))
1734 return;
1735 m_transmissionFactor = newTransmissionFactor;
1736 emit transmissionFactorChanged();
1737 markDirty(TransmissionDirty);
1738}
1739
1740QQuick3DTexture *QQuick3DSpecularGlossyMaterial::transmissionMap() const
1741{
1742 return m_transmissionMap;
1743}
1744
1745void QQuick3DSpecularGlossyMaterial::setTransmissionMap(QQuick3DTexture *newTransmissionMap)
1746{
1747 if (m_transmissionMap == newTransmissionMap)
1748 return;
1749
1750 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setTransmissionMap, newTransmissionMap, m_transmissionMap);
1751
1752 m_transmissionMap = newTransmissionMap;
1753 emit transmissionMapChanged();
1754 markDirty(TransmissionDirty);
1755}
1756
1757QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::transmissionChannel() const
1758{
1759 return m_transmissionChannel;
1760}
1761
1762void QQuick3DSpecularGlossyMaterial::setTransmissionChannel(QQuick3DMaterial::TextureChannelMapping newTransmissionChannel)
1763{
1764 if (m_transmissionChannel == newTransmissionChannel)
1765 return;
1766 m_transmissionChannel = newTransmissionChannel;
1767 emit transmissionChannelChanged();
1768 markDirty(TransmissionDirty);
1769}
1770
1771float QQuick3DSpecularGlossyMaterial::thicknessFactor() const
1772{
1773 return m_thicknessFactor;
1774}
1775
1776void QQuick3DSpecularGlossyMaterial::setThicknessFactor(float newThicknessFactor)
1777{
1778 if (qFuzzyCompare(m_thicknessFactor, newThicknessFactor))
1779 return;
1780 m_thicknessFactor = newThicknessFactor;
1781 emit thicknessFactorChanged();
1782 markDirty(VolumeDirty);
1783}
1784
1785QQuick3DTexture *QQuick3DSpecularGlossyMaterial::thicknessMap() const
1786{
1787 return m_thicknessMap;
1788}
1789
1790void QQuick3DSpecularGlossyMaterial::setThicknessMap(QQuick3DTexture *newThicknessMap)
1791{
1792 if (m_thicknessMap == newThicknessMap)
1793 return;
1794
1795 QQuick3DObjectPrivate::attachWatcher(this, &QQuick3DSpecularGlossyMaterial::setThicknessMap, newThicknessMap, m_thicknessMap);
1796
1797 m_thicknessMap = newThicknessMap;
1798 emit thicknessMapChanged();
1799 markDirty(VolumeDirty);
1800}
1801
1802QQuick3DMaterial::TextureChannelMapping QQuick3DSpecularGlossyMaterial::thicknessChannel() const
1803{
1804 return m_thicknessChannel;
1805}
1806
1807void QQuick3DSpecularGlossyMaterial::setThicknessChannel(QQuick3DMaterial::TextureChannelMapping newThicknessChannel)
1808{
1809 if (m_thicknessChannel == newThicknessChannel)
1810 return;
1811 m_thicknessChannel = newThicknessChannel;
1812 emit thicknessChannelChanged();
1813 markDirty(VolumeDirty);
1814}
1815
1816float QQuick3DSpecularGlossyMaterial::attenuationDistance() const
1817{
1818 return m_attenuationDistance;
1819}
1820
1821void QQuick3DSpecularGlossyMaterial::setAttenuationDistance(float newAttenuationDistance)
1822{
1823 if (qFuzzyCompare(m_attenuationDistance, newAttenuationDistance))
1824 return;
1825 m_attenuationDistance = newAttenuationDistance;
1826 emit attenuationDistanceChanged();
1827 markDirty(VolumeDirty);
1828}
1829
1830QColor QQuick3DSpecularGlossyMaterial::attenuationColor() const
1831{
1832 return m_attenuationColor;
1833}
1834
1835bool QQuick3DSpecularGlossyMaterial::fresnelScaleBiasEnabled() const
1836{
1837 return m_fresnelScaleBiasEnabled;
1838}
1839
1840float QQuick3DSpecularGlossyMaterial::fresnelScale() const
1841{
1842 return m_fresnelScale;
1843}
1844
1845float QQuick3DSpecularGlossyMaterial::fresnelBias() const
1846{
1847 return m_fresnelBias;
1848}
1849
1850float QQuick3DSpecularGlossyMaterial::fresnelPower() const
1851{
1852 return m_fresnelPower;
1853}
1854
1855bool QQuick3DSpecularGlossyMaterial::clearcoatFresnelScaleBiasEnabled() const
1856{
1857 return m_clearcoatFresnelScaleBiasEnabled;
1858}
1859
1860float QQuick3DSpecularGlossyMaterial::clearcoatFresnelScale() const
1861{
1862 return m_clearcoatFresnelScale;
1863}
1864
1865float QQuick3DSpecularGlossyMaterial::clearcoatFresnelBias() const
1866{
1867 return m_clearcoatFresnelBias;
1868}
1869
1870float QQuick3DSpecularGlossyMaterial::clearcoatFresnelPower() const
1871{
1872 return m_clearcoatFresnelPower;
1873}
1874
1875bool QQuick3DSpecularGlossyMaterial::vertexColorsEnabled() const
1876{
1877 return m_vertexColorsEnabled;
1878}
1879
1880void QQuick3DSpecularGlossyMaterial::setAttenuationColor(const QColor &newAttenuationColor)
1881{
1882 if (m_attenuationColor == newAttenuationColor)
1883 return;
1884 m_attenuationColor = newAttenuationColor;
1885 emit attenuationColorChanged();
1886 markDirty(VolumeDirty);
1887}
1888
1889void QQuick3DSpecularGlossyMaterial::setFresnelScaleBiasEnabled(bool fresnelScaleBiasEnabled)
1890{
1891 if (m_fresnelScaleBiasEnabled == fresnelScaleBiasEnabled)
1892 return;
1893
1894 m_fresnelScaleBiasEnabled = fresnelScaleBiasEnabled;
1895 emit fresnelScaleBiasEnabledChanged(m_fresnelScaleBiasEnabled);
1896 markDirty(SpecularDirty);
1897}
1898
1899void QQuick3DSpecularGlossyMaterial::setFresnelScale(float fresnelScale)
1900{
1901 if (qFuzzyCompare(m_fresnelScale, fresnelScale))
1902 return;
1903
1904 m_fresnelScale = fresnelScale;
1905 emit fresnelScaleChanged(m_fresnelScale);
1906 markDirty(SpecularDirty);
1907}
1908
1909void QQuick3DSpecularGlossyMaterial::setFresnelBias(float fresnelBias)
1910{
1911 if (qFuzzyCompare(m_fresnelBias, fresnelBias))
1912 return;
1913
1914 m_fresnelBias = fresnelBias;
1915 emit fresnelBiasChanged(m_fresnelBias);
1916 markDirty(SpecularDirty);
1917}
1918
1919void QQuick3DSpecularGlossyMaterial::setFresnelPower(float fresnelPower)
1920{
1921 if (qFuzzyCompare(m_fresnelPower, fresnelPower))
1922 return;
1923
1924 m_fresnelPower = fresnelPower;
1925 emit fresnelPowerChanged(m_fresnelPower);
1926 markDirty(SpecularDirty);
1927}
1928
1929void QQuick3DSpecularGlossyMaterial::setClearcoatFresnelScaleBiasEnabled(bool clearcoatFresnelScaleBiasEnabled)
1930{
1931 if (m_clearcoatFresnelScaleBiasEnabled == clearcoatFresnelScaleBiasEnabled)
1932 return;
1933
1934 m_clearcoatFresnelScaleBiasEnabled = clearcoatFresnelScaleBiasEnabled;
1935 emit clearcoatFresnelScaleBiasEnabledChanged(m_clearcoatFresnelScaleBiasEnabled);
1936 markDirty(ClearcoatDirty);
1937}
1938
1939void QQuick3DSpecularGlossyMaterial::setClearcoatFresnelScale(float clearcoatFresnelScale)
1940{
1941 if (qFuzzyCompare(m_clearcoatFresnelScale, clearcoatFresnelScale))
1942 return;
1943
1944 m_clearcoatFresnelScale = clearcoatFresnelScale;
1945 emit clearcoatFresnelScaleChanged(m_clearcoatFresnelScale);
1946 markDirty(ClearcoatDirty);
1947}
1948
1949void QQuick3DSpecularGlossyMaterial::setClearcoatFresnelBias(float clearcoatFresnelBias)
1950{
1951 if (qFuzzyCompare(m_clearcoatFresnelBias, clearcoatFresnelBias))
1952 return;
1953
1954 m_clearcoatFresnelBias = clearcoatFresnelBias;
1955 emit clearcoatFresnelBiasChanged(m_clearcoatFresnelBias);
1956 markDirty(ClearcoatDirty);
1957}
1958
1959void QQuick3DSpecularGlossyMaterial::setClearcoatFresnelPower(float clearcoatFresnelPower)
1960{
1961 if (qFuzzyCompare(m_clearcoatFresnelPower, clearcoatFresnelPower))
1962 return;
1963
1964 m_clearcoatFresnelPower = clearcoatFresnelPower;
1965 emit clearcoatFresnelPowerChanged(m_clearcoatFresnelPower);
1966 markDirty(ClearcoatDirty);
1967}
1968
1969void QQuick3DSpecularGlossyMaterial::setVertexColorsEnabled(bool vertexColors)
1970{
1971 if (m_vertexColorsEnabled == vertexColors)
1972 return;
1973
1974 m_vertexColorsEnabled = vertexColors;
1975 emit vertexColorsEnabledChanged(m_vertexColorsEnabled);
1976 markDirty(VertexColorsDirty);
1977}
1978
1979bool QQuick3DSpecularGlossyMaterial::vertexColorsMaskEnabled() const
1980{
1981 return m_vertexColorsMaskEnabled;
1982}
1983
1984void QQuick3DSpecularGlossyMaterial::setVertexColorsMaskEnabled(bool vertexColorsMaskEnabled)
1985{
1986 if (m_vertexColorsMaskEnabled == vertexColorsMaskEnabled)
1987 return;
1988 m_vertexColorsMaskEnabled = vertexColorsMaskEnabled;
1989 emit vertexColorsMaskEnabledChanged();
1990 markDirty(VertexColorsDirty);
1991}
1992
1993QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags QQuick3DSpecularGlossyMaterial::vertexColorRedMask() const
1994{
1995 return m_vertexColorRedMask;
1996}
1997
1998void QQuick3DSpecularGlossyMaterial::setVertexColorRedMask(QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags vertexColorRedMask)
1999{
2000 if (m_vertexColorRedMask == vertexColorRedMask)
2001 return;
2002 m_vertexColorRedMask = vertexColorRedMask;
2003 emit vertexColorRedMaskChanged();
2004 markDirty(VertexColorsDirty);
2005}
2006
2007QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags QQuick3DSpecularGlossyMaterial::vertexColorGreenMask() const
2008{
2009 return m_vertexColorGreenMask;
2010}
2011
2012void QQuick3DSpecularGlossyMaterial::setVertexColorGreenMask(QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags vertexColorGreenMask)
2013{
2014 if (m_vertexColorGreenMask == vertexColorGreenMask)
2015 return;
2016 m_vertexColorGreenMask = vertexColorGreenMask;
2017 emit vertexColorGreenMaskChanged();
2018 markDirty(VertexColorsDirty);
2019}
2020
2021QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags QQuick3DSpecularGlossyMaterial::vertexColorBlueMask() const
2022{
2023 return m_vertexColorBlueMask;
2024}
2025
2026void QQuick3DSpecularGlossyMaterial::setVertexColorBlueMask(QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags vertexColorBlueMask)
2027{
2028 if (m_vertexColorBlueMask == vertexColorBlueMask)
2029 return;
2030 m_vertexColorBlueMask = vertexColorBlueMask;
2031 emit vertexColorBlueMaskChanged();
2032 markDirty(VertexColorsDirty);
2033}
2034
2035QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags QQuick3DSpecularGlossyMaterial::vertexColorAlphaMask() const
2036{
2037 return m_vertexColorAlphaMask;
2038}
2039
2040void QQuick3DSpecularGlossyMaterial::setVertexColorAlphaMask(QQuick3DSpecularGlossyMaterial::VertexColorMaskFlags vertexColorAlphaMask)
2041{
2042 if (m_vertexColorAlphaMask == vertexColorAlphaMask)
2043 return;
2044 m_vertexColorAlphaMask = vertexColorAlphaMask;
2045 emit vertexColorAlphaMaskChanged();
2046 markDirty(VertexColorsDirty);
2047}
2048
2049QT_END_NAMESPACE
Combined button and popup list for selecting options.