From f21030cce25d2866e1a6160e2eddfbc518decd4a Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 2 Jun 2011 13:20:06 +0100 Subject: [PATCH] Fixed typos --- glm/core/_swizzle.inl | 20 - glm/core/type_vec1.inl | 1555 +++++++++++++------------- glm/core/type_vec2.inl | 1933 ++++++++++++++++---------------- glm/core/type_vec3.inl | 2107 ++++++++++++++++++----------------- glm/core/type_vec4.inl | 2365 ++++++++++++++++++++-------------------- 5 files changed, 3978 insertions(+), 4002 deletions(-) delete mode 100644 glm/core/_swizzle.inl diff --git a/glm/core/_swizzle.inl b/glm/core/_swizzle.inl deleted file mode 100644 index 8502d9e3..00000000 --- a/glm/core/_swizzle.inl +++ /dev/null @@ -1,20 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2006-04-27 -// Updated : 2006-04-27 -// Licence : This source is under MIT License -// File : _swizzle.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __swizzle_inl__ -#define __swizzle_inl__ - -#include "./_swizzle.h" - -namespace glm -{ - -} - -#endif//__swizzle_inl__ diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index df0d1ada..835ad4b7 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -7,879 +7,878 @@ // File : glm/core/type_vec1.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { - namespace detail + template + GLM_FUNC_QUALIFIER typename tvec1::size_type tvec1::length() const { - template - GLM_FUNC_QUALIFIER typename tvec1::size_type tvec1::length() const - { - return 1; - } + return 1; + } - template - GLM_FUNC_QUALIFIER typename tvec1::size_type tvec1::value_size() - { - return 1; - } + template + GLM_FUNC_QUALIFIER typename tvec1::size_type tvec1::value_size() + { + return 1; + } - ////////////////////////////////////// - // Accesses + ////////////////////////////////////// + // Accesses - template - GLM_FUNC_QUALIFIER typename tvec1::value_type & tvec1::operator[] - ( - size_type i - ) - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec1::value_type & tvec1::operator[] + ( + size_type i + ) + { + assert(i < value_size()); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER typename tvec1::value_type const & tvec1::operator[] - ( - size_type i - ) const - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec1::value_type const & tvec1::operator[] + ( + size_type i + ) const + { + assert(i < value_size()); + return (&x)[i]; + } - ////////////////////////////////////// - // Implicit basic constructors + ////////////////////////////////////// + // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tvec1::tvec1() : - x(value_type(0)) - {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1() : + x(value_type(0)) + {} - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - ctor - ) - {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + ctor + ) + {} - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - tvec1 const & v - ) : - x(v.x) - {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + tvec1 const & v + ) : + x(v.x) + {} - ////////////////////////////////////// - // Explicit basic constructors + ////////////////////////////////////// + // Explicit basic constructors - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - value_type const & s - ) : - x(s) - {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + value_type const & s + ) : + x(s) + {} - ////////////////////////////////////// - // Swizzle constructors + ////////////////////////////////////// + // Swizzle constructors - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - tref1 const & r - ) : - x(r.x) - {} + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + tref1 const & r + ) : + x(r.x) + {} - ////////////////////////////////////// - // Convertion scalar constructors + ////////////////////////////////////// + // Convertion scalar constructors - template - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - U const & s - ) : - x(value_type(s)) - {} + template + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + U const & s + ) : + x(value_type(s)) + {} - ////////////////////////////////////// - // Convertion vector constructors + ////////////////////////////////////// + // Convertion vector constructors - template - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - tvec2 const & v - ) : - x(value_type(v.x)) - {} + template + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + tvec2 const & v + ) : + x(value_type(v.x)) + {} - template - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - tvec3 const & v - ) : - x(value_type(v.x)) - {} + template + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + tvec3 const & v + ) : + x(value_type(v.x)) + {} - template - template - GLM_FUNC_QUALIFIER tvec1::tvec1 - ( - tvec4 const & v - ) : - x(value_type(v.x)) - {} + template + template + GLM_FUNC_QUALIFIER tvec1::tvec1 + ( + tvec4 const & v + ) : + x(value_type(v.x)) + {} - ////////////////////////////////////// - // Unary arithmetic operators + ////////////////////////////////////// + // Unary arithmetic operators - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator= - ( - tvec1 const & v - ) - { - this->x = v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator= + ( + tvec1 const & v + ) + { + this->x = v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+= - ( - value_type const & s - ) - { - this->x += s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+= + ( + value_type const & s + ) + { + this->x += s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+= - ( - tvec1 const & v - ) - { - this->x += v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+= + ( + tvec1 const & v + ) + { + this->x += v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-= - ( - value_type const & s - ) - { - this->x -= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-= + ( + value_type const & s + ) + { + this->x -= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-= - ( - tvec1 const & v - ) - { - this->x -= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-= + ( + tvec1 const & v + ) + { + this->x -= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*= - ( - value_type const & s - ) - { - this->x *= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*= + ( + value_type const & s + ) + { + this->x *= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*= - ( - tvec1 const & v - ) - { - this->x *= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*= + ( + tvec1 const & v + ) + { + this->x *= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/= - ( - value_type const & s - ) - { - this->x /= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/= + ( + value_type const & s + ) + { + this->x /= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/= - ( - tvec1 const & v - ) - { - this->x /= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/= + ( + tvec1 const & v + ) + { + this->x /= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator++() - { - ++this->x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator++() + { + ++this->x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator--() - { - --this->x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator--() + { + --this->x; + return *this; + } - ////////////////////////////////////// - // Boolean operators + ////////////////////////////////////// + // Boolean operators - template - GLM_FUNC_QUALIFIER bool operator== - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return (v1.x == v2.x); - } + template + GLM_FUNC_QUALIFIER bool operator== + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return (v1.x == v2.x); + } - template - GLM_FUNC_QUALIFIER bool operator!= - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return (v1.x != v2.x); - } + template + GLM_FUNC_QUALIFIER bool operator!= + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return (v1.x != v2.x); + } - ////////////////////////////////////// - // Unary bit operators + ////////////////////////////////////// + // Unary bit operators - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%= - ( - value_type const & s - ) - { - this->x %= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%= + ( + value_type const & s + ) + { + this->x %= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%= - ( - tvec1 const & v - ) - { - this->x %= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%= + ( + tvec1 const & v + ) + { + this->x %= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&= - ( - value_type const & s - ) - { - this->x &= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&= + ( + value_type const & s + ) + { + this->x &= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&= - ( - tvec1 const & v - ) - { - this->x &= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&= + ( + tvec1 const & v + ) + { + this->x &= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|= - ( - value_type const & s - ) - { - this->x |= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|= + ( + value_type const & s + ) + { + this->x |= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|= - ( - tvec1 const & v - ) - { - this->x |= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|= + ( + tvec1 const & v + ) + { + this->x |= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^= - ( - value_type const & s - ) - { - this->x ^= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^= + ( + value_type const & s + ) + { + this->x ^= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^= - ( - tvec1 const & v - ) - { - this->x ^= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^= + ( + tvec1 const & v + ) + { + this->x ^= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<= - ( - value_type const & s - ) - { - this->x <<= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<= + ( + value_type const & s + ) + { + this->x <<= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<= - ( - tvec1 const & v - ) - { - this->x <<= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<= + ( + tvec1 const & v + ) + { + this->x <<= v.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>= - ( - value_type const & s - ) - { - this->x >>= s; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>= + ( + value_type const & s + ) + { + this->x >>= s; + return *this; + } - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>= - ( - tvec1 const & v - ) - { - this->x >>= v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>= + ( + tvec1 const & v + ) + { + this->x >>= v.x; + return *this; + } - ////////////////////////////////////// - // Swizzle operators + ////////////////////////////////////// + // Swizzle operators - template - GLM_FUNC_QUALIFIER T - tvec1::swizzle(comp x) const - { - return (*this)[x]; - } + template + GLM_FUNC_QUALIFIER T + tvec1::swizzle(comp x) const + { + return (*this)[x]; + } - template - GLM_FUNC_QUALIFIER tvec2 - tvec1::swizzle - ( - comp x, - comp y - ) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } + template + GLM_FUNC_QUALIFIER tvec2 + tvec1::swizzle + ( + comp x, + comp y + ) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } - template - GLM_FUNC_QUALIFIER tvec3 - tvec1::swizzle - ( - comp x, - comp y, - comp z - ) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } + template + GLM_FUNC_QUALIFIER tvec3 + tvec1::swizzle + ( + comp x, + comp y, + comp z + ) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } - template - GLM_FUNC_QUALIFIER tvec4 - tvec1::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } + template + GLM_FUNC_QUALIFIER tvec4 + tvec1::swizzle + ( + comp x, + comp y, + comp z, + comp w + ) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } - template - GLM_FUNC_QUALIFIER tref1 - tvec1::swizzle - ( - comp x - ) - { - return tref1( - (*this)[x]); - } + template + GLM_FUNC_QUALIFIER tref1 + tvec1::swizzle + ( + comp x + ) + { + return tref1( + (*this)[x]); + } - ////////////////////////////////////// - // Binary arithmetic operators + ////////////////////////////////////// + // Binary arithmetic operators - template - GLM_FUNC_QUALIFIER tvec1 operator+ - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x + s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator+ + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x + s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator+ - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s + v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator+ + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s + v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator+ - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x + v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator+ + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x + v2.x); + } - //operator- - template - GLM_FUNC_QUALIFIER tvec1 operator- - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x - s); - } + //operator- + template + GLM_FUNC_QUALIFIER tvec1 operator- + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x - s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator- - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s - v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator- + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s - v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator- - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x - v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator- + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x - v2.x); + } - //operator* - template - GLM_FUNC_QUALIFIER tvec1 operator* - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x * s); - } + //operator* + template + GLM_FUNC_QUALIFIER tvec1 operator* + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x * s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator* - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s * v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator* + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s * v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator* - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x * v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator* + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x * v2.x); + } - //operator/ - template - GLM_FUNC_QUALIFIER tvec1 operator/ - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x / s); - } + //operator/ + template + GLM_FUNC_QUALIFIER tvec1 operator/ + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x / s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator/ - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s / v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator/ + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s / v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator/ - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x / v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator/ + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x / v2.x); + } - // Unary constant operators - template - GLM_FUNC_QUALIFIER tvec1 operator- - ( - tvec1 const & v - ) - { - return tvec1( - -v.x); - } + // Unary constant operators + template + GLM_FUNC_QUALIFIER tvec1 operator- + ( + tvec1 const & v + ) + { + return tvec1( + -v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator++ - ( - tvec1 const & v, - int - ) - { - return tvec1( - v.x + T(1)); - } + template + GLM_FUNC_QUALIFIER tvec1 operator++ + ( + tvec1 const & v, + int + ) + { + return tvec1( + v.x + T(1)); + } - template - GLM_FUNC_QUALIFIER tvec1 operator-- - ( - tvec1 const & v, - int - ) - { - return tvec1( - v.x - T(1)); - } + template + GLM_FUNC_QUALIFIER tvec1 operator-- + ( + tvec1 const & v, + int + ) + { + return tvec1( + v.x - T(1)); + } - ////////////////////////////////////// - // Binary bit operators + ////////////////////////////////////// + // Binary bit operators - template - GLM_FUNC_QUALIFIER tvec1 operator% - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x % s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator% + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x % s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator% - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s % v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator% + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s % v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator% - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x % v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator% + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x % v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator& - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x & s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator& + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x & s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator& - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s & v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator& + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s & v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator& - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x & v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator& + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x & v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator| - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x | s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator| + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x | s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator| - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s | v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator| + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s | v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator| - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x | v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator| + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x | v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator^ - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x ^ s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator^ + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x ^ s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator^ - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s ^ v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator^ + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s ^ v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator^ - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x ^ v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator^ + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x ^ v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator<< - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x << s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator<< + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x << s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator<< - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s << v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator<< + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s << v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator<< - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x << v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator<< + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x << v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator>> - ( - tvec1 const & v, - typename tvec1::value_type const & s - ) - { - return tvec1( - v.x >> s); - } + template + GLM_FUNC_QUALIFIER tvec1 operator>> + ( + tvec1 const & v, + typename tvec1::value_type const & s + ) + { + return tvec1( + v.x >> s); + } - template - GLM_FUNC_QUALIFIER tvec1 operator>> - ( - typename tvec1::value_type const & s, - tvec1 const & v - ) - { - return tvec1( - s >> v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator>> + ( + typename tvec1::value_type const & s, + tvec1 const & v + ) + { + return tvec1( + s >> v.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator>> - ( - tvec1 const & v1, - tvec1 const & v2 - ) - { - return tvec1( - v1.x >> v2.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator>> + ( + tvec1 const & v1, + tvec1 const & v2 + ) + { + return tvec1( + v1.x >> v2.x); + } - template - GLM_FUNC_QUALIFIER tvec1 operator~ - ( - tvec1 const & v - ) - { - return tvec1( - ~v.x); - } + template + GLM_FUNC_QUALIFIER tvec1 operator~ + ( + tvec1 const & v + ) + { + return tvec1( + ~v.x); + } - ////////////////////////////////////// - // tref definition + ////////////////////////////////////// + // tref definition - template - GLM_FUNC_QUALIFIER tref1::tref1 - ( - T & x - ) : - x(x) - {} + template + GLM_FUNC_QUALIFIER tref1::tref1 + ( + T & x + ) : + x(x) + {} - template - GLM_FUNC_QUALIFIER tref1::tref1 - ( - tref1 const & r - ) : - x(r.x) - {} + template + GLM_FUNC_QUALIFIER tref1::tref1 + ( + tref1 const & r + ) : + x(r.x) + {} - template - GLM_FUNC_QUALIFIER tref1::tref1 - ( - tvec1 const & v - ) : - x(v.x) - {} + template + GLM_FUNC_QUALIFIER tref1::tref1 + ( + tvec1 const & v + ) : + x(v.x) + {} - template - GLM_FUNC_QUALIFIER tref1 & tref1::operator= - ( - tref1 const & r - ) - { - x = r.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tref1 & tref1::operator= + ( + tref1 const & r + ) + { + x = r.x; + return *this; + } - template - GLM_FUNC_QUALIFIER tref1 & tref1::operator= - ( - tvec1 const & v - ) - { - x = v.x; - return *this; - } + template + GLM_FUNC_QUALIFIER tref1 & tref1::operator= + ( + tvec1 const & v + ) + { + x = v.x; + return *this; + } - }//namespace detail +}//namespace detail }//namespace glm diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index b9fc67cb..28f8edbe 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -7,1005 +7,1004 @@ // File : glm/core/type_tvec2.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { - namespace detail + template + GLM_FUNC_QUALIFIER typename tvec2::size_type tvec2::length() const { - template - GLM_FUNC_QUALIFIER typename tvec2::size_type tvec2::length() const - { - return 2; - } + return 2; + } - template - GLM_FUNC_QUALIFIER typename tvec2::size_type tvec2::value_size() - { - return 2; - } + template + GLM_FUNC_QUALIFIER typename tvec2::size_type tvec2::value_size() + { + return 2; + } - ////////////////////////////////////// - // Accesses + ////////////////////////////////////// + // Accesses - template - GLM_FUNC_QUALIFIER typename tvec2::value_type & - tvec2::operator[] - ( - size_type i - ) - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec2::value_type & + tvec2::operator[] + ( + size_type i + ) + { + assert(i < value_size()); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER typename tvec2::value_type const & - tvec2::operator[] - ( - size_type i - ) const - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec2::value_type const & + tvec2::operator[] + ( + size_type i + ) const + { + assert(i < value_size()); + return (&x)[i]; + } - ////////////////////////////////////// - // Implicit basic constructors + ////////////////////////////////////// + // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tvec2::tvec2() : - x(value_type(0)), - y(value_type(0)) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2() : + x(value_type(0)), + y(value_type(0)) + {} - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - ctor - ) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + ctor + ) + {} - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec2 const & v - ) : - x(v.x), - y(v.y) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + tvec2 const & v + ) : + x(v.x), + y(v.y) + {} - ////////////////////////////////////// - // Explicit basic constructors + ////////////////////////////////////// + // Explicit basic constructors - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - value_type const & s - ) : - x(s), - y(s) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + value_type const & s + ) : + x(s), + y(s) + {} - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - value_type const & s1, - value_type const & s2 - ) : - x(s1), - y(s2) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + value_type const & s1, + value_type const & s2 + ) : + x(s1), + y(s2) + {} - ////////////////////////////////////// - // Swizzle constructors + ////////////////////////////////////// + // Swizzle constructors - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tref2 const & r - ) : - x(r.x), - y(r.y) - {} + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + tref2 const & r + ) : + x(r.x), + y(r.y) + {} - ////////////////////////////////////// - // Convertion scalar constructors + ////////////////////////////////////// + // Convertion scalar constructors - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & x - ) : - x(value_type(x)), - y(value_type(x)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & x, - V const & y - ) : - x(value_type(x)), - y(value_type(y)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec2 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec3 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec4 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= - ( - tvec2 const & v - ) - { - this->x = v.x; - this->y = v.y; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= - ( - tvec2 const & v - ) - { - this->x = T(v.x); - this->y = T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - U const & s - ) - { - this->x += T(s); - this->y += T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - tvec2 const & v - ) - { - this->x += T(v.x); - this->y += T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - U const & s - ) - { - this->x -= T(s); - this->y -= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - tvec2 const & v - ) - { - this->x -= T(v.x); - this->y -= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= - ( - U const & s - ) - { - this->x *= T(s); - this->y *= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= - ( - tvec2 const & v - ) - { - this->x *= T(v.x); - this->y *= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - U const & s - ) - { - this->x /= T(s); - this->y /= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - tvec2 const & v - ) - { - this->x /= T(v.x); - this->y /= T(v.y); - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator++() - { - ++this->x; - ++this->y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator--() - { - --this->x; - --this->y; - return *this; - } - - ////////////////////////////////////// - // Boolean operators - - template - GLM_FUNC_QUALIFIER bool operator== - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return (v1.x == v2.x) && (v1.y == v2.y); - } - - template - GLM_FUNC_QUALIFIER bool operator!= - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return (v1.x != v2.x) || (v1.y != v2.y); - } - - ////////////////////////////////////// - // Unary bit operators - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= - ( - U const & s - ) - { - this->x %= T(s); - this->y %= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= - ( - tvec2 const & v - ) - { - this->x %= T(v.x); - this->y %= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= - ( - U const & s - ) - { - this->x &= T(s); - this->y &= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= - ( - tvec2 const & v - ) - { - this->x &= T(v.x); - this->y &= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= - ( - U const & s - ) - { - this->x |= T(s); - this->y |= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= - ( - tvec2 const & v - ) - { - this->x |= T(v.x); - this->y |= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= - ( - U const & s - ) - { - this->x ^= T(s); - this->y ^= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= - ( - tvec2 const & v - ) - { - this->x ^= T(v.x); - this->y ^= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= - ( - U const & s - ) - { - this->x <<= T(s); - this->y <<= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= - ( - tvec2 const & v - ) - { - this->x <<= T(v.x); - this->y <<= T(v.y); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= - ( - U const & s - ) - { - this->x >>= T(s); - this->y >>= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= - ( - tvec2 const & v - ) - { - this->x >>= T(v.x); - this->y >>= T(v.y); - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER typename tvec2::value_type tvec2::swizzle - ( - comp x - ) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec2::swizzle - ( - comp x, - comp y - ) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec2::swizzle - ( - comp x, - comp y, - comp z - ) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec2::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref2 tvec2::swizzle - ( - comp x, - comp y - ) - { - return tref2( - (*this)[x], - (*this)[y]); - } - - ////////////////////////////////////// - // Binary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x + T(s), - v.y + T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) + v.x, - T(s) + v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator+ - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x + T(v2.x), - v1.y + T(v2.y)); - } - - //operator- - template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x - T(s), - v.y - T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) - v.x, - T(s) - v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x - T(v2.x), - v1.y - T(v2.y)); - } - - //operator* - template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x * T(s), - v.y * T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) * v.x, - T(s) * v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator* - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x * T(v2.x), - v1.y * T(v2.y)); - } - - //operator/ - template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x / T(s), - v.y / T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) / v.x, - T(s) / v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator/ - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x / T(v2.x), - v1.y / T(v2.y)); - } - - // Unary constant operators - template - GLM_FUNC_QUALIFIER tvec2 operator- - ( - tvec2 const & v - ) - { - return tvec2( - -v.x, - -v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator++ - ( - tvec2 const & v, - int - ) - { - return tvec2( - v.x + T(1), - v.y + T(1)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator-- - ( - tvec2 const & v, - int - ) - { - return tvec2( - v.x - T(1), - v.y - T(1)); - } - - ////////////////////////////////////// - // Binary bit operators - - template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x % T(s), - v.y % T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) % v.x, - T(s) % v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator% - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x % T(v2.x), - v1.y % T(v2.y)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x & T(s), - v.y & T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) & v.x, - T(s) & v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator& - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x & T(v2.x), - v1.y & T(v2.y)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x | T(s), - v.y | T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) | v.x, - T(s) | v.y); - } - - template - GLM_FUNC_QUALIFIER tvec2 operator| - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x | T(v2.x), - v1.y | T(v2.y)); - } + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + U const & x + ) : + x(value_type(x)), + y(value_type(x)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + U const & x, + V const & y + ) : + x(value_type(x)), + y(value_type(y)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + tvec2 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + tvec3 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec2::tvec2 + ( + tvec4 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= + ( + tvec2 const & v + ) + { + this->x = v.x; + this->y = v.y; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= + ( + tvec2 const & v + ) + { + this->x = T(v.x); + this->y = T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= + ( + U const & s + ) + { + this->x += T(s); + this->y += T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= + ( + tvec2 const & v + ) + { + this->x += T(v.x); + this->y += T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= + ( + U const & s + ) + { + this->x -= T(s); + this->y -= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= + ( + tvec2 const & v + ) + { + this->x -= T(v.x); + this->y -= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= + ( + U const & s + ) + { + this->x *= T(s); + this->y *= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= + ( + tvec2 const & v + ) + { + this->x *= T(v.x); + this->y *= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= + ( + U const & s + ) + { + this->x /= T(s); + this->y /= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= + ( + tvec2 const & v + ) + { + this->x /= T(v.x); + this->y /= T(v.y); + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator++() + { + ++this->x; + ++this->y; + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator--() + { + --this->x; + --this->y; + return *this; + } + + ////////////////////////////////////// + // Boolean operators + + template + GLM_FUNC_QUALIFIER bool operator== + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y); + } + + template + GLM_FUNC_QUALIFIER bool operator!= + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y); + } + + ////////////////////////////////////// + // Unary bit operators + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= + ( + U const & s + ) + { + this->x %= T(s); + this->y %= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%= + ( + tvec2 const & v + ) + { + this->x %= T(v.x); + this->y %= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= + ( + U const & s + ) + { + this->x &= T(s); + this->y &= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&= + ( + tvec2 const & v + ) + { + this->x &= T(v.x); + this->y &= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= + ( + U const & s + ) + { + this->x |= T(s); + this->y |= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|= + ( + tvec2 const & v + ) + { + this->x |= T(v.x); + this->y |= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= + ( + U const & s + ) + { + this->x ^= T(s); + this->y ^= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^= + ( + tvec2 const & v + ) + { + this->x ^= T(v.x); + this->y ^= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= + ( + U const & s + ) + { + this->x <<= T(s); + this->y <<= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<= + ( + tvec2 const & v + ) + { + this->x <<= T(v.x); + this->y <<= T(v.y); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= + ( + U const & s + ) + { + this->x >>= T(s); + this->y >>= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>= + ( + tvec2 const & v + ) + { + this->x >>= T(v.x); + this->y >>= T(v.y); + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + GLM_FUNC_QUALIFIER typename tvec2::value_type tvec2::swizzle + ( + comp x + ) const + { + return (*this)[x]; + } + + template + GLM_FUNC_QUALIFIER tvec2 tvec2::swizzle + ( + comp x, + comp y + ) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + GLM_FUNC_QUALIFIER tvec3 tvec2::swizzle + ( + comp x, + comp y, + comp z + ) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + GLM_FUNC_QUALIFIER tvec4 tvec2::swizzle + ( + comp x, + comp y, + comp z, + comp w + ) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + GLM_FUNC_QUALIFIER tref2 tvec2::swizzle + ( + comp x, + comp y + ) + { + return tref2( + (*this)[x], + (*this)[y]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec2 operator+ + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x + T(s), + v.y + T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator+ + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) + v.x, + T(s) + v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator+ + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x + T(v2.x), + v1.y + T(v2.y)); + } + + //operator- + template + GLM_FUNC_QUALIFIER tvec2 operator- + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x - T(s), + v.y - T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator- + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) - v.x, + T(s) - v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator- + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x - T(v2.x), + v1.y - T(v2.y)); + } + + //operator* + template + GLM_FUNC_QUALIFIER tvec2 operator* + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x * T(s), + v.y * T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator* + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) * v.x, + T(s) * v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator* + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x * T(v2.x), + v1.y * T(v2.y)); + } + + //operator/ + template + GLM_FUNC_QUALIFIER tvec2 operator/ + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x / T(s), + v.y / T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator/ + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) / v.x, + T(s) / v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator/ + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x / T(v2.x), + v1.y / T(v2.y)); + } + + // Unary constant operators + template + GLM_FUNC_QUALIFIER tvec2 operator- + ( + tvec2 const & v + ) + { + return tvec2( + -v.x, + -v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator++ + ( + tvec2 const & v, + int + ) + { + return tvec2( + v.x + T(1), + v.y + T(1)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator-- + ( + tvec2 const & v, + int + ) + { + return tvec2( + v.x - T(1), + v.y - T(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + GLM_FUNC_QUALIFIER tvec2 operator% + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x % T(s), + v.y % T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator% + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) % v.x, + T(s) % v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator% + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x % T(v2.x), + v1.y % T(v2.y)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator& + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x & T(s), + v.y & T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator& + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) & v.x, + T(s) & v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator& + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x & T(v2.x), + v1.y & T(v2.y)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator| + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x | T(s), + v.y | T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator| + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) | v.x, + T(s) | v.y); + } + + template + GLM_FUNC_QUALIFIER tvec2 operator| + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x | T(v2.x), + v1.y | T(v2.y)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x ^ T(s), - v.y ^ T(s)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator^ + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x ^ T(s), + v.y ^ T(s)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) ^ v.x, - T(s) ^ v.y); - } + template + GLM_FUNC_QUALIFIER tvec2 operator^ + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) ^ v.x, + T(s) ^ v.y); + } - template - GLM_FUNC_QUALIFIER tvec2 operator^ - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x ^ T(v2.x), - v1.y ^ T(v2.y)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator^ + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x ^ T(v2.x), + v1.y ^ T(v2.y)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x << T(s), - v.y << T(s)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator<< + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x << T(s), + v.y << T(s)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - s << T(v.x), - s << T(v.y)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator<< + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + s << T(v.x), + s << T(v.y)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator<< - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x << T(v2.x), - v1.y << T(v2.y)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator<< + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x << T(v2.x), + v1.y << T(v2.y)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - tvec2 const & v, - T const & s - ) - { - return tvec2( - v.x >> T(s), - v.y >> T(s)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator>> + ( + tvec2 const & v, + T const & s + ) + { + return tvec2( + v.x >> T(s), + v.y >> T(s)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - T const & s, - tvec2 const & v - ) - { - return tvec2( - T(s) >> v.x, - T(s) >> v.y); - } + template + GLM_FUNC_QUALIFIER tvec2 operator>> + ( + T const & s, + tvec2 const & v + ) + { + return tvec2( + T(s) >> v.x, + T(s) >> v.y); + } - template - GLM_FUNC_QUALIFIER tvec2 operator>> - ( - tvec2 const & v1, - tvec2 const & v2 - ) - { - return tvec2( - v1.x >> T(v2.x), - v1.y >> T(v2.y)); - } + template + GLM_FUNC_QUALIFIER tvec2 operator>> + ( + tvec2 const & v1, + tvec2 const & v2 + ) + { + return tvec2( + v1.x >> T(v2.x), + v1.y >> T(v2.y)); + } - template - GLM_FUNC_QUALIFIER tvec2 operator~ - ( - tvec2 const & v - ) - { - return tvec2( - ~v.x, - ~v.y); - } + template + GLM_FUNC_QUALIFIER tvec2 operator~ + ( + tvec2 const & v + ) + { + return tvec2( + ~v.x, + ~v.y); + } - ////////////////////////////////////// - // tref definition + ////////////////////////////////////// + // tref definition - template - tref2::tref2 - ( - T & x, - T & y - ) : - x(x), - y(y) - {} + template + tref2::tref2 + ( + T & x, + T & y + ) : + x(x), + y(y) + {} - template - tref2::tref2 - ( - tref2 const & r - ) : - x(r.x), - y(r.y) - {} + template + tref2::tref2 + ( + tref2 const & r + ) : + x(r.x), + y(r.y) + {} - template - tref2::tref2 - ( - tvec2 const & v - ) : - x(v.x), - y(v.y) - {} + template + tref2::tref2 + ( + tvec2 const & v + ) : + x(v.x), + y(v.y) + {} - template - tref2& tref2::operator= - ( - tref2 const & r - ) - { - x = r.x; - y = r.y; - return *this; - } + template + tref2& tref2::operator= + ( + tref2 const & r + ) + { + x = r.x; + y = r.y; + return *this; + } - template - tref2& tref2::operator= - ( - tvec2 const & v - ) - { - x = v.x; - y = v.y; - return *this; - } + template + tref2& tref2::operator= + ( + tvec2 const & v + ) + { + x = v.x; + y = v.y; + return *this; + } - }//namespace detail +}//namespace detail }//namespace glm diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index f7e9bfb5..f06d541f 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -7,1092 +7,1091 @@ // File : glm/core/type_tvec3.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { - namespace detail + template + GLM_FUNC_QUALIFIER typename tvec3::size_type tvec3::length() const { - template - GLM_FUNC_QUALIFIER typename tvec3::size_type tvec3::length() const - { - return 3; - } + return 3; + } - template - GLM_FUNC_QUALIFIER typename tvec3::size_type tvec3::value_size() - { - return 3; - } + template + GLM_FUNC_QUALIFIER typename tvec3::size_type tvec3::value_size() + { + return 3; + } - ////////////////////////////////////// - // Accesses + ////////////////////////////////////// + // Accesses - template - GLM_FUNC_QUALIFIER typename tvec3::value_type & - tvec3::operator[] - ( - size_type i - ) - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec3::value_type & + tvec3::operator[] + ( + size_type i + ) + { + assert(i < value_size()); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER typename tvec3::value_type const & - tvec3::operator[] - ( - size_type i - ) const - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec3::value_type const & + tvec3::operator[] + ( + size_type i + ) const + { + assert(i < value_size()); + return (&x)[i]; + } - ////////////////////////////////////// - // Implicit basic constructors + ////////////////////////////////////// + // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tvec3::tvec3() : - x(value_type(0)), - y(value_type(0)), - z(value_type(0)) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3() : + x(value_type(0)), + y(value_type(0)), + z(value_type(0)) + {} - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - ctor - ) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + ctor + ) + {} - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec3 const & v - ) : - x(v.x), - y(v.y), - z(v.z) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + tvec3 const & v + ) : + x(v.x), + y(v.y), + z(v.z) + {} - ////////////////////////////////////// - // Explicit basic constructors + ////////////////////////////////////// + // Explicit basic constructors - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - value_type const & s - ) : - x(s), - y(s), - z(s) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + value_type const & s + ) : + x(s), + y(s), + z(s) + {} - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - value_type const & s0, - value_type const & s1, - value_type const & s2 - ) : - x(s0), - y(s1), - z(s2) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + value_type const & s0, + value_type const & s1, + value_type const & s2 + ) : + x(s0), + y(s1), + z(s2) + {} - ////////////////////////////////////// - // Swizzle constructors + ////////////////////////////////////// + // Swizzle constructors - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tref3 const & r - ) : - x(r.x), - y(r.y), - z(r.z) - {} + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + tref3 const & r + ) : + x(r.x), + y(r.y), + z(r.z) + {} - ////////////////////////////////////// - // Convertion scalar constructors + ////////////////////////////////////// + // Convertion scalar constructors - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - U const & s - ) : - x(value_type(s)), - y(value_type(s)), - z(value_type(s)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - A const & x, - B const & y, - C const & z - ) : - x(value_type(x)), - y(value_type(y)), - z(value_type(z)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec2 const & v, - B const & s - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(s)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - A const & s, - tvec2 const & v - ) : - x(value_type(s)), - y(value_type(v.x)), - z(value_type(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec3 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(v.z)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec4 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(v.z)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec3& tvec3::operator= - ( - tvec3 const & v - ) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3& tvec3::operator= - ( - tvec3 const & v - ) - { - this->x = T(v.x); - this->y = T(v.y); - this->z = T(v.z); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= - ( - U const & s - ) - { - this->x += T(s); - this->y += T(s); - this->z += T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= - ( - tvec3 const & v - ) - { - this->x += T(v.x); - this->y += T(v.y); - this->z += T(v.z); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= - ( - U const & s - ) - { - this->x -= T(s); - this->y -= T(s); - this->z -= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= - ( - tvec3 const & v - ) - { - this->x -= T(v.x); - this->y -= T(v.y); - this->z -= T(v.z); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= - ( - U const & s - ) - { - this->x *= T(s); - this->y *= T(s); - this->z *= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= - ( - tvec3 const & v - ) - { - this->x *= T(v.x); - this->y *= T(v.y); - this->z *= T(v.z); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= - ( - U const & s - ) - { - this->x /= T(s); - this->y /= T(s); - this->z /= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= - ( - tvec3 const & v - ) - { - this->x /= T(v.x); - this->y /= T(v.y); - this->z /= T(v.z); - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator++() - { - ++this->x; - ++this->y; - ++this->z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator--() - { - --this->x; - --this->y; - --this->z; - return *this; - } - - ////////////////////////////////////// - // Boolean operators - - template - GLM_FUNC_QUALIFIER bool operator== - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z); - } - - template - GLM_FUNC_QUALIFIER bool operator!= - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); - } - - ////////////////////////////////////// - // Unary bit operators - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= - ( - U const & s - ) - { - this->x %= s; - this->y %= s; - this->z %= s; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= - ( - tvec3 const & v - ) - { - this->x %= v.x; - this->y %= v.y; - this->z %= v.z; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= - ( - U const & s - ) - { - this->x &= s; - this->y &= s; - this->z &= s; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= - ( - tvec3 const & v - ) - { - this->x &= v.x; - this->y &= v.y; - this->z &= v.z; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= - ( - U const & s - ) - { - this->x |= s; - this->y |= s; - this->z |= s; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= - ( - tvec3 const & v - ) - { - this->x |= v.x; - this->y |= v.y; - this->z |= v.z; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= - ( - U const & s - ) - { - this->x ^= s; - this->y ^= s; - this->z ^= s; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= - ( - tvec3 const & v - ) - { - this->x ^= v.x; - this->y ^= v.y; - this->z ^= v.z; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= - ( - U const & s - ) - { - this->x <<= s; - this->y <<= s; - this->z <<= s; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= - ( - tvec3 const & v - ) - { - this->x <<= T(v.x); - this->y <<= T(v.y); - this->z <<= T(v.z); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= - ( - U const & s - ) - { - this->x >>= T(s); - this->y >>= T(s); - this->z >>= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= - ( - tvec3 const & v - ) - { - this->x >>= T(v.x); - this->y >>= T(v.y); - this->z >>= T(v.z); - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER typename tvec3::value_type - tvec3::swizzle - ( - comp x - ) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec3::swizzle - ( - comp x, - comp y - ) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec3::swizzle - ( - comp x, - comp y, - comp z - ) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec3::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref3 tvec3::swizzle - ( - comp x, - comp y, - comp z - ) - { - return tref3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - ////////////////////////////////////// - // Binary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec3 operator+ - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x + T(s), - v.y + T(s), - v.z + T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator+ - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) + v.x, - T(s) + v.y, - T(s) + v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator+ - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x + T(v2.x), - v1.y + T(v2.y), - v1.z + T(v2.z)); - } - - //operator- - template - GLM_FUNC_QUALIFIER tvec3 operator- - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x - T(s), - v.y - T(s), - v.z - T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator- - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) - v.x, - T(s) - v.y, - T(s) - v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator- - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x - T(v2.x), - v1.y - T(v2.y), - v1.z - T(v2.z)); - } - - //operator* - template - GLM_FUNC_QUALIFIER tvec3 operator* - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x * T(s), - v.y * T(s), - v.z * T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator* - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) * v.x, - T(s) * v.y, - T(s) * v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator* - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x * T(v2.x), - v1.y * T(v2.y), - v1.z * T(v2.z)); - } - - //operator/ - template - GLM_FUNC_QUALIFIER tvec3 operator/ - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x / T(s), - v.y / T(s), - v.z / T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator/ - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) / v.x, - T(s) / v.y, - T(s) / v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator/ - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x / T(v2.x), - v1.y / T(v2.y), - v1.z / T(v2.z)); - } - - // Unary constant operators - template - GLM_FUNC_QUALIFIER tvec3 operator- - ( - tvec3 const & v - ) - { - return tvec3( - -v.x, - -v.y, - -v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator++ - ( - tvec3 const & v, - int - ) - { - return tvec3( - v.x + T(1), - v.y + T(1), - v.z + T(1)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator-- - ( - tvec3 const & v, - int - ) - { - return tvec3( - v.x - T(1), - v.y - T(1), - v.z - T(1)); - } - - ////////////////////////////////////// - // Binary bit operators - - template - GLM_FUNC_QUALIFIER tvec3 operator% - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x % T(s), - v.y % T(s), - v.z % T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator% - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) % v.x, - T(s) % v.y, - T(s) % v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator% - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x % T(v2.x), - v1.y % T(v2.y), - v1.z % T(v2.z)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator& - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x & T(s), - v.y & T(s), - v.z & T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator& - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) & v.x, - T(s) & v.y, - T(s) & v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator& - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x & T(v2.x), - v1.y & T(v2.y), - v1.z & T(v2.z)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator| - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x | T(s), - v.y | T(s), - v.z | T(s)); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator| - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) | v.x, - T(s) | v.y, - T(s) | v.z); - } - - template - GLM_FUNC_QUALIFIER tvec3 operator| - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x | T(v2.x), - v1.y | T(v2.y), - v1.z | T(v2.z)); - } + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + U const & s + ) : + x(value_type(s)), + y(value_type(s)), + z(value_type(s)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + A const & x, + B const & y, + C const & z + ) : + x(value_type(x)), + y(value_type(y)), + z(value_type(z)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + tvec2 const & v, + B const & s + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(s)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + A const & s, + tvec2 const & v + ) : + x(value_type(s)), + y(value_type(v.x)), + z(value_type(v.y)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + tvec3 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(v.z)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec3::tvec3 + ( + tvec4 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(v.z)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec3& tvec3::operator= + ( + tvec3 const & v + ) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3& tvec3::operator= + ( + tvec3 const & v + ) + { + this->x = T(v.x); + this->y = T(v.y); + this->z = T(v.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= + ( + U const & s + ) + { + this->x += T(s); + this->y += T(s); + this->z += T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= + ( + tvec3 const & v + ) + { + this->x += T(v.x); + this->y += T(v.y); + this->z += T(v.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= + ( + U const & s + ) + { + this->x -= T(s); + this->y -= T(s); + this->z -= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= + ( + tvec3 const & v + ) + { + this->x -= T(v.x); + this->y -= T(v.y); + this->z -= T(v.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= + ( + U const & s + ) + { + this->x *= T(s); + this->y *= T(s); + this->z *= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= + ( + tvec3 const & v + ) + { + this->x *= T(v.x); + this->y *= T(v.y); + this->z *= T(v.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= + ( + U const & s + ) + { + this->x /= T(s); + this->y /= T(s); + this->z /= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= + ( + tvec3 const & v + ) + { + this->x /= T(v.x); + this->y /= T(v.y); + this->z /= T(v.z); + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator++() + { + ++this->x; + ++this->y; + ++this->z; + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator--() + { + --this->x; + --this->y; + --this->z; + return *this; + } + + ////////////////////////////////////// + // Boolean operators + + template + GLM_FUNC_QUALIFIER bool operator== + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z); + } + + template + GLM_FUNC_QUALIFIER bool operator!= + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); + } + + ////////////////////////////////////// + // Unary bit operators + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= + ( + U const & s + ) + { + this->x %= s; + this->y %= s; + this->z %= s; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= + ( + tvec3 const & v + ) + { + this->x %= v.x; + this->y %= v.y; + this->z %= v.z; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= + ( + U const & s + ) + { + this->x &= s; + this->y &= s; + this->z &= s; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= + ( + tvec3 const & v + ) + { + this->x &= v.x; + this->y &= v.y; + this->z &= v.z; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= + ( + U const & s + ) + { + this->x |= s; + this->y |= s; + this->z |= s; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= + ( + tvec3 const & v + ) + { + this->x |= v.x; + this->y |= v.y; + this->z |= v.z; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= + ( + U const & s + ) + { + this->x ^= s; + this->y ^= s; + this->z ^= s; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= + ( + tvec3 const & v + ) + { + this->x ^= v.x; + this->y ^= v.y; + this->z ^= v.z; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= + ( + U const & s + ) + { + this->x <<= s; + this->y <<= s; + this->z <<= s; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= + ( + tvec3 const & v + ) + { + this->x <<= T(v.x); + this->y <<= T(v.y); + this->z <<= T(v.z); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= + ( + U const & s + ) + { + this->x >>= T(s); + this->y >>= T(s); + this->z >>= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= + ( + tvec3 const & v + ) + { + this->x >>= T(v.x); + this->y >>= T(v.y); + this->z >>= T(v.z); + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + GLM_FUNC_QUALIFIER typename tvec3::value_type + tvec3::swizzle + ( + comp x + ) const + { + return (*this)[x]; + } + + template + GLM_FUNC_QUALIFIER tvec2 tvec3::swizzle + ( + comp x, + comp y + ) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + GLM_FUNC_QUALIFIER tvec3 tvec3::swizzle + ( + comp x, + comp y, + comp z + ) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + GLM_FUNC_QUALIFIER tvec4 tvec3::swizzle + ( + comp x, + comp y, + comp z, + comp w + ) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + GLM_FUNC_QUALIFIER tref3 tvec3::swizzle + ( + comp x, + comp y, + comp z + ) + { + return tref3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec3 operator+ + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x + T(s), + v.y + T(s), + v.z + T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator+ + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) + v.x, + T(s) + v.y, + T(s) + v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator+ + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x + T(v2.x), + v1.y + T(v2.y), + v1.z + T(v2.z)); + } + + //operator- + template + GLM_FUNC_QUALIFIER tvec3 operator- + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x - T(s), + v.y - T(s), + v.z - T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator- + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) - v.x, + T(s) - v.y, + T(s) - v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator- + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x - T(v2.x), + v1.y - T(v2.y), + v1.z - T(v2.z)); + } + + //operator* + template + GLM_FUNC_QUALIFIER tvec3 operator* + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x * T(s), + v.y * T(s), + v.z * T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator* + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) * v.x, + T(s) * v.y, + T(s) * v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator* + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x * T(v2.x), + v1.y * T(v2.y), + v1.z * T(v2.z)); + } + + //operator/ + template + GLM_FUNC_QUALIFIER tvec3 operator/ + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x / T(s), + v.y / T(s), + v.z / T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator/ + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) / v.x, + T(s) / v.y, + T(s) / v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator/ + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x / T(v2.x), + v1.y / T(v2.y), + v1.z / T(v2.z)); + } + + // Unary constant operators + template + GLM_FUNC_QUALIFIER tvec3 operator- + ( + tvec3 const & v + ) + { + return tvec3( + -v.x, + -v.y, + -v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator++ + ( + tvec3 const & v, + int + ) + { + return tvec3( + v.x + T(1), + v.y + T(1), + v.z + T(1)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator-- + ( + tvec3 const & v, + int + ) + { + return tvec3( + v.x - T(1), + v.y - T(1), + v.z - T(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + GLM_FUNC_QUALIFIER tvec3 operator% + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x % T(s), + v.y % T(s), + v.z % T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator% + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) % v.x, + T(s) % v.y, + T(s) % v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator% + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x % T(v2.x), + v1.y % T(v2.y), + v1.z % T(v2.z)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator& + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x & T(s), + v.y & T(s), + v.z & T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator& + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) & v.x, + T(s) & v.y, + T(s) & v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator& + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x & T(v2.x), + v1.y & T(v2.y), + v1.z & T(v2.z)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator| + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x | T(s), + v.y | T(s), + v.z | T(s)); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator| + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) | v.x, + T(s) | v.y, + T(s) | v.z); + } + + template + GLM_FUNC_QUALIFIER tvec3 operator| + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x | T(v2.x), + v1.y | T(v2.y), + v1.z | T(v2.z)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator^ - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x ^ T(s), - v.y ^ T(s), - v.z ^ T(s)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator^ + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x ^ T(s), + v.y ^ T(s), + v.z ^ T(s)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator^ - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) ^ v.x, - T(s) ^ v.y, - T(s) ^ v.z); - } + template + GLM_FUNC_QUALIFIER tvec3 operator^ + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) ^ v.x, + T(s) ^ v.y, + T(s) ^ v.z); + } - template - GLM_FUNC_QUALIFIER tvec3 operator^ - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x ^ T(v2.x), - v1.y ^ T(v2.y), - v1.z ^ T(v2.z)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator^ + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x ^ T(v2.x), + v1.y ^ T(v2.y), + v1.z ^ T(v2.z)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator<< - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x << T(s), - v.y << T(s), - v.z << T(s)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator<< + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x << T(s), + v.y << T(s), + v.z << T(s)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator<< - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - T(s) << v.x, - T(s) << v.y, - T(s) << v.z); - } + template + GLM_FUNC_QUALIFIER tvec3 operator<< + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + T(s) << v.x, + T(s) << v.y, + T(s) << v.z); + } - template - GLM_FUNC_QUALIFIER tvec3 operator<< - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x << T(v2.x), - v1.y << T(v2.y), - v1.z << T(v2.z)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator<< + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x << T(v2.x), + v1.y << T(v2.y), + v1.z << T(v2.z)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator>> - ( - tvec3 const & v, - T const & s - ) - { - return tvec3( - v.x >> T(s), - v.y >> T(s), - v.z >> T(s)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator>> + ( + tvec3 const & v, + T const & s + ) + { + return tvec3( + v.x >> T(s), + v.y >> T(s), + v.z >> T(s)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator>> - ( - T const & s, - tvec3 const & v - ) - { - return tvec3( - s >> T(v.x), - s >> T(v.y), - s >> T(v.z)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator>> + ( + T const & s, + tvec3 const & v + ) + { + return tvec3( + s >> T(v.x), + s >> T(v.y), + s >> T(v.z)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator>> - ( - tvec3 const & v1, - tvec3 const & v2 - ) - { - return tvec3( - v1.x >> T(v2.x), - v1.y >> T(v2.y), - v1.z >> T(v2.z)); - } + template + GLM_FUNC_QUALIFIER tvec3 operator>> + ( + tvec3 const & v1, + tvec3 const & v2 + ) + { + return tvec3( + v1.x >> T(v2.x), + v1.y >> T(v2.y), + v1.z >> T(v2.z)); + } - template - GLM_FUNC_QUALIFIER tvec3 operator~ - ( - tvec3 const & v - ) - { - return tvec3( - ~v.x, - ~v.y, - ~v.z); - } + template + GLM_FUNC_QUALIFIER tvec3 operator~ + ( + tvec3 const & v + ) + { + return tvec3( + ~v.x, + ~v.y, + ~v.z); + } - ////////////////////////////////////// - // tref definition + ////////////////////////////////////// + // tref definition - template - GLM_FUNC_QUALIFIER tref3::tref3(T & x, T & y, T & z) : - x(x), - y(y), - z(z) - {} + template + GLM_FUNC_QUALIFIER tref3::tref3(T & x, T & y, T & z) : + x(x), + y(y), + z(z) + {} - template - GLM_FUNC_QUALIFIER tref3::tref3 - ( - tref3 const & r - ) : - x(r.x), - y(r.y), - z(r.z) - {} + template + GLM_FUNC_QUALIFIER tref3::tref3 + ( + tref3 const & r + ) : + x(r.x), + y(r.y), + z(r.z) + {} - template - GLM_FUNC_QUALIFIER tref3::tref3 - ( - tvec3 const & v - ) : - x(v.x), - y(v.y), - z(v.z) - {} + template + GLM_FUNC_QUALIFIER tref3::tref3 + ( + tvec3 const & v + ) : + x(v.x), + y(v.y), + z(v.z) + {} - template - GLM_FUNC_QUALIFIER tref3 & tref3::operator= - ( - tref3 const & r - ) - { - x = r.x; - y = r.y; - z = r.z; - return *this; - } + template + GLM_FUNC_QUALIFIER tref3 & tref3::operator= + ( + tref3 const & r + ) + { + x = r.x; + y = r.y; + z = r.z; + return *this; + } - template - GLM_FUNC_QUALIFIER tref3 & tref3::operator= - ( - tvec3 const & v - ) - { - x = v.x; - y = v.y; - z = v.z; - return *this; - } + template + GLM_FUNC_QUALIFIER tref3 & tref3::operator= + ( + tvec3 const & v + ) + { + x = v.x; + y = v.y; + z = v.z; + return *this; + } - }//namespace detail +}//namespace detail }//namespace glm diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index 52e16d8a..6750beae 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -7,1221 +7,1220 @@ // File : glm/core/type_tvec4.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { - namespace detail + template + GLM_FUNC_QUALIFIER typename tvec4::size_type tvec4::length() const { - template - GLM_FUNC_QUALIFIER typename tvec4::size_type tvec4::length() const - { - return 4; - } + return 4; + } - template - GLM_FUNC_QUALIFIER typename tvec4::size_type tvec4::value_size() - { - return 4; - } + template + GLM_FUNC_QUALIFIER typename tvec4::size_type tvec4::value_size() + { + return 4; + } - ////////////////////////////////////// - // Accesses + ////////////////////////////////////// + // Accesses - template - GLM_FUNC_QUALIFIER typename tvec4::value_type & - tvec4::operator[] - ( - size_type i - ) - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec4::value_type & + tvec4::operator[] + ( + size_type i + ) + { + assert(i < value_size()); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER typename tvec4::value_type const & - tvec4::operator[] - ( - size_type i - ) const - { - assert(i < value_size()); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER typename tvec4::value_type const & + tvec4::operator[] + ( + size_type i + ) const + { + assert(i < value_size()); + return (&x)[i]; + } - ////////////////////////////////////// - // Implicit basic constructors + ////////////////////////////////////// + // Implicit basic constructors - template - GLM_FUNC_QUALIFIER tvec4::tvec4() : - x(value_type(0)), - y(value_type(0)), - z(value_type(0)), - w(value_type(0)) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4() : + x(value_type(0)), + y(value_type(0)), + z(value_type(0)), + w(value_type(0)) + {} - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - ctor - ) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + ctor + ) + {} - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - type const & v - ) : - x(v.x), - y(v.y), - z(v.z), - w(v.w) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + type const & v + ) : + x(v.x), + y(v.y), + z(v.z), + w(v.w) + {} - ////////////////////////////////////// - // Explicit basic constructors + ////////////////////////////////////// + // Explicit basic constructors - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - value_type const & s - ) : - x(s), - y(s), - z(s), - w(s) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + value_type const & s + ) : + x(s), + y(s), + z(s), + w(s) + {} - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - value_type const & s1, - value_type const & s2, - value_type const & s3, - value_type const & s4 - ) : - x(s1), - y(s2), - z(s3), - w(s4) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + value_type const & s1, + value_type const & s2, + value_type const & s3, + value_type const & s4 + ) : + x(s1), + y(s2), + z(s3), + w(s4) + {} - ////////////////////////////////////// - // Swizzle constructors + ////////////////////////////////////// + // Swizzle constructors - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tref4 const & r - ) : - x(r.x), - y(r.y), - z(r.z), - w(r.w) - {} + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + tref4 const & r + ) : + x(r.x), + y(r.y), + z(r.z), + w(r.w) + {} - ////////////////////////////////////// - // Convertion scalar constructors + ////////////////////////////////////// + // Convertion scalar constructors - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - U const & x - ) : - x(value_type(x)), - y(value_type(x)), - z(value_type(x)), - w(value_type(x)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & x, - B const & y, - C const & z, - D const & w - ) : - x(value_type(x)), - y(value_type(y)), - z(value_type(z)), - w(value_type(w)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec2 const & v, - B const & s1, - C const & s2 - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(s1)), - w(value_type(s2)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s1, - tvec2 const & v, - C const & s2 - ) : - x(value_type(s1)), - y(value_type(v.x)), - z(value_type(v.y)), - w(value_type(s2)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s1, - B const & s2, - tvec2 const & v - ) : - x(value_type(s1)), - y(value_type(s2)), - z(value_type(v.x)), - w(value_type(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec3 const & v, - B const & s - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(v.z)), - w(value_type(s)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s, - tvec3 const & v - ) : - x(value_type(s)), - y(value_type(v.x)), - z(value_type(v.y)), - w(value_type(v.z)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec2 const & v1, - tvec2 const & v2 - ) : - x(value_type(v1.x)), - y(value_type(v1.y)), - z(value_type(v2.x)), - w(value_type(v2.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec4 const & v - ) : - x(value_type(v.x)), - y(value_type(v.y)), - z(value_type(v.z)), - w(value_type(v.w)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= - ( - tvec4 const & v - ) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - this->w = v.w; - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= - ( - tvec4 const & v - ) - { - this->x = T(v.x); - this->y = T(v.y); - this->z = T(v.z); - this->w = T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= - ( - U const & s - ) - { - this->x += T(s); - this->y += T(s); - this->z += T(s); - this->w += T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= - ( - tvec4 const & v - ) - { - this->x += T(v.x); - this->y += T(v.y); - this->z += T(v.z); - this->w += T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= - ( - U const & s - ) - { - this->x -= T(s); - this->y -= T(s); - this->z -= T(s); - this->w -= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= - ( - tvec4 const & v - ) - { - this->x -= T(v.x); - this->y -= T(v.y); - this->z -= T(v.z); - this->w -= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= - ( - U const & s - ) - { - this->x *= T(s); - this->y *= T(s); - this->z *= T(s); - this->w *= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= - ( - tvec4 const & v - ) - { - this->x *= T(v.x); - this->y *= T(v.y); - this->z *= T(v.z); - this->w *= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= - ( - U const & s - ) - { - this->x /= T(s); - this->y /= T(s); - this->z /= T(s); - this->w /= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= - ( - tvec4 const & v - ) - { - this->x /= T(v.x); - this->y /= T(v.y); - this->z /= T(v.z); - this->w /= T(v.w); - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator++() - { - ++this->x; - ++this->y; - ++this->z; - ++this->w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator--() - { - --this->x; - --this->y; - --this->z; - --this->w; - return *this; - } - - ////////////////////////////////////// - // Unary bit operators - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator%= - ( - U const & s - ) - { - this->x %= T(s); - this->y %= T(s); - this->z %= T(s); - this->w %= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator%= - ( - tvec4 const & v - ) - { - this->x %= T(v.x); - this->y %= T(v.y); - this->z %= T(v.z); - this->w %= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator&= - ( - U const & s - ) - { - this->x &= T(s); - this->y &= T(s); - this->z &= T(s); - this->w &= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator&= - ( - tvec4 const & v - ) - { - this->x &= T(v.x); - this->y &= T(v.y); - this->z &= T(v.z); - this->w &= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator|= - ( - U const & s - ) - { - this->x |= T(s); - this->y |= T(s); - this->z |= T(s); - this->w |= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator|= - ( - tvec4 const & v - ) - { - this->x |= T(v.x); - this->y |= T(v.y); - this->z |= T(v.z); - this->w |= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator^= - ( - U const & s - ) - { - this->x ^= T(s); - this->y ^= T(s); - this->z ^= T(s); - this->w ^= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator^= - ( - tvec4 const & v - ) - { - this->x ^= T(v.x); - this->y ^= T(v.y); - this->z ^= T(v.z); - this->w ^= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator<<= - ( - U const & s - ) - { - this->x <<= T(s); - this->y <<= T(s); - this->z <<= T(s); - this->w <<= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator<<= - ( - tvec4 const & v - ) - { - this->x <<= T(v.x); - this->y <<= T(v.y); - this->z <<= T(v.z); - this->w <<= T(v.w); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator>>= - ( - U const & s - ) - { - this->x >>= T(s); - this->y >>= T(s); - this->z >>= T(s); - this->w >>= T(s); - return *this; - } - - template - template - GLM_FUNC_QUALIFIER tvec4 & tvec4::operator>>= - ( - tvec4 const & v - ) - { - this->x >>= T(v.x); - this->y >>= T(v.y); - this->z >>= T(v.z); - this->w >>= T(v.w); - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER typename tvec4::value_type - tvec4::swizzle - ( - comp x - ) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec4::swizzle - ( - comp x, - comp y - ) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec4::swizzle - ( - comp x, - comp y, - comp z - ) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec4::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref4 tvec4::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) - { - return tref4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - ////////////////////////////////////// - // Binary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec4 operator+ - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x + s, - v.y + s, - v.z + s, - v.w + s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator+ - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s + v.x, - s + v.y, - s + v.z, - s + v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator+ - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x + v2.x, - v1.y + v2.y, - v1.z + v2.z, - v1.w + v2.w); - } - - //operator- - template - GLM_FUNC_QUALIFIER tvec4 operator- - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x - s, - v.y - s, - v.z - s, - v.w - s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator- - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s - v.x, - s - v.y, - s - v.z, - s - v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator- - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x - v2.x, - v1.y - v2.y, - v1.z - v2.z, - v1.w - v2.w); - } - - //operator* - template - GLM_FUNC_QUALIFIER tvec4 operator* - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x * s, - v.y * s, - v.z * s, - v.w * s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator* - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s * v.x, - s * v.y, - s * v.z, - s * v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator* - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x * v2.x, - v1.y * v2.y, - v1.z * v2.z, - v1.w * v2.w); - } - - //operator/ - template - GLM_FUNC_QUALIFIER tvec4 operator/ - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x / s, - v.y / s, - v.z / s, - v.w / s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator/ - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s / v.x, - s / v.y, - s / v.z, - s / v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator/ - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x / v2.x, - v1.y / v2.y, - v1.z / v2.z, - v1.w / v2.w); - } - - // Unary constant operators - template - GLM_FUNC_QUALIFIER tvec4 operator- - ( - tvec4 const & v - ) - { - return tvec4( - -v.x, - -v.y, - -v.z, - -v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator++ - ( - tvec4 const & v, - int - ) - { - typename tvec4::value_type One(1); - return tvec4( - v.x + One, - v.y + One, - v.z + One, - v.w + One); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator-- - ( - tvec4 const & v, - int - ) - { - typename tvec4::value_type One(1); - return tvec4( - v.x - One, - v.y - One, - v.z - One, - v.w - One); - } - - ////////////////////////////////////// - // Boolean operators - - template - GLM_FUNC_QUALIFIER bool operator== - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w); - } - - template - GLM_FUNC_QUALIFIER bool operator!= - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w); - } - - ////////////////////////////////////// - // Binary bit operators - - template - GLM_FUNC_QUALIFIER tvec4 operator% - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x % s, - v.y % s, - v.z % s, - v.w % s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator% - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s % v.x, - s % v.y, - s % v.z, - s % v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator% - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x % v2.x, - v1.y % v2.y, - v1.z % v2.z, - v1.w % v2.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator& - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x & s, - v.y & s, - v.z & s, - v.w & s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator& - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s & v.x, - s & v.y, - s & v.z, - s & v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator& - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x & v2.x, - v1.y & v2.y, - v1.z & v2.z, - v1.w & v2.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator| - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x | s, - v.y | s, - v.z | s, - v.w | s); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator| - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s | v.x, - s | v.y, - s | v.z, - s | v.w); - } - - template - GLM_FUNC_QUALIFIER tvec4 operator| - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x | v2.x, - v1.y | v2.y, - v1.z | v2.z, - v1.w | v2.w); - } + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + U const & x + ) : + x(value_type(x)), + y(value_type(x)), + z(value_type(x)), + w(value_type(x)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + A const & x, + B const & y, + C const & z, + D const & w + ) : + x(value_type(x)), + y(value_type(y)), + z(value_type(z)), + w(value_type(w)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + tvec2 const & v, + B const & s1, + C const & s2 + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(s1)), + w(value_type(s2)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + A const & s1, + tvec2 const & v, + C const & s2 + ) : + x(value_type(s1)), + y(value_type(v.x)), + z(value_type(v.y)), + w(value_type(s2)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + A const & s1, + B const & s2, + tvec2 const & v + ) : + x(value_type(s1)), + y(value_type(s2)), + z(value_type(v.x)), + w(value_type(v.y)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + tvec3 const & v, + B const & s + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(v.z)), + w(value_type(s)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + A const & s, + tvec3 const & v + ) : + x(value_type(s)), + y(value_type(v.x)), + z(value_type(v.y)), + w(value_type(v.z)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + tvec2 const & v1, + tvec2 const & v2 + ) : + x(value_type(v1.x)), + y(value_type(v1.y)), + z(value_type(v2.x)), + w(value_type(v2.y)) + {} + + template + template + GLM_FUNC_QUALIFIER tvec4::tvec4 + ( + tvec4 const & v + ) : + x(value_type(v.x)), + y(value_type(v.y)), + z(value_type(v.z)), + w(value_type(v.w)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= + ( + tvec4 const & v + ) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + this->w = v.w; + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= + ( + tvec4 const & v + ) + { + this->x = T(v.x); + this->y = T(v.y); + this->z = T(v.z); + this->w = T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= + ( + U const & s + ) + { + this->x += T(s); + this->y += T(s); + this->z += T(s); + this->w += T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator+= + ( + tvec4 const & v + ) + { + this->x += T(v.x); + this->y += T(v.y); + this->z += T(v.z); + this->w += T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= + ( + U const & s + ) + { + this->x -= T(s); + this->y -= T(s); + this->z -= T(s); + this->w -= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator-= + ( + tvec4 const & v + ) + { + this->x -= T(v.x); + this->y -= T(v.y); + this->z -= T(v.z); + this->w -= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= + ( + U const & s + ) + { + this->x *= T(s); + this->y *= T(s); + this->z *= T(s); + this->w *= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator*= + ( + tvec4 const & v + ) + { + this->x *= T(v.x); + this->y *= T(v.y); + this->z *= T(v.z); + this->w *= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= + ( + U const & s + ) + { + this->x /= T(s); + this->y /= T(s); + this->z /= T(s); + this->w /= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator/= + ( + tvec4 const & v + ) + { + this->x /= T(v.x); + this->y /= T(v.y); + this->z /= T(v.z); + this->w /= T(v.w); + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator++() + { + ++this->x; + ++this->y; + ++this->z; + ++this->w; + return *this; + } + + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator--() + { + --this->x; + --this->y; + --this->z; + --this->w; + return *this; + } + + ////////////////////////////////////// + // Unary bit operators + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator%= + ( + U const & s + ) + { + this->x %= T(s); + this->y %= T(s); + this->z %= T(s); + this->w %= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator%= + ( + tvec4 const & v + ) + { + this->x %= T(v.x); + this->y %= T(v.y); + this->z %= T(v.z); + this->w %= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator&= + ( + U const & s + ) + { + this->x &= T(s); + this->y &= T(s); + this->z &= T(s); + this->w &= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator&= + ( + tvec4 const & v + ) + { + this->x &= T(v.x); + this->y &= T(v.y); + this->z &= T(v.z); + this->w &= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator|= + ( + U const & s + ) + { + this->x |= T(s); + this->y |= T(s); + this->z |= T(s); + this->w |= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator|= + ( + tvec4 const & v + ) + { + this->x |= T(v.x); + this->y |= T(v.y); + this->z |= T(v.z); + this->w |= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator^= + ( + U const & s + ) + { + this->x ^= T(s); + this->y ^= T(s); + this->z ^= T(s); + this->w ^= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator^= + ( + tvec4 const & v + ) + { + this->x ^= T(v.x); + this->y ^= T(v.y); + this->z ^= T(v.z); + this->w ^= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator<<= + ( + U const & s + ) + { + this->x <<= T(s); + this->y <<= T(s); + this->z <<= T(s); + this->w <<= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator<<= + ( + tvec4 const & v + ) + { + this->x <<= T(v.x); + this->y <<= T(v.y); + this->z <<= T(v.z); + this->w <<= T(v.w); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator>>= + ( + U const & s + ) + { + this->x >>= T(s); + this->y >>= T(s); + this->z >>= T(s); + this->w >>= T(s); + return *this; + } + + template + template + GLM_FUNC_QUALIFIER tvec4 & tvec4::operator>>= + ( + tvec4 const & v + ) + { + this->x >>= T(v.x); + this->y >>= T(v.y); + this->z >>= T(v.z); + this->w >>= T(v.w); + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + GLM_FUNC_QUALIFIER typename tvec4::value_type + tvec4::swizzle + ( + comp x + ) const + { + return (*this)[x]; + } + + template + GLM_FUNC_QUALIFIER tvec2 tvec4::swizzle + ( + comp x, + comp y + ) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + GLM_FUNC_QUALIFIER tvec3 tvec4::swizzle + ( + comp x, + comp y, + comp z + ) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + GLM_FUNC_QUALIFIER tvec4 tvec4::swizzle + ( + comp x, + comp y, + comp z, + comp w + ) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + GLM_FUNC_QUALIFIER tref4 tvec4::swizzle + ( + comp x, + comp y, + comp z, + comp w + ) + { + return tref4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + GLM_FUNC_QUALIFIER tvec4 operator+ + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x + s, + v.y + s, + v.z + s, + v.w + s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator+ + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s + v.x, + s + v.y, + s + v.z, + s + v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator+ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x + v2.x, + v1.y + v2.y, + v1.z + v2.z, + v1.w + v2.w); + } + + //operator- + template + GLM_FUNC_QUALIFIER tvec4 operator- + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x - s, + v.y - s, + v.z - s, + v.w - s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator- + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s - v.x, + s - v.y, + s - v.z, + s - v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator- + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x - v2.x, + v1.y - v2.y, + v1.z - v2.z, + v1.w - v2.w); + } + + //operator* + template + GLM_FUNC_QUALIFIER tvec4 operator* + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x * s, + v.y * s, + v.z * s, + v.w * s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator* + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s * v.x, + s * v.y, + s * v.z, + s * v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator* + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x * v2.x, + v1.y * v2.y, + v1.z * v2.z, + v1.w * v2.w); + } + + //operator/ + template + GLM_FUNC_QUALIFIER tvec4 operator/ + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x / s, + v.y / s, + v.z / s, + v.w / s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator/ + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s / v.x, + s / v.y, + s / v.z, + s / v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator/ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x / v2.x, + v1.y / v2.y, + v1.z / v2.z, + v1.w / v2.w); + } + + // Unary constant operators + template + GLM_FUNC_QUALIFIER tvec4 operator- + ( + tvec4 const & v + ) + { + return tvec4( + -v.x, + -v.y, + -v.z, + -v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator++ + ( + tvec4 const & v, + int + ) + { + typename tvec4::value_type One(1); + return tvec4( + v.x + One, + v.y + One, + v.z + One, + v.w + One); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator-- + ( + tvec4 const & v, + int + ) + { + typename tvec4::value_type One(1); + return tvec4( + v.x - One, + v.y - One, + v.z - One, + v.w - One); + } + + ////////////////////////////////////// + // Boolean operators + + template + GLM_FUNC_QUALIFIER bool operator== + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z) && (v1.w == v2.w); + } + + template + GLM_FUNC_QUALIFIER bool operator!= + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z) || (v1.w != v2.w); + } + + ////////////////////////////////////// + // Binary bit operators + + template + GLM_FUNC_QUALIFIER tvec4 operator% + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x % s, + v.y % s, + v.z % s, + v.w % s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator% + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s % v.x, + s % v.y, + s % v.z, + s % v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator% + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x % v2.x, + v1.y % v2.y, + v1.z % v2.z, + v1.w % v2.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator& + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x & s, + v.y & s, + v.z & s, + v.w & s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator& + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s & v.x, + s & v.y, + s & v.z, + s & v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator& + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x & v2.x, + v1.y & v2.y, + v1.z & v2.z, + v1.w & v2.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator| + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x | s, + v.y | s, + v.z | s, + v.w | s); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator| + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s | v.x, + s | v.y, + s | v.z, + s | v.w); + } + + template + GLM_FUNC_QUALIFIER tvec4 operator| + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x | v2.x, + v1.y | v2.y, + v1.z | v2.z, + v1.w | v2.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator^ - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x ^ s, - v.y ^ s, - v.z ^ s, - v.w ^ s); - } + template + GLM_FUNC_QUALIFIER tvec4 operator^ + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x ^ s, + v.y ^ s, + v.z ^ s, + v.w ^ s); + } - template - GLM_FUNC_QUALIFIER tvec4 operator^ - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s ^ v.x, - s ^ v.y, - s ^ v.z, - s ^ v.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator^ + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s ^ v.x, + s ^ v.y, + s ^ v.z, + s ^ v.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator^ - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x ^ v2.x, - v1.y ^ v2.y, - v1.z ^ v2.z, - v1.w ^ v2.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator^ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x ^ v2.x, + v1.y ^ v2.y, + v1.z ^ v2.z, + v1.w ^ v2.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator<< - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x << s, - v.y << s, - v.z << s, - v.w << s); - } + template + GLM_FUNC_QUALIFIER tvec4 operator<< + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x << s, + v.y << s, + v.z << s, + v.w << s); + } - template - GLM_FUNC_QUALIFIER tvec4 operator<< - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s << v.x, - s << v.y, - s << v.z, - s << v.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator<< + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s << v.x, + s << v.y, + s << v.z, + s << v.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator<< - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x << v2.x, - v1.y << v2.y, - v1.z << v2.z, - v1.w << v2.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator<< + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x << v2.x, + v1.y << v2.y, + v1.z << v2.z, + v1.w << v2.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator>> - ( - tvec4 const & v, - typename tvec4::value_type const & s - ) - { - return tvec4( - v.x >> s, - v.y >> s, - v.z >> s, - v.w >> s); - } + template + GLM_FUNC_QUALIFIER tvec4 operator>> + ( + tvec4 const & v, + typename tvec4::value_type const & s + ) + { + return tvec4( + v.x >> s, + v.y >> s, + v.z >> s, + v.w >> s); + } - template - GLM_FUNC_QUALIFIER tvec4 operator>> - ( - typename tvec4::value_type const & s, - tvec4 const & v - ) - { - return tvec4( - s >> v.x, - s >> v.y, - s >> v.z, - s >> v.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator>> + ( + typename tvec4::value_type const & s, + tvec4 const & v + ) + { + return tvec4( + s >> v.x, + s >> v.y, + s >> v.z, + s >> v.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator>> - ( - tvec4 const & v1, - tvec4 const & v2 - ) - { - return tvec4( - v1.x >> v2.x, - v1.y >> v2.y, - v1.z >> v2.z, - v1.w >> v2.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator>> + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x >> v2.x, + v1.y >> v2.y, + v1.z >> v2.z, + v1.w >> v2.w); + } - template - GLM_FUNC_QUALIFIER tvec4 operator~ - ( - tvec4 const & v - ) - { - return tvec4( - ~v.x, - ~v.y, - ~v.z, - ~v.w); - } + template + GLM_FUNC_QUALIFIER tvec4 operator~ + ( + tvec4 const & v + ) + { + return tvec4( + ~v.x, + ~v.y, + ~v.z, + ~v.w); + } - ////////////////////////////////////// - // tref definition + ////////////////////////////////////// + // tref definition - template - tref4::tref4 - ( - T & x, - T & y, - T & z, - T & w - ) : - x(x), - y(y), - z(z), - w(w) - {} + template + tref4::tref4 + ( + T & x, + T & y, + T & z, + T & w + ) : + x(x), + y(y), + z(z), + w(w) + {} - template - tref4::tref4 - ( - tref4 const & r - ) : - x(r.x), - y(r.y), - z(r.z), - w(r.w) - {} + template + tref4::tref4 + ( + tref4 const & r + ) : + x(r.x), + y(r.y), + z(r.z), + w(r.w) + {} - template - tref4::tref4 - ( - tvec4 const & v - ) : - x(v.x), - y(v.y), - z(v.z), - w(v.w) - {} + template + tref4::tref4 + ( + tvec4 const & v + ) : + x(v.x), + y(v.y), + z(v.z), + w(v.w) + {} - template - tref4& tref4::operator= - ( - tref4 const & r - ) - { - x = r.x; - y = r.y; - z = r.z; - w = r.w; - return *this; - } + template + tref4& tref4::operator= + ( + tref4 const & r + ) + { + x = r.x; + y = r.y; + z = r.z; + w = r.w; + return *this; + } - template - tref4& tref4::operator= - ( - tvec4 const & v - ) - { - x = v.x; - y = v.y; - z = v.z; - w = v.w; - return *this; - } + template + tref4& tref4::operator= + ( + tvec4 const & v + ) + { + x = v.x; + y = v.y; + z = v.z; + w = v.w; + return *this; + } - }//namespace detail +}//namespace detail }//namespace glm