Added initializer list for vectors

This commit is contained in:
Christophe Riccio 2014-01-04 12:46:47 +01:00
parent 9b57315681
commit 26e02fad68
3 changed files with 45 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include <glm/vector_relational.hpp> #include <glm/vector_relational.hpp>
#include <glm/vec2.hpp> #include <glm/vec2.hpp>
#include <vector>
int test_vec2_operators() int test_vec2_operators()
{ {
@ -199,6 +200,24 @@ int test_vec2_ctor()
{ {
int Error = 0; int Error = 0;
#if(GLM_HAS_INITIALIZER_LISTS)
{
glm::vec2 a{ 0, 1 };
std::vector<glm::vec2> v = {
{0, 1},
{4, 5},
{8, 9}};
}
{
glm::dvec2 a{ 0, 1 };
std::vector<glm::dvec2> v = {
{0, 1},
{4, 5},
{8, 9}};
}
#endif
{ {
glm::vec2 A = glm::vec2(2.0f); glm::vec2 A = glm::vec2(2.0f);
glm::vec2 B = glm::vec2(2.0f, 3.0f); glm::vec2 B = glm::vec2(2.0f, 3.0f);

View File

@ -20,6 +20,24 @@ int test_vec3_ctor()
{ {
int Error = 0; int Error = 0;
#if(GLM_HAS_INITIALIZER_LISTS)
{
glm::vec3 a{ 0, 1, 2 };
std::vector<glm::vec3> v = {
{0, 1, 2},
{4, 5, 6},
{8, 9, 0}};
}
{
glm::dvec3 a{ 0, 1, 2 };
std::vector<glm::dvec3> v = {
{0, 1, 2},
{4, 5, 6},
{8, 9, 0}};
}
#endif
{ {
glm::vec3 A(1); glm::vec3 A(1);
glm::vec3 B(1, 1, 1); glm::vec3 B(1, 1, 1);

View File

@ -49,6 +49,14 @@ int test_vec4_ctor()
{4, 5, 6, 7}, {4, 5, 6, 7},
{8, 9, 0, 1}}; {8, 9, 0, 1}};
} }
{
glm::dvec4 a{ 0, 1, 2, 3 };
std::vector<glm::dvec4> v = {
{0, 1, 2, 3},
{4, 5, 6, 7},
{8, 9, 0, 1}};
}
#endif #endif
{ {