Sliced matrix transform extension
This commit is contained in:
@@ -13,8 +13,6 @@ glmCreateTestGTC(ext_scalar_uint_sized)
|
||||
glmCreateTestGTC(ext_scalar_relational)
|
||||
glmCreateTestGTC(ext_vec1)
|
||||
glmCreateTestGTC(ext_vector_bool1)
|
||||
glmCreateTestGTC(ext_vector_float1)
|
||||
glmCreateTestGTC(ext_vector_double1)
|
||||
glmCreateTestGTC(ext_vector_int1)
|
||||
glmCreateTestGTC(ext_vector_uint1)
|
||||
glmCreateTestGTC(ext_vector_iec559)
|
||||
glmCreateTestGTC(ext_vector_integer)
|
||||
glmCreateTestGTC(ext_vector_relational)
|
||||
|
||||
13
test/ext/ext_matrix_clip_space.cpp
Normal file
13
test/ext/ext_matrix_clip_space.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <glm/ext/matrix_relational.hpp>
|
||||
#include <glm/ext/matrix_clip_space.hpp>
|
||||
#include <glm/ext/matrix_float4x4.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_float4.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
return Error;
|
||||
}
|
||||
13
test/ext/ext_matrix_projection.cpp
Normal file
13
test/ext/ext_matrix_projection.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <glm/ext/matrix_relational.hpp>
|
||||
#include <glm/ext/matrix_projection.hpp>
|
||||
#include <glm/ext/matrix_float4x4.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_float4.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
return Error;
|
||||
}
|
||||
@@ -18,12 +18,30 @@ static int test_translate()
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_scale()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::mat4 const M(1.0f);
|
||||
glm::vec3 const V(2.0f);
|
||||
|
||||
glm::mat4 const S = glm::scale(M, V);
|
||||
glm::mat4 const R = glm::mat4(
|
||||
glm::vec4(2, 0, 0, 0),
|
||||
glm::vec4(0, 2, 0, 0),
|
||||
glm::vec4(0, 0, 2, 0),
|
||||
glm::vec4(0, 0, 0, 1));
|
||||
Error += glm::all(glm::equal(S, R, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_translate();
|
||||
Error += test_scale();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/ext/scalar_relational.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_double1.hpp>
|
||||
#include <glm/ext/vector_double1_precision.hpp>
|
||||
#include <glm/ext/vector_double2.hpp>
|
||||
#include <glm/ext/vector_double3.hpp>
|
||||
#include <glm/ext/vector_double4.hpp>
|
||||
|
||||
template <typename genType>
|
||||
static int test_operators()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
|
||||
genType const C = A + B;
|
||||
Error += glm::all(glm::equal(C, genType(2), glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const D = A - B;
|
||||
Error += glm::all(glm::equal(D, genType(0), glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const E = A * B;
|
||||
Error += glm::all(glm::equal(E, genType(1), glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const F = A / B;
|
||||
Error += glm::all(glm::equal(F, genType(1), glm::epsilon<double>())) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::dvec1 const A = genType(1);
|
||||
|
||||
glm::dvec1 const E(genType(1));
|
||||
Error += glm::all(glm::equal(A, E, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
glm::dvec1 const F(E);
|
||||
Error += glm::all(glm::equal(A, F, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const B = genType(1);
|
||||
genType const G(glm::dvec2(1));
|
||||
Error += glm::all(glm::equal(B, G, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const H(glm::dvec3(1));
|
||||
Error += glm::all(glm::equal(B, H, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
genType const I(glm::dvec4(1));
|
||||
Error += glm::all(glm::equal(B, I, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::dvec1) == sizeof(genType) ? 0 : 1;
|
||||
Error += genType().length() == 1 ? 0 : 1;
|
||||
Error += genType::length() == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_relational()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
genType const C(0);
|
||||
|
||||
Error += all(equal(A, B, glm::epsilon<double>())) ? 0 : 1;
|
||||
Error += any(notEqual(A, C, glm::epsilon<double>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators<glm::dvec1>();
|
||||
Error += test_operators<glm::lowp_dvec1>();
|
||||
Error += test_operators<glm::mediump_dvec1>();
|
||||
Error += test_operators<glm::highp_dvec1>();
|
||||
|
||||
Error += test_ctor<glm::dvec1>();
|
||||
Error += test_ctor<glm::lowp_dvec1>();
|
||||
Error += test_ctor<glm::mediump_dvec1>();
|
||||
Error += test_ctor<glm::highp_dvec1>();
|
||||
|
||||
Error += test_size<glm::dvec1>();
|
||||
Error += test_size<glm::lowp_dvec1>();
|
||||
Error += test_size<glm::mediump_dvec1>();
|
||||
Error += test_size<glm::highp_dvec1>();
|
||||
|
||||
Error += test_relational<glm::dvec1>();
|
||||
Error += test_relational<glm::lowp_dvec1>();
|
||||
Error += test_relational<glm::mediump_dvec1>();
|
||||
Error += test_relational<glm::highp_dvec1>();
|
||||
|
||||
Error += test_constexpr<glm::dvec1>();
|
||||
Error += test_constexpr<glm::lowp_dvec1>();
|
||||
Error += test_constexpr<glm::mediump_dvec1>();
|
||||
Error += test_constexpr<glm::highp_dvec1>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_float1.hpp>
|
||||
#include <glm/ext/vector_float1_precision.hpp>
|
||||
#include <glm/ext/vector_float2.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
#include <glm/ext/vector_float4.hpp>
|
||||
|
||||
template <typename genType>
|
||||
static int test_operators()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
|
||||
genType const C = A + B;
|
||||
Error += glm::all(glm::equal(C, genType(2), glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const D = A - B;
|
||||
Error += glm::all(glm::equal(D, genType(0), glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const E = A * B;
|
||||
Error += glm::all(glm::equal(E, genType(1), glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const F = A / B;
|
||||
Error += glm::all(glm::equal(F, genType(1), glm::epsilon<float>())) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::vec1 const A = genType(1);
|
||||
|
||||
glm::vec1 const E(genType(1));
|
||||
Error += glm::all(glm::equal(A, E, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
glm::vec1 const F(E);
|
||||
Error += glm::all(glm::equal(A, F, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const B = genType(1);
|
||||
genType const G(glm::vec2(1));
|
||||
Error += glm::all(glm::equal(B, G, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const H(glm::vec3(1));
|
||||
Error += glm::all(glm::equal(B, H, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
genType const I(glm::vec4(1));
|
||||
Error += glm::all(glm::equal(B, I, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::vec1) == sizeof(genType) ? 0 : 1;
|
||||
Error += genType().length() == 1 ? 0 : 1;
|
||||
Error += genType::length() == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_relational()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
genType const C(0);
|
||||
|
||||
Error += all(equal(A, B, glm::epsilon<float>())) ? 0 : 1;
|
||||
Error += any(notEqual(A, C, glm::epsilon<float>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators<glm::vec1>();
|
||||
Error += test_operators<glm::lowp_vec1>();
|
||||
Error += test_operators<glm::mediump_vec1>();
|
||||
Error += test_operators<glm::highp_vec1>();
|
||||
|
||||
Error += test_ctor<glm::vec1>();
|
||||
Error += test_ctor<glm::lowp_vec1>();
|
||||
Error += test_ctor<glm::mediump_vec1>();
|
||||
Error += test_ctor<glm::highp_vec1>();
|
||||
|
||||
Error += test_size<glm::vec1>();
|
||||
Error += test_size<glm::lowp_vec1>();
|
||||
Error += test_size<glm::mediump_vec1>();
|
||||
Error += test_size<glm::highp_vec1>();
|
||||
|
||||
Error += test_relational<glm::vec1>();
|
||||
Error += test_relational<glm::lowp_vec1>();
|
||||
Error += test_relational<glm::mediump_vec1>();
|
||||
Error += test_relational<glm::highp_vec1>();
|
||||
|
||||
Error += test_constexpr<glm::vec1>();
|
||||
Error += test_constexpr<glm::lowp_vec1>();
|
||||
Error += test_constexpr<glm::mediump_vec1>();
|
||||
Error += test_constexpr<glm::highp_vec1>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
166
test/ext/ext_vector_iec559.cpp
Normal file
166
test/ext/ext_vector_iec559.cpp
Normal file
@@ -0,0 +1,166 @@
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/ext/scalar_relational.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
#include <glm/ext/vector_double1.hpp>
|
||||
#include <glm/ext/vector_double1_precision.hpp>
|
||||
#include <glm/ext/vector_double2.hpp>
|
||||
#include <glm/ext/vector_double3.hpp>
|
||||
#include <glm/ext/vector_double4.hpp>
|
||||
#include <glm/ext/vector_float1.hpp>
|
||||
#include <glm/ext/vector_float1_precision.hpp>
|
||||
#include <glm/ext/vector_float2.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
#include <glm/ext/vector_float4.hpp>
|
||||
|
||||
template <typename genType>
|
||||
static int test_operators()
|
||||
{
|
||||
typedef typename genType::value_type valType;
|
||||
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
|
||||
genType const C = A + B;
|
||||
Error += glm::all(glm::equal(C, genType(2), glm::epsilon<valType>())) ? 0 : 1;
|
||||
|
||||
genType const D = A - B;
|
||||
Error += glm::all(glm::equal(D, genType(0), glm::epsilon<valType>())) ? 0 : 1;
|
||||
|
||||
genType const E = A * B;
|
||||
Error += glm::all(glm::equal(E, genType(1), glm::epsilon<valType>())) ? 0 : 1;
|
||||
|
||||
genType const F = A / B;
|
||||
Error += glm::all(glm::equal(F, genType(1), glm::epsilon<valType>())) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_ctor()
|
||||
{
|
||||
typedef typename genType::value_type T;
|
||||
|
||||
int Error = 0;
|
||||
|
||||
glm::vec<1, T> const A = genType(1);
|
||||
|
||||
glm::vec<1, T> const E(genType(1));
|
||||
Error += glm::all(glm::equal(A, E, glm::epsilon<T>())) ? 0 : 1;
|
||||
|
||||
glm::vec<1, T> const F(E);
|
||||
Error += glm::all(glm::equal(A, F, glm::epsilon<T>())) ? 0 : 1;
|
||||
|
||||
genType const B = genType(1);
|
||||
genType const G(glm::vec<2, T>(1));
|
||||
Error += glm::all(glm::equal(B, G, glm::epsilon<T>())) ? 0 : 1;
|
||||
|
||||
genType const H(glm::vec<3, T>(1));
|
||||
Error += glm::all(glm::equal(B, H, glm::epsilon<T>())) ? 0 : 1;
|
||||
|
||||
genType const I(glm::vec<4, T>(1));
|
||||
Error += glm::all(glm::equal(B, I, glm::epsilon<T>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_size()
|
||||
{
|
||||
typedef typename genType::value_type T;
|
||||
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::vec<1, T>) == sizeof(genType) ? 0 : 1;
|
||||
Error += genType().length() == 1 ? 0 : 1;
|
||||
Error += genType::length() == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_relational()
|
||||
{
|
||||
typedef typename genType::value_type valType;
|
||||
|
||||
int Error = 0;
|
||||
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
genType const C(0);
|
||||
|
||||
Error += all(equal(A, B, glm::epsilon<valType>())) ? 0 : 1;
|
||||
Error += any(notEqual(A, C, glm::epsilon<valType>())) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators<glm::dvec1>();
|
||||
Error += test_operators<glm::lowp_dvec1>();
|
||||
Error += test_operators<glm::mediump_dvec1>();
|
||||
Error += test_operators<glm::highp_dvec1>();
|
||||
|
||||
Error += test_ctor<glm::dvec1>();
|
||||
Error += test_ctor<glm::lowp_dvec1>();
|
||||
Error += test_ctor<glm::mediump_dvec1>();
|
||||
Error += test_ctor<glm::highp_dvec1>();
|
||||
|
||||
Error += test_size<glm::dvec1>();
|
||||
Error += test_size<glm::lowp_dvec1>();
|
||||
Error += test_size<glm::mediump_dvec1>();
|
||||
Error += test_size<glm::highp_dvec1>();
|
||||
|
||||
Error += test_relational<glm::dvec1>();
|
||||
Error += test_relational<glm::lowp_dvec1>();
|
||||
Error += test_relational<glm::mediump_dvec1>();
|
||||
Error += test_relational<glm::highp_dvec1>();
|
||||
|
||||
Error += test_constexpr<glm::dvec1>();
|
||||
Error += test_constexpr<glm::lowp_dvec1>();
|
||||
Error += test_constexpr<glm::mediump_dvec1>();
|
||||
Error += test_constexpr<glm::highp_dvec1>();
|
||||
|
||||
Error += test_operators<glm::vec1>();
|
||||
Error += test_operators<glm::lowp_vec1>();
|
||||
Error += test_operators<glm::mediump_vec1>();
|
||||
Error += test_operators<glm::highp_vec1>();
|
||||
|
||||
Error += test_ctor<glm::vec1>();
|
||||
Error += test_ctor<glm::lowp_vec1>();
|
||||
Error += test_ctor<glm::mediump_vec1>();
|
||||
Error += test_ctor<glm::highp_vec1>();
|
||||
|
||||
Error += test_size<glm::vec1>();
|
||||
Error += test_size<glm::lowp_vec1>();
|
||||
Error += test_size<glm::mediump_vec1>();
|
||||
Error += test_size<glm::highp_vec1>();
|
||||
|
||||
Error += test_relational<glm::vec1>();
|
||||
Error += test_relational<glm::lowp_vec1>();
|
||||
Error += test_relational<glm::mediump_vec1>();
|
||||
Error += test_relational<glm::highp_vec1>();
|
||||
|
||||
Error += test_constexpr<glm::vec1>();
|
||||
Error += test_constexpr<glm::lowp_vec1>();
|
||||
Error += test_constexpr<glm::mediump_vec1>();
|
||||
Error += test_constexpr<glm::highp_vec1>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
@@ -3,6 +3,11 @@
|
||||
#include <glm/ext/vector_int2.hpp>
|
||||
#include <glm/ext/vector_int3.hpp>
|
||||
#include <glm/ext/vector_int4.hpp>
|
||||
#include <glm/ext/vector_uint1.hpp>
|
||||
#include <glm/ext/vector_uint1_precision.hpp>
|
||||
#include <glm/ext/vector_uint2.hpp>
|
||||
#include <glm/ext/vector_uint3.hpp>
|
||||
#include <glm/ext/vector_uint4.hpp>
|
||||
#include <glm/vector_relational.hpp>
|
||||
|
||||
template <typename genType>
|
||||
@@ -82,24 +87,26 @@ static int test_operators()
|
||||
template <typename genType>
|
||||
static int test_ctor()
|
||||
{
|
||||
typedef typename genType::value_type T;
|
||||
|
||||
int Error = 0;
|
||||
|
||||
glm::ivec1 const A = genType(1);
|
||||
genType const A = genType(1);
|
||||
|
||||
glm::ivec1 const E(genType(1));
|
||||
genType const E(genType(1));
|
||||
Error += A == E ? 0 : 1;
|
||||
|
||||
glm::ivec1 const F(E);
|
||||
genType const F(E);
|
||||
Error += A == F ? 0 : 1;
|
||||
|
||||
genType const B = genType(1);
|
||||
genType const G(glm::ivec2(1));
|
||||
genType const G(glm::vec<2, T>(1));
|
||||
Error += B == G ? 0 : 1;
|
||||
|
||||
genType const H(glm::ivec3(1));
|
||||
genType const H(glm::vec<3, T>(1));
|
||||
Error += B == H ? 0 : 1;
|
||||
|
||||
genType const I(glm::ivec4(1));
|
||||
genType const I(glm::vec<4, T>(1));
|
||||
Error += B == I ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
@@ -110,7 +117,7 @@ static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::ivec1) == sizeof(genType) ? 0 : 1;
|
||||
Error += sizeof(typename genType::value_type) == sizeof(genType) ? 0 : 1;
|
||||
Error += genType().length() == 1 ? 0 : 1;
|
||||
Error += genType::length() == 1 ? 0 : 1;
|
||||
|
||||
@@ -140,7 +147,7 @@ static int test_constexpr()
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(genType(1)[0] == 1, "GLM: Failed constexpr");
|
||||
static_assert(genType(1) == genType(glm::ivec1(1)), "GLM: Failed constexpr");
|
||||
static_assert(genType(1) == genType(1), "GLM: Failed constexpr");
|
||||
static_assert(genType(1) != genType(0), "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
@@ -176,5 +183,30 @@ int main()
|
||||
Error += test_constexpr<glm::mediump_ivec1>();
|
||||
Error += test_constexpr<glm::highp_ivec1>();
|
||||
|
||||
Error += test_operators<glm::uvec1>();
|
||||
Error += test_operators<glm::lowp_uvec1>();
|
||||
Error += test_operators<glm::mediump_uvec1>();
|
||||
Error += test_operators<glm::highp_uvec1>();
|
||||
|
||||
Error += test_ctor<glm::uvec1>();
|
||||
Error += test_ctor<glm::lowp_uvec1>();
|
||||
Error += test_ctor<glm::mediump_uvec1>();
|
||||
Error += test_ctor<glm::highp_uvec1>();
|
||||
|
||||
Error += test_size<glm::uvec1>();
|
||||
Error += test_size<glm::lowp_uvec1>();
|
||||
Error += test_size<glm::mediump_uvec1>();
|
||||
Error += test_size<glm::highp_uvec1>();
|
||||
|
||||
Error += test_relational<glm::uvec1>();
|
||||
Error += test_relational<glm::lowp_uvec1>();
|
||||
Error += test_relational<glm::mediump_uvec1>();
|
||||
Error += test_relational<glm::highp_uvec1>();
|
||||
|
||||
Error += test_constexpr<glm::uvec1>();
|
||||
Error += test_constexpr<glm::lowp_uvec1>();
|
||||
Error += test_constexpr<glm::mediump_uvec1>();
|
||||
Error += test_constexpr<glm::highp_uvec1>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
#include <glm/ext/vector_uint1.hpp>
|
||||
#include <glm/ext/vector_uint1_precision.hpp>
|
||||
#include <glm/ext/vector_uint2.hpp>
|
||||
#include <glm/ext/vector_uint3.hpp>
|
||||
#include <glm/ext/vector_uint4.hpp>
|
||||
#include <glm/ext/vector_relational.hpp>
|
||||
|
||||
template <typename genType>
|
||||
static int test_operators()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
|
||||
bool const R = A != B;
|
||||
bool const S = A == B;
|
||||
Error += (S && !R) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
|
||||
genType const C = A + B;
|
||||
Error += C == genType(2) ? 0 : 1;
|
||||
|
||||
genType const D = A - B;
|
||||
Error += D == genType(0) ? 0 : 1;
|
||||
|
||||
genType const E = A * B;
|
||||
Error += E == genType(1) ? 0 : 1;
|
||||
|
||||
genType const F = A / B;
|
||||
Error += F == genType(1) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
genType const A(3);
|
||||
genType const B(2);
|
||||
|
||||
genType const C = A % B;
|
||||
Error += C == genType(1) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
genType const C(0);
|
||||
|
||||
genType const I = A & B;
|
||||
Error += I == genType(1) ? 0 : 1;
|
||||
genType const D = A & C;
|
||||
Error += D == genType(0) ? 0 : 1;
|
||||
|
||||
genType const E = A | B;
|
||||
Error += E == genType(1) ? 0 : 1;
|
||||
genType const F = A | C;
|
||||
Error += F == genType(1) ? 0 : 1;
|
||||
|
||||
genType const G = A ^ B;
|
||||
Error += G == genType(0) ? 0 : 1;
|
||||
genType const H = A ^ C;
|
||||
Error += H == genType(1) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
genType const A(0);
|
||||
genType const B(1);
|
||||
genType const C(2);
|
||||
|
||||
genType const D = B << B;
|
||||
Error += D == genType(2) ? 0 : 1;
|
||||
genType const E = C >> B;
|
||||
Error += E == genType(1) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::uvec1 const A = genType(1);
|
||||
|
||||
glm::uvec1 const E(genType(1));
|
||||
Error += A == E ? 0 : 1;
|
||||
|
||||
glm::uvec1 const F(E);
|
||||
Error += A == F ? 0 : 1;
|
||||
|
||||
genType const B = genType(1);
|
||||
genType const G(glm::uvec2(1));
|
||||
Error += B == G ? 0 : 1;
|
||||
|
||||
genType const H(glm::uvec3(1));
|
||||
Error += B == H ? 0 : 1;
|
||||
|
||||
genType const I(glm::uvec4(1));
|
||||
Error += B == I ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::uvec1) == sizeof(genType) ? 0 : 1;
|
||||
Error += genType().length() == 1 ? 0 : 1;
|
||||
Error += genType::length() == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_relational()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
genType const A(1);
|
||||
genType const B(1);
|
||||
genType const C(0);
|
||||
|
||||
Error += A == B ? 0 : 1;
|
||||
Error += A != C ? 0 : 1;
|
||||
Error += all(equal(A, B)) ? 0 : 1;
|
||||
Error += any(notEqual(A, C)) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
static int test_constexpr()
|
||||
{
|
||||
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
|
||||
static_assert(genType::length() == 1, "GLM: Failed constexpr");
|
||||
static_assert(genType(1)[0] == 1, "GLM: Failed constexpr");
|
||||
static_assert(genType(1) == genType(glm::uvec1(1)), "GLM: Failed constexpr");
|
||||
static_assert(genType(1) != genType(0), "GLM: Failed constexpr");
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators<glm::uvec1>();
|
||||
Error += test_operators<glm::lowp_uvec1>();
|
||||
Error += test_operators<glm::mediump_uvec1>();
|
||||
Error += test_operators<glm::highp_uvec1>();
|
||||
|
||||
Error += test_ctor<glm::uvec1>();
|
||||
Error += test_ctor<glm::lowp_uvec1>();
|
||||
Error += test_ctor<glm::mediump_uvec1>();
|
||||
Error += test_ctor<glm::highp_uvec1>();
|
||||
|
||||
Error += test_size<glm::uvec1>();
|
||||
Error += test_size<glm::lowp_uvec1>();
|
||||
Error += test_size<glm::mediump_uvec1>();
|
||||
Error += test_size<glm::highp_uvec1>();
|
||||
|
||||
Error += test_relational<glm::uvec1>();
|
||||
Error += test_relational<glm::lowp_uvec1>();
|
||||
Error += test_relational<glm::mediump_uvec1>();
|
||||
Error += test_relational<glm::highp_uvec1>();
|
||||
|
||||
Error += test_constexpr<glm::uvec1>();
|
||||
Error += test_constexpr<glm::lowp_uvec1>();
|
||||
Error += test_constexpr<glm::mediump_uvec1>();
|
||||
Error += test_constexpr<glm::highp_uvec1>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
Reference in New Issue
Block a user