Magnum::Trade::PbrClearCoatMaterialData class new in Git master

Clear coat material layer data.

Exposes properties of a MaterialLayer::ClearCoat layer. All APIs expect that the layer is present in the material. See Material types and convenience accessors for more information about how to use this class.

Base classes

template<MaterialLayer layer>
class MaterialLayerData<MaterialLayer::ClearCoat> new in Git master
Material layer data.

Public functions

auto hasLayerFactorRoughnessTexture() const -> bool
Whether the material has a combined layer factor / roughness texture.
auto hasTextureTransformation() const -> bool
Whether the material has texture transformation.
auto hasCommonTextureTransformation() const -> bool
Whether the material has a common transformation for all textures.
auto hasTextureCoordinates() const -> bool
Whether the material uses extra texture coordinate sets.
auto hasCommonTextureCoordinates() const -> bool
Whether the material has a common coordinate set for all textures.
auto hasTextureLayer() const -> bool
Whether the material uses array texture layers.
auto hasCommonTextureLayer() const -> bool
Whether the material has a common array texture layer for all textures.
auto roughness() const -> Float
Roughness factor.
auto roughnessTexture() const -> UnsignedInt
Roughness texture ID.
auto roughnessTextureSwizzle() const -> MaterialTextureSwizzle
Roughness texture swizzle.
auto roughnessTextureMatrix() const -> Matrix3
Roughness texture coordinate transformation matrix.
auto roughnessTextureCoordinates() const -> UnsignedInt
Roughness texture coordinate set.
auto roughnessTextureLayer() const -> UnsignedInt
Roughness array texture layer.
auto normalTexture() const -> UnsignedInt
Normal texture ID.
auto normalTextureScale() const -> Float
Normal texture scale.
auto normalTextureSwizzle() const -> MaterialTextureSwizzle
Normal texture swizzle.
auto normalTextureMatrix() const -> Matrix3
Normal texture coordinate transformation matrix.
auto normalTextureCoordinates() const -> UnsignedInt
Normal texture coordinate set.
auto normalTextureLayer() const -> UnsignedInt
Normal array texture layer.
auto commonTextureMatrix() const -> Matrix3
Common texture coordinate transformation matrix for all textures.
auto commonTextureCoordinates() const -> UnsignedInt
Common texture coordinate set for all textures.
auto commonTextureLayer() const -> UnsignedInt
Common array texture layer for all textures.

Function documentation

bool Magnum::Trade::PbrClearCoatMaterialData::hasLayerFactorRoughnessTexture() const

Whether the material has a combined layer factor / roughness texture.

Returns true if both MaterialAttribute::LayerFactorTexture and MaterialAttribute::RoughnessTexture attributes are present, point to the same texture ID, MaterialAttribute::LayerFactorTextureSwizzle is either not present or set to MaterialTextureSwizzle::R and MaterialAttribute::RoughnessTextureSwizzle is set to MaterialTextureSwizzle::G, and additionally MaterialAttribute::LayerFactorTextureMatrix and MaterialAttribute::RoughnessTextureMatrix are both either not present or have the same value, MaterialAttribute::LayerFactorTextureCoordinates and MaterialAttribute::RoughnessTextureCoordinates are both either not present or have the same value, and MaterialAttribute::LayerFactorTextureLayer and MaterialAttribute::RoughnessTextureLayer are both either not present or have the same value; false otherwise.

In other words, if this function returns true, layerFactorTexture(), layerFactorTextureMatrix(), layerFactorTextureCoordinates() and layerFactorTextureLayer() return values common for both layer factor and roughness texture, and the two are packed together with layer factor occupying the R channel and roughness the G channel. This check is present in order to provide support for the KHR_materials_clearcoat glTF extension.

bool Magnum::Trade::PbrClearCoatMaterialData::hasTextureTransformation() const

Whether the material has texture transformation.

Returns true if any of the MaterialAttribute::LayerFactorTextureMatrix, MaterialAttribute::RoughnessTextureMatrix, MaterialAttribute::NormalTextureMatrix or MaterialAttribute::TextureMatrix attributes are present in this layer or if MaterialAttribute::TextureMatrix is present in the base material, false otherwise.

bool Magnum::Trade::PbrClearCoatMaterialData::hasCommonTextureTransformation() const

Whether the material has a common transformation for all textures.

Returns true if, for each texture that is present, layerFactorTextureMatrix(), roughnessTextureMatrix() and normalTextureMatrix() have the same value, false otherwise. In particular, returns true also if there's no texture transformation at all. Use hasTextureTransformation() to distinguish that case.

bool Magnum::Trade::PbrClearCoatMaterialData::hasTextureCoordinates() const

Whether the material uses extra texture coordinate sets.

Returns true if any of the MaterialAttribute::LayerFactorTextureCoordinates, MaterialAttribute::RoughnessTextureCoordinates, MaterialAttribute::NormalTextureCoordinates or MaterialAttribute::TextureCoordinates attributes are present in this material and have a non-zero value or if MaterialAttribute::TextureCoordinates is present in the base material and has a non-zero value, false otherwise.

bool Magnum::Trade::PbrClearCoatMaterialData::hasCommonTextureCoordinates() const

Whether the material has a common coordinate set for all textures.

Returns true if, for each texture that is present, layerFactorTextureCoordinates(), roughnessTextureCoordinates() and normalTextureCoordinates() have the same value, false otherwise. In particular, returns true also if there's no extra texture coordinate set used at all. Use hasTextureCoordinates() to distinguish that case.

bool Magnum::Trade::PbrClearCoatMaterialData::hasTextureLayer() const

Whether the material uses array texture layers.

Returns true if any of the MaterialAttribute::LayerFactorTextureLayer, MaterialAttribute::RoughnessTextureLayer, MaterialAttribute::NormalTextureLayer or MaterialAttribute::TextureLayer attributes are present in this material or if MaterialAttribute::TextureLayer is present in the base material, false otherwise.

bool Magnum::Trade::PbrClearCoatMaterialData::hasCommonTextureLayer() const

Whether the material has a common array texture layer for all textures.

Returns true if, for each texture that is present, layerFactorTextureLayer(), roughnessTextureLayer() and normalTextureLayer() have the same value, false otherwise. In particular, returns true also if there's no array texture layer used at all. Use hasTextureLayer() to distinguish that case.

Float Magnum::Trade::PbrClearCoatMaterialData::roughness() const

Roughness factor.

Convenience access to the MaterialAttribute::Roughness attribute in this layer. If not present, the default is 1.0f.

If the layer has a MaterialAttribute::RoughnessTexture, the factor and texture is meant to be multiplied together.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::roughnessTexture() const

Roughness texture ID.

Available only if MaterialAttribute::RoughnessTexture is present in this layer. Meant to be multiplied with roughness().

MaterialTextureSwizzle Magnum::Trade::PbrClearCoatMaterialData::roughnessTextureSwizzle() const

Roughness texture swizzle.

Convenience access to the MaterialAttribute::RoughnessTextureSwizzle attribute in this layer. If not present, the default is MaterialTextureSwizzle::R. Available only if MaterialAttribute::RoughnessTexture is present in this layer.

Matrix3 Magnum::Trade::PbrClearCoatMaterialData::roughnessTextureMatrix() const

Roughness texture coordinate transformation matrix.

Convenience access to the MaterialAttribute::RoughnessTextureMatrix / MaterialAttribute::TextureMatrix attributes in this layer or a MaterialAttribute::TextureMatrix attribute in the base material. If neither is present, the default is an identity matrix. Available only if MaterialAttribute::RoughnessTexture is present in this layer.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::roughnessTextureCoordinates() const

Roughness texture coordinate set.

Convenience access to the MaterialAttribute::RoughnessTextureCoordinates / MaterialAttribute::TextureCoordinates attributes in this layer or a MaterialAttribute::TextureCoordinates attribute in the base material. If neither is present, the default is 0. Available only if MaterialAttribute::RoughnessTexture is present in this layer.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::roughnessTextureLayer() const

Roughness array texture layer.

Convenience access to the MaterialAttribute::RoughnessTextureLayer / MaterialAttribute::TextureLayer attributes in this layer or a MaterialAttribute::TextureLayer attribute in the base material. If neither is present, the default is 0. Available only if MaterialAttribute::RoughnessTexture is present in this layer.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::normalTexture() const

Normal texture ID.

Available only if MaterialAttribute::NormalTexture is present in this layer.

Float Magnum::Trade::PbrClearCoatMaterialData::normalTextureScale() const

Normal texture scale.

Convenience access to the MaterialAttribute::NormalTextureScale attribute. If not present, the default is 1.0f. Available only if MaterialAttribute::NormalTexture is present.

MaterialTextureSwizzle Magnum::Trade::PbrClearCoatMaterialData::normalTextureSwizzle() const

Normal texture swizzle.

Convenience access to the MaterialAttribute::NormalTextureSwizzle attribute in this layer. If not present, the default is MaterialTextureSwizzle::RGB. Available only if MaterialAttribute::NormalTexture is present in this layer.

The texture can be also just two-component, in which case the remaining component is implicit and calculated as $ z = \sqrt{1 - x^2 - y^2} $ .

Matrix3 Magnum::Trade::PbrClearCoatMaterialData::normalTextureMatrix() const

Normal texture coordinate transformation matrix.

Convenience access to the MaterialAttribute::NormalTextureMatrix / MaterialAttribute::TextureMatrix attributes in this layer or a MaterialAttribute::TextureMatrix attribute in the base material. If neither is present, the default is an identity matrix. Available only if MaterialAttribute::NormalTexture is present in this layer.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::normalTextureCoordinates() const

Normal texture coordinate set.

Convenience access to the MaterialAttribute::NormalTextureCoordinates / MaterialAttribute::TextureCoordinates attributes in this layer or a MaterialAttribute::TextureCoordinates attribute in the base material. If neither is present, the default is 0. Available only if MaterialAttribute::NormalTexture is present in this layer.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::normalTextureLayer() const

Normal array texture layer.

Convenience access to the MaterialAttribute::NormalTextureLayer / MaterialAttribute::TextureLayer attributes in this layer or a MaterialAttribute::TextureLayer attribute in the base material. If neither is present, the default is 0. Available only if MaterialAttribute::NormalTexture is present in this layer.

Matrix3 Magnum::Trade::PbrClearCoatMaterialData::commonTextureMatrix() const

Common texture coordinate transformation matrix for all textures.

Expects that hasCommonTextureTransformation() is true; returns a matrix that's the same for all of layerFactorTextureMatrix(), roughnessTextureMatrix() and normalTextureMatrix() where a texture is present. If no texture is present, returns an identity matrix.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::commonTextureCoordinates() const

Common texture coordinate set for all textures.

Expects that hasCommonTextureCoordinates() is true; returns a coordinate set that's the same for all of layerFactorTextureCoordinates(), roughnessTextureCoordinates() and normalTextureCoordinates() where a texture is present. If no texture is present, returns 0.

UnsignedInt Magnum::Trade::PbrClearCoatMaterialData::commonTextureLayer() const

Common array texture layer for all textures.

Expects that hasCommonTextureLayer() is true; returns a layer that's the same for all of layerFactorTextureLayer(), roughnessTextureLayer() and normalTextureLayer() where a texture is present. If no texture is present, returns 0.