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

This commit is contained in:
Dave Reid 2012-12-22 14:15:12 +10:00
parent 1af1bea837
commit 56c5ce98e6
3 changed files with 42 additions and 1 deletions

View File

@ -300,6 +300,26 @@ namespace detail
GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
GLM_FUNC_DECL tref4<T> swizzle(comp X, comp Y, comp Z, comp W);
//////////////////////////////////////
// Static constants
static const tvec4<T> xpos;
static const tvec4<T> xneg;
static const tvec4<T> ypos;
static const tvec4<T> yneg;
static const tvec4<T> zpos;
static const tvec4<T> zneg;
static const tvec4<T> wpos;
static const tvec4<T> wneg;
static const tvec4<T> right;
static const tvec4<T> left;
static const tvec4<T> up;
static const tvec4<T> down;
static const tvec4<T> backward;
static const tvec4<T> forward;
};
template <typename T>

View File

@ -1374,5 +1374,26 @@ namespace detail
return tvec4<T>(this->x, this->y, this->z, this->w);
}
//////////////////////////////////////
// Static constants
template <typename T> const tvec4<T> tvec4<T>::xpos = tvec4<T>(T( 1), T( 0), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::xneg = tvec4<T>(T(-1), T( 0), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::ypos = tvec4<T>(T( 0), T( 1), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::yneg = tvec4<T>(T( 0), T(-1), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::zpos = tvec4<T>(T( 0), T( 0), T( 1), T( 0));
template <typename T> const tvec4<T> tvec4<T>::zneg = tvec4<T>(T( 0), T( 0), T(-1), T( 0));
template <typename T> const tvec4<T> tvec4<T>::wpos = tvec4<T>(T( 0), T( 0), T( 0), T( 1));
template <typename T> const tvec4<T> tvec4<T>::wneg = tvec4<T>(T( 0), T( 0), T( 0), T(-1));
template <typename T> const tvec4<T> tvec4<T>::right = tvec4<T>(T( 1), T( 0), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::left = tvec4<T>(T(-1), T( 0), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::up = tvec4<T>(T( 0), T( 1), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::down = tvec4<T>(T( 0), T(-1), T( 0), T( 0));
template <typename T> const tvec4<T> tvec4<T>::backward = tvec4<T>(T( 0), T( 0), T( 1), T( 0));
template <typename T> const tvec4<T> tvec4<T>::forward = tvec4<T>(T( 0), T( 0), T(-1), T( 0));
}//namespace detail
}//namespace glm