Browse Source

Math: fix swizzle support for Vector3 and Vector4 in singles.

The macro, which is enabled when preprocessing the headers for
single-header libs, excluded the TypeForSize specializations, making
these two not work with Math::gather() and Math::scatter(). It's done
correctly in Vector2 and Color, not sure why not here.
pull/686/head
Vladimír Vondruš 4 months ago
parent
commit
56a3aebf73
  1. 5
      src/Magnum/Math/Vector3.h
  2. 5
      src/Magnum/Math/Vector4.h

5
src/Magnum/Math/Vector3.h

@ -287,13 +287,12 @@ template<class T> class Vector3: public Vector<3, T> {
_MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, Vector3)
#endif
#ifndef MAGNUM_NO_MATH_STRICT_WEAK_ORDERING
namespace Implementation {
template<class T> struct TypeForSize<3, T> { typedef Math::Vector3<typename T::Type> Type; };
#ifndef MAGNUM_NO_MATH_STRICT_WEAK_ORDERING
template<class T> struct StrictWeakOrdering<Vector3<T>>: StrictWeakOrdering<Vector<3, T>> {};
}
#endif
}
}}

5
src/Magnum/Math/Vector4.h

@ -314,13 +314,12 @@ template<class T> Vector4<T> planeEquation(const Vector3<T>& normal, const Vecto
return {normal, -Math::dot(normal, point)};
}
#ifndef MAGNUM_NO_MATH_STRICT_WEAK_ORDERING
namespace Implementation {
template<class T> struct TypeForSize<4, T> { typedef Math::Vector4<typename T::Type> Type; };
#ifndef MAGNUM_NO_MATH_STRICT_WEAK_ORDERING
template<class T> struct StrictWeakOrdering<Vector4<T>>: StrictWeakOrdering<Vector<4, T>> {};
}
#endif
}
}}

Loading…
Cancel
Save