Add static xpos, xneg, ypos, etc constants to tvec2.

This commit is contained in:
Dave Reid 2012-12-22 14:21:17 +10:00
parent 56c5ce98e6
commit 6ec248b75a
2 changed files with 29 additions and 0 deletions

View File

@ -219,6 +219,20 @@ namespace detail
GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const; GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y); GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
//////////////////////////////////////
// Static constants
static const tvec2<T> xpos;
static const tvec2<T> xneg;
static const tvec2<T> ypos;
static const tvec2<T> yneg;
static const tvec2<T> right;
static const tvec2<T> left;
static const tvec2<T> up;
static const tvec2<T> down;
}; };
template <typename T> template <typename T>

View File

@ -1024,5 +1024,20 @@ namespace detail
{ {
return tvec2<T>(this->x, this->y); return tvec2<T>(this->x, this->y);
} }
//////////////////////////////////////
// Static constants
template <typename T> const tvec2<T> tvec2<T>::xpos = tvec2<T>(T( 1), T( 0));
template <typename T> const tvec2<T> tvec2<T>::xneg = tvec2<T>(T(-1), T( 0));
template <typename T> const tvec2<T> tvec2<T>::ypos = tvec2<T>(T( 0), T( 1));
template <typename T> const tvec2<T> tvec2<T>::yneg = tvec2<T>(T( 0), T(-1));
template <typename T> const tvec2<T> tvec2<T>::right = tvec2<T>(T( 1), T( 0));
template <typename T> const tvec2<T> tvec2<T>::left = tvec2<T>(T(-1), T( 0));
template <typename T> const tvec2<T> tvec2<T>::up = tvec2<T>(T( 0), T( 1));
template <typename T> const tvec2<T> tvec2<T>::down = tvec2<T>(T( 0), T(-1));
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm