diff --git a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h index bfac82bb1..762fef436 100644 --- a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h +++ b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h @@ -481,6 +481,18 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility case Trade::MeshAttribute::Color: bounds = calculateBounds(mesh->colorsAsArray(mesh->attributeId(k))); break; + /* These two are arrays, and thus the bounds should be + calculated across the array elements as well. But as + the data are returned in a flattened array, it's done + implicitly without having to additionally do some + `vec.minmax()` like in case of vectors. Yay for + accidental timesavers! */ + case Trade::MeshAttribute::JointIds: + bounds = calculateBounds(mesh->jointIdsAsArray(mesh->attributeId(k))); + break; + case Trade::MeshAttribute::Weights: + bounds = calculateBounds(mesh->weightsAsArray(mesh->attributeId(k))); + break; case Trade::MeshAttribute::ObjectId: bounds = calculateBounds(mesh->objectIdsAsArray(mesh->attributeId(k))); break; diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp index 4b8b96ed7..6387dbd16 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTest.cpp @@ -32,6 +32,7 @@ #include #include "Magnum/Math/CubicHermite.h" +#include "Magnum/Math/Half.h" #include "Magnum/Math/Matrix3.h" #include "Magnum/Math/Matrix4.h" @@ -744,6 +745,8 @@ void SceneConverterImplementationTest::infoMeshesBounds() { Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, Containers::arrayView(vertexData->textureCoordinates)}, Trade::MeshAttributeData{Trade::MeshAttribute::Color, Containers::arrayView(vertexData->color)}, Trade::MeshAttributeData{Trade::MeshAttribute::ObjectId, Containers::arrayView(vertexData->objectIdSecondary)}, + Trade::MeshAttributeData{Trade::MeshAttribute::JointIds, VertexFormat::UnsignedByte, Containers::arrayView(vertexData->jointIds), 3}, + Trade::MeshAttributeData{Trade::MeshAttribute::Weights, VertexFormat::Half, Containers::arrayView(vertexData->weights), 3}, }}; } @@ -763,6 +766,8 @@ void SceneConverterImplementationTest::infoMeshesBounds() { Vector2 textureCoordinates[2]; Vector4 color[2]; UnsignedInt objectIdSecondary[2]; + Vector3ub jointIds[2]; + Vector3h weights[2]; } vertexData[1]{{ {{0.1f, -0.1f, 0.2f}, {0.2f, 0.0f, -0.2f}}, {{0.2f, -0.2f, 0.8f}, {0.3f, 0.8f, 0.2f}}, @@ -772,6 +777,8 @@ void SceneConverterImplementationTest::infoMeshesBounds() { {{0.5f, 0.5f}, {1.5f, 0.5f}}, {0x99336600_rgbaf, 0xff663333_rgbaf}, {15, 337}, + {{22, 6, 27}, {15, 12, 23}}, + {{0.5_h, 0.25_h, 0.25_h}, {0.125_h, 0.75_h, 0.125_h}} }}; } importer; diff --git a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt index e80e1226a..e2eb5d31d 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt +++ b/src/Magnum/SceneTools/Test/SceneConverterImplementationTestFiles/info-meshes-bounds.txt @@ -1,5 +1,5 @@ Mesh 0: - Level 0: 2 vertices @ Lines (0.1 kB, {}) + Level 0: 2 vertices @ Lines (0.2 kB, {}) Position @ Vector3, offset 0, stride 12 Bounds: ({0.1, -0.1, -0.2}, {0.2, 0, 0.2}) Tangent @ Vector3, offset 24, stride 12 @@ -17,6 +17,10 @@ Mesh 0: Bounds: ({0.6, 0.2, 0.2, 0}, {1, 0.4, 0.4, 0.2}) ObjectId @ UnsignedInt, offset 132, stride 4 Bounds: (15, 337) + JointIds @ UnsignedByte[3], offset 140, stride 3 + Bounds: (6, 27) + Weights @ Half[3], offset 146, stride 6 + Bounds: (0.125, 0.75) 3 indices @ UnsignedByte, offset 0, stride 1 (0.0 kB, {}) Bounds: (3, 176) -Total mesh data size: 0.1 kB +Total mesh data size: 0.2 kB