Completed GTC_vec1

master
Christophe Riccio ago%!(EXTRA string=11 years)
parent 6d1610ce0d
commit 8a1bf4410b
  1. 11
      glm/detail/type_vec1.hpp
  2. 32
      glm/detail/type_vec2.hpp
  3. 12
      glm/detail/type_vec2.inl
  4. 69
      glm/detail/type_vec3.hpp
  5. 640
      glm/detail/type_vec3.inl
  6. 140
      glm/detail/type_vec4.hpp
  7. 651
      glm/detail/type_vec4.inl
  8. 2
      readme.txt
  9. 77
      test/core/core_type_vec1.cpp
  10. 7
      test/core/core_type_vec2.cpp

@ -130,6 +130,17 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0>
GLM_FUNC_DECL tvec1(detail::_swizzle<1, T, P, tvec1<T, P>, E0, -1,-2,-3> const & that)
{
*this = that();
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
////////////////////////////////////// //////////////////////////////////////
// Unary arithmetic operators // Unary arithmetic operators

@ -117,25 +117,14 @@ namespace glm
GLM_FUNC_DECL explicit tvec2(T const & s); GLM_FUNC_DECL explicit tvec2(T const & s);
GLM_FUNC_DECL tvec2(T const & s1, T const & s2); GLM_FUNC_DECL tvec2(T const & s1, T const & s2);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1>
GLM_FUNC_DECL tvec2(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
{
*this = that();
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V> template <typename A, typename B>
GLM_FUNC_DECL tvec2(U const & x, V const & y); GLM_FUNC_DECL tvec2(A const & x, B const & y);
template <typename U, typename V> template <typename A, typename B>
GLM_FUNC_DECL tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2); GLM_FUNC_DECL tvec2(tvec1<A, P> const & v1, tvec1<B, P> const & v2);
////////////////////////////////////// //////////////////////////////////////
// Conversion vector constructors // Conversion vector constructors
@ -150,6 +139,17 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
template <int E0, int E1>
GLM_FUNC_DECL tvec2(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
{
*this = that();
}
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
////////////////////////////////////// //////////////////////////////////////
// Unary arithmetic operators // Unary arithmetic operators

@ -104,17 +104,17 @@ namespace glm
// Conversion scalar constructors // Conversion scalar constructors
template <typename T, precision P> template <typename T, precision P>
template <typename U, typename V> template <typename A, typename B>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(U const & a, V const & b) : GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(A const & a, B const & b) :
x(static_cast<T>(a)), x(static_cast<T>(a)),
y(static_cast<T>(b)) y(static_cast<T>(b))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, typename V> template <typename A, typename B>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec1<U, P> const & v1, tvec1<V, P> const & v2) : GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec1<A, P> const & a, tvec1<B, P> const & b) :
x(v1.x), x(a.x),
y(v2.x) y(b.x)
{} {}
////////////////////////////////////// //////////////////////////////////////

@ -111,55 +111,37 @@ namespace glm
template <precision Q> template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v); GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
{
*this = tvec3<T, P>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(s, v());
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
GLM_FUNC_DECL explicit tvec3(ctor); GLM_FUNC_DECL explicit tvec3(ctor);
GLM_FUNC_DECL explicit tvec3(T const & s); GLM_FUNC_DECL explicit tvec3(T const & s);
GLM_FUNC_DECL tvec3(T const & s1, T const & s2, T const & s3); GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c);
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V, typename W> template <typename A, typename B, typename C>
GLM_FUNC_DECL tvec3( GLM_FUNC_DECL tvec3(A const & a, B const & b, C const & c);
U const & x, template <typename A, typename B, typename C>
V const & y, GLM_FUNC_DECL tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
W const & z);
////////////////////////////////////// //////////////////////////////////////
// Conversion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & v, B const & s); GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, B const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B, Q> const & v); GLM_FUNC_DECL explicit tvec3(A const & a, tvec2<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v); GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
@ -167,6 +149,29 @@ namespace glm
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
{
*this = tvec3<T, P>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(s, v());
}
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
////////////////////////////////////// //////////////////////////////////////
// Unary arithmetic operators // Unary arithmetic operators

@ -99,15 +99,10 @@ namespace glm
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(T const & a, T const & b, T const & c) :
( x(a),
T const & s0, y(b),
T const & s1, z(c)
T const & s2
) :
x(s0),
y(s1),
z(s2)
{} {}
////////////////////////////////////// //////////////////////////////////////
@ -115,15 +110,18 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C> template <typename A, typename B, typename C>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(A const & a, B const & b, C const & c) :
( x(static_cast<T>(a)),
A const & x, y(static_cast<T>(b)),
B const & y, z(static_cast<T>(c))
C const & z {}
) :
x(static_cast<T>(x)), template <typename T, precision P>
y(static_cast<T>(y)), template <typename A, typename B, typename C>
z(static_cast<T>(z)) GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c) :
x(static_cast<T>(a)),
y(static_cast<T>(b)),
z(static_cast<T>(c))
{} {}
////////////////////////////////////// //////////////////////////////////////
@ -131,34 +129,39 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec2<A, Q> const & a, B const & b) :
( x(static_cast<T>(a.x)),
tvec2<A, Q> const & v, y(static_cast<T>(a.y)),
B const & s z(static_cast<T>(b))
) : {}
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)), template <typename T, precision P>
z(static_cast<T>(s)) template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b) :
x(static_cast<T>(a.x)),
y(static_cast<T>(a.y)),
z(static_cast<T>(b.x))
{}
template <typename T, precision P>
template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(A const & a, tvec2<B, Q> const & b) :
x(static_cast<T>(a)),
y(static_cast<T>(b.x)),
z(static_cast<T>(b.y))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b) :
( x(static_cast<T>(a.x)),
A const & s, y(static_cast<T>(b.x)),
tvec2<B, Q> const & v z(static_cast<T>(b.y))
) :
x(static_cast<T>(s)),
y(static_cast<T>(v.x)),
z(static_cast<T>(v.y))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec3<U, Q> const & v) :
(
tvec3<U, Q> const & v
) :
x(static_cast<T>(v.x)), x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)), y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)) z(static_cast<T>(v.z))
@ -166,10 +169,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec4<U, Q> const & v) :
(
tvec4<U, Q> const & v
) :
x(static_cast<T>(v.x)), x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)), y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)) z(static_cast<T>(v.z))
@ -207,6 +207,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (tvec1<U, P> const & v)
{
this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.x);
this->z += static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -227,6 +237,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (tvec1<U, P> const & v)
{
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.x);
this->z -= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -247,6 +267,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (tvec1<U, P> const & v)
{
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.x);
this->z *= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -267,6 +297,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (tvec1<U, P> const & v)
{
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.x);
this->z /= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -314,29 +354,6 @@ namespace glm
return Result; return Result;
} }
//////////////////////////////////////
// Boolean operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator==
(
tvec3<T, P> const & v1,
tvec3<T, P> const & v2
)
{
return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator!=
(
tvec3<T, P> const & v1,
tvec3<T, P> const & v2
)
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z);
}
////////////////////////////////////// //////////////////////////////////////
// Unary bit operators // Unary bit operators
@ -350,6 +367,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (tvec1<U, P> const & v)
{
this->x %= v.x;
this->y %= v.x;
this->z %= v.x;
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -370,6 +397,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (tvec1<U, P> const & v)
{
this->x &= v.x;
this->y &= v.x;
this->z &= v.x;
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -390,6 +427,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (tvec1<U, P> const & v)
{
this->x |= v.x;
this->y |= v.x;
this->z |= v.x;
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -410,6 +457,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (tvec1<U, P> const & v)
{
this->x ^= v.x;
this->y ^= v.x;
this->z ^= v.x;
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -430,6 +487,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (tvec1<U, P> const & v)
{
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.x);
this->z <<= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -450,6 +517,16 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (tvec1<U, P> const & v)
{
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.x);
this->z >>= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -460,15 +537,26 @@ namespace glm
return *this; return *this;
} }
//////////////////////////////////////
// Boolean operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator==(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{
return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator!=(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z);
}
////////////////////////////////////// //////////////////////////////////////
// Binary arithmetic operators // Binary arithmetic operators
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+ GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x + s, v.x + s,
@ -477,11 +565,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+ GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x + s.x,
) v.y + s.x,
v.z + s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s + v.x, s + v.x,
@ -490,11 +583,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+ GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x + v.x,
) s.x + v.y,
s.x + v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x + v2.x, v1.x + v2.x,
@ -504,11 +602,7 @@ namespace glm
//operator- //operator-
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator- GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x - s, v.x - s,
@ -517,11 +611,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator- GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x - s.x,
) v.y - s.x,
v.z - s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s - v.x, s - v.x,
@ -530,11 +629,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator- GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x - v.x,
) s.x - v.y,
s.x - v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x - v2.x, v1.x - v2.x,
@ -544,11 +648,7 @@ namespace glm
//operator* //operator*
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator* GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x * s, v.x * s,
@ -557,11 +657,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator* GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x * s.x,
) v.y * s.x,
v.z * s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s * v.x, s * v.x,
@ -570,11 +675,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator* GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x * v.x,
) s.x * v.y,
s.x * v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x * v2.x, v1.x * v2.x,
@ -584,11 +694,7 @@ namespace glm
//operator/ //operator/
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/ GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x / s, v.x / s,
@ -597,11 +703,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/ GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x / s.x,
) v.y / s.x,
v.z / s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s / v.x, s / v.x,
@ -610,11 +721,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/ GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x / v.x,
) s.x / v.y,
s.x / v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x / v2.x, v1.x / v2.x,
@ -624,10 +740,7 @@ namespace glm
// Unary constant operators // Unary constant operators
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator- GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v)
(
tvec3<T, P> const & v
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
-v.x, -v.x,
@ -639,11 +752,7 @@ namespace glm
// Binary bit operators // Binary bit operators
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator% GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x % s, v.x % s,
@ -652,11 +761,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator% GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x % s.x,
) v.y % s.x,
v.z % s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s % v.x, s % v.x,
@ -665,11 +779,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator% GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x % v.x,
) s.x % v.y,
s.x % v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x % v2.x, v1.x % v2.x,
@ -678,11 +797,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator& GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x & s, v.x & s,
@ -691,11 +806,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator& GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x & s.x,
) v.y & s.x,
v.z & s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s & v.x, s & v.x,
@ -704,11 +824,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator& GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x & v.x,
) s.x & v.y,
s.x & v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x & v2.x, v1.x & v2.x,
@ -717,11 +842,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator| GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x | s, v.x | s,
@ -730,11 +851,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator| GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x | s.x,
) v.y | s.x,
v.z | s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s | v.x, s | v.x,
@ -743,11 +869,16 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator| GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec1<T, P> const & s, tvec3<T, P> const & v)
( {
tvec3<T, P> const & v1, return tvec3<T, P>(
tvec3<T, P> const & v2 s.x | v.x,
) s.x | v.y,
s.x | v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x | v2.x, v1.x | v2.x,
@ -756,11 +887,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^ GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, T const & s)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x ^ s, v.x ^ s,
@ -769,114 +896,133 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^ GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec3<T, P>(
tvec3<T, P> const & v v.x ^ s.x,
) v.y ^ s.x,
v.z ^ s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(T const & s, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s ^ v.x,
s ^ v.y,
s ^ v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec1<T, P> const & s, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x ^ v.x,
s.x ^ v.y,
s.x ^ v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
{
return tvec3<T, P>(
v1.x ^ v2.x,
v1.y ^ v2.y,
v1.z ^ v2.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & s)
{
return tvec3<T, P>(
v.x << s,
v.y << s,
v.z << s);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & s)
{
return tvec3<T, P>(
v.x << s.x,
v.y << s.x,
v.z << s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(T const & s, tvec3<T, P> const & v)
{ {
return tvec3<T, P>( return tvec3<T, P>(
T(s) ^ v.x, s << v.x,
T(s) ^ v.y, s << v.y,
T(s) ^ v.z); s << v.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^ GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec1<T, P> const & s, tvec3<T, P> const & v)
(
tvec3<T, P> const & v1,
tvec3<T, P> const & v2
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x ^ T(v2.x), s.x << v.x,
v1.y ^ T(v2.y), s.x << v.y,
v1.z ^ T(v2.z)); s.x << v.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<< GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x << T(s), v1.x << v2.x,
v.y << T(s), v1.y << v2.y,
v.z << T(s)); v1.z << v2.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<< GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & s)
(
T const & s,
tvec3<T, P> const & v
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
T(s) << v.x, v.x >> s,
T(s) << v.y, v.y >> s,
T(s) << v.z); v.z >> s);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<< GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & s)
(
tvec3<T, P> const & v1,
tvec3<T, P> const & v2
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x << T(v2.x), v.x >> s.x,
v1.y << T(v2.y), v.y >> s.x,
v1.z << T(v2.z)); v.z >> s.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>> GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(T const & s, tvec3<T, P> const & v)
(
tvec3<T, P> const & v,
T const & s
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v.x >> T(s), s >> v.x,
v.y >> T(s), s >> v.y,
v.z >> T(s)); s >> v.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>> GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec1<T, P> const & s, tvec3<T, P> const & v)
(
T const & s,
tvec3<T, P> const & v
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
s >> T(v.x), s.x >> v.x,
s >> T(v.y), s.x >> v.y,
s >> T(v.z)); s.x >> v.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>> GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v1, tvec3<T, P> const & v2)
(
tvec3<T, P> const & v1,
tvec3<T, P> const & v2
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
v1.x >> T(v2.x), v1.x >> v2.x,
v1.y >> T(v2.y), v1.y >> v2.y,
v1.z >> T(v2.z)); v1.z >> v2.z);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator~ GLM_FUNC_QUALIFIER tvec3<T, P> operator~(tvec3<T, P> const & v)
(
tvec3<T, P> const & v
)
{ {
return tvec3<T, P>( return tvec3<T, P>(
~v.x, ~v.x,

@ -153,48 +153,55 @@ namespace glm
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL explicit tvec4(ctor);
ctor); GLM_FUNC_DECL explicit tvec4(T const & s);
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL tvec4(T const & s0, T const & s1, T const & s2, T const & s3);
T const & s);
GLM_FUNC_DECL tvec4(
T const & s0,
T const & s1,
T const & s2,
T const & s3);
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL tvec4( GLM_FUNC_DECL tvec4(A const & x, B const & y, C const & z, D const & w);
A const & x, template <typename A, typename B, typename C, typename D>
B const & y, GLM_FUNC_DECL tvec4(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c, tvec1<D, P> const & d);
C const & z,
D const & w);
////////////////////////////////////// //////////////////////////////////////
// Conversion vector constructors // Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & v, B const & s1, C const & s2); GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, B const & b, C const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(A const & a, tvec2<B, Q> const & b, C const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(A const & s1, tvec2<B, Q> const & v, C const & s2); GLM_FUNC_DECL explicit tvec4(A const & a, B const & b, tvec2<C, Q> const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tvec2<C, Q> const & v); GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, B const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & v, B const & s); GLM_FUNC_DECL explicit tvec4(A const & a, tvec3<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(A const & s, tvec3<B, Q> const & v); GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & v1, tvec2<B, Q> const & v2); GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v); GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
@ -251,32 +258,31 @@ namespace glm
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator+=(T v); template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<T, P> const & v);
template <typename U, precision Q>
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, Q> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(U s); GLM_FUNC_DECL tvec4<T, P> & operator+=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(U s); GLM_FUNC_DECL tvec4<T, P> & operator-=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(U s); GLM_FUNC_DECL tvec4<T, P> & operator*=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(U s); GLM_FUNC_DECL tvec4<T, P> & operator/=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v);
////////////////////////////////////// //////////////////////////////////////
@ -293,62 +299,98 @@ namespace glm
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (U s); GLM_FUNC_DECL tvec4<T, P> & operator%= (U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (U s); GLM_FUNC_DECL tvec4<T, P> & operator&= (U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (U s); GLM_FUNC_DECL tvec4<T, P> & operator|= (U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (U s); GLM_FUNC_DECL tvec4<T, P> & operator^= (U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U s); GLM_FUNC_DECL tvec4<T, P> & operator<<=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U s); GLM_FUNC_DECL tvec4<T, P> & operator>>=(U s);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v);
}; };
template <typename T, precision P> 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+(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator+(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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-(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator-(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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*(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator*(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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/(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator/(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -364,54 +406,90 @@ namespace glm
template <typename T, precision P> 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%(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator%(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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&(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator&(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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|(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator|(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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^(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator^(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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<<(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator<<(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P> 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>>(tvec4<T, P> const & v, tvec1<T, P> const & s);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(T const & s, tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> operator>>(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec1<T, P> const & s, tvec4<T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

@ -70,7 +70,7 @@ namespace glm
w(0) w(0)
{} {}
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)) #if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4() : GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4() :
data(_mm_setzero_ps()) data(_mm_setzero_ps())
@ -90,7 +90,7 @@ namespace glm
w(v.w) w(v.w)
{} {}
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)) #if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, lowp> const & v) : GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, lowp> const & v) :
data(v.data) data(v.data)
@ -163,29 +163,20 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(A const & a, B const & b, C const & c, D const & d) :
( x(static_cast<T>(a)),
A const & x, y(static_cast<T>(b)),
B const & y, z(static_cast<T>(c)),
C const & z, w(static_cast<T>(d))
D const & w
) :
x(static_cast<T>(x)),
y(static_cast<T>(y)),
z(static_cast<T>(z)),
w(static_cast<T>(w))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename A, typename B, typename C, typename D>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c, tvec1<D, P> const & d) :
( x(static_cast<T>(a.x)),
tvec4<U, Q> const & v y(static_cast<T>(b.x)),
) : z(static_cast<T>(c.x)),
x(static_cast<T>(v.x)), w(static_cast<T>(d.x))
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)),
w(static_cast<T>(v.w))
{} {}
////////////////////////////////////// //////////////////////////////////////
@ -193,26 +184,25 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec2<A, Q> const & a, B const & b, C const & c) :
( x(static_cast<T>(a.x)),
tvec2<A, Q> const & v, y(static_cast<T>(a.y)),
B const & s1, z(static_cast<T>(b)),
C const & s2 w(static_cast<T>(c))
) :
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(s1)),
w(static_cast<T>(s2))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c) :
( x(static_cast<T>(a.x)),
A const & s1, y(static_cast<T>(a.y)),
tvec2<B, Q> const & v, z(static_cast<T>(b.x)),
C const & s2 w(static_cast<T>(c.x))
) : {}
template <typename T, precision P>
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(A const & s1, tvec2<B, Q> const & v, C const & s2) :
x(static_cast<T>(s1)), x(static_cast<T>(s1)),
y(static_cast<T>(v.x)), y(static_cast<T>(v.x)),
z(static_cast<T>(v.y)), z(static_cast<T>(v.y)),
@ -221,55 +211,83 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c) :
( x(static_cast<T>(a.x)),
A const & s1, y(static_cast<T>(b.x)),
B const & s2, z(static_cast<T>(b.y)),
tvec2<C, Q> const & v w(static_cast<T>(c.x))
) : {}
template <typename T, precision P>
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(A const & s1, B const & s2, tvec2<C, Q> const & v) :
x(static_cast<T>(s1)), x(static_cast<T>(s1)),
y(static_cast<T>(s2)), y(static_cast<T>(s2)),
z(static_cast<T>(v.x)), z(static_cast<T>(v.x)),
w(static_cast<T>(v.y)) w(static_cast<T>(v.y))
{} {}
template <typename T, precision P>
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c) :
x(static_cast<T>(a.x)),
y(static_cast<T>(b.x)),
z(static_cast<T>(c.x)),
w(static_cast<T>(c.y))
{}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec3<A, Q> const & a, B const & b) :
( x(static_cast<T>(a.x)),
tvec3<A, Q> const & v, y(static_cast<T>(a.y)),
B const & s z(static_cast<T>(a.z)),
) : w(static_cast<T>(b))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)),
w(static_cast<T>(s))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b) :
( x(static_cast<T>(a.x)),
A const & s, y(static_cast<T>(a.y)),
tvec3<B, Q> const & v z(static_cast<T>(a.z)),
) : w(static_cast<T>(b.x))
x(static_cast<T>(s)),
y(static_cast<T>(v.x)),
z(static_cast<T>(v.y)),
w(static_cast<T>(v.z))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(A const & a, tvec3<B, Q> const & b) :
( x(static_cast<T>(a)),
tvec2<A, Q> const & v1, y(static_cast<T>(b.x)),
tvec2<B, Q> const & v2 z(static_cast<T>(b.y)),
) : w(static_cast<T>(b.z))
x(static_cast<T>(v1.x)), {}
y(static_cast<T>(v1.y)),
z(static_cast<T>(v2.x)), template <typename T, precision P>
w(static_cast<T>(v2.y)) template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b) :
x(static_cast<T>(a.x)),
y(static_cast<T>(b.x)),
z(static_cast<T>(b.y)),
w(static_cast<T>(b.z))
{}
template <typename T, precision P>
template <typename A, typename B, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b) :
x(static_cast<T>(a.x)),
y(static_cast<T>(a.y)),
z(static_cast<T>(b.x)),
w(static_cast<T>(b.y))
{}
template <typename T, precision P>
template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(tvec4<U, Q> const & v) :
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z)),
w(static_cast<T>(v.w))
{} {}
////////////////////////////////////// //////////////////////////////////////
@ -285,7 +303,7 @@ namespace glm
return *this; return *this;
} }
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)) #if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator= (tvec4<float, lowp> const & v) GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator= (tvec4<float, lowp> const & v)
{ {
@ -302,115 +320,48 @@ namespace glm
#endif #endif
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (T v) template <typename U>
{ GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator=(tvec4<U, P> const & v)
this->x += v;
this->y += v;
this->z += v;
this->w += v;
return *this;
}
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2))
template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+= (float s)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(s));
return *this;
}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+= (float s)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(s));
return *this;
}
#endif
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (tvec4<T, P> const & v)
{
this->x += v.x;
this->y += v.y;
this->z += v.z;
this->w += v.w;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (T v)
{
this->x -= v;
this->y -= v;
this->z -= v;
this->w -= v;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (tvec4<T, P> const & v)
{
this->x -= v.x;
this->y -= v.y;
this->z -= v.z;
this->w -= v.w;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (T v)
{
this->x *= v;
this->y *= v;
this->z *= v;
this->w *= v;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (tvec4<T, P> const & v)
{ {
this->x *= v.x; this->x = static_cast<T>(v.x);
this->y *= v.y; this->y = static_cast<T>(v.y);
this->z *= v.z; this->z = static_cast<T>(v.z);
this->w *= v.w; this->w = static_cast<T>(v.w);
return *this; return *this;
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (T v) template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+=(U s)
{ {
this->x /= v; this->x += static_cast<T>(s);
this->y /= v; this->y += static_cast<T>(s);
this->z /= v; this->z += static_cast<T>(s);
this->w /= v; this->w += static_cast<T>(s);
return *this; return *this;
} }
template <typename T, precision P> #if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (tvec4<T, P> const & v) template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(U s)
{ {
this->x /= v.x; this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
this->y /= v.y;
this->z /= v.z;
this->w /= v.w;
return *this; return *this;
} }
template <typename T, precision P> template <>
template <typename U, precision Q> template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<U, Q> const & v) GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(U s)
{ {
this->x = static_cast<T>(v.x); this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
this->y = static_cast<T>(v.y);
this->z = static_cast<T>(v.z);
this->w = static_cast<T>(v.w);
return *this; return *this;
} }
#endif
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (U s) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+=(tvec1<U, P> const & s)
{ {
this->x += static_cast<T>(s); this->x += static_cast<T>(s);
this->y += static_cast<T>(s); this->y += static_cast<T>(s);
@ -419,10 +370,10 @@ namespace glm
return *this; return *this;
} }
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)) #if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
template <> template <>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+= (U s) GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(tvec1<U, P> const & s)
{ {
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s))); this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
return *this; return *this;
@ -430,7 +381,7 @@ namespace glm
template <> template <>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+= (U s) GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(tvec1<U, P> const & s)
{ {
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s))); this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
return *this; return *this;
@ -459,6 +410,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-=(tvec1<U, P> const & v)
{
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.x);
this->z -= static_cast<T>(v.x);
this->w -= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -481,6 +443,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*=(tvec1<U, P> const & v)
{
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.x);
this->z *= static_cast<T>(v.x);
this->w *= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -503,6 +476,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/=(tvec1<U, P> const & v)
{
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.x);
this->z /= static_cast<T>(v.x);
this->w /= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -567,6 +551,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator%=(tvec1<U, P> const & v)
{
this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.x);
this->z %= static_cast<T>(v.x);
this->w %= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -589,6 +584,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator&=(tvec1<U, P> const & v)
{
this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.x);
this->z &= static_cast<T>(v.x);
this->w &= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -611,6 +617,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator|=(tvec1<U, P> const & v)
{
this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.x);
this->z |= static_cast<T>(v.x);
this->w |= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -633,6 +650,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator^=(tvec1<U, P> const & v)
{
this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.x);
this->z ^= static_cast<T>(v.x);
this->w ^= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -655,6 +683,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator<<=(tvec1<U, P> const & v)
{
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.x);
this->z <<= static_cast<T>(v.x);
this->w <<= static_cast<T>(v.x);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -677,6 +716,17 @@ namespace glm
return *this; return *this;
} }
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator>>=(tvec1<U, P> const & v)
{
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);
this->z >>= static_cast<T>(v.z);
this->w >>= static_cast<T>(v.w);
return *this;
}
template <typename T, precision P> template <typename T, precision P>
template <typename U> 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)
@ -688,6 +738,21 @@ namespace glm
return *this; return *this;
} }
//////////////////////////////////////
// Boolean operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator==(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w);
}
////////////////////////////////////// //////////////////////////////////////
// Binary arithmetic operators // Binary arithmetic operators
@ -876,38 +941,11 @@ namespace glm
-v.w); -v.w);
} }
//////////////////////////////////////
// Boolean operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator==
(
tvec4<T, P> const & v1,
tvec4<T, P> const & v2
)
{
return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator!=
(
tvec4<T, P> const & v1,
tvec4<T, P> const & v2
)
{
return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w);
}
////////////////////////////////////// //////////////////////////////////////
// Binary bit operators // Binary bit operators
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator% GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x % s, v.x % s,
@ -917,11 +955,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator% GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x % s.x,
) v.y % s.x,
v.z % s.x,
v.w % s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s % v.x, s % v.x,
@ -931,11 +975,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator% GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x % v.x,
) s.x % v.y,
s.x % v.z,
s.x % v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x % v2.x, v1.x % v2.x,
@ -945,11 +995,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator& GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x & s, v.x & s,
@ -959,11 +1005,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator& GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x & s.x,
) v.y & s.x,
v.z & s.x,
v.w & s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s & v.x, s & v.x,
@ -973,11 +1025,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator& GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x & v.x,
) s.x & v.y,
s.x & v.z,
s.x & v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x & v2.x, v1.x & v2.x,
@ -987,11 +1045,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator| GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x | s, v.x | s,
@ -1001,11 +1055,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator| GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x | s.x,
) v.y | s.x,
v.z | s.x,
v.w | s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s | v.x, s | v.x,
@ -1015,11 +1075,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator| GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x | v.x,
) s.x | v.y,
s.x | v.z,
s.x | v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x | v2.x, v1.x | v2.x,
@ -1029,11 +1095,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^ GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x ^ s, v.x ^ s,
@ -1043,11 +1105,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^ GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x ^ s.x,
) v.y ^ s.x,
v.z ^ s.x,
v.w ^ s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s ^ v.x, s ^ v.x,
@ -1057,11 +1125,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^ GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x ^ v.x,
) s.x ^ v.y,
s.x ^ v.z,
s.x ^ v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x ^ v2.x, v1.x ^ v2.x,
@ -1071,11 +1145,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<< GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x << s, v.x << s,
@ -1085,11 +1155,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<< GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x << s.x,
) v.y << s.x,
v.z << s.x,
v.w << s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s << v.x, s << v.x,
@ -1099,11 +1175,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<< GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x << v.x,
) s.x << v.y,
s.x << v.z,
s.x << v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x << v2.x, v1.x << v2.x,
@ -1113,11 +1195,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>> GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec4<T, P> const & v, T const & s)
(
tvec4<T, P> const & v,
T const & s
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v.x >> s, v.x >> s,
@ -1127,11 +1205,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>> GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & s)
( {
T const & s, return tvec4<T, P>(
tvec4<T, P> const & v v.x >> s.x,
) v.y >> s.x,
v.z >> s.x,
v.w >> s.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(T const & s, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(
s >> v.x, s >> v.x,
@ -1141,11 +1225,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>> GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec1<T, P> const & s, tvec4<T, P> const & v)
( {
tvec4<T, P> const & v1, return tvec4<T, P>(
tvec4<T, P> const & v2 s.x >> v.x,
) s.x >> v.y,
s.x >> v.z,
s.x >> v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(
v1.x >> v2.x, v1.x >> v2.x,
@ -1155,10 +1245,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator~ GLM_FUNC_QUALIFIER tvec4<T, P> operator~(tvec4<T, P> const & v)
(
tvec4<T, P> const & v
)
{ {
return tvec4<T, P>( return tvec4<T, P>(
~v.x, ~v.x,

@ -50,7 +50,7 @@ GLM 0.9.6.0: 2014-XX-XX
- Added move contructors and assignment operators #141 - Added move contructors and assignment operators #141
- Use pragma once - Use pragma once
- Fixed Visual Studio 14 compiler warnings - Fixed Visual Studio 14 compiler warnings
- Added *vec1 support to *vec2 and *vec3 types - Added GTC_vec1 extension, *vec1 support to *vec2 and *vec3 types
- Limited extended integer type redifinition #233 - Limited extended integer type redifinition #233
- Improved linearRand: support precision and integers #230 - Improved linearRand: support precision and integers #230
- Added vec3 slerp #237 - Added vec3 slerp #237

@ -8,9 +8,11 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE #define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp> #include <glm/gtc/vec1.hpp>
#include <vector>
int test_operators() int test_vec1_operators()
{ {
int Error(0); int Error(0);
@ -38,7 +40,69 @@ int test_operators()
return Error; return Error;
} }
int test_operator_increment() int test_vec1_ctor()
{
int Error = 0;
/*
#if GLM_HAS_INITIALIZER_LISTS
{
glm::vec1 a{ 0 };
std::vector<glm::vec1> v = {
{0.f},
{4.f},
{8.f}};
}
{
glm::dvec2 a{ 0 };
std::vector<glm::dvec1> v = {
{0.0},
{4.0},
{8.0}};
}
#endif
*/
#if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
glm::vec2 C(A.xy);
glm::vec2 D(A.xy());
Error += glm::all(glm::equal(A, B)) ? 0 : 1;
Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1;
}
#endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{
glm::vec2 A = glm::vec2(2.0f);
glm::vec2 B = glm::vec2(2.0f, 3.0f);
glm::vec2 C = glm::vec2(2.0f, 3.0);
//glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says?
glm::vec2 E(glm::dvec2(2.0));
glm::vec2 F(glm::ivec2(2));
}
return Error;
}
int test_vec1_size()
{
int Error = 0;
Error += sizeof(glm::vec1) == sizeof(glm::mediump_vec1) ? 0 : 1;
Error += 8 == sizeof(glm::mediump_vec1) ? 0 : 1;
Error += sizeof(glm::dvec1) == sizeof(glm::highp_dvec1) ? 0 : 1;
Error += 16 == sizeof(glm::highp_dvec1) ? 0 : 1;
Error += glm::vec1().length() == 2 ? 0 : 1;
Error += glm::dvec1().length() == 2 ? 0 : 1;
return Error;
}
int test_vec1_operator_increment()
{ {
int Error(0); int Error(0);
@ -69,8 +133,13 @@ int main()
{ {
int Error = 0; int Error = 0;
Error += test_operators(); glm::vec1 v;
Error += test_operator_increment(); assert(v.length() == 1);
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();
Error += test_vec1_operator_increment();
return Error; return Error;
} }

@ -201,7 +201,7 @@ int test_vec2_ctor()
{ {
int Error = 0; int Error = 0;
#if(GLM_HAS_INITIALIZER_LISTS) #if GLM_HAS_INITIALIZER_LISTS
{ {
glm::vec2 a{ 0, 1 }; glm::vec2 a{ 0, 1 };
std::vector<glm::vec2> v = { std::vector<glm::vec2> v = {
@ -219,7 +219,7 @@ int test_vec2_ctor()
} }
#endif #endif
#if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) #if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{ {
glm::vec2 A = glm::vec2(1.0f, 2.0f); glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy; glm::vec2 B = A.xy;
@ -230,7 +230,7 @@ int test_vec2_ctor()
Error += glm::all(glm::equal(A, C)) ? 0 : 1; Error += glm::all(glm::equal(A, C)) ? 0 : 1;
Error += glm::all(glm::equal(A, D)) ? 0 : 1; Error += glm::all(glm::equal(A, D)) ? 0 : 1;
} }
#endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)) #endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
{ {
glm::vec2 A = glm::vec2(2.0f); glm::vec2 A = glm::vec2(2.0f);
@ -239,7 +239,6 @@ int test_vec2_ctor()
//glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says? //glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says?
glm::vec2 E(glm::dvec2(2.0)); glm::vec2 E(glm::dvec2(2.0));
glm::vec2 F(glm::ivec2(2)); glm::vec2 F(glm::ivec2(2));
} }
return Error; return Error;

Loading…
Cancel
Save