Reduce dependencies, added scalar EXT extensions
This commit is contained in:
@@ -10,7 +10,6 @@ glmCreateTestGTC(core_force_xyzw_only)
|
||||
glmCreateTestGTC(core_type_aligned)
|
||||
glmCreateTestGTC(core_type_cast)
|
||||
glmCreateTestGTC(core_type_ctor)
|
||||
glmCreateTestGTC(core_type_float)
|
||||
glmCreateTestGTC(core_type_int)
|
||||
glmCreateTestGTC(core_type_length)
|
||||
glmCreateTestGTC(core_type_mat2x2)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <glm/ext/vector_uint2.hpp>
|
||||
#include <glm/ext/vector_uint3.hpp>
|
||||
#include <glm/ext/vector_uint4.hpp>
|
||||
#include <glm/ext/scalar_int_sized.hpp>
|
||||
#include <glm/ext/scalar_uint_sized.hpp>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <cstdio>
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
int test_float_size()
|
||||
{
|
||||
return
|
||||
sizeof(glm::float_t) != sizeof(glm::lowp_float) &&
|
||||
sizeof(glm::float_t) != sizeof(glm::mediump_float) &&
|
||||
sizeof(glm::float_t) != sizeof(glm::highp_float);
|
||||
}
|
||||
|
||||
int test_float_precision()
|
||||
{
|
||||
return (
|
||||
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
|
||||
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1;
|
||||
}
|
||||
|
||||
int test_vec2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_float_size();
|
||||
Error += test_float_precision();
|
||||
|
||||
return Error;
|
||||
}
|
||||
@@ -1,34 +1,5 @@
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
static int test_int_size()
|
||||
{
|
||||
return
|
||||
sizeof(glm::int_t) != sizeof(glm::lowp_int) &&
|
||||
sizeof(glm::int_t) != sizeof(glm::mediump_int) &&
|
||||
sizeof(glm::int_t) != sizeof(glm::highp_int);
|
||||
}
|
||||
|
||||
static int test_uint_size()
|
||||
{
|
||||
return
|
||||
sizeof(glm::uint_t) != sizeof(glm::lowp_uint) &&
|
||||
sizeof(glm::uint_t) != sizeof(glm::mediump_uint) &&
|
||||
sizeof(glm::uint_t) != sizeof(glm::highp_uint);
|
||||
}
|
||||
|
||||
static int test_int_precision()
|
||||
{
|
||||
return (
|
||||
sizeof(glm::lowp_int) <= sizeof(glm::mediump_int) &&
|
||||
sizeof(glm::mediump_int) <= sizeof(glm::highp_int)) ? 0 : 1;
|
||||
}
|
||||
|
||||
static int test_uint_precision()
|
||||
{
|
||||
return (
|
||||
sizeof(glm::lowp_uint) <= sizeof(glm::mediump_uint) &&
|
||||
sizeof(glm::mediump_uint) <= sizeof(glm::highp_uint)) ? 0 : 1;
|
||||
}
|
||||
#include <glm/ext/scalar_int_sized.hpp>
|
||||
|
||||
static int test_bit_operator()
|
||||
{
|
||||
@@ -49,10 +20,6 @@ int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_int_size();
|
||||
Error += test_int_precision();
|
||||
Error += test_uint_size();
|
||||
Error += test_uint_precision();
|
||||
Error += test_bit_operator();
|
||||
|
||||
return Error;
|
||||
|
||||
@@ -2,6 +2,10 @@ glmCreateTestGTC(ext_matrix_relational)
|
||||
glmCreateTestGTC(ext_quaternion_geometric)
|
||||
glmCreateTestGTC(ext_quaternion_relational)
|
||||
glmCreateTestGTC(ext_quaternion_type)
|
||||
glmCreateTestGTC(ext_scalar_constants)
|
||||
glmCreateTestGTC(ext_scalar_float_sized)
|
||||
glmCreateTestGTC(ext_scalar_int_sized)
|
||||
glmCreateTestGTC(ext_scalar_uint_sized)
|
||||
glmCreateTestGTC(ext_scalar_relational)
|
||||
glmCreateTestGTC(ext_vec1)
|
||||
glmCreateTestGTC(ext_vector_vec1)
|
||||
|
||||
36
test/ext/ext_scalar_constants.cpp
Normal file
36
test/ext/ext_scalar_constants.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <glm/ext/scalar_constants.hpp>
|
||||
|
||||
template <typename valType>
|
||||
static int test_epsilon()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
valType const Test = glm::epsilon<valType>();
|
||||
Error += Test > static_cast<valType>(0) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
static int test_pi()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
valType const Test = glm::pi<valType>();
|
||||
Error += Test > static_cast<valType>(3.14) ? 0 : 1;
|
||||
Error += Test < static_cast<valType>(3.15) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_epsilon<float>();
|
||||
Error += test_epsilon<double>();
|
||||
Error += test_pi<float>();
|
||||
Error += test_pi<double>();
|
||||
|
||||
return Error;
|
||||
}
|
||||
37
test/ext/ext_scalar_float_sized.cpp
Normal file
37
test/ext/ext_scalar_float_sized.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <glm/ext/scalar_float_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
|
||||
|
||||
#ifndef GLM_FORCE_SINGLE_ONLY
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
|
||||
#endif//GLM_FORCE_SINGLE_ONLY
|
||||
|
||||
static int test_float_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::float32) == sizeof(float) ? 0 : 1;
|
||||
Error += sizeof(glm::float64) == sizeof(double) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_float_precision()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(float) <= sizeof(double) ? 0 : 1;
|
||||
Error += sizeof(glm::float32) < sizeof(glm::float64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_float_size();
|
||||
Error += test_float_precision();
|
||||
|
||||
return Error;
|
||||
}
|
||||
42
test/ext/ext_scalar_int_sized.cpp
Normal file
42
test/ext/ext_scalar_int_sized.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <glm/ext/scalar_int_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int16) == sizeof(short), "signed short size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::int32) == sizeof(int), "signed int size isn't 4 bytes on this platform");
|
||||
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::int8) == 1 ? 0 : 1;
|
||||
Error += sizeof(glm::int16) == 2 ? 0 : 1;
|
||||
Error += sizeof(glm::int32) == 4 ? 0 : 1;
|
||||
Error += sizeof(glm::int64) == 8 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_comp()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::int8) < sizeof(glm::int16) ? 0 : 1;
|
||||
Error += sizeof(glm::int16) < sizeof(glm::int32) ? 0 : 1;
|
||||
Error += sizeof(glm::int32) < sizeof(glm::int64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_size();
|
||||
Error += test_comp();
|
||||
|
||||
return Error;
|
||||
}
|
||||
42
test/ext/ext_scalar_uint_sized.cpp
Normal file
42
test/ext/ext_scalar_uint_sized.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <glm/ext/scalar_uint_sized.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
|
||||
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint16) == sizeof(unsigned short), "unsigned short size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::uint32) == sizeof(unsigned int), "unsigned int size isn't 4 bytes on this platform");
|
||||
|
||||
static int test_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::uint8) == 1 ? 0 : 1;
|
||||
Error += sizeof(glm::uint16) == 2 ? 0 : 1;
|
||||
Error += sizeof(glm::uint32) == 4 ? 0 : 1;
|
||||
Error += sizeof(glm::uint64) == 8 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_comp()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::uint8) < sizeof(glm::uint16) ? 0 : 1;
|
||||
Error += sizeof(glm::uint16) < sizeof(glm::uint32) ? 0 : 1;
|
||||
Error += sizeof(glm::uint32) < sizeof(glm::uint64) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_size();
|
||||
Error += test_comp();
|
||||
|
||||
return Error;
|
||||
}
|
||||
Reference in New Issue
Block a user