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

Flat material data.

See Material types and convenience accessors for more information about how to use this class.

Base classes

class MaterialData new in Git master
Material data.

Public functions

auto hasTexture() const -> bool
Whether the material has a texture.
auto hasTextureTransformation() const -> bool
Whether the material has texture transformation.
auto hasTextureCoordinates() const -> bool
Whether the material uses extra texture coordinate sets.
auto hasTextureLayer() const -> bool
Whether the material uses array texture layers.
auto color() const -> Color4
Color.
auto texture() const -> UnsignedInt
Texture ID.
auto textureMatrix() const -> Matrix3
Texture coordinate transformation matrix.
auto textureCoordinates() const -> UnsignedInt
Texture coordinate set.
auto textureLayer() const -> UnsignedInt
Array texture layer.

Function documentation

bool Magnum::Trade::FlatMaterialData::hasTexture() const

Whether the material has a texture.

Returns true if any of the MaterialAttribute::BaseColorTexture or MaterialAttribute::DiffuseTexture attributes is present, false otherwise.

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

Whether the material has texture transformation.

Returns true if the material is textured and a MaterialAttribute::BaseColorTextureMatrix, MaterialAttribute::DiffuseTextureMatrix or MaterialAttribute::TextureMatrix attribute matching the texture is present, false otherwise. In particular, if there's for example a MaterialAttribute::BaseColorTexture but only a MaterialAttribute::DiffuseTextureMatrix, returns false.

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

Whether the material uses extra texture coordinate sets.

Returns true if the material is textured and a MaterialAttribute::BaseColorTextureCoordinates, MaterialAttribute::DiffuseTextureCoordinates or MaterialAttribute::TextureCoordinates attribute matching the texture is present and has a non-zero value, false otherwise. In particular, if there's for example a MaterialAttribute::BaseColorTexture but only a MaterialAttribute::DiffuseTextureCoordinates, returns false.

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

Whether the material uses array texture layers.

Returns true if the material is textured and a MaterialAttribute::BaseColorTextureLayer, MaterialAttribute::DiffuseTextureLayer or MaterialAttribute::TextureLayer attribute matching the texture is present and has a non-zero value, false otherwise. In particular, if there's for example a MaterialAttribute::BaseColorTexture but only a MaterialAttribute::DiffuseTextureLayer, returns false.

Color4 Magnum::Trade::FlatMaterialData::color() const

Color.

Convenience access to the MaterialAttribute::BaseColor / MaterialAttribute::DiffuseColor attributes. If neither of them is present, the default is 0xffffffff_srgbaf.

If the material has a texture, the color attribute matching the texture is picked (instead of combining e.g. a MaterialAttribute::BaseColor with MaterialAttribute::DiffuseTexture). The color and texture is meant to be multiplied together.

UnsignedInt Magnum::Trade::FlatMaterialData::texture() const

Texture ID.

Available only if either MaterialAttribute::BaseColorTexture or MaterialAttribute::DiffuseTexture is present. Meant to be multiplied with color().

Matrix3 Magnum::Trade::FlatMaterialData::textureMatrix() const

Texture coordinate transformation matrix.

Convenience access to the MaterialAttribute::DiffuseTextureMatrix / MaterialAttribute::BaseColorTextureMatrix / MaterialAttribute::TextureMatrix attributes, picking the one matching the texture (instead of combining e.g. a MaterialAttribute::BaseColorTexture with MaterialAttribute::DiffuseTextureMatrix). If no matching attribute is present, the default is an identity matrix. Available only if the material has a texture.

UnsignedInt Magnum::Trade::FlatMaterialData::textureCoordinates() const

Texture coordinate set.

Convenience access to the MaterialAttribute::DiffuseTextureCoordinates / MaterialAttribute::BaseColorTextureCoordinates / MaterialAttribute::TextureCoordinates attributes, picking the one matching the texture (instead of combining e.g. a MaterialAttribute::BaseColorTexture with MaterialAttribute::DiffuseTextureCoordinates). If no matching attribute is present, the default is 0. Available only if the material has a texture.

UnsignedInt Magnum::Trade::FlatMaterialData::textureLayer() const

Array texture layer.

Convenience access to the MaterialAttribute::DiffuseTextureLayer / MaterialAttribute::BaseColorTextureLayer / MaterialAttribute::TextureLayer attributes, picking the one matching the texture (instead of combining e.g. a MaterialAttribute::BaseColorTexture with MaterialAttribute::DiffuseTextureLayer). If no matching attribute is present, the default is 0. Available only if the material has a texture.