Magnum::MaterialTools namespace new in Git master

Material tools.

Tools for converting materials.

This library is built if MAGNUM_WITH_MATERIALTOOLS is enabled when building Magnum. To use this library with CMake, request the MaterialTools component of the Magnum package and link to the Magnum::MaterialTools target:

find_package(Magnum REQUIRED MaterialTools)

# ...
target_link_libraries(your-app PRIVATE Magnum::MaterialTools)

See Downloading and building and Usage with CMake for more information.

Enums

enum class PhongToPbrMetallicRoughnessFlag { KeepOriginalAttributes = 1 << 0, DropUnconvertableAttributes = 1 << 1, FailOnUnconvertableAttributes = (1 << 2)|DropUnconvertableAttributes } new in Git master
Phong to PBR metallic/roughness conversion flag.

Typedefs

using PhongToPbrMetallicRoughnessFlags = Containers::EnumSet<PhongToPbrMetallicRoughnessFlag> new in Git master
Phong to PBR conversion flags.

Functions

auto phongToPbrMetallicRoughness(const Trade::MaterialData& material, PhongToPbrMetallicRoughnessFlags flags = {}) -> Containers::Optional<Trade::MaterialData> new in Git master
Convert a Phong material to PBR metallic/roughness.

Enum documentation

enum class Magnum::MaterialTools::PhongToPbrMetallicRoughnessFlag new in Git master

Phong to PBR metallic/roughness conversion flag.

Enumerators
KeepOriginalAttributes

Keep original attributes instead of removing all that were converted.

DropUnconvertableAttributes

Drop attributes that can't be converted instead of keeping them in the output. If FailOnUnconvertableAttributes is specified as well, it has a priority.

FailOnUnconvertableAttributes

Fail if any attributes can't be converted instead of keeping them in the output. Has a priority over DropUnconvertableAttributes.

Typedef documentation

Function documentation

Containers::Optional<Trade::MaterialData> Magnum::MaterialTools::phongToPbrMetallicRoughness(const Trade::MaterialData& material, PhongToPbrMetallicRoughnessFlags flags = {}) new in Git master

Convert a Phong material to PBR metallic/roughness.

Performs conversion of the following attributes. If the target attribute is already present, it's passed through unchanged. The original attribute is removed, unless PhongToPbrMetallicRoughnessFlag::KeepOriginalAttributes is set.

The following attributes currently aren't converted. If they are present in the input material, a message is printed to Warning. The attributes are passed through unchanged unless PhongToPbrMetallicRoughnessFlag::DropUnconvertableAttributes is set; if FailOnUnconvertableAttributes is set instead, a message is printed to Error and the function returns Containers::NullOpt.

All other attributes (including ones common for Phong and PBR such as Trade::MaterialAttribute::NormalTexture) are passed through unchanged. The resulting material has Trade::MaterialType::PbrMetallicRoughness set and Trade::MaterialType::Phong removed.