From bc5d127bd6b1fef4cf9888b92b2f09acea57bff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 18 May 2023 13:07:21 +0200 Subject: [PATCH] sceneconverter: don't query Arguments value unnecessarily often. It's an --info output which doesn't have to be the fastest ever, but it also doesn't have to waste time for no reason. --- .../SceneTools/Implementation/sceneConverterUtilities.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h index 23303a465..a411659fb 100644 --- a/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h +++ b/src/Magnum/SceneTools/Implementation/sceneConverterUtilities.h @@ -452,6 +452,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility } /* Mesh properties */ + const bool showBounds = args.isSet("bounds"); Containers::Array meshInfos; if(args.isSet("info") || args.isSet("info-meshes")) for(UnsignedInt i = 0; i != importer.meshCount(); ++i) { for(UnsignedInt j = 0; j != importer.meshLevelCount(i); ++j) { @@ -482,7 +483,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility info.indexStride = mesh->indexStride(); info.indexDataSize = mesh->indexData().size(); info.indexDataFlags = mesh->indexDataFlags(); - if(args.isSet("bounds")) + if(showBounds) info.indexBounds = calculateBounds(mesh->indicesAsArray()); } for(UnsignedInt k = 0; k != mesh->attributeCount(); ++k) { @@ -492,7 +493,7 @@ bool printInfo(const Debug::Flags useColor, const bool useColor24, const Utility implementation-specific format and if it's not a custom attribute */ Containers::String bounds; - if(args.isSet("bounds") && !isVertexFormatImplementationSpecific(mesh->attributeFormat(k))) switch(name) { + if(showBounds && !isVertexFormatImplementationSpecific(mesh->attributeFormat(k))) switch(name) { case Trade::MeshAttribute::Position: bounds = calculateBounds(mesh->positions3DAsArray(mesh->attributeId(k))); break;