diff --git a/glm/detail/qualifier.hpp b/glm/detail/qualifier.hpp index d05e03345..29f0ff89a 100644 --- a/glm/detail/qualifier.hpp +++ b/glm/detail/qualifier.hpp @@ -34,7 +34,7 @@ namespace glm template struct vec; template struct mat; - template struct qua; + template struct qua; template using tvec1 = vec<1, T, Q>; template using tvec2 = vec<2, T, Q>; diff --git a/glm/detail/type_quat.hpp b/glm/detail/type_quat.hpp index 906843a57..728e6a491 100644 --- a/glm/detail/type_quat.hpp +++ b/glm/detail/type_quat.hpp @@ -19,18 +19,21 @@ namespace glm # if GLM_COMPILER & GLM_COMPILER_GCC # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" +# pragma GCC diagnostic ignored "-Wattributes" // for alignas(1), packed types # elif GLM_COMPILER & GLM_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wgnu-anonymous-struct" # pragma clang diagnostic ignored "-Wnested-anon-types" +# pragma clang diagnostic ignored "-Wpadded" # elif GLM_COMPILER & GLM_COMPILER_VC # pragma warning(push) # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +# pragma warning(disable: 4324) // nonstandard extension used : nameless struct/union # endif # endif - template - struct qua + template + struct alignas(N) qua { // -- Implementation detail -- @@ -71,9 +74,9 @@ namespace glm // -- Implicit basic constructors -- GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR qua() GLM_DEFAULT_CTOR; - GLM_CTOR_DECL qua(qua const& q) = default; + GLM_CTOR_DECL qua(qua const& q) = default; template - GLM_CTOR_DECL qua(qua const& q); + GLM_CTOR_DECL qua(qua const& q); // -- Explicit basic constructors -- @@ -85,12 +88,12 @@ namespace glm GLM_CTOR_DECL qua(T w, T x, T y, T z); # endif - GLM_FUNC_DECL static GLM_CONSTEXPR qua wxyz(T w, T x, T y, T z); + GLM_FUNC_DECL static GLM_CONSTEXPR qua wxyz(T w, T x, T y, T z); // -- Conversion constructors -- - template - GLM_CTOR_DECL GLM_EXPLICIT qua(qua const& q); + template + GLM_CTOR_DECL GLM_EXPLICIT qua(qua const& q); GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const; GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const; @@ -110,20 +113,20 @@ namespace glm // -- Unary arithmetic operators -- - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator=(qua const& q) = default; + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator=(qua const& q) = default; template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator=(qua const& q); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator=(qua const& q); template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator+=(qua const& q); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator+=(qua const& q); template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator-=(qua const& q); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator-=(qua const& q); template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator*=(qua const& q); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator*=(qua const& q); template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator*=(U s); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator*=(U s); template - GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator/=(U s); + GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR qua& operator/=(U s); }; # if GLM_SILENT_WARNINGS == GLM_ENABLE @@ -138,51 +141,51 @@ namespace glm // -- Unary bit operators -- - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator+(qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator+(qua const& q); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator-(qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator-(qua const& q); // -- Binary operators -- - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator+(qua const& q, qua const& p); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator+(qua const& q, qua const& p); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator-(qua const& q, qua const& p); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator-(qua const& q, qua const& p); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(qua const& q, qua const& p); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(qua const& q, qua const& p); - template - GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v); + template + GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v); - template - GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q); - template - GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v); + template + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v); - template - GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(qua const& q, T const& s); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(qua const& q, T const& s); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(T const& s, qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator*(T const& s, qua const& q); - template - GLM_FUNC_DECL GLM_CONSTEXPR qua operator/(qua const& q, T const& s); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua operator/(qua const& q, T const& s); // -- Boolean operators -- - template - GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2); + template + GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2); - template - GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2); + template + GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2); } //namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_quat.inl b/glm/detail/type_quat.inl index 9b9c2100d..8babf095b 100644 --- a/glm/detail/type_quat.inl +++ b/glm/detail/type_quat.inl @@ -71,8 +71,8 @@ namespace detail // -- Component accesses -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & qua::operator[](typename qua::length_type i) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & qua::operator[](typename qua::length_type i) { GLM_ASSERT_LENGTH(i, this->length()); # ifdef GLM_FORCE_QUAT_DATA_WXYZ @@ -82,8 +82,8 @@ namespace detail # endif } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR T const& qua::operator[](typename qua::length_type i) const + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR T const& qua::operator[](typename qua::length_type i) const { GLM_ASSERT_LENGTH(i, this->length()); # ifdef GLM_FORCE_QUAT_DATA_WXYZ @@ -96,8 +96,8 @@ namespace detail // -- Implicit basic constructors -- # if GLM_CONFIG_CTOR_INIT == GLM_ENABLE - template - GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR qua::qua() + template + GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR qua::qua() # ifdef GLM_FORCE_QUAT_DATA_WXYZ : w(1), x(0), y(0), z(0) # else @@ -106,9 +106,9 @@ namespace detail {} # endif - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(qua const& q) # ifdef GLM_FORCE_QUAT_DATA_WXYZ : w(q.w), x(q.x), y(q.y), z(q.z) # else @@ -118,8 +118,8 @@ namespace detail // -- Explicit basic constructors -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T s, vec<3, T, Q> const& v) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T s, vec<3, T, Q> const& v) # ifdef GLM_FORCE_QUAT_DATA_WXYZ : w(s), x(v.x), y(v.y), z(v.z) # else @@ -127,11 +127,11 @@ namespace detail # endif {} - template + template # ifdef GLM_FORCE_QUAT_DATA_XYZW - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T _x, T _y, T _z, T _w) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T _x, T _y, T _z, T _w) # else - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T _w, T _x, T _y, T _z) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(T _w, T _x, T _y, T _z) # endif # ifdef GLM_FORCE_QUAT_DATA_WXYZ : w(_w), x(_x), y(_y), z(_z) @@ -140,20 +140,20 @@ namespace detail # endif {} - template - GLM_CONSTEXPR qua qua::wxyz(T w, T x, T y, T z) { + template + GLM_CONSTEXPR qua qua::wxyz(T w, T x, T y, T z) { # ifdef GLM_FORCE_QUAT_DATA_XYZW - return qua(x, y, z, w); + return qua(x, y, z, w); # else - return qua(w, x, y, z); + return qua(w, x, y, z); # endif } // -- Conversion constructors -- - template - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(qua const& q) + template + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(qua const& q) # ifdef GLM_FORCE_QUAT_DATA_WXYZ : w(static_cast(q.w)), x(static_cast(q.x)), y(static_cast(q.y)), z(static_cast(q.z)) # else @@ -179,8 +179,8 @@ namespace detail // this->z = c.x * c.y * s.z - s.x * s.y * c.z; //} - template - GLM_FUNC_QUALIFIER qua::qua(vec<3, T, Q> const& u, vec<3, T, Q> const& v) + template + GLM_FUNC_QUALIFIER qua::qua(vec<3, T, Q> const& u, vec<3, T, Q> const& v) { T norm_u_norm_v = sqrt(dot(u, u) * dot(v, v)); T real_part = norm_u_norm_v + dot(u, v); @@ -203,8 +203,8 @@ namespace detail *this = normalize(qua::wxyz(real_part, t.x, t.y, t.z)); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(vec<3, T, Q> const& eulerAngle) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(vec<3, T, Q> const& eulerAngle) { vec<3, T, Q> c = glm::cos(eulerAngle * T(0.5)); vec<3, T, Q> s = glm::sin(eulerAngle * T(0.5)); @@ -215,35 +215,35 @@ namespace detail this->z = c.x * c.y * s.z - s.x * s.y * c.z; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(mat<3, 3, T, Q> const& m) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(mat<3, 3, T, Q> const& m) { *this = quat_cast(m); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(mat<4, 4, T, Q> const& m) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua::qua(mat<4, 4, T, Q> const& m) { *this = quat_cast(m); } - template - GLM_FUNC_QUALIFIER qua::operator mat<3, 3, T, Q>() const + template + GLM_FUNC_QUALIFIER qua::operator mat<3, 3, T, Q>() const { return mat3_cast(*this); } - template - GLM_FUNC_QUALIFIER qua::operator mat<4, 4, T, Q>() const + template + GLM_FUNC_QUALIFIER qua::operator mat<4, 4, T, Q>() const { return mat4_cast(*this); } // -- Unary arithmetic operators -- - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator=(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator=(qua const& q) { this->w = static_cast(q.w); this->x = static_cast(q.x); @@ -252,26 +252,26 @@ namespace detail return *this; } - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator+=(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator+=(qua const& q) { - return (*this = detail::compute_quat_add::value>::call(*this, qua(q))); + return (*this = detail::compute_quat_add::value>::call(*this, qua(q))); } - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator-=(qua const& q) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator-=(qua const& q) { - return (*this = detail::compute_quat_sub::value>::call(*this, qua(q))); + return (*this = detail::compute_quat_sub::value>::call(*this, qua(q))); } - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator*=(qua const& r) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator*=(qua const& r) { - qua const p(*this); - qua const q(r); + qua const p(*this); + qua const q(r); this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y; @@ -280,56 +280,56 @@ namespace detail return *this; } - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator*=(U s) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator*=(U s) { return (*this = detail::compute_quat_mul_scalar::value>::call(*this, static_cast(s))); } - template + template template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator/=(U s) + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua & qua::operator/=(U s) { return (*this = detail::compute_quat_div_scalar::value>::call(*this, static_cast(s))); } // -- Unary bit operators -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator+(qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator+(qua const& q) { return q; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator-(qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator-(qua const& q) { - return qua::wxyz(-q.w, -q.x, -q.y, -q.z); + return qua::wxyz(-q.w, -q.x, -q.y, -q.z); } // -- Binary operators -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator+(qua const& q, qua const& p) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator+(qua const& q, qua const& p) { - return qua(q) += p; + return qua(q) += p; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator-(qua const& q, qua const& p) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator-(qua const& q, qua const& p) { - return qua(q) -= p; + return qua(q) -= p; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(qua const& q, qua const& p) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(qua const& q, qua const& p) { - return qua(q) *= p; + return qua(q) *= p; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v) { vec<3, T, Q> const QuatVector(q.x, q.y, q.z); vec<3, T, Q> const uv(glm::cross(QuatVector, v)); @@ -338,54 +338,54 @@ namespace detail return v + ((uv * q.w) + uuv) * static_cast(2); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q) { return glm::inverse(q) * v; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v) { return detail::compute_quat_mul_vec4::value>::call(q, v); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q) { return glm::inverse(q) * v; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(qua const& q, T const& s) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(qua const& q, T const& s) { - return qua::wxyz( + return qua::wxyz( q.w * s, q.x * s, q.y * s, q.z * s); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(T const& s, qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator*(T const& s, qua const& q) { return q * s; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator/(qua const& q, T const& s) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua operator/(qua const& q, T const& s) { - return qua::wxyz( + return qua::wxyz( q.w / s, q.x / s, q.y / s, q.z / s); } // -- Boolean operators -- - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2) { return q1.x == q2.x && q1.y == q2.y && q1.z == q2.z && q1.w == q2.w; } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2) { return q1.x != q2.x || q1.y != q2.y || q1.z != q2.z || q1.w != q2.w; } diff --git a/glm/ext/quaternion_common.hpp b/glm/ext/quaternion_common.hpp index f738692a4..9e10d83b2 100644 --- a/glm/ext/quaternion_common.hpp +++ b/glm/ext/quaternion_common.hpp @@ -49,8 +49,8 @@ namespace glm /// @tparam Q A value from qualifier enum /// /// @see - slerp(qua const& x, qua const& y, T const& a) - template - GLM_FUNC_DECL qua mix(qua const& x, qua const& y, T a); + template + GLM_FUNC_DECL qua mix(qua const& x, qua const& y, T a); /// Linear interpolation of two quaternions. /// The interpolation is oriented. @@ -61,8 +61,8 @@ namespace glm /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a); /// Spherical linear interpolation of two quaternions. /// The interpolation always take the short path and the rotation is performed at constant speed. @@ -73,8 +73,8 @@ namespace glm /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a); + template + GLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a); /// Spherical linear interpolation of two quaternions with multiple spins over rotation axis. /// The interpolation always take the short path when the spin count is positive and long path @@ -88,22 +88,22 @@ namespace glm /// @tparam T A floating-point scalar type /// @tparam S An integer scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a, S k); + template + GLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a, S k); /// Returns the q conjugate. /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL GLM_CONSTEXPR qua conjugate(qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua conjugate(qua const& q); /// Returns the q inverse. /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL GLM_CONSTEXPR qua inverse(qua const& q); + template + GLM_FUNC_DECL GLM_CONSTEXPR qua inverse(qua const& q); /// Returns true if x holds a NaN (not a number) /// representation in the underlying implementation's set of @@ -115,8 +115,8 @@ namespace glm /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL vec<4, bool, Q> isnan(qua const& x); + template + GLM_FUNC_DECL vec<4, bool, Q> isnan(qua const& x); /// Returns true if x holds a positive infinity or negative /// infinity representation in the underlying implementation's @@ -126,8 +126,8 @@ namespace glm /// /// @tparam T A floating-point scalar type /// @tparam Q A value from qualifier enum - template - GLM_FUNC_DECL vec<4, bool, Q> isinf(qua const& x); + template + GLM_FUNC_DECL vec<4, bool, Q> isinf(qua const& x); /// @} } //namespace glm diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl index fb2556d1e..eae87b250 100644 --- a/glm/ext/quaternion_common.inl +++ b/glm/ext/quaternion_common.inl @@ -1,7 +1,7 @@ namespace glm { - template - GLM_FUNC_QUALIFIER qua mix(qua const& x, qua const& y, T a) + template + GLM_FUNC_QUALIFIER qua mix(qua const& x, qua const& y, T a) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'mix' only accept floating-point inputs"); @@ -11,7 +11,7 @@ namespace glm if(cosTheta > static_cast(1) - epsilon()) { // Linear interpolation - return qua::wxyz( + return qua::wxyz( mix(x.w, y.w, a), mix(x.x, y.x, a), mix(x.y, y.y, a), @@ -25,8 +25,8 @@ namespace glm } } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua lerp(qua const& x, qua const& y, T a) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'lerp' only accept floating-point inputs"); @@ -37,12 +37,12 @@ namespace glm return x * (static_cast(1) - a) + (y * a); } - template - GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a) + template + GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'slerp' only accept floating-point inputs"); - qua z = y; + qua z = y; T cosTheta = dot(x, y); @@ -58,7 +58,7 @@ namespace glm if(cosTheta > static_cast(1) - epsilon()) { // Linear interpolation - return qua::wxyz( + return qua::wxyz( mix(x.w, z.w, a), mix(x.x, z.x, a), mix(x.y, z.y, a), @@ -72,13 +72,13 @@ namespace glm } } - template - GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a, S k) + template + GLM_FUNC_QUALIFIER qua slerp(qua const& x, qua const& y, T a, S k) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'slerp' only accept floating-point inputs"); static_assert(std::numeric_limits::is_integer, "'slerp' only accept integer for spin count"); - qua z = y; + qua z = y; T cosTheta = dot(x, y); @@ -109,28 +109,28 @@ namespace glm } } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua conjugate(qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua conjugate(qua const& q) { - return qua::wxyz(q.w, -q.x, -q.y, -q.z); + return qua::wxyz(q.w, -q.x, -q.y, -q.z); } - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua inverse(qua const& q) + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR qua inverse(qua const& q) { return conjugate(q) / dot(q, q); } - template - GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(qua const& q) + template + GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(qua const& q) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'isnan' only accept floating-point inputs"); return vec<4, bool, Q>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w)); } - template - GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(qua const& q) + template + GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(qua const& q) { static_assert(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'isinf' only accept floating-point inputs"); diff --git a/glm/ext/quaternion_double.hpp b/glm/ext/quaternion_double.hpp index de19eab8b..b29cfc476 100644 --- a/glm/ext/quaternion_double.hpp +++ b/glm/ext/quaternion_double.hpp @@ -31,8 +31,19 @@ namespace glm /// @addtogroup ext_quaternion_double /// @{ + /// Quaternion of aligned double-precision floating-point numbers. + typedef qua aligned_dquat; + + /// Quaternion of packed double-precision floating-point numbers. + typedef qua packed_dquat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES /// Quaternion of double-precision floating-point numbers. - typedef qua dquat; + typedef aligned_dquat dquat; +#else + /// Quaternion of double-precision floating-point numbers. + typedef packed_dquat dquat; +#endif /// @} } //namespace glm @@ -44,3 +55,16 @@ static_assert(std::is_trivially_copy_assignable::value); static_assert(std::is_trivially_copyable::value); static_assert(std::is_copy_constructible::value); static_assert(glm::dquat::length() == 4); + +static_assert(sizeof(glm::aligned_dquat) == 32); +static_assert(alignof(glm::aligned_dquat) == 32); +static_assert(sizeof(glm::packed_dquat) == 32); +// static_assert(alignof(glm::packed_dquat) == 8); FIXME + +static_assert(sizeof(glm::dquat) == 32); +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES +static_assert(alignof(glm::dquat) == 32); +#else +static_assert(alignof(glm::dquat) == 8); +#endif + diff --git a/glm/ext/quaternion_double_precision.hpp b/glm/ext/quaternion_double_precision.hpp index 650b65a96..abc65df12 100644 --- a/glm/ext/quaternion_double_precision.hpp +++ b/glm/ext/quaternion_double_precision.hpp @@ -22,20 +22,67 @@ namespace glm /// @addtogroup ext_quaternion_double_precision /// @{ + /// Quaternion of aligned double-precision floating-point numbers using high precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua aligned_highp_dquat; + + /// Quaternion of packed double-precision floating-point numbers using high precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua packed_highp_dquat; + + /// Quaternion of aligned double-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua aligned_mediump_dquat; + + /// Quaternion of packed double-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua packed_mediump_dquat; + + /// Quaternion of aligned double-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua aligned_lowp_dquat; + + /// Quaternion of packed double-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef qua packed_lowp_dquat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES /// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs. /// /// @see ext_quaternion_double_precision - typedef qua lowp_dquat; + typedef aligned_highp_dquat highp_dquat; - /// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. + /// Quaternion of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef aligned_mediump_dquat mediump_dquat; + + /// Quaternion of double-precision floating-point numbers using low precision arithmetic in term of ULPs. /// /// @see ext_quaternion_double_precision - typedef qua mediump_dquat; + typedef aligned_lowp_dquat lowp_dquat; +#else + /// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef packed_highp_dquat highp_dquat; - /// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. + /// Quaternion of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. /// /// @see ext_quaternion_double_precision - typedef qua highp_dquat; + typedef packed_mediump_dquat mediump_dquat; + + /// Quaternion of double-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_double_precision + typedef packed_lowp_dquat lowp_dquat; +#endif /// @} } //namespace glm @@ -57,3 +104,31 @@ static_assert(std::is_copy_constructible::value); static_assert(glm::lowp_dquat::length() == 4); static_assert(glm::mediump_dquat::length() == 4); static_assert(glm::highp_dquat::length() == 4); + +static_assert(sizeof(glm::aligned_highp_dquat) == 32); +static_assert(alignof(glm::aligned_highp_dquat) == 32); +static_assert(sizeof(glm::packed_highp_dquat) == 32); +static_assert(alignof(glm::packed_highp_dquat) == 8); + +static_assert(sizeof(glm::aligned_mediump_dquat) == 32); +static_assert(alignof(glm::aligned_mediump_dquat) == 32); +static_assert(sizeof(glm::packed_mediump_dquat) == 32); +static_assert(alignof(glm::packed_mediump_dquat) == 8); + +static_assert(sizeof(glm::aligned_lowp_dquat) == 32); +static_assert(alignof(glm::aligned_lowp_dquat) == 32); +static_assert(sizeof(glm::packed_lowp_dquat) == 32); +static_assert(alignof(glm::packed_lowp_dquat) == 8); + +static_assert(sizeof(glm::highp_dquat) == 32); +static_assert(sizeof(glm::mediump_dquat) == 32); +static_assert(sizeof(glm::lowp_dquat) == 32); +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES +static_assert(alignof(glm::highp_dquat) == 32); +static_assert(alignof(glm::mediump_dquat) == 32); +static_assert(alignof(glm::lowp_dquat) == 32); +#else +static_assert(alignof(glm::highp_dquat) == 8); +static_assert(alignof(glm::mediump_dquat) == 8); +static_assert(alignof(glm::lowp_dquat) == 8); +#endif diff --git a/glm/ext/quaternion_float.hpp b/glm/ext/quaternion_float.hpp index b438b6dba..7e07e7b5f 100644 --- a/glm/ext/quaternion_float.hpp +++ b/glm/ext/quaternion_float.hpp @@ -31,8 +31,19 @@ namespace glm /// @addtogroup ext_quaternion_float /// @{ + /// Quaternion of aligned single-precision floating-point numbers. + typedef qua aligned_quat; + + /// Quaternion of packed single-precision floating-point numbers. + typedef qua packed_quat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES /// Quaternion of single-precision floating-point numbers. - typedef qua quat; + typedef aligned_quat quat; +#else + /// Quaternion of single-precision floating-point numbers. + typedef packed_quat quat; +#endif /// @} } //namespace glm @@ -44,3 +55,15 @@ static_assert(std::is_trivially_copy_assignable::value); static_assert(std::is_trivially_copyable::value); static_assert(std::is_copy_constructible::value); static_assert(glm::quat::length() == 4); + +static_assert(sizeof(glm::aligned_quat) == 16); +static_assert(alignof(glm::aligned_quat) == 16); +static_assert(sizeof(glm::packed_quat) == 16); +// static_assert(alignof(glm::packed_quat) == 4); FIXME + +static_assert(sizeof(glm::quat) == 16); +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES +static_assert(alignof(glm::quat) == 16); +#else +static_assert(alignof(glm::quat) == 4); +#endif diff --git a/glm/ext/quaternion_float_precision.hpp b/glm/ext/quaternion_float_precision.hpp index 89f037c80..c4c183162 100644 --- a/glm/ext/quaternion_float_precision.hpp +++ b/glm/ext/quaternion_float_precision.hpp @@ -22,14 +22,67 @@ namespace glm /// @addtogroup ext_quaternion_float_precision /// @{ - /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua lowp_quat; + /// Quaternion of aligned single-precision floating-point numbers using high precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua aligned_highp_quat; + + /// Quaternion of packed single-precision floating-point numbers using high precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua packed_highp_quat; + + /// Quaternion of aligned single-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua aligned_mediump_quat; + + /// Quaternion of packed single-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua packed_mediump_quat; + /// Quaternion of aligned single-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua aligned_lowp_quat; + + /// Quaternion of packed single-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef qua packed_lowp_quat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua mediump_quat; + /// + /// @see ext_quaternion_float_precision + typedef aligned_highp_quat highp_quat; + /// Quaternion of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef aligned_mediump_quat mediump_quat; + + /// Quaternion of single-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef aligned_lowp_quat lowp_quat; +#else /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua highp_quat; + /// + /// @see ext_quaternion_float_precision + typedef packed_highp_quat highp_quat; + + /// Quaternion of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef packed_mediump_quat mediump_quat; + + /// Quaternion of single-precision floating-point numbers using low precision arithmetic in term of ULPs. + /// + /// @see ext_quaternion_float_precision + typedef packed_lowp_quat lowp_quat; +#endif /// @} } //namespace glm @@ -51,3 +104,32 @@ static_assert(std::is_copy_constructible::value); static_assert(glm::lowp_quat::length() == 4); static_assert(glm::mediump_quat::length() == 4); static_assert(glm::highp_quat::length() == 4); + +static_assert(sizeof(glm::aligned_highp_quat) == 16); +static_assert(alignof(glm::aligned_highp_quat) == 16); +static_assert(sizeof(glm::packed_highp_quat) == 16); +static_assert(alignof(glm::packed_highp_quat) == 4); + +static_assert(sizeof(glm::aligned_mediump_quat) == 16); +static_assert(alignof(glm::aligned_mediump_quat) == 16); +static_assert(sizeof(glm::packed_mediump_quat) == 16); +static_assert(alignof(glm::packed_mediump_quat) == 4); + +static_assert(sizeof(glm::aligned_lowp_quat) == 16); +static_assert(alignof(glm::aligned_lowp_quat) == 16); +static_assert(sizeof(glm::packed_lowp_quat) == 16); +static_assert(alignof(glm::packed_lowp_quat) == 4); + +static_assert(sizeof(glm::highp_quat) == 16); +static_assert(sizeof(glm::mediump_quat) == 16); +static_assert(sizeof(glm::lowp_quat) == 16); +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES +static_assert(alignof(glm::highp_quat) == 16); +static_assert(alignof(glm::mediump_quat) == 16); +static_assert(alignof(glm::lowp_quat) == 16); +#else +static_assert(alignof(glm::highp_quat) == 4); +static_assert(alignof(glm::mediump_quat) == 4); +static_assert(alignof(glm::lowp_quat) == 4); +#endif + diff --git a/glm/fwd.hpp b/glm/fwd.hpp index aac882f22..e969d1a89 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -1192,30 +1192,103 @@ namespace glm // Quaternion - typedef qua lowp_quat; - typedef qua mediump_quat; - typedef qua highp_quat; - typedef qua quat; - - typedef qua lowp_fquat; - typedef qua mediump_fquat; - typedef qua highp_fquat; - typedef qua fquat; - - typedef qua lowp_f32quat; - typedef qua mediump_f32quat; - typedef qua highp_f32quat; - typedef qua f32quat; - - typedef qua lowp_dquat; - typedef qua mediump_dquat; - typedef qua highp_dquat; - typedef qua dquat; - - typedef qua lowp_f64quat; - typedef qua mediump_f64quat; - typedef qua highp_f64quat; - typedef qua f64quat; + typedef qua aligned_lowp_quat; + typedef qua aligned_mediump_quat; + typedef qua aligned_highp_quat; + + typedef qua packed_lowp_quat; + typedef qua packed_mediump_quat; + typedef qua packed_highp_quat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES + typedef qua lowp_quat; + typedef qua mediump_quat; + typedef qua highp_quat; + typedef qua quat; +#else + typedef qua lowp_quat; + typedef qua mediump_quat; + typedef qua highp_quat; + typedef qua quat; +#endif + + typedef qua aligned_lowp_fquat; + typedef qua aligned_mediump_fquat; + typedef qua aligned_highp_fquat; + + typedef qua packed_lowp_fquat; + typedef qua packed_mediump_fquat; + typedef qua packed_highp_fquat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES + typedef qua lowp_fquat; + typedef qua mediump_fquat; + typedef qua highp_fquat; + typedef qua fquat; +#else + typedef qua lowp_fquat; + typedef qua mediump_fquat; + typedef qua highp_fquat; + typedef qua fquat; +#endif + + typedef qua aligned_lowp_dquat; + typedef qua aligned_mediump_dquat; + typedef qua aligned_highp_dquat; + + typedef qua packed_lowp_dquat; + typedef qua packed_mediump_dquat; + typedef qua packed_highp_dquat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES + typedef qua lowp_dquat; + typedef qua mediump_dquat; + typedef qua highp_dquat; + typedef qua dquat; +#else + typedef qua lowp_dquat; + typedef qua mediump_dquat; + typedef qua highp_dquat; + typedef qua dquat; +#endif + + typedef qua aligned_lowp_f32quat; + typedef qua aligned_mediump_f32quat; + typedef qua aligned_highp_f32quat; + + typedef qua packed_lowp_f32quat; + typedef qua packed_mediump_f32quat; + typedef qua packed_highp_f32quat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES + typedef qua lowp_f32quat; + typedef qua mediump_f32quat; + typedef qua highp_f32quat; + typedef qua f32quat; +#else + typedef qua lowp_f32quat; + typedef qua mediump_f32quat; + typedef qua highp_f32quat; + typedef qua f32quat; +#endif + + typedef qua aligned_lowp_f64quat; + typedef qua aligned_mediump_f64quat; + typedef qua aligned_highp_f64quat; + + typedef qua packed_lowp_f64quat; + typedef qua packed_mediump_f64quat; + typedef qua packed_highp_f64quat; + +#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES + typedef qua lowp_f64quat; + typedef qua mediump_f64quat; + typedef qua highp_f64quat; + typedef qua f64quat; +#else + typedef qua lowp_f64quat; + typedef qua mediump_f64quat; + typedef qua highp_f64quat; + typedef qua f64quat; +#endif }//namespace glm - - diff --git a/glm/gtc/type_aligned.hpp b/glm/gtc/type_aligned.hpp index 9b6bf7366..066b0a8dd 100644 --- a/glm/gtc/type_aligned.hpp +++ b/glm/gtc/type_aligned.hpp @@ -864,123 +864,8 @@ namespace glm /// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs. typedef mat<4, 4, double, packed_lowp> packed_lowp_dmat4x4; - // -- *quat -- - - /// quaternion aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua aligned_highp_quat; - - /// quaternion aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. - typedef qua aligned_mediump_quat; - - /// quaternion aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs. - typedef qua aligned_lowp_quat; - - /// quaternion aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua aligned_highp_dquat; - - /// quaternion aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. - typedef qua aligned_mediump_dquat; - - /// quaternion aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs. - typedef qua aligned_lowp_dquat; - - /// quaternion tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua packed_highp_quat; - - /// quaternion tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. - typedef qua packed_mediump_quat; - - /// quaternion tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs. - typedef qua packed_lowp_quat; - - /// quaternion tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs. - typedef qua packed_highp_dquat; - - /// quaternion tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. - typedef qua packed_mediump_dquat; - - /// quaternion tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs. - typedef qua packed_lowp_dquat; - // -- default -- -#if(defined(GLM_PRECISION_LOWP_FLOAT)) - typedef aligned_lowp_vec1 aligned_vec1; - typedef aligned_lowp_vec2 aligned_vec2; - typedef aligned_lowp_vec3 aligned_vec3; - typedef aligned_lowp_vec4 aligned_vec4; - typedef packed_lowp_vec1 packed_vec1; - typedef packed_lowp_vec2 packed_vec2; - typedef packed_lowp_vec3 packed_vec3; - typedef packed_lowp_vec4 packed_vec4; - - typedef aligned_lowp_mat2 aligned_mat2; - typedef aligned_lowp_mat3 aligned_mat3; - typedef aligned_lowp_mat4 aligned_mat4; - typedef packed_lowp_mat2 packed_mat2; - typedef packed_lowp_mat3 packed_mat3; - typedef packed_lowp_mat4 packed_mat4; - - typedef aligned_lowp_mat2x2 aligned_mat2x2; - typedef aligned_lowp_mat2x3 aligned_mat2x3; - typedef aligned_lowp_mat2x4 aligned_mat2x4; - typedef aligned_lowp_mat3x2 aligned_mat3x2; - typedef aligned_lowp_mat3x3 aligned_mat3x3; - typedef aligned_lowp_mat3x4 aligned_mat3x4; - typedef aligned_lowp_mat4x2 aligned_mat4x2; - typedef aligned_lowp_mat4x3 aligned_mat4x3; - typedef aligned_lowp_mat4x4 aligned_mat4x4; - typedef packed_lowp_mat2x2 packed_mat2x2; - typedef packed_lowp_mat2x3 packed_mat2x3; - typedef packed_lowp_mat2x4 packed_mat2x4; - typedef packed_lowp_mat3x2 packed_mat3x2; - typedef packed_lowp_mat3x3 packed_mat3x3; - typedef packed_lowp_mat3x4 packed_mat3x4; - typedef packed_lowp_mat4x2 packed_mat4x2; - typedef packed_lowp_mat4x3 packed_mat4x3; - typedef packed_lowp_mat4x4 packed_mat4x4; - - typedef aligned_lowp_quat aligned_quat; - typedef packed_lowp_quat packed_quat; -#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT)) - typedef aligned_mediump_vec1 aligned_vec1; - typedef aligned_mediump_vec2 aligned_vec2; - typedef aligned_mediump_vec3 aligned_vec3; - typedef aligned_mediump_vec4 aligned_vec4; - typedef packed_mediump_vec1 packed_vec1; - typedef packed_mediump_vec2 packed_vec2; - typedef packed_mediump_vec3 packed_vec3; - typedef packed_mediump_vec4 packed_vec4; - - typedef aligned_mediump_mat2 aligned_mat2; - typedef aligned_mediump_mat3 aligned_mat3; - typedef aligned_mediump_mat4 aligned_mat4; - typedef packed_mediump_mat2 packed_mat2; - typedef packed_mediump_mat3 packed_mat3; - typedef packed_mediump_mat4 packed_mat4; - - typedef aligned_mediump_mat2x2 aligned_mat2x2; - typedef aligned_mediump_mat2x3 aligned_mat2x3; - typedef aligned_mediump_mat2x4 aligned_mat2x4; - typedef aligned_mediump_mat3x2 aligned_mat3x2; - typedef aligned_mediump_mat3x3 aligned_mat3x3; - typedef aligned_mediump_mat3x4 aligned_mat3x4; - typedef aligned_mediump_mat4x2 aligned_mat4x2; - typedef aligned_mediump_mat4x3 aligned_mat4x3; - typedef aligned_mediump_mat4x4 aligned_mat4x4; - typedef packed_mediump_mat2x2 packed_mat2x2; - typedef packed_mediump_mat2x3 packed_mat2x3; - typedef packed_mediump_mat2x4 packed_mat2x4; - typedef packed_mediump_mat3x2 packed_mat3x2; - typedef packed_mediump_mat3x3 packed_mat3x3; - typedef packed_mediump_mat3x4 packed_mat3x4; - typedef packed_mediump_mat4x2 packed_mat4x2; - typedef packed_mediump_mat4x3 packed_mat4x3; - typedef packed_mediump_mat4x4 packed_mat4x4; - - typedef aligned_mediump_quat aligned_quat; - typedef packed_mediump_quat packed_quat; -#else //defined(GLM_PRECISION_HIGHP_FLOAT) /// 1 component vector aligned in memory of single-precision floating-point numbers. typedef aligned_highp_vec1 aligned_vec1; @@ -1077,90 +962,6 @@ namespace glm /// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers. typedef packed_highp_mat4x4 packed_mat4x4; - /// quaternion tightly aligned in memory of single-precision floating-point numbers. - typedef aligned_highp_quat aligned_quat; - - /// quaternion tightly packed in memory of single-precision floating-point numbers. - typedef packed_highp_quat packed_quat; -#endif//GLM_PRECISION - -#if(defined(GLM_PRECISION_LOWP_DOUBLE)) - typedef aligned_lowp_dvec1 aligned_dvec1; - typedef aligned_lowp_dvec2 aligned_dvec2; - typedef aligned_lowp_dvec3 aligned_dvec3; - typedef aligned_lowp_dvec4 aligned_dvec4; - typedef packed_lowp_dvec1 packed_dvec1; - typedef packed_lowp_dvec2 packed_dvec2; - typedef packed_lowp_dvec3 packed_dvec3; - typedef packed_lowp_dvec4 packed_dvec4; - - typedef aligned_lowp_dmat2 aligned_dmat2; - typedef aligned_lowp_dmat3 aligned_dmat3; - typedef aligned_lowp_dmat4 aligned_dmat4; - typedef packed_lowp_dmat2 packed_dmat2; - typedef packed_lowp_dmat3 packed_dmat3; - typedef packed_lowp_dmat4 packed_dmat4; - - typedef aligned_lowp_dmat2x2 aligned_dmat2x2; - typedef aligned_lowp_dmat2x3 aligned_dmat2x3; - typedef aligned_lowp_dmat2x4 aligned_dmat2x4; - typedef aligned_lowp_dmat3x2 aligned_dmat3x2; - typedef aligned_lowp_dmat3x3 aligned_dmat3x3; - typedef aligned_lowp_dmat3x4 aligned_dmat3x4; - typedef aligned_lowp_dmat4x2 aligned_dmat4x2; - typedef aligned_lowp_dmat4x3 aligned_dmat4x3; - typedef aligned_lowp_dmat4x4 aligned_dmat4x4; - typedef packed_lowp_dmat2x2 packed_dmat2x2; - typedef packed_lowp_dmat2x3 packed_dmat2x3; - typedef packed_lowp_dmat2x4 packed_dmat2x4; - typedef packed_lowp_dmat3x2 packed_dmat3x2; - typedef packed_lowp_dmat3x3 packed_dmat3x3; - typedef packed_lowp_dmat3x4 packed_dmat3x4; - typedef packed_lowp_dmat4x2 packed_dmat4x2; - typedef packed_lowp_dmat4x3 packed_dmat4x3; - typedef packed_lowp_dmat4x4 packed_dmat4x4; - - typedef aligned_lowp_dquat aligned_dquat; - typedef packed_lowp_dquat packed_dquat; -#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE)) - typedef aligned_mediump_dvec1 aligned_dvec1; - typedef aligned_mediump_dvec2 aligned_dvec2; - typedef aligned_mediump_dvec3 aligned_dvec3; - typedef aligned_mediump_dvec4 aligned_dvec4; - typedef packed_mediump_dvec1 packed_dvec1; - typedef packed_mediump_dvec2 packed_dvec2; - typedef packed_mediump_dvec3 packed_dvec3; - typedef packed_mediump_dvec4 packed_dvec4; - - typedef aligned_mediump_dmat2 aligned_dmat2; - typedef aligned_mediump_dmat3 aligned_dmat3; - typedef aligned_mediump_dmat4 aligned_dmat4; - typedef packed_mediump_dmat2 packed_dmat2; - typedef packed_mediump_dmat3 packed_dmat3; - typedef packed_mediump_dmat4 packed_dmat4; - - typedef aligned_mediump_dmat2x2 aligned_dmat2x2; - typedef aligned_mediump_dmat2x3 aligned_dmat2x3; - typedef aligned_mediump_dmat2x4 aligned_dmat2x4; - typedef aligned_mediump_dmat3x2 aligned_dmat3x2; - typedef aligned_mediump_dmat3x3 aligned_dmat3x3; - typedef aligned_mediump_dmat3x4 aligned_dmat3x4; - typedef aligned_mediump_dmat4x2 aligned_dmat4x2; - typedef aligned_mediump_dmat4x3 aligned_dmat4x3; - typedef aligned_mediump_dmat4x4 aligned_dmat4x4; - typedef packed_mediump_dmat2x2 packed_dmat2x2; - typedef packed_mediump_dmat2x3 packed_dmat2x3; - typedef packed_mediump_dmat2x4 packed_dmat2x4; - typedef packed_mediump_dmat3x2 packed_dmat3x2; - typedef packed_mediump_dmat3x3 packed_dmat3x3; - typedef packed_mediump_dmat3x4 packed_dmat3x4; - typedef packed_mediump_dmat4x2 packed_dmat4x2; - typedef packed_mediump_dmat4x3 packed_dmat4x3; - typedef packed_mediump_dmat4x4 packed_dmat4x4; - - typedef aligned_mediump_dquat aligned_dquat; - typedef packed_mediump_dquat packed_dquat; -#else //defined(GLM_PRECISION_HIGHP_DOUBLE) /// 1 component vector aligned in memory of double-precision floating-point numbers. typedef aligned_highp_dvec1 aligned_dvec1; @@ -1257,24 +1058,8 @@ namespace glm /// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers. typedef packed_highp_dmat4x4 packed_dmat4x4; - /// quaternion tightly aligned in memory of double-precision floating-point numbers. - typedef aligned_highp_dquat aligned_dquat; - - /// quaternion tightly packed in memory of double-precision floating-point numbers. - typedef packed_highp_dquat packed_dquat; -#endif//GLM_PRECISION - -#if(defined(GLM_PRECISION_LOWP_INT)) - typedef aligned_lowp_ivec1 aligned_ivec1; - typedef aligned_lowp_ivec2 aligned_ivec2; - typedef aligned_lowp_ivec3 aligned_ivec3; - typedef aligned_lowp_ivec4 aligned_ivec4; -#elif(defined(GLM_PRECISION_MEDIUMP_INT)) - typedef aligned_mediump_ivec1 aligned_ivec1; - typedef aligned_mediump_ivec2 aligned_ivec2; - typedef aligned_mediump_ivec3 aligned_ivec3; - typedef aligned_mediump_ivec4 aligned_ivec4; -#else //defined(GLM_PRECISION_HIGHP_INT) + // -- Signed integer definition -- + /// 1 component vector aligned in memory of signed integer numbers. typedef aligned_highp_ivec1 aligned_ivec1; @@ -1298,21 +1083,9 @@ namespace glm /// 4 components vector tightly packed in memory of signed integer numbers. typedef packed_highp_ivec4 packed_ivec4; -#endif//GLM_PRECISION // -- Unsigned integer definition -- -#if(defined(GLM_PRECISION_LOWP_UINT)) - typedef aligned_lowp_uvec1 aligned_uvec1; - typedef aligned_lowp_uvec2 aligned_uvec2; - typedef aligned_lowp_uvec3 aligned_uvec3; - typedef aligned_lowp_uvec4 aligned_uvec4; -#elif(defined(GLM_PRECISION_MEDIUMP_UINT)) - typedef aligned_mediump_uvec1 aligned_uvec1; - typedef aligned_mediump_uvec2 aligned_uvec2; - typedef aligned_mediump_uvec3 aligned_uvec3; - typedef aligned_mediump_uvec4 aligned_uvec4; -#else //defined(GLM_PRECISION_HIGHP_UINT) /// 1 component vector aligned in memory of unsigned integer numbers. typedef aligned_highp_uvec1 aligned_uvec1; @@ -1336,19 +1109,9 @@ namespace glm /// 4 components vector tightly packed in memory of unsigned integer numbers. typedef packed_highp_uvec4 packed_uvec4; -#endif//GLM_PRECISION - -#if(defined(GLM_PRECISION_LOWP_BOOL)) - typedef aligned_lowp_bvec1 aligned_bvec1; - typedef aligned_lowp_bvec2 aligned_bvec2; - typedef aligned_lowp_bvec3 aligned_bvec3; - typedef aligned_lowp_bvec4 aligned_bvec4; -#elif(defined(GLM_PRECISION_MEDIUMP_BOOL)) - typedef aligned_mediump_bvec1 aligned_bvec1; - typedef aligned_mediump_bvec2 aligned_bvec2; - typedef aligned_mediump_bvec3 aligned_bvec3; - typedef aligned_mediump_bvec4 aligned_bvec4; -#else //defined(GLM_PRECISION_HIGHP_BOOL) + + // -- Boolean definition -- + /// 1 component vector aligned in memory of bool values. typedef aligned_highp_bvec1 aligned_bvec1; @@ -1372,7 +1135,6 @@ namespace glm /// 4 components vector tightly packed in memory of bool values. typedef packed_highp_bvec4 packed_bvec4; -#endif//GLM_PRECISION /// @} }//namespace glm diff --git a/glm/gtx/type_aligned.hpp b/glm/gtx/type_aligned.hpp index ec4093584..5aa2781d2 100644 --- a/glm/gtx/type_aligned.hpp +++ b/glm/gtx/type_aligned.hpp @@ -25,215 +25,11 @@ namespace glm { - /////////////////////////// - // Signed int vector types - /// @addtogroup gtx_type_aligned /// @{ - /// Low qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int8, aligned_lowp_int8, 1); - - /// Low qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int16, aligned_lowp_int16, 2); - - /// Low qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int32, aligned_lowp_int32, 4); - - /// Low qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int64, aligned_lowp_int64, 8); - - - /// Low qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int8_t, aligned_lowp_int8_t, 1); - - /// Low qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int16_t, aligned_lowp_int16_t, 2); - - /// Low qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int32_t, aligned_lowp_int32_t, 4); - - /// Low qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_int64_t, aligned_lowp_int64_t, 8); - - - /// Low qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_i8, aligned_lowp_i8, 1); - - /// Low qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_i16, aligned_lowp_i16, 2); - - /// Low qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_i32, aligned_lowp_i32, 4); - - /// Low qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_i64, aligned_lowp_i64, 8); - - - /// Medium qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int8, aligned_mediump_int8, 1); - - /// Medium qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int16, aligned_mediump_int16, 2); - - /// Medium qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int32, aligned_mediump_int32, 4); - - /// Medium qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int64, aligned_mediump_int64, 8); - - - /// Medium qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int8_t, aligned_mediump_int8_t, 1); - - /// Medium qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int16_t, aligned_mediump_int16_t, 2); - - /// Medium qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int32_t, aligned_mediump_int32_t, 4); - - /// Medium qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_int64_t, aligned_mediump_int64_t, 8); - - - /// Medium qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_i8, aligned_mediump_i8, 1); - - /// Medium qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_i16, aligned_mediump_i16, 2); - - /// Medium qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_i32, aligned_mediump_i32, 4); - - /// Medium qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_i64, aligned_mediump_i64, 8); - - - /// High qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int8, aligned_highp_int8, 1); - - /// High qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int16, aligned_highp_int16, 2); - - /// High qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int32, aligned_highp_int32, 4); - - /// High qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int64, aligned_highp_int64, 8); - - - /// High qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int8_t, aligned_highp_int8_t, 1); - - /// High qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int16_t, aligned_highp_int16_t, 2); - - /// High qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int32_t, aligned_highp_int32_t, 4); - - /// High qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_int64_t, aligned_highp_int64_t, 8); - - - /// High qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_i8, aligned_highp_i8, 1); - - /// High qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_i16, aligned_highp_i16, 2); - - /// High qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_i32, aligned_highp_i32, 4); - - /// High qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_i64, aligned_highp_i64, 8); - - - /// Default qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int8, aligned_int8, 1); - - /// Default qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int16, aligned_int16, 2); - - /// Default qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int32, aligned_int32, 4); - - /// Default qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int64, aligned_int64, 8); - - - /// Default qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int8_t, aligned_int8_t, 1); - - /// Default qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int16_t, aligned_int16_t, 2); - - /// Default qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int32_t, aligned_int32_t, 4); - - /// Default qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(int64_t, aligned_int64_t, 8); - - - /// Default qualifier 8 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(i8, aligned_i8, 1); - - /// Default qualifier 16 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(i16, aligned_i16, 2); - - /// Default qualifier 32 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(i32, aligned_i32, 4); - - /// Default qualifier 64 bit signed integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(i64, aligned_i64, 8); - + /////////////////////////// + // Signed int vector types /// Default qualifier 32 bit signed integer aligned scalar type. /// @see gtx_type_aligned @@ -323,210 +119,6 @@ namespace glm ///////////////////////////// // Unsigned int vector types - /// Low qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint8, aligned_lowp_uint8, 1); - - /// Low qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint16, aligned_lowp_uint16, 2); - - /// Low qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint32, aligned_lowp_uint32, 4); - - /// Low qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint64, aligned_lowp_uint64, 8); - - - /// Low qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint8_t, aligned_lowp_uint8_t, 1); - - /// Low qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint16_t, aligned_lowp_uint16_t, 2); - - /// Low qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint32_t, aligned_lowp_uint32_t, 4); - - /// Low qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_uint64_t, aligned_lowp_uint64_t, 8); - - - /// Low qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_u8, aligned_lowp_u8, 1); - - /// Low qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_u16, aligned_lowp_u16, 2); - - /// Low qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_u32, aligned_lowp_u32, 4); - - /// Low qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(lowp_u64, aligned_lowp_u64, 8); - - - /// Medium qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint8, aligned_mediump_uint8, 1); - - /// Medium qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint16, aligned_mediump_uint16, 2); - - /// Medium qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint32, aligned_mediump_uint32, 4); - - /// Medium qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint64, aligned_mediump_uint64, 8); - - - /// Medium qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint8_t, aligned_mediump_uint8_t, 1); - - /// Medium qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint16_t, aligned_mediump_uint16_t, 2); - - /// Medium qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint32_t, aligned_mediump_uint32_t, 4); - - /// Medium qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_uint64_t, aligned_mediump_uint64_t, 8); - - - /// Medium qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_u8, aligned_mediump_u8, 1); - - /// Medium qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_u16, aligned_mediump_u16, 2); - - /// Medium qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_u32, aligned_mediump_u32, 4); - - /// Medium qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(mediump_u64, aligned_mediump_u64, 8); - - - /// High qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint8, aligned_highp_uint8, 1); - - /// High qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint16, aligned_highp_uint16, 2); - - /// High qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint32, aligned_highp_uint32, 4); - - /// High qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint64, aligned_highp_uint64, 8); - - - /// High qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint8_t, aligned_highp_uint8_t, 1); - - /// High qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint16_t, aligned_highp_uint16_t, 2); - - /// High qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint32_t, aligned_highp_uint32_t, 4); - - /// High qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_uint64_t, aligned_highp_uint64_t, 8); - - - /// High qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_u8, aligned_highp_u8, 1); - - /// High qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_u16, aligned_highp_u16, 2); - - /// High qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_u32, aligned_highp_u32, 4); - - /// High qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(highp_u64, aligned_highp_u64, 8); - - - /// Default qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint8, aligned_uint8, 1); - - /// Default qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint16, aligned_uint16, 2); - - /// Default qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint32, aligned_uint32, 4); - - /// Default qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint64, aligned_uint64, 8); - - - /// Default qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint8_t, aligned_uint8_t, 1); - - /// Default qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint16_t, aligned_uint16_t, 2); - - /// Default qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint32_t, aligned_uint32_t, 4); - - /// Default qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(uint64_t, aligned_uint64_t, 8); - - - /// Default qualifier 8 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(u8, aligned_u8, 1); - - /// Default qualifier 16 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(u16, aligned_u16, 2); - - /// Default qualifier 32 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(u32, aligned_u32, 4); - - /// Default qualifier 64 bit unsigned integer aligned scalar type. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(u64, aligned_u64, 8); - - /// Default qualifier 32 bit unsigned integer aligned scalar type. /// @see gtx_type_aligned GLM_ALIGNED_TYPEDEF(uvec1, aligned_uvec1, 4); @@ -944,34 +536,6 @@ namespace glm /// @see gtx_type_aligned GLM_ALIGNED_TYPEDEF(f64mat4x4, aligned_f64mat4x4, 32); -# endif//GLM_FORCE_SINGLE_ONLY - - - ////////////////////////// - // Quaternion types - - /// Single-qualifier floating-point aligned quaternion. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(quat, aligned_quat, 16); - - /// Single-qualifier floating-point aligned quaternion. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(quat, aligned_fquat, 16); - - /// Double-qualifier floating-point aligned quaternion. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(dquat, aligned_dquat, 32); - - /// Single-qualifier floating-point aligned quaternion. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(f32quat, aligned_f32quat, 16); - -# ifndef GLM_FORCE_SINGLE_ONLY - - /// Double-qualifier floating-point aligned quaternion. - /// @see gtx_type_aligned - GLM_ALIGNED_TYPEDEF(f64quat, aligned_f64quat, 32); - # endif//GLM_FORCE_SINGLE_ONLY /// @} diff --git a/glm/gtx/type_aligned.inl b/glm/gtx/type_aligned.inl index 54c1b818b..f5be19048 100644 --- a/glm/gtx/type_aligned.inl +++ b/glm/gtx/type_aligned.inl @@ -1,4 +1,4 @@ -/// @ref gtc_type_aligned +/// @ref gtx_type_aligned namespace glm { diff --git a/test/core/core_force_aligned_gentypes.cpp b/test/core/core_force_aligned_gentypes.cpp index 70713c4b1..130122b62 100644 --- a/test/core/core_force_aligned_gentypes.cpp +++ b/test/core/core_force_aligned_gentypes.cpp @@ -1,10 +1,74 @@ #include #include +#include + +# if GLM_SILENT_WARNINGS == GLM_ENABLE +# if GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +# pragma GCC diagnostic ignored "-Wattributes" // for alignas(1), packed types +# elif GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-anonymous-struct" +# pragma clang diagnostic ignored "-Wnested-anon-types" +# pragma clang diagnostic ignored "-Wpadded" +# elif GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(push) +# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +# pragma warning(disable: 4324) +# endif +# endif + +struct test_packed4 { + float x; + float y; + float z; + float w; +}; + +struct alignas(sizeof(float) * 4) test_aligned4 { + float x; + float y; + float z; +}; + +struct test_packed3 { + float x; + float y; + float z; +}; + +struct alignas(sizeof(float) * 4) test_aligned3 { + float x; + float y; + float z; +}; + int main() { int Error = 0; + printf("alignof(test_packed4): %d\n", static_cast(alignof(test_packed4))); + printf("alignof(test_aligned4): %d\n", static_cast(alignof(test_aligned4))); + printf("alignof(test_packed3): %d\n", static_cast(alignof(test_packed3))); + printf("alignof(test_aligned3): %d\n", static_cast(alignof(test_aligned3))); + + printf("alignof(packed_quat): %d\n", static_cast(alignof(glm::packed_quat))); + printf("alignof(glm::aligned_quat): %d\n", static_cast(alignof(glm::aligned_quat))); + printf("alignof(glm::quat): %d\n", static_cast(alignof(glm::quat))); + return Error; } +# if GLM_SILENT_WARNINGS == GLM_ENABLE +# if GLM_COMPILER & GLM_COMPILER_CLANG +# pragma clang diagnostic pop +# elif GLM_COMPILER & GLM_COMPILER_GCC +# pragma GCC diagnostic pop +# elif GLM_COMPILER & GLM_COMPILER_VC +# pragma warning(pop) +# endif +# endif + + diff --git a/test/ext/ext_quaternion_type.cpp b/test/ext/ext_quaternion_type.cpp index 11e724756..5cffbaaa6 100644 --- a/test/ext/ext_quaternion_type.cpp +++ b/test/ext/ext_quaternion_type.cpp @@ -87,6 +87,16 @@ static int test_precision() return Error; } +static int test_align() +{ + int Error = 0; + + Error += sizeof(glm::lowp_quat) <= sizeof(glm::mediump_quat) ? 0 : 1; + Error += sizeof(glm::mediump_quat) <= sizeof(glm::highp_quat) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -95,6 +105,7 @@ int main() Error += test_two_axis_ctr(); Error += test_size(); Error += test_precision(); + Error += test_align(); return Error; } diff --git a/test/gtc/gtc_random.cpp b/test/gtc/gtc_random.cpp index 734c69d34..ea4e64984 100644 --- a/test/gtc/gtc_random.cpp +++ b/test/gtc/gtc_random.cpp @@ -1,12 +1,7 @@ -#ifndef GLM_FORCE_PURE -#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES -#endif #include #include #include -#if GLM_LANG & GLM_LANG_CXX0X_FLAG -# include -#endif +#include std::size_t const TestSamples = 10000; @@ -324,47 +319,7 @@ static int test_ballRand() return Error; } -/* -#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) -int test_grid() -{ - int Error = 0; - - typedef std::array colors; - typedef std::array grid; - - grid Grid; - colors Colors; - - grid GridBest; - colors ColorsBest; - while(true) - { - for(std::size_t i = 0; i < Grid.size(); ++i) - Grid[i] = int(glm::linearRand(0.0, 8.0 * 8.0 * 8.0 - 1.0) / 64.0); - - for(std::size_t i = 0; i < Grid.size(); ++i) - ++Colors[Grid[i]]; - - bool Exit = true; - for(std::size_t i = 0; i < Colors.size(); ++i) - { - if(Colors[i] == 8) - continue; - - Exit = false; - break; - } - - if(Exit == true) - break; - } - - return Error; -} -#endif -*/ int main() { int Error = 0; @@ -374,10 +329,6 @@ int main() Error += test_sphericalRand(); Error += test_diskRand(); Error += test_ballRand(); -/* -#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) - Error += test_grid(); -#endif -*/ + return Error; }