Browse Source

sceneconverter: show morph target ID in --info output, if present.

pull/623/head
Vladimír Vondruš 3 years ago
parent
commit
0607c476f7
  1. 5
      src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h
  2. 8
      src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp
  3. 7
      src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt

5
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; std::size_t offset;
Int stride; Int stride;
UnsignedInt arraySize; UnsignedInt arraySize;
Int morphTargetId;
Trade::MeshAttribute name; Trade::MeshAttribute name;
Containers::String customName; Containers::String customName;
VertexFormat format; VertexFormat format;
@ -541,6 +542,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
mesh->attributeOffset(k), mesh->attributeOffset(k),
mesh->attributeStride(k), mesh->attributeStride(k),
mesh->attributeArraySize(k), mesh->attributeArraySize(k),
mesh->attributeMorphTargetId(k),
name, Trade::isMeshAttributeCustom(name) ? name, Trade::isMeshAttributeCustom(name) ?
importer.meshAttributeName(name) : "", importer.meshAttributeName(name) : "",
mesh->attributeFormat(k), mesh->attributeFormat(k),
@ -1057,6 +1059,9 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility
<< Debug::boldColor(Debug::Color::Default) << ")"; << Debug::boldColor(Debug::Color::Default) << ")";
} else d << Debug::packed << attribute.name; } 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; d << Debug::color(Debug::Color::Blue) << "@" << Debug::packed << Debug::color(Debug::Color::Cyan) << attribute.format;
if(attribute.arraySize) if(attribute.arraySize)
d << Debug::nospace << Utility::format("[{}]", attribute.arraySize); d << Debug::nospace << Utility::format("[{}]", attribute.arraySize);

8
src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp

@ -697,7 +697,8 @@ void SceneConverterImplementationTest::infoMeshes() {
Trade::DataFlag::ExternallyOwned, indices, Trade::DataFlag::ExternallyOwned, indices,
Trade::MeshIndexData{indices}, Trade::MeshIndexData{indices},
Trade::DataFlag::ExternallyOwned|Trade::DataFlag::Mutable, points, { 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 /* Second is multi-level, with second level being indexed meshlets
@ -740,7 +741,10 @@ void SceneConverterImplementationTest::infoMeshes() {
} }
UnsignedShort indices[70]; UnsignedShort indices[70];
Vector3 points[50]; struct Point {
Vector3 base;
Vector2 morphTarget;
} points[50];
} importer; } importer;
const char* argv[]{"", data.oneOrAll ? "--info-meshes" : "--info"}; const char* argv[]{"", data.oneOrAll ? "--info-meshes" : "--info"};

7
src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes.txt

@ -1,6 +1,7 @@
Mesh 0: Mesh 0:
Level 0: 50 vertices @ Points (0.6 kB, ExternallyOwned|Mutable) Level 0: 50 vertices @ Points (1.0 kB, ExternallyOwned|Mutable)
Position @ Vector3, offset 0, stride 12 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) 70 indices @ UnsignedShort, offset 0, stride 2 (0.1 kB, ExternallyOwned)
Mesh 1: LODs? No, meshlets. Mesh 1: LODs? No, meshlets.
Level 0: 250 vertices @ Triangles (6.8 kB) 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 Custom(116:vertexCount) @ UnsignedByte, offset 85725, stride 1
Mesh 2: Mesh 2:
Level 0: 15 vertices @ Instances (0.0 kB) Level 0: 15 vertices @ Instances (0.0 kB)
Total mesh data size: 91.4 kB Total mesh data size: 91.8 kB

Loading…
Cancel
Save