Added make_vec*

This commit is contained in:
Christophe Riccio
2017-08-25 15:11:24 +02:00
parent d550798ca0
commit ba4e508e98
3 changed files with 266 additions and 92 deletions

View File

@@ -1,4 +1,5 @@
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/vec1.hpp>
int test_value_ptr_vec()
{
@@ -237,10 +238,90 @@ int test_make_pointer_vec()
return Error;
}
int test_make_vec1()
{
int Error = 0;
glm::ivec1 const v1 = glm::make_vec1(glm::ivec1(2));
Error += v1 == glm::ivec1(2) ? 0 : 1;
glm::ivec1 const v2 = glm::make_vec1(glm::ivec2(2));
Error += v2 == glm::ivec1(2) ? 0 : 1;
glm::ivec1 const v3 = glm::make_vec1(glm::ivec3(2));
Error += v3 == glm::ivec1(2) ? 0 : 1;
glm::ivec1 const v4 = glm::make_vec1(glm::ivec4(2));
Error += v3 == glm::ivec1(2) ? 0 : 1;
return Error;
}
int test_make_vec2()
{
int Error = 0;
glm::ivec2 const v1 = glm::make_vec2(glm::ivec1(2));
Error += v1 == glm::ivec2(2, 0) ? 0 : 1;
glm::ivec2 const v2 = glm::make_vec2(glm::ivec2(2));
Error += v2 == glm::ivec2(2, 2) ? 0 : 1;
glm::ivec2 const v3 = glm::make_vec2(glm::ivec3(2));
Error += v3 == glm::ivec2(2, 2) ? 0 : 1;
glm::ivec2 const v4 = glm::make_vec2(glm::ivec4(2));
Error += v3 == glm::ivec2(2, 2) ? 0 : 1;
return Error;
}
int test_make_vec3()
{
int Error = 0;
glm::ivec3 const v1 = glm::make_vec3(glm::ivec1(2));
Error += v1 == glm::ivec3(2, 0, 0) ? 0 : 1;
glm::ivec3 const v2 = glm::make_vec3(glm::ivec2(2));
Error += v2 == glm::ivec3(2, 2, 0) ? 0 : 1;
glm::ivec3 const v3 = glm::make_vec3(glm::ivec3(2));
Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1;
glm::ivec3 const v4 = glm::make_vec3(glm::ivec4(2));
Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1;
return Error;
}
int test_make_vec4()
{
int Error = 0;
glm::ivec4 const v1 = glm::make_vec4(glm::ivec1(2));
Error += v1 == glm::ivec4(2, 0, 0, 1) ? 0 : 1;
glm::ivec4 const v2 = glm::make_vec4(glm::ivec2(2));
Error += v2 == glm::ivec4(2, 2, 0, 1) ? 0 : 1;
glm::ivec4 const v3 = glm::make_vec4(glm::ivec3(2));
Error += v3 == glm::ivec4(2, 2, 2, 1) ? 0 : 1;
glm::ivec4 const v4 = glm::make_vec4(glm::ivec4(2));
Error += v3 == glm::ivec4(2, 2, 2, 4) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_make_vec1();
Error += test_make_vec2();
Error += test_make_vec3();
Error += test_make_vec4();
Error += test_make_pointer_vec();
Error += test_make_pointer_mat();
Error += test_value_ptr_vec();