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