From e677dc12d5e06c6cfa9632012459baf293691e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 23 Jul 2023 14:36:52 +0200 Subject: [PATCH] sceneconverter: adapt tests to DDS, KTX and glTF plugin changes. The KTX and glTF plugins now print a commit identifier in their generator string for better tool trackability, have to disable that to have predictable output. The DDS plugin now Y-flips compressed pixel formats, leading to a different message. Disabling the flip to not have to deal with any message at all. --- .../SceneTools/Test/SceneConverterTest.cpp | 64 ++++++++++++++---- .../images-3d-1x1x1.bin | Bin 510 -> 414 bytes .../images-3d-1x1x1.gltf | 8 +-- .../materials-pbr.gltf | 16 +++-- .../mesh-passthrough-on-failure.gltf | 8 ++- .../quad-name-custom-attributes.gltf | 7 +- .../Test/SceneConverterTestFiles/quad.gltf | 11 ++- .../SceneConverterTestFiles/two-quads.gltf | 22 ++++-- 8 files changed, 101 insertions(+), 35 deletions(-) diff --git a/src/Magnum/SceneTools/Test/SceneConverterTest.cpp b/src/Magnum/SceneTools/Test/SceneConverterTest.cpp index 963b9bb77..4b59ffa1f 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTest.cpp +++ b/src/Magnum/SceneTools/Test/SceneConverterTest.cpp @@ -150,8 +150,13 @@ const struct { "quad.ply", nullptr, {}}, {"one mesh, whole scene converter", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as that's less context + sensitive and thus shouldn't cause accidentally uncovered + code paths. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad.obj"), - Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") + Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf"), }}, "ObjImporter", nullptr, "GltfSceneConverter", {}, nullptr, "quad.gltf", "quad.bin", @@ -343,8 +348,10 @@ const struct { "Mesh 1 fuzzy duplicate removal: 6 -> 4 vertices\n" "Trade::AbstractSceneConverter::addImporterContents(): adding scene 0 out of 1\n"}, {"one implicit mesh, two converters", {InPlaceInit, { - /* Not removing the generator identifier in this case as we want to - test passing no options */ + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as in this case as we + want to test passing no -c options. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad-strip.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") @@ -353,8 +360,10 @@ const struct { "quad.gltf", "quad.bin", {}}, {"one implicit mesh, two converters, explicit last", {InPlaceInit, { - /* Not removing the generator identifier in this case as we want to - test passing no options */ + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as in this case as we + want to test passing no -c options. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", "-C", "GltfSceneConverter", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad-strip.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") @@ -363,8 +372,10 @@ const struct { "quad.gltf", "quad.bin", {}}, {"one implicit mesh, two converters, verbose", {InPlaceInit, { - /* Not removing the generator identifier in this case as we want to - test passing no options */ + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as in this case as we + want to test passing no -c options. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", "-v", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad-strip.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") @@ -393,6 +404,10 @@ const struct { "Trade::AnySceneConverter::beginFile(): using GltfSceneConverter\n" "Trade::AbstractSceneConverter::addImporterContents(): adding mesh 0 out of 1\n"}, {"one implicit mesh, two converters, explicit last, verbose", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as in this case as we + want to test passing no -c options. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", "-C", "GltfSceneConverter", "-v", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad-strip.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") @@ -440,6 +455,10 @@ const struct { "quad.ply", nullptr, "Option nonexistentMeshOptimizerOption not recognized by MeshOptimizerSceneConverter\n"}, {"one implicit mesh, two converters, options for both", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as -c is tested for + something else. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", "-c", "nonexistentMeshOptimizerOption=yes", "-c", "nonexistentAnyConverterOption=no", @@ -451,6 +470,10 @@ const struct { "Option nonexistentMeshOptimizerOption not recognized by MeshOptimizerSceneConverter\n" "Trade::AnySceneConverter::beginFile(): option nonexistentAnyConverterOption not recognized by GltfSceneConverter\n"}, {"one implicit mesh, two converters, explicit last, options for both", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as -c is tested for + something else. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-C", "MeshOptimizerSceneConverter", "-c", "nonexistentMeshOptimizerOption=yes", "-C", "StanfordSceneConverter", @@ -520,6 +543,11 @@ const struct { "quad-name-custom-attributes.gltf", "quad-name-custom-attributes.bin", {}}, {"mesh converter", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as that's less context + sensitive and thus shouldn't cause accidentally uncovered + code paths. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-M", "MeshOptimizerSceneConverter", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/quad-strip.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/quad.gltf") @@ -571,6 +599,11 @@ const struct { " overdraw 1 -> 1\n" "Trade::AbstractSceneConverter::addImporterContents(): adding scene 0 out of 1\n"}, {"two mesh converters, two options, one mesh, verbose", {InPlaceInit, { + /* Unfortunately *have to* use an option to make the output + predictable. Using --set instead of -c as that's less context + sensitive and thus shouldn't cause accidentally uncovered + code paths. */ + "--set", "GltfSceneConverter:generator=\"Magnum GltfSceneConverter\"", "-I", "GltfImporter", "-C", "GltfSceneConverter", "-M", "MeshOptimizerSceneConverter", "-m", "nonexistentFirstOption=yes", @@ -674,10 +707,12 @@ const struct { "Processing 2D image 1 (1/2) with StbResizeImageConverter...\n" "Processing 2D image 1 (2/2) with StbResizeImageConverter...\n"}, {"3D image converter, two images", {InPlaceInit, { + /* Removing the KTX generator identifier for predictable output */ + "--set", "KtxImageConverter:generator=", "-i", "experimentalKhrTextureKtx", "-P", "StbResizeImageConverter", "-p", "size=\"1 1\"", - /* Removing the generator identifier for a smaller file, bundling - the images to avoid having too many files */ + /* Removing the glTF generator identifier for predictable output, + bundling the images to avoid having too many files */ "-c", "experimentalKhrTextureKtx,imageConverter=KtxImageConverter,bundleImages,generator=", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/images-3d.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/images-3d-1x1x1.gltf") @@ -687,11 +722,13 @@ const struct { "images-3d-1x1x1.gltf", "images-3d-1x1x1.bin", {}}, {"3D image converter, two images, verbose", {InPlaceInit, { + /* Removing the KTX generator identifier for predictable output */ + "--set", "KtxImageConverter:generator=", "-I", "GltfImporter", "-C", "GltfSceneConverter", "-i", "experimentalKhrTextureKtx", "-P", "StbResizeImageConverter", "-p", "size=\"1 1\"", - /* Removing the generator identifier for a smaller file, bundling - the images to avoid having too many files */ + /* Removing the generator identifier for predictable output, + bundling the images to avoid having too many files */ "-c", "experimentalKhrTextureKtx,imageConverter=KtxImageConverter,bundleImages,generator=", "-v", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/images-3d.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/images-3d-1x1x1.gltf") @@ -1189,14 +1226,13 @@ const struct { "GltfImporter", "PngImporter", nullptr, "PngImageConverter", "PngImageConverter doesn't support 2D image conversion, only Convert2DToData\n"}, {"plugin doesn't support compressed image conversion", {InPlaceInit, { + /* To not print warnings about Y flip for block-compressed data */ + "--set", "DdsImporter:assumeYUpZBackward=true", "-I", "GltfImporter", "-P", "StbResizeImageConverter", Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/image-dds.gltf"), Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.gltf") }}, "GltfImporter", "DdsImporter", nullptr, "StbResizeImageConverter", - /** @todo add an ability to pass options to AnyImageImporter to - suppress this */ - "Trade::DdsImporter::openData(): block-compressed image is assumed to be encoded with Y down and Z forward, imported data will have wrong orientation. Enable assumeYUpZBackward to suppress this warning.\n" "StbResizeImageConverter doesn't support compressed 2D image conversion, only Convert2D|Convert3D\n"}, {"can't process a 2D image", {InPlaceInit, { "-I", "GltfImporter", "-P", "StbResizeImageConverter", diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.bin b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.bin index d4e06873678535b841ef4167c9ba8d4dab421cec..9956ad1f3e39bf585cb9080a43d2a5f115fea83c 100644 GIT binary patch delta 66 fcmeyzJdb&Tji>|zCO9)Ou$q~H;Xgj<{|pQOM|TP9 literal 510 zcmZ4O9TK5nWU!l;ONvXJfq{V$2?LoJ{0yL&4-jtwVh12b2Y;Xf%xE-74+t|%UU|@$RfbsveY7w1QPhadIWnP7?c3%mOQ5b diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.gltf index 1cdc1f821..3b92aec74 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/images-3d-1x1x1.gltf @@ -11,19 +11,19 @@ "buffers": [ { "uri": "images-3d-1x1x1.bin", - "byteLength": 510 + "byteLength": 414 } ], "bufferViews": [ { "buffer": 0, "byteOffset": 0, - "byteLength": 255 + "byteLength": 207 }, { "buffer": 0, - "byteOffset": 255, - "byteLength": 255 + "byteOffset": 207, + "byteLength": 207 } ], "samplers": [ diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/materials-pbr.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/materials-pbr.gltf index 8ce1f88c3..6a53bd0b6 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/materials-pbr.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/materials-pbr.gltf @@ -12,12 +12,16 @@ { "buffer": 0, "byteOffset": 0, - "byteLength": 36 + "byteLength": 36, + "byteStride": 12, + "target": 34962 }, { "buffer": 0, "byteOffset": 36, - "byteLength": 36 + "byteLength": 36, + "byteStride": 12, + "target": 34962 } ], "accessors": [ @@ -25,13 +29,17 @@ "bufferView": 0, "componentType": 5126, "count": 3, - "type": "VEC3" + "type": "VEC3", + "min": [-1, -1, 0], + "max": [1, 1, 0] }, { "bufferView": 1, "componentType": 5126, "count": 3, - "type": "VEC3" + "type": "VEC3", + "min": [-1, -1, 0], + "max": [1, 1, 0] } ], "meshes": [ diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/mesh-passthrough-on-failure.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/mesh-passthrough-on-failure.gltf index f82d3eba0..a37d3049b 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/mesh-passthrough-on-failure.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/mesh-passthrough-on-failure.gltf @@ -12,7 +12,9 @@ { "buffer": 0, "byteOffset": 0, - "byteLength": 72 + "byteLength": 72, + "byteStride": 12, + "target": 34962 } ], "accessors": [ @@ -20,7 +22,9 @@ "bufferView": 0, "componentType": 5126, "count": 6, - "type": "VEC3" + "type": "VEC3", + "min": [-1, -1, 0], + "max": [1, 1, 0] } ], "meshes": [ diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad-name-custom-attributes.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad-name-custom-attributes.gltf index d25e01a0d..25f83ca63 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad-name-custom-attributes.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad-name-custom-attributes.gltf @@ -12,12 +12,15 @@ { "buffer": 0, "byteOffset": 0, - "byteLength": 12 + "byteLength": 12, + "target": 34963 }, { "buffer": 0, "byteOffset": 12, - "byteLength": 48 + "byteLength": 48, + "byteStride": 12, + "target": 34962 } ], "accessors": [ diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad.gltf index 69519f700..b8687c36f 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/quad.gltf @@ -13,12 +13,15 @@ { "buffer": 0, "byteOffset": 0, - "byteLength": 24 + "byteLength": 24, + "target": 34963 }, { "buffer": 0, "byteOffset": 24, - "byteLength": 48 + "byteLength": 48, + "byteStride": 12, + "target": 34962 } ], "accessors": [ @@ -32,7 +35,9 @@ "bufferView": 1, "componentType": 5126, "count": 4, - "type": "VEC3" + "type": "VEC3", + "min": [-1, -1, 0], + "max": [1, 1, 0] } ], "meshes": [ diff --git a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/two-quads.gltf b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/two-quads.gltf index a89213076..0bf514bac 100644 --- a/src/Magnum/SceneTools/Test/SceneConverterTestFiles/two-quads.gltf +++ b/src/Magnum/SceneTools/Test/SceneConverterTestFiles/two-quads.gltf @@ -12,22 +12,28 @@ { "buffer": 0, "byteOffset": 0, - "byteLength": 24 + "byteLength": 24, + "target": 34963 }, { "buffer": 0, "byteOffset": 24, - "byteLength": 48 + "byteLength": 48, + "byteStride": 12, + "target": 34962 }, { "buffer": 0, "byteOffset": 72, - "byteLength": 24 + "byteLength": 24, + "target": 34963 }, { "buffer": 0, "byteOffset": 96, - "byteLength": 48 + "byteLength": 48, + "byteStride": 12, + "target": 34962 } ], "accessors": [ @@ -41,7 +47,9 @@ "bufferView": 1, "componentType": 5126, "count": 4, - "type": "VEC3" + "type": "VEC3", + "min": [-10, -10, 10], + "max": [10, 10, 10] }, { "bufferView": 2, @@ -53,7 +61,9 @@ "bufferView": 3, "componentType": 5126, "count": 4, - "type": "VEC3" + "type": "VEC3", + "min": [-1, -1, 0], + "max": [1, 1, 0] } ], "meshes": [