Added C++11 initalizer lists to quaternions
This commit is contained in:
@@ -77,6 +77,11 @@ namespace detail
|
|||||||
T const & y,
|
T const & y,
|
||||||
T const & z);
|
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
|
// Convertions
|
||||||
|
|
||||||
/// Create a quaternion from two normalized axis
|
/// Create a quaternion from two normalized axis
|
||||||
|
|||||||
@@ -83,6 +83,19 @@ namespace detail
|
|||||||
w(w)
|
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
|
// tquat conversions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user