From 90e52671bedd4c5920aee88726d80fa9bf06a316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 20 Jan 2022 21:58:56 +0100 Subject: [PATCH] MeshTools: test primitive propagation in transform*(). --- src/Magnum/MeshTools/Test/TransformTest.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Magnum/MeshTools/Test/TransformTest.cpp b/src/Magnum/MeshTools/Test/TransformTest.cpp index fc197f99c..6b0571e3c 100644 --- a/src/Magnum/MeshTools/Test/TransformTest.cpp +++ b/src/Magnum/MeshTools/Test/TransformTest.cpp @@ -450,6 +450,7 @@ template void TransformTest::meshData2D() { CORRADE_COMPARE(mesh.isIndexed(), data.indexed); Trade::MeshData out = transform2D(mesh, data.transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleStrip); /* Indices should be preserved */ if(data.indexed) { @@ -552,13 +553,14 @@ void TransformTest::meshData2DRvaluePassthrough() { }); const void* originalAttributeData = attributes; - Trade::MeshData mesh{MeshPrimitive::TriangleStrip, + Trade::MeshData mesh{MeshPrimitive::TriangleFan, data.indexed ? std::move(indexData) : nullptr, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, std::move(vertexData), std::move(attributes)}; const Matrix3 transformation = Matrix3::rotation(35.0_degf); Trade::MeshData out = transform2D(std::move(mesh), transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); /* Indices should be passed through unchanged */ if(data.indexed) { @@ -827,6 +829,7 @@ template void TransformTest::meshData3D() { CORRADE_COMPARE(mesh.isIndexed(), data.indexed); Trade::MeshData out = transform3D(mesh, data.transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleStrip); /* Indices should be preserved */ if(data.indexed) { @@ -995,13 +998,14 @@ void TransformTest::meshData3DRvaluePassthrough() { arrayAppend(attributes, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, vertices.slice(&Vertex::normal)}); const void* originalAttributeData = attributes; - Trade::MeshData mesh{MeshPrimitive::TriangleStrip, + Trade::MeshData mesh{MeshPrimitive::TriangleFan, data.indexed ? std::move(indexData) : nullptr, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, std::move(vertexData), std::move(attributes)}; const Matrix4 transformation = Matrix4::rotationX(35.0_degf); Trade::MeshData out = transform3D(std::move(mesh), transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); /* Indices should be passed through unchanged */ if(data.indexed) { @@ -1344,6 +1348,7 @@ template void TransformTest::meshDataTextureCoordinates2D() { CORRADE_COMPARE(mesh.isIndexed(), data.indexed); Trade::MeshData out = transformTextureCoordinates2D(mesh, data.transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleStrip); /* Indices should be preserved */ if(data.indexed) { @@ -1431,13 +1436,14 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthrough() { }); const void* originalAttributeData = attributes; - Trade::MeshData mesh{MeshPrimitive::TriangleStrip, + Trade::MeshData mesh{MeshPrimitive::TriangleFan, data.indexed ? std::move(indexData) : nullptr, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, std::move(vertexData), std::move(attributes)}; const Matrix3 transformation = Matrix3::rotation(35.0_degf); Trade::MeshData out = transformTextureCoordinates2D(std::move(mesh), transformation, data.id); + CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); /* Indices should be passed through unchanged */ if(data.indexed) {