Fixed B /= B.y bug for all assignment operators of vector classes. #116

This commit is contained in:
Christophe Riccio 2013-09-17 21:37:40 +02:00
parent aa0b2a5e28
commit b258af3e67
9 changed files with 112 additions and 262 deletions

View File

@ -159,19 +159,19 @@ namespace detail
GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec2<U, P> const & v);
@ -187,27 +187,27 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec2<U, P> const & v);
};

View File

@ -184,7 +184,7 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=
(
U const & s
U s
)
{
this->x += static_cast<T>(s);
@ -208,7 +208,7 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=
(
U const & s
U s
)
{
this->x -= static_cast<T>(s);
@ -232,7 +232,7 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=
(
U const & s
U s
)
{
this->x *= static_cast<T>(s);
@ -256,7 +256,7 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=
(
U const & s
U s
)
{
this->x /= static_cast<T>(s);
@ -339,10 +339,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (U s)
{
this->x %= static_cast<T>(s);
this->y %= static_cast<T>(s);
@ -351,10 +348,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (tvec2<U, P> const & v)
{
this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.y);
@ -363,10 +357,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (U s)
{
this->x &= static_cast<T>(s);
this->y &= static_cast<T>(s);
@ -375,10 +366,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (tvec2<U, P> const & v)
{
this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.y);
@ -387,10 +375,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (U s)
{
this->x |= static_cast<T>(s);
this->y |= static_cast<T>(s);
@ -399,10 +384,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (tvec2<U, P> const & v)
{
this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.y);
@ -411,10 +393,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (U s)
{
this->x ^= static_cast<T>(s);
this->y ^= static_cast<T>(s);
@ -423,10 +402,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (tvec2<U, P> const & v)
{
this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.y);
@ -435,10 +411,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (U s)
{
this->x <<= static_cast<T>(s);
this->y <<= static_cast<T>(s);
@ -447,10 +420,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (tvec2<U, P> const & v)
{
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y);
@ -459,10 +429,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (U s)
{
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
@ -471,10 +438,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (tvec2<U, P> const & v)
{
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);

View File

@ -177,19 +177,19 @@ namespace detail
GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v);
@ -205,27 +205,27 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec3<U, P> const & v);
};

View File

@ -183,10 +183,7 @@ namespace detail
// Unary arithmetic operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator=
(
tvec3<T, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<T, P> const & v)
{
this->x = v.x;
this->y = v.y;
@ -196,10 +193,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<U, P> const & v)
{
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
@ -209,10 +203,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (U s)
{
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
@ -222,10 +213,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (tvec3<U, P> const & v)
{
this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.y);
@ -235,10 +223,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (U s)
{
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
@ -248,10 +233,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (tvec3<U, P> const & v)
{
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.y);
@ -261,10 +243,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (U s)
{
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
@ -274,10 +253,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (tvec3<U, P> const & v)
{
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.y);
@ -287,10 +263,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (U s)
{
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
@ -300,10 +273,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (tvec3<U, P> const & v)
{
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.y);
@ -376,10 +346,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (U s)
{
this->x %= s;
this->y %= s;
@ -389,10 +356,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (tvec3<U, P> const & v)
{
this->x %= v.x;
this->y %= v.y;
@ -402,10 +366,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (U s)
{
this->x &= s;
this->y &= s;
@ -415,10 +376,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (tvec3<U, P> const & v)
{
this->x &= v.x;
this->y &= v.y;
@ -428,10 +386,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (U s)
{
this->x |= s;
this->y |= s;
@ -441,10 +396,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (tvec3<U, P> const & v)
{
this->x |= v.x;
this->y |= v.y;
@ -454,10 +406,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (U s)
{
this->x ^= s;
this->y ^= s;
@ -467,10 +416,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (tvec3<U, P> const & v)
{
this->x ^= v.x;
this->y ^= v.y;
@ -480,10 +426,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (U s)
{
this->x <<= s;
this->y <<= s;
@ -493,10 +436,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (tvec3<U, P> const & v)
{
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y);
@ -506,10 +446,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (U s)
{
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
@ -519,10 +456,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (tvec3<U, P> const & v)
{
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);

View File

@ -214,19 +214,19 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, Q> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v);
@ -242,27 +242,27 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v);
};
@ -279,7 +279,7 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(T const & s, tvec4<T, P> const & v);

View File

@ -142,9 +142,9 @@ namespace detail
template <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4
(
tvec4<U, Q> const & v
) :
(
tvec4<U, Q> const & v
) :
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)),
@ -239,10 +239,7 @@ namespace detail
// Unary arithmetic operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator=
(
tvec4<T, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<T, P> const & v)
{
this->x = v.x;
this->y = v.y;
@ -253,10 +250,7 @@ namespace detail
template <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator=
(
tvec4<U, Q> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<U, Q> const & v)
{
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
@ -267,10 +261,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (U s)
{
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
@ -281,10 +272,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (tvec4<U, P> const & v)
{
this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.y);
@ -295,10 +283,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (U s)
{
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
@ -309,10 +294,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (tvec4<U, P> const & v)
{
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.y);
@ -323,10 +305,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (U s)
{
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
@ -337,10 +316,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (tvec4<U, P> const & v)
{
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.y);
@ -351,10 +327,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (U s)
{
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
@ -365,10 +338,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (tvec4<U, P> const & v)
{
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.y);
@ -421,10 +391,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator%=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator%= (U s)
{
this->x %= static_cast<T>(s);
this->y %= static_cast<T>(s);
@ -435,10 +402,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator%=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator%= (tvec4<U, P> const & v)
{
this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.y);
@ -449,10 +413,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator&=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator&= (U s)
{
this->x &= static_cast<T>(s);
this->y &= static_cast<T>(s);
@ -463,10 +424,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator&=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator&= (tvec4<U, P> const & v)
{
this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.y);
@ -477,10 +435,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator|=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator|= (U s)
{
this->x |= static_cast<T>(s);
this->y |= static_cast<T>(s);
@ -491,10 +446,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator|=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator|= (tvec4<U, P> const & v)
{
this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.y);
@ -505,10 +457,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator^=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator^= (U s)
{
this->x ^= static_cast<T>(s);
this->y ^= static_cast<T>(s);
@ -519,10 +468,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator^=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator^= (tvec4<U, P> const & v)
{
this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.y);
@ -533,10 +479,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator<<=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator<<= (U s)
{
this->x <<= static_cast<T>(s);
this->y <<= static_cast<T>(s);
@ -547,10 +490,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator<<=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator<<= (tvec4<U, P> const & v)
{
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y);
@ -561,10 +501,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator>>=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator>>= (U s)
{
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
@ -575,10 +512,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator>>=
(
tvec4<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator>>= (tvec4<U, P> const & v)
{
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);

View File

@ -153,6 +153,12 @@ int test_vec2_operators()
B /= 2.0f;
Error += B == glm::vec2(2, 1.25) ? 0 : 1;
}
{
glm::vec2 B(2.0f);
B /= B.y;
Error += B == glm::vec2(1.0f) ? 0 : 1;
}
{
glm::vec2 A(1.0f, 2.0f);

View File

@ -135,6 +135,12 @@ int test_vec3_operators()
B /= 2.0f;
Error += B == glm::vec3(2, 1.25, 1) ? 0 : 1;
}
{
glm::vec3 B(2.0f);
B /= B.y;
Error += B == glm::vec3(1.0f) ? 0 : 1;
}
{
glm::vec3 A(1.0f, 2.0f, 3.0f);

View File

@ -158,6 +158,12 @@ int test_vec4_operators()
B /= 2.0f;
Error += B == glm::vec4(2, 1.25, 1, 7.0f / 4.0f / 2.0f) ? 0 : 1;
}
{
glm::vec4 B(2.0f);
B /= B.y;
Error += B == glm::vec4(1.0f) ? 0 : 1;
}
{
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);