/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2007-01-15 // Updated : 2007-01-15 // Licence : This source is under GNU LGPL licence // File : _cvec2.inl /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef __cvec2_inl__ #define __cvec2_inl__ #include "_cvec2.h" namespace glm{ namespace detail{ template const int _cvec2::value_size = 2; ////////////////////////////////////////////////////////////// // _cvec2 constructor template inline _cvec2::_cvec2(const T x, const T y) : x(x), y(y) {} ////////////////////////////////////////////////////////////// // vec2 and ivec2 accesses template inline T& _cvec2::operator [] (int i) { return (&x)[i]; } template inline const T _cvec2::operator [] (int i) const { return (&x)[i]; } template inline _cvec2::operator T* () { return &x; } template inline _cvec2::operator const T* () const { return &x; } #if defined(GLM_SWIZZLE) ////////////////////////////////////////////////////////////// // Left hand side 2 components common swizzle operator template inline REF2 _cvec2::_xy() { return REF2(this->x, this->y); } template inline REF2 _cvec2::_yx() { return REF2(this->y, this->x); } ////////////////////////////////////////////////////////////// // Right hand side 2 components common swizzle operators template inline const VEC2 _cvec2::_xx() const { return VEC2(this->x, this->x); } template inline const VEC2 _cvec2::_yx() const { return VEC2(this->y, this->x); } template inline VEC2 _cvec2::_xy() const { return VEC2(this->x, this->y); } template inline const VEC2 _cvec2::_yy() const { return VEC2(this->y, this->y); } ////////////////////////////////////////////////////////////// // Right hand side 3 components common swizzle operators template inline const VEC3 _cvec2::_xxx() const { return VEC3(this->x, this->x, this->x); } template inline const VEC3 _cvec2::_yxx() const { return VEC3(this->y, this->x, this->x); } template inline const VEC3 _cvec2::_xyx() const { return VEC3(this->x, this->y, this->x); } template inline const VEC3 _cvec2::_yyx() const { return VEC3(this->y, this->y, this->x); } template inline const VEC3 _cvec2::_xxy() const { return VEC3(this->x, this->x, this->y); } template inline const VEC3 _cvec2::_yxy() const { return VEC3(this->y, this->x, this->y); } template inline const VEC3 _cvec2::_xyy() const { return VEC3(this->x, this->y, this->y); } template inline const VEC3 _cvec2::_yyy() const { return VEC3(this->y, this->y, this->y); } ////////////////////////////////////////////////////////////// // Right hand side 4 components common swizzle operators template inline const VEC4 _cvec2::_xxxx() const { return VEC4(this->x, this->x, this->x, this->x); } template inline const VEC4 _cvec2::_yxxx() const { return VEC4(this->y, this->x, this->x, this->x); } template inline const VEC4 _cvec2::_xyxx() const { return VEC4(this->x, this->y, this->x, this->x); } template inline const VEC4 _cvec2::_yyxx() const { return VEC4(this->y, this->y, this->x, this->x); } template inline const VEC4 _cvec2::_xxyx() const { return VEC4(this->x, this->x, this->y, this->x); } template inline const VEC4 _cvec2::_yxyx() const { return VEC4(this->y, this->x, this->y, this->x); } template inline const VEC4 _cvec2::_xyyx() const { return VEC4(this->x, this->y, this->y, this->x); } template inline const VEC4 _cvec2::_yyyx() const { return VEC4(this->y, this->y, this->y, this->x); } template inline const VEC4 _cvec2::_xxxy() const { return VEC4(this->x, this->x, this->x, this->y); } template inline const VEC4 _cvec2::_yxxy() const { return VEC4(this->y, this->x, this->x, this->y); } template inline const VEC4 _cvec2::_xyxy() const { return VEC4(this->x, this->y, this->x, this->y); } template inline const VEC4 _cvec2::_yyxy() const { return VEC4(this->y, this->y, this->x, this->y); } template inline const VEC4 _cvec2::_xxyy() const { return VEC4(this->x, this->x, this->y, this->y); } template inline const VEC4 _cvec2::_yxyy() const { return VEC4(this->y, this->x, this->y, this->y); } template inline const VEC4 _cvec2::_xyyy() const { return VEC4(this->x, this->y, this->y, this->y); } template inline const VEC4 _cvec2::_yyyy() const { return VEC4(this->y, this->y, this->y, this->y); } #endif //defined(GLM_SWIZZLE) } //namespace detail } //namespace glm #endif //__cvec2_inl__