From 0607c476f7c36b5fbef27fcaa76745ea308bac48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 20 Jun 2023 21:06:40 +0200 Subject: [PATCH] sceneconverter: show morph target ID in --info output, if present. --- .../SceneTools/Implementation/sceneConverterUtilities.h | 5 +++++ .../SceneTools/Test/SceneConverterImplementationTest.cpp | 8 ++++++-- .../SceneConverterImplementationTestFiles/info-meshes.txt | 7 ++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h index 1c42c5893..2f56590c1 100644 --- a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h +++ b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h @@ -122,6 +122,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility std::size_t offset; Int stride; UnsignedInt arraySize; + Int morphTargetId; Trade::MeshAttribute name; Containers::String customName; VertexFormat format; @@ -541,6 +542,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility mesh->attributeOffset(k), mesh->attributeStride(k), mesh->attributeArraySize(k), + mesh->attributeMorphTargetId(k), name, Trade::isMeshAttributeCustom(name) ? importer.meshAttributeName(name) : "", mesh->attributeFormat(k), @@ -1057,6 +1059,9 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility << Debug::boldColor(Debug::Color::Default) << ")"; } else d << Debug::packed << attribute.name; + if(attribute.morphTargetId != -1) + d << Debug::resetColor << Debug::nospace << ", morph target" << attribute.morphTargetId; + d << Debug::color(Debug::Color::Blue) << "@" << Debug::packed << Debug::color(Debug::Color::Cyan) << attribute.format; if(attribute.arraySize) d << Debug::nospace << Utility::format("[{}]", attribute.arraySize); diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp index bf78ed6d4..772b6c8d3 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp @@ -697,7 +697,8 @@ void SceneConverterImplementationTest::infoMeshes() { Trade::DataFlag::ExternallyOwned, indices, Trade::MeshIndexData{indices}, Trade::DataFlag::ExternallyOwned|Trade::DataFlag::Mutable, points, { - Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::arrayView(points)} + Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::stridedArrayView(points).slice(&Point::base)}, + Trade::MeshAttributeData{Trade::MeshAttribute::Position, Containers::stridedArrayView(points).slice(&Point::morphTarget), 66}, }}; /* Second is multi-level, with second level being indexed meshlets @@ -740,7 +741,10 @@ void SceneConverterImplementationTest::infoMeshes() { } UnsignedShort indices[70]; - Vector3 points[50]; + struct Point { + Vector3 base; + Vector2 morphTarget; + } points[50]; } importer; const char* argv[]{"", data.oneOrAll ? "--info-meshes" : "--info"}; diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt index 884355add..de04992b9 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt @@ -1,6 +1,7 @@ Mesh 0: - Level 0: 50 vertices @ Points (0.6 kB, ExternallyOwned|Mutable) - Position @ Vector3, offset 0, stride 12 + Level 0: 50 vertices @ Points (1.0 kB, ExternallyOwned|Mutable) + Position @ Vector3, offset 0, stride 20 + Position, morph target 66 @ Vector2, offset 12, stride 20 70 indices @ UnsignedShort, offset 0, stride 2 (0.1 kB, ExternallyOwned) Mesh 1: LODs? No, meshlets. Level 0: 250 vertices @ Triangles (6.8 kB) @@ -13,4 +14,4 @@ Mesh 1: LODs? No, meshlets. Custom(116:vertexCount) @ UnsignedByte, offset 85725, stride 1 Mesh 2: Level 0: 15 vertices @ Instances (0.0 kB) -Total mesh data size: 91.4 kB +Total mesh data size: 91.8 kB