Initial build with half types removed
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
glmCreateTestGTC(core_type_cast)
|
||||
glmCreateTestGTC(core_type_float)
|
||||
glmCreateTestGTC(core_type_half)
|
||||
glmCreateTestGTC(core_type_int)
|
||||
glmCreateTestGTC(core_type_length)
|
||||
glmCreateTestGTC(core_type_mat2x2)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2008-08-31
|
||||
// Updated : 2011-09-20
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/core/type_half.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
|
||||
int test_half_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::half A(1.0f);
|
||||
Error += float(A) == 1.0f ? 0 : 1;
|
||||
|
||||
glm::half B = glm::half(1.0f);
|
||||
Error += float(B) == 1.0f ? 0 : 1;
|
||||
|
||||
glm::half C = B;
|
||||
Error += float(C) == 1.0f ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_cast()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::half A(2.0f);
|
||||
Error += float(A) == 2.0f ? 0 : 1;
|
||||
|
||||
glm::half B(2.0);
|
||||
Error += float(B) == 2.0f ? 0 : 1;
|
||||
|
||||
glm::half C(2);
|
||||
Error += float(C) == 2.0f ? 0 : 1;
|
||||
|
||||
float D(A);
|
||||
Error += D == 2.0f ? 0 : 1;
|
||||
|
||||
double E(A);
|
||||
Error += E == 2.0 ? 0 : 1;
|
||||
|
||||
int F(A);
|
||||
Error += F == 2.0 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_relational()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::half A(1.0f);
|
||||
glm::half B(2.0f);
|
||||
|
||||
Error += !(A == B) ? 0 : 1;
|
||||
Error += (A != B) ? 0 : 1;
|
||||
Error += (A <= B) ? 0 : 1;
|
||||
Error += (A < B) ? 0 : 1;
|
||||
Error += !(A >= B) ? 0 : 1;
|
||||
Error += !(A > B) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_arithmetic_unary_ops()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
A += B;
|
||||
Error += (A == glm::half( 5.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
A -= B;
|
||||
Error += (A == glm::half(-1.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
B -= A;
|
||||
Error += (B == glm::half( 1.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
A *= B;
|
||||
Error += (A == glm::half(6.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
A /= B;
|
||||
Error += (A == glm::half(2.0f / 3.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
B /= A;
|
||||
Error += (B == glm::half(3.0f / 2.0f) ? 0 : 1);
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_arithmetic_binary_ops()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::half A(2.0f);
|
||||
glm::half B(3.0f);
|
||||
|
||||
Error += A + B == glm::half( 5.0f) ? 0 : 1;
|
||||
Error += A - B == glm::half(-1.0f) ? 0 : 1;
|
||||
Error += B - A == glm::half( 1.0f) ? 0 : 1;
|
||||
Error += A * B == glm::half( 6.0f) ? 0 : 1;
|
||||
Error += A / B == glm::half(2.0f / 3.0f) ? 0 : 1;
|
||||
Error += B / A == glm::half(3.0f / 2.0f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_arithmetic_counter_ops()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
Error += A == glm::half(2.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B = A++;
|
||||
Error += B == glm::half(3.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B = A--;
|
||||
Error += B == glm::half(1.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B = ++A;
|
||||
Error += B == glm::half(3.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B = --A;
|
||||
Error += B == glm::half(1.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::half A(2.0f);
|
||||
glm::half B = -A;
|
||||
Error += B == glm::half(-2.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Result = 0;
|
||||
|
||||
Result += test_half_ctor();
|
||||
Result += test_half_cast();
|
||||
Result += test_half_relational();
|
||||
Result += test_half_arithmetic_unary_ops();
|
||||
Result += test_half_arithmetic_binary_ops();
|
||||
Result += test_half_arithmetic_counter_ops();
|
||||
|
||||
return Result;
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
|
||||
int test_length_mat_non_squared()
|
||||
{
|
||||
@@ -28,13 +27,6 @@ int test_length_mat_non_squared()
|
||||
Error += glm::dmat4x2().length() == 4 ? 0 : 1;
|
||||
Error += glm::dmat4x3().length() == 4 ? 0 : 1;
|
||||
|
||||
Error += glm::hmat2x3().length() == 2 ? 0 : 1;
|
||||
Error += glm::hmat2x4().length() == 2 ? 0 : 1;
|
||||
Error += glm::hmat3x2().length() == 3 ? 0 : 1;
|
||||
Error += glm::hmat3x4().length() == 3 ? 0 : 1;
|
||||
Error += glm::hmat4x2().length() == 4 ? 0 : 1;
|
||||
Error += glm::hmat4x3().length() == 4 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -56,13 +48,6 @@ int test_length_mat()
|
||||
Error += glm::dmat3x3().length() == 3 ? 0 : 1;
|
||||
Error += glm::dmat4x4().length() == 4 ? 0 : 1;
|
||||
|
||||
Error += glm::hmat2().length() == 2 ? 0 : 1;
|
||||
Error += glm::hmat3().length() == 3 ? 0 : 1;
|
||||
Error += glm::hmat4().length() == 4 ? 0 : 1;
|
||||
Error += glm::hmat2x2().length() == 2 ? 0 : 1;
|
||||
Error += glm::hmat3x3().length() == 3 ? 0 : 1;
|
||||
Error += glm::hmat4x4().length() == 4 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -81,11 +66,7 @@ int test_length_vec()
|
||||
|
||||
Error += glm::uvec2().length() == 2 ? 0 : 1;
|
||||
Error += glm::uvec3().length() == 3 ? 0 : 1;
|
||||
Error += glm::uvec4().length() == 4 ? 0 : 1;
|
||||
|
||||
Error += glm::hvec2().length() == 2 ? 0 : 1;
|
||||
Error += glm::hvec3().length() == 3 ? 0 : 1;
|
||||
Error += glm::hvec4().length() == 4 ? 0 : 1;
|
||||
Error += glm::uvec4().length() == 4 ? 0 : 1;
|
||||
|
||||
Error += glm::dvec2().length() == 2 ? 0 : 1;
|
||||
Error += glm::dvec3().length() == 3 ? 0 : 1;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
||||
@@ -274,46 +273,6 @@ int test_vec3_swizzle3_3()
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_vec3_swizzle_half()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::half a1(1);
|
||||
glm::half b1(2);
|
||||
glm::half c1(3);
|
||||
glm::hvec3 v(a1, b1, c1);
|
||||
glm::hvec3 u;
|
||||
|
||||
u = v;
|
||||
|
||||
Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1;
|
||||
|
||||
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
|
||||
u = v.xyz;
|
||||
Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1;
|
||||
u = v.zyx;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
u.zyx = v;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
|
||||
u = v.rgb;
|
||||
Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1;
|
||||
u = v.bgr;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
u.bgr = v;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
|
||||
u = v.stp;
|
||||
Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1;
|
||||
u = v.pts;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
u.pts = v;
|
||||
Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1;
|
||||
#endif//(GLM_SUPPORT_SWIZZLE_OPERATOR())
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_vec3_swizzle_operators()
|
||||
{
|
||||
int Error = 0;
|
||||
@@ -459,7 +418,6 @@ int main()
|
||||
Error += test_vec3_size();
|
||||
Error += test_vec3_swizzle3_2();
|
||||
Error += test_vec3_swizzle3_3();
|
||||
Error += test_vec3_swizzle_half();
|
||||
Error += test_vec3_swizzle_partial();
|
||||
Error += test_vec3_swizzle_operators();
|
||||
Error += test_vec3_swizzle_functions();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
#include <vector>
|
||||
|
||||
template <int Value>
|
||||
@@ -33,15 +32,6 @@ enum comp
|
||||
// return _mm_shuffle_ps(Src, Src, mask<(int(W) << 6) | (int(Z) << 4) | (int(Y) << 2) | (int(X) << 0)>::value);
|
||||
//}
|
||||
|
||||
int test_hvec4()
|
||||
{
|
||||
glm::hvec4 const A = glm::hvec4(0, 1, 2, 3);
|
||||
//glm::hvec4 B = glm::swizzle<glm::X, glm::Y, glm::Z, glm::W>(A);
|
||||
|
||||
//glm::vec4 B = glm::detail::tvec##(glm::vec4::_size)<float>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_vec4_ctor()
|
||||
{
|
||||
@@ -294,7 +284,6 @@ int main()
|
||||
Error += test_vec4_ctor();
|
||||
Error += test_vec4_size();
|
||||
Error += test_vec4_operators();
|
||||
Error += test_hvec4();
|
||||
Error += test_vec4_swizzle_partial();
|
||||
Error += test_operator_increment();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user