Fixed float warnings

This commit is contained in:
Groove
2018-07-28 12:39:15 +02:00
parent 382d3c674d
commit 9299abaf9b
3 changed files with 284 additions and 279 deletions

View File

@@ -1,3 +1,5 @@
#include <glm/ext/vector_relational.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/matrix_access.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@@ -18,8 +20,8 @@ int test_mat2x2_row_set()
m = glm::row(m, 0, glm::vec2( 0, 1));
m = glm::row(m, 1, glm::vec2( 4, 5));
Error += glm::row(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -33,8 +35,8 @@ int test_mat2x2_col_set()
m = glm::column(m, 0, glm::vec2( 0, 1));
m = glm::column(m, 1, glm::vec2( 4, 5));
Error += glm::column(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -49,9 +51,9 @@ int test_mat2x3_row_set()
m = glm::row(m, 1, glm::vec2( 4, 5));
m = glm::row(m, 2, glm::vec2( 8, 9));
Error += glm::row(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec2( 8, 9) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -65,8 +67,8 @@ int test_mat2x3_col_set()
m = glm::column(m, 0, glm::vec3( 0, 1, 2));
m = glm::column(m, 1, glm::vec3( 4, 5, 6));
Error += glm::column(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -82,10 +84,10 @@ int test_mat2x4_row_set()
m = glm::row(m, 2, glm::vec2( 8, 9));
m = glm::row(m, 3, glm::vec2(12, 13));
Error += glm::row(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec2( 8, 9) ? 0 : 1;
Error += glm::row(m, 3) == glm::vec2(12, 13) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 3), glm::vec2(12, 13), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -99,8 +101,8 @@ int test_mat2x4_col_set()
m = glm::column(m, 0, glm::vec4( 0, 1, 2, 3));
m = glm::column(m, 1, glm::vec4( 4, 5, 6, 7));
Error += glm::column(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -114,8 +116,8 @@ int test_mat3x2_row_set()
m = glm::row(m, 0, glm::vec3( 0, 1, 2));
m = glm::row(m, 1, glm::vec3( 4, 5, 6));
Error += glm::row(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -130,9 +132,9 @@ int test_mat3x2_col_set()
m = glm::column(m, 1, glm::vec2( 4, 5));
m = glm::column(m, 2, glm::vec2( 8, 9));
Error += glm::column(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec2( 8, 9) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -147,9 +149,9 @@ int test_mat3x3_row_set()
m = glm::row(m, 1, glm::vec3( 4, 5, 6));
m = glm::row(m, 2, glm::vec3( 8, 9, 10));
Error += glm::row(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec3( 8, 9, 10) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -164,9 +166,9 @@ int test_mat3x3_col_set()
m = glm::column(m, 1, glm::vec3( 4, 5, 6));
m = glm::column(m, 2, glm::vec3( 8, 9, 10));
Error += glm::column(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec3( 8, 9, 10) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -182,10 +184,10 @@ int test_mat3x4_row_set()
m = glm::row(m, 2, glm::vec3( 8, 9, 10));
m = glm::row(m, 3, glm::vec3(12, 13, 14));
Error += glm::row(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec3( 8, 9, 10) ? 0 : 1;
Error += glm::row(m, 3) == glm::vec3(12, 13, 14) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 3), glm::vec3(12, 13, 14), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -200,9 +202,9 @@ int test_mat3x4_col_set()
m = glm::column(m, 1, glm::vec4( 4, 5, 6, 7));
m = glm::column(m, 2, glm::vec4( 8, 9, 10, 11));
Error += glm::column(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec4( 8, 9, 10, 11) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -216,8 +218,8 @@ int test_mat4x2_row_set()
m = glm::row(m, 0, glm::vec4( 0, 1, 2, 3));
m = glm::row(m, 1, glm::vec4( 4, 5, 6, 7));
Error += glm::row(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -233,10 +235,10 @@ int test_mat4x2_col_set()
m = glm::column(m, 2, glm::vec2( 8, 9));
m = glm::column(m, 3, glm::vec2(12, 13));
Error += glm::column(m, 0) == glm::vec2( 0, 1) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec2( 4, 5) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec2( 8, 9) ? 0 : 1;
Error += glm::column(m, 3) == glm::vec2(12, 13) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 3), glm::vec2(12, 13), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -251,9 +253,9 @@ int test_mat4x3_row_set()
m = glm::row(m, 1, glm::vec4( 4, 5, 6, 7));
m = glm::row(m, 2, glm::vec4( 8, 9, 10, 11));
Error += glm::row(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec4( 8, 9, 10, 11) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -269,10 +271,10 @@ int test_mat4x3_col_set()
m = glm::column(m, 2, glm::vec3( 8, 9, 10));
m = glm::column(m, 3, glm::vec3(12, 13, 14));
Error += glm::column(m, 0) == glm::vec3( 0, 1, 2) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec3( 4, 5, 6) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec3( 8, 9, 10) ? 0 : 1;
Error += glm::column(m, 3) == glm::vec3(12, 13, 14) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 3), glm::vec3(12, 13, 14), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -288,10 +290,10 @@ int test_mat4x4_row_set()
m = glm::row(m, 2, glm::vec4( 8, 9, 10, 11));
m = glm::row(m, 3, glm::vec4(12, 13, 14, 15));
Error += glm::row(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::row(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::row(m, 2) == glm::vec4( 8, 9, 10, 11) ? 0 : 1;
Error += glm::row(m, 3) == glm::vec4(12, 13, 14, 15) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::row(m, 3), glm::vec4(12, 13, 14, 15), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -307,10 +309,10 @@ int test_mat4x4_col_set()
m = glm::column(m, 2, glm::vec4( 8, 9, 10, 11));
m = glm::column(m, 3, glm::vec4(12, 13, 14, 15));
Error += glm::column(m, 0) == glm::vec4( 0, 1, 2, 3) ? 0 : 1;
Error += glm::column(m, 1) == glm::vec4( 4, 5, 6, 7) ? 0 : 1;
Error += glm::column(m, 2) == glm::vec4( 8, 9, 10, 11) ? 0 : 1;
Error += glm::column(m, 3) == glm::vec4(12, 13, 14, 15) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(glm::column(m, 3), glm::vec4(12, 13, 14, 15), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -322,13 +324,13 @@ int test_mat4x4_row_get()
glm::mat4 m(1);
glm::vec4 A = glm::row(m, 0);
Error += A == glm::vec4(1, 0, 0, 0) ? 0 : 1;
Error += glm::all(glm::equal(A, glm::vec4(1, 0, 0, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 B = glm::row(m, 1);
Error += B == glm::vec4(0, 1, 0, 0) ? 0 : 1;
Error += glm::all(glm::equal(B, glm::vec4(0, 1, 0, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 C = glm::row(m, 2);
Error += C == glm::vec4(0, 0, 1, 0) ? 0 : 1;
Error += glm::all(glm::equal(C, glm::vec4(0, 0, 1, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 D = glm::row(m, 3);
Error += D == glm::vec4(0, 0, 0, 1) ? 0 : 1;
Error += glm::all(glm::equal(D, glm::vec4(0, 0, 0, 1), glm::epsilon<float>())) ? 0 : 1;
return Error;
}
@@ -340,13 +342,13 @@ int test_mat4x4_col_get()
glm::mat4 m(1);
glm::vec4 A = glm::column(m, 0);
Error += A == glm::vec4(1, 0, 0, 0) ? 0 : 1;
Error += glm::all(glm::equal(A, glm::vec4(1, 0, 0, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 B = glm::column(m, 1);
Error += B == glm::vec4(0, 1, 0, 0) ? 0 : 1;
Error += glm::all(glm::equal(B, glm::vec4(0, 1, 0, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 C = glm::column(m, 2);
Error += C == glm::vec4(0, 0, 1, 0) ? 0 : 1;
Error += glm::all(glm::equal(C, glm::vec4(0, 0, 1, 0), glm::epsilon<float>())) ? 0 : 1;
glm::vec4 D = glm::column(m, 3);
Error += D == glm::vec4(0, 0, 0, 1) ? 0 : 1;
Error += glm::all(glm::equal(D, glm::vec4(0, 0, 0, 1), glm::epsilon<float>())) ? 0 : 1;
return Error;
}