From b8dcedf84589abe40bf6e73c2ba7db21655e74c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 7 Jan 2025 20:20:34 +0100 Subject: [PATCH] Math: don't use range-for loops over initializer lists. Because that apparently cannot work without #include , and even though that particular include is maybe just 30 lines, I refuse to do that because it'd soon make the MagnumMath.hpp single tip over 10k preprocessed lines again. Fuck you, C++. --- src/Magnum/Math/Intersection.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Magnum/Math/Intersection.h b/src/Magnum/Math/Intersection.h index 8dc52580e..7c527dad5 100644 --- a/src/Magnum/Math/Intersection.h +++ b/src/Magnum/Math/Intersection.h @@ -643,18 +643,19 @@ template bool aabbCone( { const Vector3 c = aabbCenter - coneOrigin; - for(const Int axis: {0, 1, 2}) { + /* Not doing for(Int axis: {0, 1, 2}) because that'd need an + include. FFS, C++. */ + for(Int axis = 0; axis != 3; ++axis) { const Int z = axis; const Int x = (axis + 1) % 3; const Int y = (axis + 2) % 3; if(coneNormal[z] != T(0)) { - const Float t0 = ((c[z] - aabbExtents[z])/coneNormal[z]); - const Float t1 = ((c[z] + aabbExtents[z])/coneNormal[z]); - - const Vector3 i0 = coneNormal*t0; - const Vector3 i1 = coneNormal*t1; - - for(const auto& i : {i0, i1}) { + /* Dtto here, making an array to not need an initializer_list */ + const Vector3 i01[]{ + coneNormal*((c[z] - aabbExtents[z])/coneNormal[z]), + coneNormal*((c[z] + aabbExtents[z])/coneNormal[z]) + }; + for(const Vector3& i: i01) { Vector3 closestPoint = i; if(i[x] - c[x] > aabbExtents[x]) {