Enable /WX, warning as error on Visual Studio
This commit is contained in:
@@ -18,11 +18,13 @@ namespace floor_
|
||||
{
|
||||
float A = 1.1f;
|
||||
float B = glm::floor(A);
|
||||
Error += glm::epsilonEqual(B, 1.f, 0.0001f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
double A = 1.1;
|
||||
double B = glm::floor(A);
|
||||
Error += glm::epsilonEqual(B, 1.0, 0.0001) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -218,12 +218,12 @@ namespace bitfieldReverse
|
||||
GLM_FUNC_QUALIFIER glm::vec<L, T, Q> bitfieldReverseOps(glm::vec<L, T, Q> const& v)
|
||||
{
|
||||
glm::vec<L, T, Q> x(v);
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, static_cast<T>(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, static_cast<T>(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, static_cast<T>(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, static_cast<T>(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, static_cast<T>(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, static_cast<T>(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -1418,12 +1418,12 @@ namespace bitCount
|
||||
static glm::vec<L, int, Q> bitCount_bitfield(glm::vec<L, T, Q> const& v)
|
||||
{
|
||||
glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> x(*reinterpret_cast<glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> const *>(&v));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename glm::detail::make_unsigned<T>::type(0x5555555555555555ull), typename glm::detail::make_unsigned<T>::type( 1));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename glm::detail::make_unsigned<T>::type(0x3333333333333333ull), typename glm::detail::make_unsigned<T>::type( 2));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename glm::detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned<T>::type( 4));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename glm::detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned<T>::type( 8));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename glm::detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned<T>::type(16));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename glm::detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned<T>::type(32));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x5555555555555555ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 1));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x3333333333333333ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 2));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0F0F0F0F0F0F0F0Full), static_cast<typename glm::detail::make_unsigned<T>::type>( 4));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00FF00FF00FF00FFull), static_cast<typename glm::detail::make_unsigned<T>::type>( 8));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0000FFFF0000FFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(16));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00000000FFFFFFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(32));
|
||||
return glm::vec<L, int, Q>(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
struct vec4
|
||||
{
|
||||
static int length();
|
||||
};
|
||||
|
||||
int vec4::length()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Failed = 0;
|
||||
int Error = 0;
|
||||
|
||||
vec4 V;
|
||||
|
||||
int LengthA = V.length();
|
||||
int LengthB = vec4::length();
|
||||
|
||||
return Failed;
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace mask
|
||||
{32, 0xffffffff}
|
||||
};
|
||||
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
/* mask_zero is sadly not a correct code
|
||||
for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i)
|
||||
{
|
||||
@@ -495,6 +495,9 @@ namespace bitfieldInterleave
|
||||
glm::uint64 B(glm::bitfieldInterleave(glm::uint16(x), glm::uint16(y)));
|
||||
glm::uint64 C(glm::bitfieldInterleave(glm::uint32(x), glm::uint32(y)));
|
||||
|
||||
assert(A == B);
|
||||
assert(A == C);
|
||||
|
||||
glm::int64 D(glm::bitfieldInterleave(glm::int8(x), glm::int8(y)));
|
||||
glm::int64 E(glm::bitfieldInterleave(glm::int16(x), glm::int16(y)));
|
||||
glm::int64 F(glm::bitfieldInterleave(glm::int32(x), glm::int32(y)));
|
||||
@@ -675,10 +678,10 @@ namespace bitfieldInterleave5
|
||||
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y)
|
||||
{
|
||||
glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x);
|
||||
Result = ((Result << 8) | Result) & glm::uint32(0x00FF00FF00FF00FFull);
|
||||
Result = ((Result << 4) | Result) & glm::uint32(0x0F0F0F0F0F0F0F0Full);
|
||||
Result = ((Result << 2) | Result) & glm::uint32(0x3333333333333333ull);
|
||||
Result = ((Result << 1) | Result) & glm::uint32(0x5555555555555555ull);
|
||||
Result = ((Result << 8) | Result) & static_cast<glm::uint32>(0x00FF00FF00FF00FFull);
|
||||
Result = ((Result << 4) | Result) & static_cast<glm::uint32>(0x0F0F0F0F0F0F0F0Full);
|
||||
Result = ((Result << 2) | Result) & static_cast<glm::uint32>(0x3333333333333333ull);
|
||||
Result = ((Result << 1) | Result) & static_cast<glm::uint32>(0x5555555555555555ull);
|
||||
return static_cast<glm::uint32>((Result & 0x00000000FFFFFFFFull) | (Result >> 31));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
|
||||
int test_epsilon()
|
||||
{
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
float Test = glm::epsilon<float>();
|
||||
Error += Test > 0.0f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
double Test = glm::epsilon<double>();
|
||||
Error += Test > 0.0 ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
|
||||
@@ -271,7 +271,7 @@ int test_RGBM()
|
||||
|
||||
for(std::size_t i = 0; i < 1024; ++i)
|
||||
{
|
||||
glm::vec3 const Color(i);
|
||||
glm::vec3 const Color(static_cast<float>(i));
|
||||
glm::vec4 const RGBM = glm::packRGBM(Color);
|
||||
glm::vec3 const Result= glm::unpackRGBM(RGBM);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ int test_quat_normalize()
|
||||
|
||||
int test_quat_euler()
|
||||
{
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
@@ -115,6 +115,7 @@ int test_quat_euler()
|
||||
float Pitch = glm::pitch(q);
|
||||
float Yaw = glm::yaw(q);
|
||||
glm::vec3 Angles = glm::eulerAngles(q);
|
||||
Error += glm::all(glm::epsilonEqual(Angles, glm::vec3(Pitch, Yaw, Roll), 0.000001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -123,6 +124,7 @@ int test_quat_euler()
|
||||
double Pitch = glm::pitch(q);
|
||||
double Yaw = glm::yaw(q);
|
||||
glm::dvec3 Angles = glm::eulerAngles(q);
|
||||
Error += glm::all(glm::epsilonEqual(Angles, glm::dvec3(Pitch, Yaw, Roll), 0.000001)) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
@@ -130,7 +132,7 @@ int test_quat_euler()
|
||||
|
||||
int test_quat_slerp()
|
||||
{
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
|
||||
float const Epsilon = 0.0001f;//glm::epsilon<float>();
|
||||
|
||||
@@ -236,14 +238,6 @@ int test_quat_two_axis_ctr()
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_quat_type()
|
||||
{
|
||||
glm::quat A;
|
||||
glm::dquat B;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_quat_mul_vec()
|
||||
{
|
||||
int Error(0);
|
||||
@@ -310,7 +304,6 @@ int main()
|
||||
Error += test_quat_two_axis_ctr();
|
||||
Error += test_quat_mul();
|
||||
Error += test_quat_precision();
|
||||
Error += test_quat_type();
|
||||
Error += test_quat_angle();
|
||||
Error += test_quat_angleAxis();
|
||||
Error += test_quat_mix();
|
||||
|
||||
@@ -130,17 +130,6 @@ int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
my_vec4_aligned GNA;
|
||||
my_dvec4_aligned GNI;
|
||||
|
||||
std::size_t A0 = sizeof(my_dvec4_aligned);
|
||||
std::size_t B0 = sizeof(my_dvec4_packed);
|
||||
std::size_t C0 = sizeof(glm::aligned_dvec4);
|
||||
|
||||
std::size_t A1 = sizeof(my_vec4_aligned);
|
||||
std::size_t B1 = sizeof(my_vec4_packed);
|
||||
std::size_t C1 = sizeof(glm::aligned_vec4);
|
||||
|
||||
Error += test_ctor();
|
||||
Error += test_copy();
|
||||
|
||||
|
||||
@@ -106,13 +106,22 @@ namespace fmod_
|
||||
|
||||
int test_isdenormal()
|
||||
{
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
|
||||
bool A = glm::isdenormal(1.0f);
|
||||
Error += !A ? 0 : 1;
|
||||
|
||||
glm::bvec1 B = glm::isdenormal(glm::vec1(1.0f));
|
||||
Error += !glm::any(B) ? 0 : 1;
|
||||
|
||||
glm::bvec2 C = glm::isdenormal(glm::vec2(1.0f));
|
||||
Error += !glm::any(C) ? 0 : 1;
|
||||
|
||||
glm::bvec3 D = glm::isdenormal(glm::vec3(1.0f));
|
||||
Error += !glm::any(D) ? 0 : 1;
|
||||
|
||||
glm::bvec4 E = glm::isdenormal(glm::vec4(1.0f));
|
||||
Error += !glm::any(E) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ int test_axisAngle()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
float p = 0.171654f;
|
||||
glm::mat4 m1(-0.9946f, 0.0f, -0.104531f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.104531f, 0.0f, -0.9946f, 0.0f,
|
||||
|
||||
@@ -43,21 +43,24 @@ int test_quat_shortMix()
|
||||
|
||||
int test_orientation()
|
||||
{
|
||||
int Error(0);
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
float p = glm::roll(q);
|
||||
Error += glm::epsilonEqual(p, glm::pi<float>() * 0.5f, 0.0001f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
float p = glm::pitch(q);
|
||||
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
float p = glm::yaw(q);
|
||||
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
@@ -113,6 +116,7 @@ int main()
|
||||
|
||||
Error += test_log();
|
||||
Error += test_rotation();
|
||||
Error += test_orientation();
|
||||
Error += test_quat_fastMix();
|
||||
Error += test_quat_shortMix();
|
||||
Error += test_quat_lookAt();
|
||||
|
||||
@@ -6,40 +6,68 @@
|
||||
|
||||
#include <glm/gtx/range.hpp>
|
||||
|
||||
int testVec()
|
||||
int test_vec()
|
||||
{
|
||||
int Error(0);
|
||||
glm::vec3 v(1, 2, 3);
|
||||
int Error = 0;
|
||||
|
||||
int count = 0;
|
||||
for(float x : v){ count++; }
|
||||
Error += count == 3 ? 0 : 1;
|
||||
{
|
||||
glm::ivec3 const v(1, 2, 3);
|
||||
|
||||
int count = 0;
|
||||
glm::ivec3 Result(0);
|
||||
for(int x : v)
|
||||
{
|
||||
Result[count] = x;
|
||||
count++;
|
||||
}
|
||||
Error += count == 3 ? 0 : 1;
|
||||
Error += v == Result ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::ivec3 v(1, 2, 3);
|
||||
for(int& x : v)
|
||||
x = 0;
|
||||
Error += glm::all(glm::equal(v, glm::ivec3(0))) ? 0 : 1;
|
||||
}
|
||||
|
||||
for(float& x : v){ x = 0; }
|
||||
Error += glm::all(glm::equal(v, glm::vec3(0, 0, 0))) ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int testMat()
|
||||
int test_mat()
|
||||
{
|
||||
int Error(0);
|
||||
glm::mat4x3 m(1);
|
||||
int Error = 0;
|
||||
|
||||
int count = 0;
|
||||
for(float x : m){ count++; }
|
||||
Error += count == 12 ? 0 : 1;
|
||||
{
|
||||
glm::mat4x3 m(1.0f);
|
||||
|
||||
int count = 0;
|
||||
float Sum = 0.0f;
|
||||
for(float x : m)
|
||||
{
|
||||
count++;
|
||||
Sum += x;
|
||||
}
|
||||
Error += count == 12 ? 0 : 1;
|
||||
Error += glm::epsilonEqual(Sum, 3.0f, 0.001f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4x3 m(1.0f);
|
||||
|
||||
for (float& x : m) { x = 0; }
|
||||
glm::vec4 v(1, 1, 1, 1);
|
||||
Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1;
|
||||
}
|
||||
|
||||
for(float& x : m){ x = 0; }
|
||||
glm::vec4 v(1, 1, 1, 1);
|
||||
Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
Error += testVec();
|
||||
Error += testMat();
|
||||
int Error = 0;
|
||||
Error += test_vec();
|
||||
Error += test_mat();
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user