/// @ref core /// @file glm/core/type_tvec2.inl namespace glm { # ifdef GLM_STATIC_CONST_MEMBERS template const tvec2 tvec2::ZERO(static_cast(0), static_cast(0)); template const tvec2 tvec2::X(static_cast(1), static_cast(0)); template const tvec2 tvec2::Y(static_cast(0), static_cast(1)); template const tvec2 tvec2::XY(static_cast(1), static_cast(1)); # endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2() # ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0) # endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) : x(v.x), y(v.y) {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) : x(v.x), y(v.y) {} // -- Explicit basic constructors -- template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2::tvec2(ctor) {} template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(T scalar) : x(scalar), y(scalar) {} template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(T s1, T s2) : x(s1), y(s2) {} // -- Conversion scalar constructors -- template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(A a, B b) : x(static_cast(a)) , y(static_cast(b)) {} template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec1 const & a, tvec1 const & b) : x(static_cast(a.x)) , y(static_cast(b.x)) {} // -- Conversion vector constructors -- template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec2 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec3 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} template template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2::tvec2(tvec4 const & v) : x(static_cast(v.x)) , y(static_cast(v.y)) {} // -- Component accesses -- template GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2::length_type tvec2::length() const { return 2; } template GLM_FUNC_QUALIFIER T & tvec2::operator[](typename tvec2::length_type i) { assert(i >= 0 && i < this->length()); return (&x)[i]; } template GLM_FUNC_QUALIFIER T const & tvec2::operator[](typename tvec2::length_type i) const { assert(i >= 0 && i < this->length()); return (&x)[i]; } // -- Unary arithmetic operators -- # if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) { this->x = v.x; this->y = v.y; return *this; } # endif//!GLM_HAS_DEFAULTED_FUNCTIONS template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) { this->x = static_cast(v.x); this->y = static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(U scalar) { this->x += static_cast(scalar); this->y += static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(tvec1 const & v) { this->x += static_cast(v.x); this->y += static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+=(tvec2 const & v) { this->x += static_cast(v.x); this->y += static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(U scalar) { this->x -= static_cast(scalar); this->y -= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(tvec1 const & v) { this->x -= static_cast(v.x); this->y -= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-=(tvec2 const & v) { this->x -= static_cast(v.x); this->y -= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(U scalar) { this->x *= static_cast(scalar); this->y *= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(tvec1 const & v) { this->x *= static_cast(v.x); this->y *= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*=(tvec2 const & v) { this->x *= static_cast(v.x); this->y *= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(U scalar) { this->x /= static_cast(scalar); this->y /= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(tvec1 const & v) { this->x /= static_cast(v.x); this->y /= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/=(tvec2 const & v) { this->x /= static_cast(v.x); this->y /= static_cast(v.y); return *this; } // -- Increment and decrement operators -- 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; } template GLM_FUNC_QUALIFIER tvec2 tvec2::operator++(int) { tvec2 Result(*this); ++*this; return Result; } template GLM_FUNC_QUALIFIER tvec2 tvec2::operator--(int) { tvec2 Result(*this); --*this; return Result; } // -- Unary bit operators -- template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%=(U scalar) { this->x %= static_cast(scalar); this->y %= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%=(tvec1 const & v) { this->x %= static_cast(v.x); this->y %= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator%=(tvec2 const & v) { this->x %= static_cast(v.x); this->y %= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&=(U scalar) { this->x &= static_cast(scalar); this->y &= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&=(tvec1 const & v) { this->x &= static_cast(v.x); this->y &= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator&=(tvec2 const & v) { this->x &= static_cast(v.x); this->y &= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|=(U scalar) { this->x |= static_cast(scalar); this->y |= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|=(tvec1 const & v) { this->x |= static_cast(v.x); this->y |= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator|=(tvec2 const & v) { this->x |= static_cast(v.x); this->y |= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^=(U scalar) { this->x ^= static_cast(scalar); this->y ^= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^=(tvec1 const & v) { this->x ^= static_cast(v.x); this->y ^= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator^=(tvec2 const & v) { this->x ^= static_cast(v.x); this->y ^= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<=(U scalar) { this->x <<= static_cast(scalar); this->y <<= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<=(tvec1 const & v) { this->x <<= static_cast(v.x); this->y <<= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator<<=(tvec2 const & v) { this->x <<= static_cast(v.x); this->y <<= static_cast(v.y); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>=(U scalar) { this->x >>= static_cast(scalar); this->y >>= static_cast(scalar); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>=(tvec1 const & v) { this->x >>= static_cast(v.x); this->y >>= static_cast(v.x); return *this; } template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator>>=(tvec2 const & v) { this->x >>= static_cast(v.x); this->y >>= static_cast(v.y); return *this; } // -- Unary arithmetic operators -- template GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v) { return v; } template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v) { return tvec2( -v.x, -v.y); } // -- Binary arithmetic operators -- template GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T scalar) { return tvec2( v.x + scalar, v.y + scalar); } template GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x + v2.x, v1.y + v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator+(T scalar, tvec2 const & v) { return tvec2( scalar + v.x, scalar + v.y); } template GLM_FUNC_QUALIFIER tvec2 operator+(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x + v2.x, v1.x + v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x + v2.x, v1.y + v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T scalar) { return tvec2( v.x - scalar, v.y - scalar); } template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x - v2.x, v1.y - v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator-(T scalar, tvec2 const & v) { return tvec2( scalar - v.x, scalar - v.y); } template GLM_FUNC_QUALIFIER tvec2 operator-(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x - v2.x, v1.x - v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x - v2.x, v1.y - v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v, T scalar) { return tvec2( v.x * scalar, v.y * scalar); } template GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x * v2.x, v1.y * v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator*(T scalar, tvec2 const & v) { return tvec2( scalar * v.x, scalar * v.y); } template GLM_FUNC_QUALIFIER tvec2 operator*(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x * v2.x, v1.x * v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x * v2.x, v1.y * v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T scalar) { return tvec2( v.x / scalar, v.y / scalar); } template GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x / v2.x, v1.y / v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator/(T scalar, tvec2 const & v) { return tvec2( scalar / v.x, scalar / v.y); } template GLM_FUNC_QUALIFIER tvec2 operator/(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x / v2.x, v1.x / v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x / v2.x, v1.y / v2.y); } // -- Binary bit operators -- template GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T scalar) { return tvec2( v.x % scalar, v.y % scalar); } template GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x % v2.x, v1.y % v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator%(T scalar, tvec2 const & v) { return tvec2( scalar % v.x, scalar % v.y); } template GLM_FUNC_QUALIFIER tvec2 operator%(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x % v2.x, v1.x % v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x % v2.x, v1.y % v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T scalar) { return tvec2( v.x & scalar, v.y & scalar); } template GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x & v2.x, v1.y & v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator&(T scalar, tvec2 const & v) { return tvec2( scalar & v.x, scalar & v.y); } template GLM_FUNC_QUALIFIER tvec2 operator&(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x & v2.x, v1.x & v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x & v2.x, v1.y & v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T scalar) { return tvec2( v.x | scalar, v.y | scalar); } template GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x | v2.x, v1.y | v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator|(T scalar, tvec2 const & v) { return tvec2( scalar | v.x, scalar | v.y); } template GLM_FUNC_QUALIFIER tvec2 operator|(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x | v2.x, v1.x | v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x | v2.x, v1.y | v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T scalar) { return tvec2( v.x ^ scalar, v.y ^ scalar); } template GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x ^ v2.x, v1.y ^ v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator^(T scalar, tvec2 const & v) { return tvec2( scalar ^ v.x, scalar ^ v.y); } template GLM_FUNC_QUALIFIER tvec2 operator^(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x ^ v2.x, v1.x ^ v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x ^ v2.x, v1.y ^ v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T scalar) { return tvec2( v.x << scalar, v.y << scalar); } template GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x << v2.x, v1.y << v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator<<(T scalar, tvec2 const & v) { return tvec2( scalar << v.x, scalar << v.y); } template GLM_FUNC_QUALIFIER tvec2 operator<<(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x << v2.x, v1.x << v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x << v2.x, v1.y << v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T scalar) { return tvec2( v.x >> scalar, v.y >> scalar); } template GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v1, tvec1 const & v2) { return tvec2( v1.x >> v2.x, v1.y >> v2.x); } template GLM_FUNC_QUALIFIER tvec2 operator>>(T scalar, tvec2 const & v) { return tvec2( scalar >> v.x, scalar >> v.y); } template GLM_FUNC_QUALIFIER tvec2 operator>>(tvec1 const & v1, tvec2 const & v2) { return tvec2( v1.x >> v2.x, v1.x >> v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v1, tvec2 const & v2) { return tvec2( v1.x >> v2.x, v1.y >> v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator~(tvec2 const & v) { return tvec2( ~v.x, ~v.y); } // -- 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); } template GLM_FUNC_QUALIFIER tvec2 operator&&(tvec2 const & v1, tvec2 const & v2) { return tvec2(v1.x && v2.x, v1.y && v2.y); } template GLM_FUNC_QUALIFIER tvec2 operator||(tvec2 const & v1, tvec2 const & v2) { return tvec2(v1.x || v2.x, v1.y || v2.y); } }//namespace glm