mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Fixed mat4 initializer list contructors
This commit is contained in:
parent
812ff4fcc8
commit
81ed43373f
@ -91,10 +91,9 @@ namespace detail
|
|||||||
|
|
||||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||||
template <typename U>
|
template <typename U>
|
||||||
GLM_FUNC_DECL tmat4x4(std::initializer_list<U> const & m);
|
GLM_FUNC_DECL tmat4x4(std::initializer_list<U> m);
|
||||||
|
|
||||||
template <typename U>
|
GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<T, P> > m);
|
||||||
GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<U, P> > const & m);
|
|
||||||
#endif//GLM_HAS_INITIALIZER_LISTS
|
#endif//GLM_HAS_INITIALIZER_LISTS
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
@ -177,19 +177,20 @@ namespace detail
|
|||||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
template <typename U>
|
template <typename U>
|
||||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<U> const & m)
|
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<U> m)
|
||||||
{
|
{
|
||||||
assert(m.size() >= this->length());
|
assert(m.size() >= this->length());
|
||||||
|
|
||||||
this->value[0] = reinterpret_cast<tvec4<U, P> const &>(m.begin()[0]);
|
typename std::initializer_list<U>::iterator p = m.begin();
|
||||||
this->value[1] = reinterpret_cast<tvec4<U, P> const &>(m.begin()[4]);
|
|
||||||
this->value[2] = reinterpret_cast<tvec4<U, P> const &>(m.begin()[8]);
|
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
|
||||||
this->value[3] = reinterpret_cast<tvec4<U, P> const &>(m.begin()[12]);
|
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
|
||||||
|
this->value[2] = tvec4<T, P>(*(p + 8), *(p + 9), *(p + 10), *(p + 11));
|
||||||
|
this->value[3] = tvec4<T, P>(*(p + 12), *(p + 13), *(p + 14), *(p + 15));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
template <typename U>
|
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<tvec4<T, P> > m)
|
||||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<tvec4<U, P> > const & m)
|
|
||||||
{
|
{
|
||||||
this->value[0] = m.begin()[0];
|
this->value[0] = m.begin()[0];
|
||||||
this->value[1] = m.begin()[1];
|
this->value[1] = m.begin()[1];
|
||||||
|
@ -111,7 +111,7 @@ namespace detail
|
|||||||
|
|
||||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||||
template <typename U>
|
template <typename U>
|
||||||
GLM_FUNC_DECL tvec4(std::initializer_list<U> const & v);
|
GLM_FUNC_DECL tvec4(std::initializer_list<U> l);
|
||||||
#endif//GLM_HAS_INITIALIZER_LISTS
|
#endif//GLM_HAS_INITIALIZER_LISTS
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
@ -83,7 +83,7 @@ namespace detail
|
|||||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
template <typename U>
|
template <typename U>
|
||||||
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(std::initializer_list<U> const & v) :
|
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(std::initializer_list<U> v) :
|
||||||
x(static_cast<T>(v.begin()[0])),
|
x(static_cast<T>(v.begin()[0])),
|
||||||
y(static_cast<T>(v.begin()[1])),
|
y(static_cast<T>(v.begin()[1])),
|
||||||
z(static_cast<T>(v.begin()[2])),
|
z(static_cast<T>(v.begin()[2])),
|
||||||
|
@ -131,10 +131,10 @@ int test_ctr()
|
|||||||
glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||||
|
|
||||||
glm::mat4 m2{
|
glm::mat4 m2{
|
||||||
glm::vec4{0, 1, 2, 3},
|
{0, 1, 2, 3},
|
||||||
glm::vec4{4, 5, 6, 7},
|
{4, 5, 6, 7},
|
||||||
glm::vec4{8, 9, 10, 11},
|
{8, 9, 10, 11},
|
||||||
glm::vec4{12, 13, 14, 15}};
|
{12, 13, 14, 15}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
std::initializer_list<glm::mat4> m3{
|
std::initializer_list<glm::mat4> m3{
|
||||||
@ -145,8 +145,12 @@ int test_ctr()
|
|||||||
*/
|
*/
|
||||||
//glm::mat4 m4{m3};
|
//glm::mat4 m4{m3};
|
||||||
|
|
||||||
/*
|
std::vector<glm::mat4> v1{
|
||||||
std::vector<glm::mat4> v{
|
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
||||||
|
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<glm::mat4> v2{
|
||||||
{
|
{
|
||||||
{ 0, 1, 2, 3 },
|
{ 0, 1, 2, 3 },
|
||||||
{ 4, 5, 6, 7 },
|
{ 4, 5, 6, 7 },
|
||||||
@ -160,7 +164,7 @@ int test_ctr()
|
|||||||
{ 12, 13, 14, 15 }
|
{ 12, 13, 14, 15 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
#endif//GLM_HAS_INITIALIZER_LISTS
|
#endif//GLM_HAS_INITIALIZER_LISTS
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
|
Loading…
Reference in New Issue
Block a user