From 6299ece980373909fdbe3d1b5f28ea98a119255e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Mar 2020 21:27:58 +0100 Subject: [PATCH] Shaders: test MeshVisualizer TBN direction defaults. Now possible, with compile() supporting the new attribs and primitives generating them. Finally out of this cyclic dependency hell, yay. --- .../Shaders/Test/MeshVisualizerGLTest.cpp | 24 +++++++++++++++++- .../MeshVisualizerTestFiles/defaults-tbn.tga | Bin 0 -> 5513 bytes 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/Magnum/Shaders/Test/MeshVisualizerTestFiles/defaults-tbn.tga diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 5363411d4..c9997aa84 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -746,7 +746,29 @@ void MeshVisualizerGLTest::renderDefaultsTangentBitangentNormal() { CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() + std::string(" is not supported")); #endif - CORRADE_SKIP("Needs compile() and Primitives supporting TBN, which is not done yet."); + GL::Mesh sphere = MeshTools::compile(Primitives::uvSphereSolid(4, 8, + Primitives::UVSphereFlag::Tangents)); + + MeshVisualizer3D{MeshVisualizer3D::Flag::TangentDirection| + MeshVisualizer3D::Flag::BitangentFromTangentDirection| + MeshVisualizer3D::Flag::NormalDirection} + .setViewportSize({80, 80}) /** @todo make this unnecessary */ + .draw(sphere); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) || + !(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) + CORRADE_SKIP("AnyImageImporter / TgaImageImporter plugins not found."); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + CORRADE_COMPARE_WITH( + /* Dropping the alpha channel, as it's always 1.0 */ + Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), + Utility::Directory::join(_testDir, "MeshVisualizerTestFiles/defaults-tbn.tga"), + /* AMD has off-by-one errors on edges compared to Intel */ + (DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f})); } #endif diff --git a/src/Magnum/Shaders/Test/MeshVisualizerTestFiles/defaults-tbn.tga b/src/Magnum/Shaders/Test/MeshVisualizerTestFiles/defaults-tbn.tga new file mode 100644 index 0000000000000000000000000000000000000000..3cc802ecc2770e72921f103242a841578e1741a4 GIT binary patch literal 5513 zcmeI0?Tb}a6vlsZ&fICr9Gxb!G$IuT#mFy-f|8J^I1~;T>ZigWsURsL2rB04WNMl( zWmyn~VP!#5*kC0k7Eu`#Mbf|1^Q?XDIp>~x``ni~%$al7TF-v=+HY&`wc#c@&m@!F zPWBJ%h5>jL+WC#~eGkUqj1-yBQ~JU?qobp_w6Y0loD`YLskAuq^eL!}T?!XrABf{^ zV@s+tHcOOE2;oeXmsH{ytPA$d<+s9h*wl|LlU6n%jBJ)}N!K7e=o)i)4lcl5@Rn;R zJ+!~Mw6X~yobjy&hg3s)^)w7YejA*H{cr=E7RKc2M*X>}Tw2+L5YG6aflg1RE|f~o z0lm%E7@e(!Yw&PC>P%YMgfOyM+KkhE^sh*#cCrVqz&-G$6qV0zK`yOqLg+ER$!*?# z`ry79j>}z`2XAz7yQW-P*@O`8zc~7}C%9L@x3D*+@u@Cu*W{Tcn-IeF<2G-E%}{&|PrA2G7Hu+fJ6f2V z^$8GSyudGt(&8A$jBZyS);VxYOB3doJ(XBv2&A=5h&jEiX7m{JVO0wsg{yFHIcXAW zOd4rz6Cw>kPR&;{dR)3#t;|>hzrxOPjwi~rN_U2BO)Q=+K6817_weN`fDd5WYrV5< zD$3juKsF&3^s<`KYqAfkCfl>{1>9W*ki;4RL|WT~$a-1L*wU+~KK}0Lj4ctcH;_T_!M5ymKl&-UrV3CozXdIUA5pP_{ibra@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