From 9e2a1117de6c2188331ea55990752ed5f5cd110a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 5 Jul 2019 20:27:08 +0200 Subject: [PATCH] MeshTools: yay? a new SILLY workaround for MSVC 2019? --- src/Magnum/MeshTools/GenerateNormals.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Magnum/MeshTools/GenerateNormals.cpp b/src/Magnum/MeshTools/GenerateNormals.cpp index e14e6408a..b6f9142f1 100644 --- a/src/Magnum/MeshTools/GenerateNormals.cpp +++ b/src/Magnum/MeshTools/GenerateNormals.cpp @@ -86,6 +86,14 @@ std::pair, std::vector> generateFlatNormals(co } #endif +#if defined(CORRADE_MSVC2019_COMPATIBILITY) && !defined(CORRADE_MSVC2017_COMPATIBILITY) +/* When using /permissive- with MSVC2019, using namespace inside the function + below FOR SOME REASON gets lost when instantiating the template. That's + stupid but what can we do -- the only way to work around that is to move it + outside the function. */ +using namespace Math::Literals; +#endif + template void generateSmoothNormalsInto(const Containers::StridedArrayView1D& indices, const Containers::StridedArrayView1D& positions, const Containers::StridedArrayView1D& normals) { CORRADE_ASSERT(indices.size() % 3 == 0, "MeshTools::generateSmoothNormalsInto(): index count not divisible by 3", ); @@ -159,6 +167,8 @@ template void generateSmoothNormalsInto(const Containers::StridedArrayV /* Inner angle at each vertex of the triangle. The last one can be calculated as a remainder to 180°. */ + /* This using namespace doesn't work with MSVC2019 with /permissive- + (it gets lost when instantiating?!), so it's duplicated above */ using namespace Math::Literals; crossAngles[i].second[0] = Math::angle(v10n, v20n); crossAngles[i].second[1] = Math::angle(-v10n, v21n);