From 303a571a70a98121a8e2bce85d5390d2273d4fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 4 Nov 2022 12:09:14 +0100 Subject: [PATCH] sceneconverter: reduce unnecessary code duplication. --- .../Implementation/sceneConverterUtilities.h | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h index 330c23b11..ac6324b02 100644 --- a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h +++ b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h @@ -854,6 +854,10 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility #define _c(type) case Trade::MaterialAttributeType::type: \ d << Debug::packed << info.data.attribute(i, j); \ break; + #define _ct(name, type) case Trade::MaterialAttributeType::name: \ + d << Debug::packed << info.data.attribute(i, j); \ + break; + _ct(Bool, bool) /* LCOV_EXCL_START */ _c(Float) _c(Deg) @@ -880,10 +884,12 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility _c(Matrix4x2) _c(Matrix4x3) /* LCOV_EXCL_STOP */ + _ct(Pointer, const void*) + _ct(MutablePointer, void*) + _ct(String, Containers::StringView) + _ct(TextureSwizzle, Trade::MaterialTextureSwizzle) #undef _c - case Trade::MaterialAttributeType::Bool: - d << info.data.attribute(i, j); - break; + #undef _ct case Trade::MaterialAttributeType::Vector3: /** @todo hasSuffix() might be more robust against false positives, but KHR_materials_specular in glTF @@ -900,21 +906,9 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility d << Debug::color << Math::pack(info.data.attribute(i, j).rgb()); d << Debug::packed << info.data.attribute(i, j); break; - case Trade::MaterialAttributeType::Pointer: - d << info.data.attribute(i, j); - break; - case Trade::MaterialAttributeType::MutablePointer: - d << info.data.attribute(i, j); - break; - case Trade::MaterialAttributeType::String: - d << info.data.attribute(i, j); - break; case Trade::MaterialAttributeType::Buffer: d << info.data.attribute>(i, j).size() << "bytes"; break; - case Trade::MaterialAttributeType::TextureSwizzle: - d << Debug::packed << info.data.attribute(i, j); - break; } } }