class new in Git master
#include <Magnum/Trade/MaterialData.h>
MaterialData Material data.
Key-value store for builtin as well as custom material attributes, with an ability to define additional layers further affecting the base material. Populated instances of this class are returned from AbstractImporter::
Usage
The simplest usage is through templated attribute() functions, which take a string attribute name or one of the pre-defined MaterialAttribute values. You're expected to check for attribute presence first with hasAttribute(), and the requested type has to match attributeType(). To make things easier, each of the attributes defined in MaterialAttribute has a strictly defined type, so you can safely assume the type when requesting those. In addition there's findAttribute() and attributeOr() that return a Containers::
Trade::MaterialData data = …; // Assumes the attribute exists Float roughness = data.attribute<Float>(Trade::MaterialAttribute::Roughness); // Optional access Color4 color = data.attributeOr(Trade::MaterialAttribute::BaseColor, 0x3bd267ff_srgbaf); if(Containers::Optional<UnsignedInt> texture = data.findAttribute<UnsignedInt>(Trade::MaterialAttribute::BaseColorTexture)) { // ... }
It's also possible to iterate through all attributes using attributeName(), attributeType() and attribute() taking indices instead of names, with attributeCount() returning the total attribute count.
Material types and convenience accessors
A material usually consists of a set of attributes for a particular rendering workflow — PBR metallic/roughness, Phong or for example flat-shaded materials. To hint what the material contains, types() returns a set of MaterialType values. It's not just a single value as the data can define attributes for more than one material type (for example both metallic/roughness and specular/glossiness PBR workflow), allowing the application to pick the best type for a particular use case.
Because retrieving everything through the attribute() APIs can get verbose and complex, the Trade library provides a set of accessor APIs for common material types such as FlatMaterialData, PhongMaterialData, PbrMetallicRoughnessMaterialData, PbrSpecularGlossinessMaterialData as well as material layers like PbrClearCoatMaterialData. Using as() you can convert any MaterialData instance to a reference to one of those. These convenience APIs then take care of default values when an attribute isn't present or handle fallbacks when an attribute can be defined in multiple ways:
/* Prefer a specular/glossiness workflow, if present */ if(data.types() & Trade::MaterialType::PbrSpecularGlossiness) { const auto& pbr = data.as<Trade::PbrSpecularGlossinessMaterialData>(); Color4 diffuse = pbr.diffuseColor(); Color4 specular = pbr.specularColor(); Float glossiness = pbr.glossiness(); … /* Otherwise use metallic/roughness (or defaults if no attributes present) */ } else { const auto& pbr = data.as<Trade::PbrMetallicRoughnessMaterialData>(); Color4 base = pbr.baseColor(); Float metalness = pbr.metalness(); Float roughness = pbr.roughness(); … }
Each MaterialAttribute is exposed through one or more of those convenience APIs, see the documentation of of a particular enum value for more information.
Texture packing, coordinate transformation and coordinate sets
The material APIs allow for a lot of flexibility — texture maps may be arbitrarily packed together to efficiently use all four channels, each texture can use a different set of texture coordinates and there can be a different coordinate transformation for each texture.
In most cases, however, real-world textures fit into a few well-known packing schemes and usually have a common transformation and coordinate sets for all. Checking for all corner cases on the application side would be a headache, so there are queries like PbrSpecularGlossinessMaterialData::
Trade::PbrSpecularGlossinessMaterialData data = …; /* Simple case for diffuse + packed specular/glossiness texture, the default coordinate set and a common coordinate transformation for all textures */ if(data.hasAttribute(Trade::MaterialAttribute::DiffuseTexture) && data.hasSpecularGlossinessTexture() && data.hasCommonTextureTransformation() && !data.hasTextureCoordinates()) { UnsignedInt diffuse = data.diffuseTexture(); UnsignedInt specularGlossiness = data.specularTexture(); Matrix3 textureMatrix = data.commonTextureMatrix(); … /* Extra work needed when using a non-default texture coordinate set */ } else if(data.hasTextureCoordinates() && data.hasCommonTextureCoordinates()) { … /* Etc... */ } else Fatal{} << "Material too complex, giving up";
Material layers
In addition to the base material, there can be material layers. While a material attribute can be specified only once for a particular layer, multiple layers can use the same attribute name for different purpose. Layers are commonly used in PBR workflows to describe lacquered wood, metallic paint or for example a thin film on leather surfaces. You can enumerate and query layers using layerCount(), layerName() and hasLayer(), layer-specific attributes are retrieved by passing layer ID or name as the first parameter to the attribute() family of APIs.
For each layer there can be predefined layerFactor(), layerFactorTexture() and other texture-related attributes which define how much the layer affects the underlying material, but the exact semantics of how the factor is applied is left to the layer implementation.
Here's an example showing retrieval of a clear coat layer parameters, if present:
if(data.hasLayer(Trade::MaterialLayer::ClearCoat)) { Float clearCoatFactor = data.attributeOr(Trade::MaterialLayer::ClearCoat, Trade::MaterialAttribute::LayerFactor, 1.0f); Float clearCoatRoughness = data.attributeOr(Trade::MaterialLayer::ClearCoat, Trade::MaterialAttribute::Roughness, 0.0f); … }
Like with base material attributes, builtin layers also have convenience accessor APIs. The above can be written in a more compact way using PbrClearCoatMaterialData:
if(data.types() & Trade::MaterialType::PbrClearCoat) { const auto& clearCoat = data.as<Trade::PbrClearCoatMaterialData>(); Float clearCoatFactor = clearCoat.layerFactor(); Float clearCoatRoughness = clearCoat.roughness(); … }
Mutable data access
The interfaces implicitly return attribute values by copy or through const
views on the contained data through the attributeData(), layerData() and attribute() accessors. This is done because in general case the data can also refer to a memory-mapped file or constant memory. In cases when it's desirable to modify the attribute values in-place, there's a set of mutableAttribute() functions. To use these, you need to check that the data are mutable using attributeDataFlags() first. The following snippet desaturates the base color of a PBR material:
Color4& color = data.mutableAttribute<Color4>(Trade::MaterialAttribute::BaseColor); ColorHsv hsv = color.toHsv(); color.rgb() = Color3::fromHsv({hsv.hue, hsv.saturation*0.85f, hsv.value});
Because the class internally expects the attribute data to be sorted and partitioned into layers, it's not possible to modify attribute names, add/remove attributes or change layer offsets — only to edit values of existing attributes.
Populating an instance
A MaterialData instance by default takes over ownership of an Containers::
Trade::MaterialData data{Trade::MaterialType::PbrMetallicRoughness, { {Trade::MaterialAttribute::DoubleSided, true}, {Trade::MaterialAttribute::BaseColor, 0x3bd267ff_srgbaf}, {Trade::MaterialAttribute::BaseColorTexture, 17u}, {Trade::MaterialAttribute::TextureMatrix, Matrix3::scaling({0.5f, 1.0f})} }};
Non-owned instances
In some cases you may want the MaterialData instance to only refer to external data without taking ownership, for example with a memory-mapped file, global data etc. For that, instead of moving in an Containers::
using namespace Containers::Literals; constexpr Trade::MaterialAttributeData attributes[]{ {"BaseColor"_s, Color4{0.043735f, 0.64448f, 0.135633f, 1.0f}}, {"BaseColorTexture"_s, 5u}, {"DoubleSided"_s, true}, {"TextureMatrix"_s, Matrix3{{0.5f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}}} }; Trade::MaterialData data{Trade::MaterialType::Phong, {}, attributes};
Custom material attributes
While attribute names beginning with uppercase letters and whitespace are reserved for builtin Magnum attributes, anything beginning with a lowercase letter or a printable non-letter character can be a custom attribute. For greater flexibility, custom attributes can be also strings, untyped buffers or pointers, allowing you to store arbitrary properties such as image filenames or direct texture pointers instead of IDs:
char sha1[20]{…}; Trade::MaterialData data{Trade::MaterialType::PbrMetallicRoughness, { {Trade::MaterialAttribute::BaseColor, 0x3bd267ff_srgbaf}, {Trade::MaterialAttribute::TextureMatrix, Matrix3::scaling({0.5f, 1.0f})}, {"baseColorTexturePointer", &baseColorTexture}, {"highlightColor", 0x00ffff_srgbf}, {"name", "Canary Green Plastic, really ugly"}, {"hash", Containers::ArrayView<const void>{sha1}}, }}; // Retrieving the texture pointer GL::Texture2D* texture = data.attribute<GL::Texture2D*>("baseColorTexturePointer");
Adding material layers
Material layers are internally represented as ranges of the attribute array and by default the whole attribute array is treated as a base material. The actual split into layers can be described using an additional offset array passed to MaterialData(MaterialTypes, Containers::2
to 6
(thus four attributes):
Trade::MaterialData data{ Trade::MaterialType::PbrMetallicRoughness|Trade::MaterialType::PbrClearCoat, { {Trade::MaterialAttribute::BaseColor, 0xffcc33_srgbf}, {Trade::MaterialAttribute::NoneRoughnessMetallicTexture, 0u}, {Trade::MaterialLayer::ClearCoat}, {Trade::MaterialAttribute::LayerFactorTexture, 1u}, {Trade::MaterialAttribute::RoughnessTexture, 1u}, {Trade::MaterialAttribute::RoughnessTextureSwizzle, Trade::MaterialTextureSwizzle::G} }, {2, 6} };
Like with just a base material, the attributes get sorted for a lookup — but not as a whole, each layer separately. In contrary, because layer order matters, those are not reordered (and thus their lookup is , however it isn't expected to have that many layers for this to matter). The layers can be named by supplying a MaterialAttribute::
Apart from builtin layers, there's no limit in what the layers can be used for — the data can for example describe a completely custom landscape from a set of authored rockTile
, sandTile
, grassTile
textures and procedurally generated blend factors a
, b
, c
, d
:
Trade::MaterialData proceduralLandscape{ Trade::MaterialTypes{}, // Doesn't match any builtin material type { // Rock layer {Trade::MaterialAttribute::LayerFactorTexture, a}, {Trade::MaterialAttribute::BaseColorTexture, rockTile}, // Sand layer {Trade::MaterialAttribute::LayerFactorTexture, b}, {"blendType", "mix"}, {Trade::MaterialAttribute::BaseColorTexture, sandTile}, // Grass layer {Trade::MaterialAttribute::LayerFactorTexture, c}, {"blendType", "overlay"}, {"strandLengthTexture", d}, {Trade::MaterialAttribute::BaseColorTexture, grassTile}, }, // There's no base material, everything is in layers {0, 2, 5, 9} };
Internal representation
The attributes are stored sorted by the key in a contiguous array, with each MaterialAttributeData item occupying 64 bytes. The item contains a 1-byte type identifier, the actual value and the rest is occupied with null-terminated name. This means the name length can vary from 14 bytes for Matrix3x4 / Matrix4x3 to 61 bytes for bool
(excluding null terminator). As each item has a fixed size anyway, there's no value in supporting space-efficient 8-, 16- or half-float types. Conversely, Double types are currently not supported either as there isn't currently seen any need for extended precision.
Derived classes
- class FlatMaterialData new in Git master
- Flat material data.
-
template<MaterialLayer layer>class MaterialLayerData new in Git master
- Material layer data.
- class PbrMetallicRoughnessMaterialData new in Git master
- PBR metallic/roughness material data.
- class PbrSpecularGlossinessMaterialData new in Git master
- PBR specular/glossiness material data.
- class PhongMaterialData
- Phong material data.
-
template<MaterialLayer layer>class MaterialLayerData new in Git master
- Material layer data.
Public types
- enum class Flag: UnsignedInt { DoubleSided = 1 << 0 } deprecated in Git master
- Material flag.
-
using Flags = Containers::
EnumSet<Flag> deprecated in Git master - Material flags.
Constructors, destructors, conversion operators
-
MaterialData(MaterialTypes types,
Containers::
Array<MaterialAttributeData>&& attributeData, const void* importerState = nullptr) explicit noexcept - Construct.
-
MaterialData(MaterialTypes types,
std::
initializer_list<MaterialAttributeData> attributeData, const void* importerState = nullptr) explicit -
MaterialData(MaterialTypes types,
DataFlags attributeDataFlags,
Containers::
ArrayView<const MaterialAttributeData> attributeData, const void* importerState = nullptr) explicit noexcept - Construct a non-owned material data.
-
MaterialData(MaterialTypes types,
Containers::
Array<MaterialAttributeData>&& attributeData, Containers:: Array<UnsignedInt>&& layerData, const void* importerState = nullptr) explicit noexcept - Construct with layers.
-
MaterialData(MaterialTypes types,
std::
initializer_list<MaterialAttributeData> attributeData, std:: initializer_list<UnsignedInt> layerData, const void* importerState = nullptr) explicit -
MaterialData(MaterialTypes types,
DataFlags attributeDataFlags,
Containers::
ArrayView<const MaterialAttributeData> attributeData, DataFlags layerDataFlags, Containers:: ArrayView<const UnsignedInt> layerData, const void* importerState = nullptr) explicit noexcept - Construct a non-owned material data with layers.
- MaterialData(const MaterialData&) deleted
- Copying is not allowed.
- MaterialData(MaterialData&&) noexcept
- Move constructor.
Public functions
- auto operator=(const MaterialData&) -> MaterialData& deleted
- Copying is not allowed.
- auto operator=(MaterialData&&) -> MaterialData& noexcept
- Move assignment.
- auto attributeDataFlags() const -> DataFlags
- Attribute data flags ¨ Since the attribute list is always assumed to be sorted and partitioned into layers, only attribute values can be edited when the DataFlag::
Mutable flag is present. - auto layerDataFlags() const -> DataFlags
- Layer data flags.
- auto types() const -> MaterialTypes
- Material types.
-
template<class T>auto as() const & -> const T&
- Interpret as a material data of concrete type.
-
template<class T>auto as() && -> T
- Interpret a rvalue as a material data of concrete type.
- auto type() const -> MaterialType deprecated in Git master
- Material type.
-
auto layerData() const -> Containers::
ArrayView<const UnsignedInt> - Raw layer offset data.
-
auto attributeData() const -> Containers::
ArrayView<const MaterialAttributeData> - Raw attribute data.
- auto layerCount() const -> UnsignedInt
- Layer count.
- auto attributeDataOffset(UnsignedInt layer) const -> UnsignedInt
- Offset of a layer inside attribute data.
-
auto hasLayer(Containers::
StringView layer) const -> bool - Whether a material has given named layer.
- auto hasLayer(MaterialLayer layer) const -> bool
-
auto findLayerId(Containers::
StringView layer) const -> Containers:: Optional<UnsignedInt> - Find ID of a named layer.
-
auto findLayerId(MaterialLayer layer) const -> Containers::
Optional<UnsignedInt> -
auto layerId(Containers::
StringView layer) const -> UnsignedInt - ID of a named layer.
- auto layerId(MaterialLayer layer) const -> UnsignedInt
-
auto layerName(UnsignedInt layer) const -> Containers::
StringView - Layer name.
- auto layerFactor(UnsignedInt layer) const -> Float
- Factor of given layer.
-
auto layerFactor(Containers::
StringView layer) const -> Float - Factor of a named layer.
- auto layerFactor(MaterialLayer layer) const -> Float
- auto layerFactorTexture(UnsignedInt layer) const -> UnsignedInt
- Factor texture ID for given layer.
-
auto layerFactorTexture(Containers::
StringView layer) const -> UnsignedInt - Factor texture ID for a named layer.
- auto layerFactorTexture(MaterialLayer layer) const -> UnsignedInt
- auto layerFactorTextureSwizzle(UnsignedInt layer) const -> MaterialTextureSwizzle
- Factor texture swizzle for given layer.
-
auto layerFactorTextureSwizzle(Containers::
StringView layer) const -> MaterialTextureSwizzle - Factor texture swizzle for a named layer.
- auto layerFactorTextureSwizzle(MaterialLayer layer) const -> MaterialTextureSwizzle
- auto layerFactorTextureMatrix(UnsignedInt layer) const -> Matrix3
- Factor texture coordinate transformation matrix for given layer.
-
auto layerFactorTextureMatrix(Containers::
StringView layer) const -> Matrix3 - Factor texture coordinate transformation matrix for a named layer.
- auto layerFactorTextureMatrix(MaterialLayer layer) const -> Matrix3
- auto layerFactorTextureCoordinates(UnsignedInt layer) const -> UnsignedInt
- Factor texture coordinate set for given layer.
-
auto layerFactorTextureCoordinates(Containers::
StringView layer) const -> UnsignedInt - Factor texture coordinate set for a named layer.
- auto layerFactorTextureCoordinates(MaterialLayer layer) const -> UnsignedInt
- auto layerFactorTextureLayer(UnsignedInt layer) const -> UnsignedInt
- Factor array texture layer for given layer.
-
auto layerFactorTextureLayer(Containers::
StringView layer) const -> UnsignedInt - Factor array texture layer for a named layer.
- auto layerFactorTextureLayer(MaterialLayer layer) const -> UnsignedInt
- auto attributeCount(UnsignedInt layer) const -> UnsignedInt
- Attribute count in given layer.
-
auto attributeCount(Containers::
StringView layer) const -> UnsignedInt - Attribute count in a named layer.
- auto attributeCount(MaterialLayer layer) const -> UnsignedInt
- auto attributeCount() const -> UnsignedInt
- Attribute count in the base material.
-
auto hasAttribute(UnsignedInt layer,
Containers::
StringView name) const -> bool - Whether a material layer has given attribute.
- auto hasAttribute(UnsignedInt layer, MaterialAttribute name) const -> bool
-
auto hasAttribute(Containers::
StringView layer, Containers:: StringView name) const -> bool - Whether a named material layer has given attribute.
-
auto hasAttribute(Containers::
StringView layer, MaterialAttribute name) const -> bool -
auto hasAttribute(MaterialLayer layer,
Containers::
StringView name) const -> bool - auto hasAttribute(MaterialLayer layer, MaterialAttribute name) const -> bool
-
auto hasAttribute(Containers::
StringView name) const -> bool - Whether the base material has given attribute.
- auto hasAttribute(MaterialAttribute name) const -> bool
-
auto findAttributeId(UnsignedInt layer,
Containers::
StringView name) const -> Containers:: Optional<UnsignedInt> - Find ID of a named attribute in given material layer.
-
auto findAttributeId(UnsignedInt layer,
MaterialAttribute name) const -> Containers::
Optional<UnsignedInt> -
auto findAttributeId(Containers::
StringView layer, Containers:: StringView name) const -> Containers:: Optional<UnsignedInt> - Find ID of a named attribute in a named material layer.
-
auto findAttributeId(Containers::
StringView layer, MaterialAttribute name) const -> Containers:: Optional<UnsignedInt> -
auto findAttributeId(MaterialLayer layer,
Containers::
StringView name) const -> Containers:: Optional<UnsignedInt> -
auto findAttributeId(MaterialLayer layer,
MaterialAttribute name) const -> Containers::
Optional<UnsignedInt> -
auto findAttributeId(Containers::
StringView name) const -> Containers:: Optional<UnsignedInt> - Find ID of a named attribute in the base material.
-
auto findAttributeId(MaterialAttribute name) const -> Containers::
Optional<UnsignedInt> -
auto attributeId(UnsignedInt layer,
Containers::
StringView name) const -> UnsignedInt - ID of a named attribute in given material layer.
- auto attributeId(UnsignedInt layer, MaterialAttribute name) const -> UnsignedInt
-
auto attributeId(Containers::
StringView layer, Containers:: StringView name) const -> UnsignedInt - ID of a named attribute in a named material layer.
-
auto attributeId(Containers::
StringView layer, MaterialAttribute name) const -> UnsignedInt -
auto attributeId(MaterialLayer layer,
Containers::
StringView name) const -> UnsignedInt - auto attributeId(MaterialLayer layer, MaterialAttribute name) const -> UnsignedInt
-
auto attributeId(Containers::
StringView name) const -> UnsignedInt - ID of a named attribute in the base material.
- auto attributeId(MaterialAttribute name) const -> UnsignedInt
- auto attributeData(UnsignedInt layer, UnsignedInt id) const -> const MaterialAttributeData&
- Raw attribute data.
- auto attributeData(UnsignedInt id) const -> const MaterialAttributeData&
- Raw attribute data in the base material.
-
auto attributeName(UnsignedInt layer,
UnsignedInt id) const -> Containers::
StringView - Name of an attribute in given material layer.
-
auto attributeName(Containers::
StringView layer, UnsignedInt id) const -> Containers:: StringView - Name of an attribute in a named material layer.
-
auto attributeName(MaterialLayer layer,
UnsignedInt id) const -> Containers::
StringView -
auto attributeName(UnsignedInt id) const -> Containers::
StringView - Name of an attribute in the base material.
- auto attributeType(UnsignedInt layer, UnsignedInt id) const -> MaterialAttributeType
- Type of an attribute in given material layer.
-
auto attributeType(UnsignedInt layer,
Containers::
StringView name) const -> MaterialAttributeType - Type of a named attribute in given material layer.
- auto attributeType(UnsignedInt layer, MaterialAttribute name) const -> MaterialAttributeType
-
auto attributeType(Containers::
StringView layer, UnsignedInt id) const -> MaterialAttributeType - Type of an attribute in a named material layer.
- auto attributeType(MaterialLayer layer, UnsignedInt id) const -> MaterialAttributeType
-
auto attributeType(Containers::
StringView layer, Containers:: StringView name) const -> MaterialAttributeType - Type of a named attribute in a named material layer.
-
auto attributeType(Containers::
StringView layer, MaterialAttribute name) const -> MaterialAttributeType -
auto attributeType(MaterialLayer layer,
Containers::
StringView name) const -> MaterialAttributeType - auto attributeType(MaterialLayer layer, MaterialAttribute name) const -> MaterialAttributeType
- auto attributeType(UnsignedInt id) const -> MaterialAttributeType
- Type of an attribute in the base material.
-
auto attributeType(Containers::
StringView name) const -> MaterialAttributeType - Type of a named attribute in the base material.
- auto attributeType(MaterialAttribute name) const -> MaterialAttributeType
- auto attribute(UnsignedInt layer, UnsignedInt id) const -> const void*
- Type-erased value of an attribute in given material layer.
- auto mutableAttribute(UnsignedInt layer, UnsignedInt id) -> void*
- Type-erased mutable value of an attribute in given material layer.
-
auto attribute(UnsignedInt layer,
Containers::
StringView name) const -> const void* - Type-erased value of a named attribute in given material layer.
- auto attribute(UnsignedInt layer, MaterialAttribute name) const -> const void*
-
auto mutableAttribute(UnsignedInt layer,
Containers::
StringView name) -> void* - Type-erased value of a named attribute in given material layer.
- auto mutableAttribute(UnsignedInt layer, MaterialAttribute name) -> void*
-
auto attribute(Containers::
StringView layer, UnsignedInt id) const -> const void* - Type-erased value of an attribute in a named material layer.
- auto attribute(MaterialLayer layer, UnsignedInt id) const -> const void*
-
auto mutableAttribute(Containers::
StringView layer, UnsignedInt id) -> void* - Type-erased mutable value of an attribute in a named material layer.
- auto mutableAttribute(MaterialLayer layer, UnsignedInt id) -> void*
-
auto attribute(Containers::
StringView layer, Containers:: StringView name) const -> const void* - Type-erased value of a named attribute in a named material layer.
-
auto attribute(Containers::
StringView layer, MaterialAttribute name) const -> const void* -
auto attribute(MaterialLayer layer,
Containers::
StringView name) const -> const void* - auto attribute(MaterialLayer layer, MaterialAttribute name) const -> const void*
-
auto mutableAttribute(Containers::
StringView layer, Containers:: StringView name) -> void* - Type-erased mutable value of a named attribute in a named material layer.
-
auto mutableAttribute(Containers::
StringView layer, MaterialAttribute name) -> void* -
auto mutableAttribute(MaterialLayer layer,
Containers::
StringView name) -> void* - auto mutableAttribute(MaterialLayer layer, MaterialAttribute name) -> void*
- auto attribute(UnsignedInt id) const -> const void*
- Type-erased value of an attribute in the base material.
- auto mutableAttribute(UnsignedInt id) -> void*
- Type-erased mutable value of an attribute in the base material.
-
auto attribute(Containers::
StringView name) const -> const void* - Type-erased value of a named attribute in the base material.
- auto attribute(MaterialAttribute name) const -> const void*
-
auto mutableAttribute(Containers::
StringView name) -> void* - Type-erased mutable value of a named attribute in the base material.
- auto mutableAttribute(MaterialAttribute name) -> void*
-
template<class T>auto attribute(UnsignedInt layer, UnsignedInt id) const -> T
- Value of an attribute in given material layer.
-
template<class T>auto mutableAttribute(UnsignedInt layer, UnsignedInt id) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of an attribute in given material layer.
-
template<class T>auto attribute(UnsignedInt layer, Containers::
StringView name) const -> T - Value of a named attribute in given material layer.
-
template<class T>auto attribute(UnsignedInt layer, MaterialAttribute name) const -> T
-
template<class T>auto mutableAttribute(UnsignedInt layer, Containers::
StringView name) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of a named attribute in given material layer.
-
template<class T>auto mutableAttribute(UnsignedInt layer, MaterialAttribute name) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
template<class T>auto attribute(Containers::
StringView layer, UnsignedInt id) const -> T - Value of an attribute in a named material layer.
-
template<class T>auto attribute(MaterialLayer layer, UnsignedInt id) const -> T
-
template<class T>auto mutableAttribute(Containers::
StringView layer, UnsignedInt id) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of an attribute in a named material layer.
-
template<class T>auto mutableAttribute(MaterialLayer layer, UnsignedInt id) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
template<class T>auto attribute(Containers::
StringView layer, Containers:: StringView name) const -> T - Value of a named attribute in a named material layer.
-
template<class T>auto attribute(Containers::
StringView layer, MaterialAttribute name) const -> T -
template<class T>auto attribute(MaterialLayer layer, Containers::
StringView name) const -> T -
template<class T>auto attribute(MaterialLayer layer, MaterialAttribute name) const -> T
-
template<class T>auto mutableAttribute(Containers::
StringView layer, Containers:: StringView name) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of a named attribute in a named material layer.
-
template<class T>auto mutableAttribute(Containers::
StringView layer, MaterialAttribute name) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
template<class T>auto mutableAttribute(MaterialLayer layer, Containers::
StringView name) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
template<class T>auto mutableAttribute(MaterialLayer layer, MaterialAttribute name) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
template<class T>auto attribute(UnsignedInt id) const -> T
- Value of an attribute in the base material.
-
template<class T>auto mutableAttribute(UnsignedInt id) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of an attribute in the base material.
-
template<class T>auto attribute(Containers::
StringView name) const -> T - Value of a named attribute in the base material.
-
template<class T>auto attribute(MaterialAttribute name) const -> T
-
template<class T>auto mutableAttribute(Containers::
StringView name) -> std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type - Mutable value of a named attribute in the base material.
-
template<class T>auto mutableAttribute(MaterialAttribute name) -> std::
conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type -
auto findAttribute(UnsignedInt layer,
Containers::
StringView name) const -> const void* - Type-erased attribute value in given material layer, if exists.
- auto findAttribute(UnsignedInt layer, MaterialAttribute name) const -> const void*
-
auto tryAttribute(UnsignedInt layer,
Containers::
StringView name) const -> const void* deprecated in Git master - Type-erased attribute value in given material layer, if exists.
- auto tryAttribute(UnsignedInt layer, MaterialAttribute name) const -> const void* deprecated in Git master
-
auto findAttribute(Containers::
StringView layer, Containers:: StringView name) const -> const void* - Type-erased attribute value in a named material layer, if exists.
-
auto findAttribute(Containers::
StringView layer, MaterialAttribute name) const -> const void* -
auto findAttribute(MaterialLayer layer,
Containers::
StringView name) const -> const void* - auto findAttribute(MaterialLayer layer, MaterialAttribute name) const -> const void*
-
auto tryAttribute(Containers::
StringView layer, Containers:: StringView name) const -> const void* deprecated in Git master - Type-erased attribute value in a named material layer, if exists.
-
auto tryAttribute(Containers::
StringView layer, MaterialAttribute name) const -> const void* deprecated in Git master -
auto tryAttribute(MaterialLayer layer,
Containers::
StringView name) const -> const void* deprecated in Git master - auto tryAttribute(MaterialLayer layer, MaterialAttribute name) const -> const void* deprecated in Git master
-
template<class T>auto findAttribute(UnsignedInt layer, Containers::
StringView name) const -> Containers:: Optional<T> - Value of a named attribute in given material layer, if exists.
-
template<class T>auto findAttribute(UnsignedInt layer, MaterialAttribute name) const -> Containers::
Optional<T> -
template<class T>auto tryAttribute(UnsignedInt layer, Containers::
StringView name) const -> Containers:: Optional<T> deprecated in Git master - Type-erased attribute value in given material layer, if exists.
-
template<class T>auto tryAttribute(UnsignedInt layer, MaterialAttribute name) const -> Containers::
Optional<T> deprecated in Git master -
template<class T>auto findAttribute(Containers::
StringView layer, Containers:: StringView name) const -> Containers:: Optional<T> - Value of a named attribute in a named material layer, if exists.
-
template<class T>auto findAttribute(Containers::
StringView layer, MaterialAttribute name) const -> Containers:: Optional<T> -
template<class T>auto findAttribute(MaterialLayer layer, Containers::
StringView name) const -> Containers:: Optional<T> -
template<class T>auto findAttribute(MaterialLayer layer, MaterialAttribute name) const -> Containers::
Optional<T> -
template<class T>auto tryAttribute(Containers::
StringView layer, Containers:: StringView name) const -> Containers:: Optional<T> deprecated in Git master - Type-erased attribute value in a named material layer, if exists.
-
template<class T>auto tryAttribute(Containers::
StringView layer, MaterialAttribute name) const -> Containers:: Optional<T> deprecated in Git master -
template<class T>auto tryAttribute(MaterialLayer layer, Containers::
StringView name) const -> Containers:: Optional<T> deprecated in Git master - Type-erased attribute value in given material layer, if exists.
-
template<class T>auto tryAttribute(MaterialLayer layer, MaterialAttribute name) const -> Containers::
Optional<T> deprecated in Git master -
auto findAttribute(Containers::
StringView name) const -> const void* - Type-erased attribute value in the base material, if exists.
- auto findAttribute(MaterialAttribute name) const -> const void*
-
auto tryAttribute(Containers::
StringView name) const -> const void* deprecated in Git master - Type-erased attribute value in the base material, if exists.
- auto tryAttribute(MaterialAttribute name) const -> const void* deprecated in Git master
-
template<class T>auto findAttribute(Containers::
StringView name) const -> Containers:: Optional<T> - Value of a named attribute in the base material, if exists.
-
template<class T>auto findAttribute(MaterialAttribute name) const -> Containers::
Optional<T> -
template<class T>auto tryAttribute(Containers::
StringView name) const -> Containers:: Optional<T> deprecated in Git master - Type-erased attribute value in the base material, if exists.
-
template<class T>auto tryAttribute(MaterialAttribute name) const -> Containers::
Optional<T> deprecated in Git master -
template<class T>auto attributeOr(UnsignedInt layer, Containers::
StringView name, const T& defaultValue) const -> T - Value of a named attribute in given layer or a default.
-
template<class T>auto attributeOr(UnsignedInt layer, MaterialAttribute name, const T& defaultValue) const -> T
-
template<class T>auto attributeOr(Containers::
StringView layer, Containers:: StringView name, const T& defaultValue) const -> T - Value of a named attribute in a named layer or a default.
-
template<class T>auto attributeOr(Containers::
StringView layer, MaterialAttribute name, const T& defaultValue) const -> T -
template<class T>auto attributeOr(MaterialLayer layer, Containers::
StringView name, const T& defaultValue) const -> T -
template<class T>auto attributeOr(MaterialLayer layer, MaterialAttribute name, const T& defaultValue) const -> T
-
template<class T>auto attributeOr(Containers::
StringView name, const T& defaultValue) const -> T - Value of a named attribute in the base material or a default.
-
template<class T>auto attributeOr(MaterialAttribute name, const T& defaultValue) const -> T
- auto isDoubleSided() const -> bool
- Whether a material is double-sided.
- auto flags() const -> Flags deprecated in Git master
- Material flags.
- auto alphaMode() const -> MaterialAlphaMode
- Alpha mode.
- auto alphaMask() const -> Float
- Alpha mask.
-
auto releaseLayerData() -> Containers::
Array<UnsignedInt> - Release layer data storage.
-
auto releaseAttributeData() -> Containers::
Array<MaterialAttributeData> - Release attribute data storage.
- auto importerState() const -> const void*
- Importer-specific state.
Enum documentation
enum class Magnum:: Trade:: MaterialData:: Flag: UnsignedInt
Material flag.
This enum is further extended in subclasses.
Enumerators | |
---|---|
DoubleSided |
The material is double-sided. Back faces should not be culled away but rendered as well, with normals flipped for correct lighting. |
Typedef documentation
typedef Containers:: EnumSet<Flag> Magnum:: Trade:: MaterialData:: Flags
Material flags.
This enum is extended in subclasses.
Function documentation
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
Containers:: Array<MaterialAttributeData>&& attributeData,
const void* importerState = nullptr) explicit noexcept
Construct.
Parameters | |
---|---|
types | Which material types are described by this data. Can be an empty set. |
attributeData | Attribute data |
importerState | Importer-specific state |
The attributeData
gets sorted by name internally, expecting no duplicates.
The attributeDataFlags() / layerDataFlags() are implicitly set to a combination of DataFlag::
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
std:: initializer_list<MaterialAttributeData> attributeData,
const void* importerState = nullptr) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
DataFlags attributeDataFlags,
Containers:: ArrayView<const MaterialAttributeData> attributeData,
const void* importerState = nullptr) explicit noexcept
Construct a non-owned material data.
Parameters | |
---|---|
types | Which material types are described by this data. Can be an empty set. |
attributeDataFlags | Attribute data flags |
attributeData | Attribute data |
importerState | Importer-specific state |
Compared to MaterialData(MaterialTypes, Containers::attributeData
is expected to be already sorted by name, without duplicates. The attributeDataFlags
can contain DataFlag::
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
Containers:: Array<MaterialAttributeData>&& attributeData,
Containers:: Array<UnsignedInt>&& layerData,
const void* importerState = nullptr) explicit noexcept
Construct with layers.
Parameters | |
---|---|
types | Which material types are described by this data. Can be an empty set. |
attributeData | Attribute data |
layerData | Layer offset data |
importerState | Importer-specific state |
The attributeData
gets sorted by name internally, expecting no duplicates inside each layer. The layerData
is expected to be either empty or a monotonically non-decreasing sequence of offsets counting up to attributeData
size, with i-th item specifying end offset of i-th layer.
The attributeDataFlags() / layerDataFlags() are implicitly set to a combination of DataFlag::
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
std:: initializer_list<MaterialAttributeData> attributeData,
std:: initializer_list<UnsignedInt> layerData,
const void* importerState = nullptr) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Trade:: MaterialData:: MaterialData(MaterialTypes types,
DataFlags attributeDataFlags,
Containers:: ArrayView<const MaterialAttributeData> attributeData,
DataFlags layerDataFlags,
Containers:: ArrayView<const UnsignedInt> layerData,
const void* importerState = nullptr) explicit noexcept
Construct a non-owned material data with layers.
Parameters | |
---|---|
types | Which material types are described by this data. Can be an empty set. |
attributeDataFlags | Attribute data flags |
attributeData | Attribute data |
layerDataFlags | Layer offset data flags |
layerData | Layer offset data |
importerState | Importer-specific state |
The data
is expected to be already sorted by name, without duplicates inside each layer. The layerData
is expected to be either empty or a monotonically non-decreasing sequence of offsets counting up to attributeData
size, with i-th item specifying end offset of i-th layer.
The attributeDataFlags
/ layerDataFlags
parameters can contain DataFlag::
DataFlags Magnum:: Trade:: MaterialData:: attributeDataFlags() const
Attribute data flags ¨ Since the attribute list is always assumed to be sorted and partitioned into layers, only attribute values can be edited when the DataFlag::
DataFlags Magnum:: Trade:: MaterialData:: layerDataFlags() const
Layer data flags.
Since the attribute list is always assumed to be sorted and partitioned into layers, the DataFlag::
MaterialTypes Magnum:: Trade:: MaterialData:: types() const
Material types.
Each type indicates that the material data can be interpreted as given type. For custom materials the set can also be empty.
template<class T>
const T& Magnum:: Trade:: MaterialData:: as() const &
Interpret as a material data of concrete type.
Returns a reference to *this
cast to given type. T
is expected to be a subclass of the same size such as PhongMaterialData or PbrMetallicRoughnessMaterialData, as well as layers like PbrClearCoatMaterialData.
template<class T>
T Magnum:: Trade:: MaterialData:: as() &&
Interpret a rvalue as a material data of concrete type.
Compared to the above, returns a value and not a reference. The original instance then behaves the same as a moved-from instance.
MaterialType Magnum:: Trade:: MaterialData:: type() const
Material type.
Containers:: ArrayView<const UnsignedInt> Magnum:: Trade:: MaterialData:: layerData() const
Raw layer offset data.
May return nullptr
if the material doesn't have any extra layers.
Containers:: ArrayView<const MaterialAttributeData> Magnum:: Trade:: MaterialData:: attributeData() const
Raw attribute data.
Returns nullptr
if the material has no attributes.
UnsignedInt Magnum:: Trade:: MaterialData:: layerCount() const
Layer count.
There's always at least the base material, so this function returns at least 1
.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeDataOffset(UnsignedInt layer) const
Offset of a layer inside attribute data.
Returns the offset where attributes for layer
start in the array returned by attributeData() const. The layer
is expected to be less or equal to layerCount(), i.e. it's always possible to call this function with layer
and layer + 1
to get the attribute range for given layer, or with layerCount() to get the total attribute count in all layers.
bool Magnum:: Trade:: MaterialData:: hasLayer(Containers:: StringView layer) const
Whether a material has given named layer.
Layers with no name assigned are skipped. The base material (layer 0
is skipped as well) to avoid confusing base material with a layer. If you want to create a material consisting of just a layer, use 0
for the first layer offset in the constructor.
bool Magnum:: Trade:: MaterialData:: hasLayer(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findLayerId(Containers:: StringView layer) const
Find ID of a named layer.
The layer
doesn't exist, returns Containers::
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findLayerId(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: layerId(Containers:: StringView layer) const
ID of a named layer.
Like findLayerId(), but the layer
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: layerId(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: StringView Magnum:: Trade:: MaterialData:: layerName(UnsignedInt layer) const
Layer name.
Retrieves a MaterialAttribute::nullptr
view if the layer has no name, and an empty non-null view if the layer name is empty. The layer
is expected to be smaller than layerCount() const.
The name, if present, is ignored for the base material (layer 0
) to avoid confsing base material with a layer. If you want to create a material consisting of just a layer, use 0
for the first layer offset in the constructor.
Float Magnum:: Trade:: MaterialData:: layerFactor(UnsignedInt layer) const
Factor of given layer.
Convenience access to the MaterialAttribute::1.0f
. The layer
is expected to be smaller than layerCount() const.
If the layer has MaterialAttribute::
Float Magnum:: Trade:: MaterialData:: layerFactor(Containers:: StringView layer) const
Factor of a named layer.
Convenience access to the MaterialAttribute::1.0f
. The layer
is expected to exist.
If the layer has MaterialAttribute::
Float Magnum:: Trade:: MaterialData:: layerFactor(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTexture(UnsignedInt layer) const
Factor texture ID for given layer.
Available only if the MaterialAttribute::layer
is expected to be smaller than layerCount().
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTexture(Containers:: StringView layer) const
Factor texture ID for a named layer.
Available only if the MaterialAttribute::layer
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTexture(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialTextureSwizzle Magnum:: Trade:: MaterialData:: layerFactorTextureSwizzle(UnsignedInt layer) const
Factor texture swizzle for given layer.
Convenience access to the MaterialAttribute::layer
is expected to be smaller than layerCount().
MaterialTextureSwizzle Magnum:: Trade:: MaterialData:: layerFactorTextureSwizzle(Containers:: StringView layer) const
Factor texture swizzle for a named layer.
Convenience access to the MaterialAttribute::layer
is expected to exist.
MaterialTextureSwizzle Magnum:: Trade:: MaterialData:: layerFactorTextureSwizzle(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Matrix3 Magnum:: Trade:: MaterialData:: layerFactorTextureMatrix(UnsignedInt layer) const
Factor texture coordinate transformation matrix for given layer.
Convenience access to the MaterialAttribute::layer
is expected to be smaller than layerCount().
Matrix3 Magnum:: Trade:: MaterialData:: layerFactorTextureMatrix(Containers:: StringView layer) const
Factor texture coordinate transformation matrix for a named layer.
Convenience access to the MaterialAttribute::layer
is expected to exist.
Matrix3 Magnum:: Trade:: MaterialData:: layerFactorTextureMatrix(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureCoordinates(UnsignedInt layer) const
Factor texture coordinate set for given layer.
Convenience access to the MaterialAttribute::0
. Available only if the MaterialAttribute::layer
is expected to be smaller than layerCount().
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureCoordinates(Containers:: StringView layer) const
Factor texture coordinate set for a named layer.
Convenience access to the MaterialAttribute::0
. Available only if the MaterialAttribute::layer
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureCoordinates(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureLayer(UnsignedInt layer) const
Factor array texture layer for given layer.
Convenience access to the MaterialAttribute::0
. Available only if the MaterialAttribute::layer
is expected to be smaller than layerCount().
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureLayer(Containers:: StringView layer) const
Factor array texture layer for a named layer.
Convenience access to the MaterialAttribute::0
. Available only if the MaterialAttribute::layer
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: layerFactorTextureLayer(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeCount(UnsignedInt layer) const
Attribute count in given layer.
The layer
is expected to be smaller than layerCount() const.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeCount(Containers:: StringView layer) const
Attribute count in a named layer.
The layer
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeCount(MaterialLayer layer) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeCount() const
Attribute count in the base material.
Equivalent to calling attributeCount(UnsignedInt) const with layer
set to 0
.
bool Magnum:: Trade:: MaterialData:: hasAttribute(UnsignedInt layer,
Containers:: StringView name) const
Whether a material layer has given attribute.
The layer
is expected to be smaller than layerCount() const.
bool Magnum:: Trade:: MaterialData:: hasAttribute(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Trade:: MaterialData:: hasAttribute(Containers:: StringView layer,
Containers:: StringView name) const
Whether a named material layer has given attribute.
The layer
is expected to exist.
bool Magnum:: Trade:: MaterialData:: hasAttribute(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Trade:: MaterialData:: hasAttribute(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Trade:: MaterialData:: hasAttribute(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Trade:: MaterialData:: hasAttribute(Containers:: StringView name) const
Whether the base material has given attribute.
Equivalent to calling hasAttribute(UnsignedInt, Containers::layer
set to 0
.
bool Magnum:: Trade:: MaterialData:: hasAttribute(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(UnsignedInt layer,
Containers:: StringView name) const
Find ID of a named attribute in given material layer.
If name
doesn't exist, returns Containers::layer
is expected to be smaller than layerCount() const. The lookup is done in an complexity with being attribute count in given layer
.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(Containers:: StringView layer,
Containers:: StringView name) const
Find ID of a named attribute in a named material layer.
If name
doesn't exist, returns Containers::layer
is expected to exist. The lookup is done in an complexity with being layer count and being attribute count in given layer
.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(Containers:: StringView name) const
Find ID of a named attribute in the base material.
Equivalent to calling findAttributeId(UnsignedInt, Containers::layer
set to 0
.
Containers:: Optional<UnsignedInt> Magnum:: Trade:: MaterialData:: findAttributeId(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(UnsignedInt layer,
Containers:: StringView name) const
ID of a named attribute in given material layer.
Like findAttributeId(UnsignedInt, Containers::name
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(Containers:: StringView layer,
Containers:: StringView name) const
ID of a named attribute in a named material layer.
Like findAttributeId(Containers::name
is expected to exist.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(Containers:: StringView name) const
ID of a named attribute in the base material.
Equivalent to calling attributeId(UnsignedInt, Containers::layer
set to 0
.
UnsignedInt Magnum:: Trade:: MaterialData:: attributeId(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const MaterialAttributeData& Magnum:: Trade:: MaterialData:: attributeData(UnsignedInt layer,
UnsignedInt id) const
Raw attribute data.
The layer
is expected to be smaller than layerCount() const, id
is expected to be smaller than attributeCount(UnsignedInt) const.
const MaterialAttributeData& Magnum:: Trade:: MaterialData:: attributeData(UnsignedInt id) const
Raw attribute data in the base material.
The
expected to be smaller than attributeCount() const.id
is
Containers:: StringView Magnum:: Trade:: MaterialData:: attributeName(UnsignedInt layer,
UnsignedInt id) const
Name of an attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and the id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer. The returned view always has Containers::
Containers:: StringView Magnum:: Trade:: MaterialData:: attributeName(Containers:: StringView layer,
UnsignedInt id) const
Name of an attribute in a named material layer.
The layer
is expected to exist and the id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer.
Containers:: StringView Magnum:: Trade:: MaterialData:: attributeName(MaterialLayer layer,
UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Containers:: StringView Magnum:: Trade:: MaterialData:: attributeName(UnsignedInt id) const
Name of an attribute in the base material.
Equivalent to calling attributeName(UnsignedInt, UnsignedInt) const with layer
set to 0
.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(UnsignedInt layer,
UnsignedInt id) const
Type of an attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(UnsignedInt layer,
Containers:: StringView name) const
Type of a named attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and name
is expected to exist in that layer.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(Containers:: StringView layer,
UnsignedInt id) const
Type of an attribute in a named material layer.
The layer
is expected to exist and the id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(MaterialLayer layer,
UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(Containers:: StringView layer,
Containers:: StringView name) const
Type of a named attribute in a named material layer.
The layer
is expected to exist and name
is expected to exist in that layer.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(UnsignedInt id) const
Type of an attribute in the base material.
Equivalent to calling attributeType(UnsignedInt, UnsignedInt) const with layer
set to 0
.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(Containers:: StringView name) const
Type of a named attribute in the base material.
Equivalent to calling attributeType(UnsignedInt, Containers::layer
set to 0
.
MaterialAttributeType Magnum:: Trade:: MaterialData:: attributeType(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
UnsignedInt id) const
Type-erased value of an attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer. Cast the pointer to a concrete type based on type().
- In case of a MaterialAttributeType::
Pointer or a MaterialAttributeType:: MutablePointer, returns a pointer to a pointer, not the pointer value itself. - In case of a MaterialAttributeType::
String returns a null-terminated const char*
(not a pointer to Containers::StringView). This doesn't preserve the actual string size in case the string data contain zero bytes, thus prefer to use typed access in that case. - In case of a MaterialAttributeType::
Buffer returns a pointer to the data with no size information, Prefer to use typed access in that case.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
UnsignedInt id)
Type-erased mutable value of an attribute in given material layer.
Like attribute(UnsignedInt, UnsignedInt) const but returns a mutable pointer. Expects that the material is mutable.
const void* Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
Containers:: StringView name) const
Type-erased value of a named attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and name
is expected to exist in that layer. Cast the pointer to a concrete type based on attributeType().
- In case of a MaterialAttributeType::
Pointer or a MaterialAttributeType:: MutablePointer, returns a pointer to a pointer, not the pointer value itself. - In case of a MaterialAttributeType::
String returns a null-terminated const char*
(not a pointer to Containers::StringView). This doesn't preserve the actual string size in case the string data contain zero bytes, thus prefer to use typed access in that case. - In case of a MaterialAttributeType::
Buffer returns a pointer to the data with no size information, Prefer to use typed access in that case.
const void* Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
Containers:: StringView name)
Type-erased value of a named attribute in given material layer.
Like attribute(UnsignedInt, Containers::
void* Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
UnsignedInt id) const
Type-erased value of an attribute in a named material layer.
The layer
is expected to exist and the id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer. Cast the pointer to a concrete type based on attributeType().
- In case of a MaterialAttributeType::
Pointer or a MaterialAttributeType:: MutablePointer, returns a pointer to a pointer, not the pointer value itself. - In case of a MaterialAttributeType::
String returns a null-terminated const char*
(not a pointer to Containers::StringView). This doesn't preserve the actual string size in case the string data contain zero bytes, thus prefer to use typed access in that case. - In case of a MaterialAttributeType::
Buffer returns a pointer to the data with no size information, Prefer to use typed access in that case.
const void* Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
UnsignedInt id)
Type-erased mutable value of an attribute in a named material layer.
Like attribute(Containers::
void* Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
UnsignedInt id)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
Containers:: StringView name) const
Type-erased value of a named attribute in a named material layer.
The layer
is expected to exist and name
is expected to exist in that layer. Cast the pointer to a concrete type based on attributeType().
- In case of a MaterialAttributeType::
Pointer or a MaterialAttributeType:: MutablePointer, returns a pointer to a pointer, not the pointer value itself. - In case of a MaterialAttributeType::
String returns a null-terminated const char*
(not a pointer to Containers::StringView). This doesn't preserve the actual string size in case the string data contain zero bytes, thus prefer to use typed access in that case. - In case of a MaterialAttributeType::
Buffer returns a pointer to the data with no size information, Prefer to use typed access in that case.
const void* Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
Containers:: StringView name)
Type-erased mutable value of a named attribute in a named material layer.
Like attribute(Containers::
void* Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
Containers:: StringView name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: attribute(UnsignedInt id) const
Type-erased value of an attribute in the base material.
Equivalent to calling attribute(UnsignedInt, UnsignedInt) const with layer
set to 0
.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt id)
Type-erased mutable value of an attribute in the base material.
Like attribute(UnsignedInt) const but returns a mutable pointer. Expects that the material is mutable.
const void* Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView name) const
Type-erased value of a named attribute in the base material.
Equivalent to calling attribute(UnsignedInt, Containers::layer
set to 0
.
const void* Magnum:: Trade:: MaterialData:: attribute(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void* Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView name)
Type-erased mutable value of a named attribute in the base material.
Like attribute(Containers::
void* Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
UnsignedInt id) const
Value of an attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer. Expects that T
corresponds to attributeType(UnsignedInt, UnsignedInt) const for given layer
and id
. In case of a string, the returned view always has Containers::
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
UnsignedInt id)
Mutable value of an attribute in given material layer.
Like attribute(UnsignedInt, UnsignedInt) const but returns a mutable reference. Expects that the material is mutable. In case of a string / buffer, you're expected to use Containers::T
and you get a Containers::
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
Containers:: StringView name) const
Value of a named attribute in given material layer.
The layer
is expected to be smaller than layerCount() const and name
is expected to exist in that layer. Expects that T
corresponds to attributeType(UnsignedInt, Containers::layer
and name
. In case of a string, the returned view always has Containers::
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
Containers:: StringView name)
Mutable value of a named attribute in given material layer.
Like attribute(UnsignedInt, Containers::T
and you get a Containers::
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
UnsignedInt id) const
Value of an attribute in a named material layer.
The layer
is expected to exist and id
is expected to be smaller than attributeCount(UnsignedInt) const in that layer. Expects that T
corresponds to attributeType(Containers::layer
and id
. In case of a string, the returned view always has Containers::
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
UnsignedInt id) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
UnsignedInt id)
Mutable value of an attribute in a named material layer.
Like attribute(Containers::T
and you get a Containers::
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
UnsignedInt id)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
Containers:: StringView name) const
Value of a named attribute in a named material layer.
The layer
is expected to exist and name
is expected to exist in that layer. Expects that T
corresponds to attributeType(Containers::layer
and name
. In case of a string, the returned view always has Containers::
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
Containers:: StringView name)
Mutable value of a named attribute in a named material layer.
Like attribute(Containers::T
and you get a Containers::
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
Containers:: StringView name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialLayer layer,
MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(UnsignedInt id) const
Value of an attribute in the base material.
Equivalent to calling attribute(UnsignedInt, UnsignedInt) const with layer
set to 0
.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(UnsignedInt id)
Mutable value of an attribute in the base material.
Equivalent to calling mutableAttribute(UnsignedInt, UnsignedInt) with layer
set to 0
.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(Containers:: StringView name) const
Value of a named attribute in the base material.
Equivalent to calling attribute(UnsignedInt, Containers::layer
set to 0
.
template<class T>
T Magnum:: Trade:: MaterialData:: attribute(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(Containers:: StringView name)
Mutable value of a named attribute in the base material.
Equivalent to calling mutableAttribute(UnsignedInt, Containers::layer
set to 0
.
template<class T>
std:: conditional<std:: is_same<T, Containers:: MutableStringView>::value||std:: is_same<T, Containers:: ArrayView<void>>::value, T, T&>::type Magnum:: Trade:: MaterialData:: mutableAttribute(MaterialAttribute name)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: findAttribute(UnsignedInt layer,
Containers:: StringView name) const
Type-erased attribute value in given material layer, if exists.
Compared to attribute(UnsignedInt, Containers::name
doesn't exist, returns nullptr
instead of asserting. Expects that layer
is smaller than layerCount() const. Cast the pointer to a concrete type based on attributeType().
const void* Magnum:: Trade:: MaterialData:: findAttribute(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(UnsignedInt layer,
Containers:: StringView name) const
Type-erased attribute value in given material layer, if exists.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(UnsignedInt layer,
MaterialAttribute name) const
const void* Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView layer,
Containers:: StringView name) const
Type-erased attribute value in a named material layer, if exists.
Compared to attribute(Containers::name
doesn't exist, returns nullptr
instead of asserting. Expects that layer
exists. Cast the pointer to a concrete type based on attributeType().
const void* Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: findAttribute(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: findAttribute(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView layer,
Containers:: StringView name) const
Type-erased attribute value in a named material layer, if exists.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView layer,
MaterialAttribute name) const
const void* Magnum:: Trade:: MaterialData:: tryAttribute(MaterialLayer layer,
Containers:: StringView name) const
const void* Magnum:: Trade:: MaterialData:: tryAttribute(MaterialLayer layer,
MaterialAttribute name) const
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(UnsignedInt layer,
Containers:: StringView name) const
Value of a named attribute in given material layer, if exists.
Compared to attribute(UnsignedInt, Containers::name
doesn't exist, returns Containers::layer
is smaller than layerCount() const and that T
corresponds to attributeType(UnsignedInt, Containers::layer
and name
.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(UnsignedInt layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(UnsignedInt layer,
Containers:: StringView name) const
Type-erased attribute value in given material layer, if exists.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(UnsignedInt layer,
MaterialAttribute name) const
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView layer,
Containers:: StringView name) const
Value of a named attribute in a named material layer, if exists.
Compared to attribute(Containers::name
doesn't exist, returns Containers::layer
exists and that T
corresponds to attributeType(Containers::layer
and name
.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(MaterialLayer layer,
Containers:: StringView name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(MaterialLayer layer,
MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView layer,
Containers:: StringView name) const
Type-erased attribute value in a named material layer, if exists.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView layer,
MaterialAttribute name) const
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(MaterialLayer layer,
Containers:: StringView name) const
Type-erased attribute value in given material layer, if exists.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(MaterialLayer layer,
MaterialAttribute name) const
const void* Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView name) const
Type-erased attribute value in the base material, if exists.
Equivalent to calling findAttribute(UnsignedInt, Containers::layer
set to 0
.
const void* Magnum:: Trade:: MaterialData:: findAttribute(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView name) const
Type-erased attribute value in the base material, if exists.
const void* Magnum:: Trade:: MaterialData:: tryAttribute(MaterialAttribute name) const
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(Containers:: StringView name) const
Value of a named attribute in the base material, if exists.
Equivalent to calling findAttribute(UnsignedInt, Containers::layer
set to 0
.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: findAttribute(MaterialAttribute name) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(Containers:: StringView name) const
Type-erased attribute value in the base material, if exists.
template<class T>
Containers:: Optional<T> Magnum:: Trade:: MaterialData:: tryAttribute(MaterialAttribute name) const
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(UnsignedInt layer,
Containers:: StringView name,
const T& defaultValue) const
Value of a named attribute in given layer or a default.
Compared to attribute(UnsignedInt, Containers::name
doesn't exist, returns defaultValue
instead of asserting. Expects that layer
is smaller than layerCount() const and that T
corresponds to attributeType(UnsignedInt, Containers::layer
and name
.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(UnsignedInt layer,
MaterialAttribute name,
const T& defaultValue) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(Containers:: StringView layer,
Containers:: StringView name,
const T& defaultValue) const
Value of a named attribute in a named layer or a default.
Compared to attribute(Containers::name
doesn't exist, returns defaultValue
instead of asserting. Expects that layer
exists and that T
corresponds to attributeType(Containers::layer
and name
.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(Containers:: StringView layer,
MaterialAttribute name,
const T& defaultValue) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(MaterialLayer layer,
Containers:: StringView name,
const T& defaultValue) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(MaterialLayer layer,
MaterialAttribute name,
const T& defaultValue) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(Containers:: StringView name,
const T& defaultValue) const
Value of a named attribute in the base material or a default.
Equivalent to calling attributeOr(UnsignedInt, Containers::layer
set to 0
.
template<class T>
T Magnum:: Trade:: MaterialData:: attributeOr(MaterialAttribute name,
const T& defaultValue) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Trade:: MaterialData:: isDoubleSided() const
Whether a material is double-sided.
Convenience access to the MaterialAttribute::false
.
MaterialAlphaMode Magnum:: Trade:: MaterialData:: alphaMode() const
Alpha mode.
Convenience access to MaterialAttribute::
Float Magnum:: Trade:: MaterialData:: alphaMask() const
Alpha mask.
Convenience access to the MaterialAttribute::0.5f
.
Containers:: Array<UnsignedInt> Magnum:: Trade:: MaterialData:: releaseLayerData()
Release layer data storage.
Releases the ownership of the layer offset array and resets internal layer-related state to default. The material then behaves like if it has no layers. Note that the returned array has a custom no-op deleter when the data are not owned by the material, and while the returned array type is mutable, the actual memory might be not.
Containers:: Array<MaterialAttributeData> Magnum:: Trade:: MaterialData:: releaseAttributeData()
Release attribute data storage.
Releases the ownership of the attribute array and resets internal attribute-related state to default. The material then behaves like if it has no attributes. Note that the returned array has a custom no-op deleter when the data are not owned by the material, and while the returned array type is mutable, the actual memory might be not.
const void* Magnum:: Trade:: MaterialData:: importerState() const
Importer-specific state.
See AbstractImporter::
Debug& operator<<(Debug& debug,
MaterialData:: Flag value)
Debug output operator.
Debug& operator<<(Debug& debug,
MaterialData:: Flags value)
Debug output operator.