Added C++11 initalizer lists to quaternions

This commit is contained in:
Christophe Riccio 2013-10-01 02:00:27 +02:00
parent 2d5724e23a
commit 258361ccd4
2 changed files with 18 additions and 0 deletions

View File

@ -77,6 +77,11 @@ namespace detail
T const & y,
T const & z);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tquat(std::initializer_list<U> l);
#endif//GLM_HAS_INITIALIZER_LISTS
// Convertions
/// Create a quaternion from two normalized axis

View File

@ -83,6 +83,19 @@ namespace detail
w(w)
{}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0])),
y(static_cast<T>(l.begin()[1])),
z(static_cast<T>(l.begin()[2])),
w(static_cast<T>(l.begin()[3]))
{
assert(v.size() >= this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////////////////////////////
// tquat conversions