From b74a11eebc393ab32a9f66b2a4dca23d5d5003e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 3 Dec 2022 17:21:14 +0100 Subject: [PATCH] sceneconverter: use MeshData::attributeId() instead of a custom helper. The API got added in 4d5c53dbc6fbdf5b812a11b6fc75f8b65f8b9ec0 and apparently I forgot to check where it would make sense to be used. --- .../Implementation/sceneConverterUtilities.h | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h index 8da0fc95c..bfac82bb1 100644 --- a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h +++ b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h @@ -66,15 +66,6 @@ template Containers::String calculateBounds(Containers::Array&& attr return out.str(); } -/* Named attribute index from a global index */ -/** @todo some helper for this directly on the MeshData class? */ -UnsignedInt namedAttributeId(const Trade::MeshData& mesh, UnsignedInt id) { - const Trade::MeshAttribute name = mesh.attributeName(id); - for(UnsignedInt i = 0; i != mesh.attributeCount(name); ++i) - if(mesh.attributeId(name, i) == id) return i; - CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ -} - bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility::Arguments& args, Trade::AbstractImporter& importer, std::chrono::high_resolution_clock::duration& importTime) { struct AnimationInfo { UnsignedInt animation; @@ -473,25 +464,25 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility Containers::String bounds; if(args.isSet("bounds") && !isVertexFormatImplementationSpecific(mesh->attributeFormat(k))) switch(name) { case Trade::MeshAttribute::Position: - bounds = calculateBounds(mesh->positions3DAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->positions3DAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::Tangent: - bounds = calculateBounds(mesh->tangentsAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->tangentsAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::Bitangent: - bounds = calculateBounds(mesh->bitangentsAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->bitangentsAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::Normal: - bounds = calculateBounds(mesh->normalsAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->normalsAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::TextureCoordinates: - bounds = calculateBounds(mesh->textureCoordinates2DAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->textureCoordinates2DAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::Color: - bounds = calculateBounds(mesh->colorsAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->colorsAsArray(mesh->attributeId(k))); break; case Trade::MeshAttribute::ObjectId: - bounds = calculateBounds(mesh->objectIdsAsArray(namedAttributeId(*mesh, k))); + bounds = calculateBounds(mesh->objectIdsAsArray(mesh->attributeId(k))); break; }