Fixed setup options

This commit is contained in:
Christophe Riccio
2011-10-20 14:03:08 +01:00
parent ee15fe5289
commit 5050bfacf7
13 changed files with 132 additions and 128 deletions

View File

@@ -8,9 +8,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
//#define GLM_FORCE_ONLY_XYZW
//#define GLM_FORCE_PURE
#define GLM_MESSAGES
#define GLM_SWIZZLE_OPERATOR
#define GLM_FORCE_CXX98
#define GLM_SWIZZLE
//#define GLM_FORCE_CXX98
#include <glm/glm.hpp>
int test_vec2_swizzle()

View File

@@ -15,13 +15,13 @@ int test_half_ctor()
int Error = 0;
glm::half A(1.0f);
Error += A.toFloat() == 1.0f ? 0 : 1;
Error += float(A) == 1.0f ? 0 : 1;
glm::half B = glm::half(1.0f);
Error += B.toFloat() == 1.0f ? 0 : 1;
Error += float(B) == 1.0f ? 0 : 1;
glm::half C = B;
Error += C.toFloat() == 1.0f ? 0 : 1;
Error += float(C) == 1.0f ? 0 : 1;
return Error;
}
@@ -31,13 +31,13 @@ int test_half_cast()
int Error = 0;
glm::half A(2.0f);
Error += A.toFloat() == 2.0f ? 0 : 1;
Error += float(A) == 2.0f ? 0 : 1;
glm::half B(2.0);
Error += B.toFloat() == 2.0f ? 0 : 1;
Error += float(B) == 2.0f ? 0 : 1;
glm::half C(2);
Error += C.toFloat() == 2.0f ? 0 : 1;
Error += float(C) == 2.0f ? 0 : 1;
float D(A);
Error += D == 2.0f ? 0 : 1;

View File

@@ -7,7 +7,7 @@
// File : test/core/type_vec1.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE_OPERATOR
#define GLM_SWIZZLE
#include <glm/glm.hpp>
static int test_operators()

View File

@@ -7,7 +7,7 @@
// File : test/core/type_vec2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE_OPERATOR
#define GLM_SWIZZLE
#include <glm/glm.hpp>
int test_vec2_operators()

View File

@@ -7,7 +7,7 @@
// File : test/core/type_vec3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE_OPERATOR
#define GLM_SWIZZLE
#include <glm/glm.hpp>
#include <glm/gtc/half_float.hpp>
#include <cstdio>
@@ -280,29 +280,29 @@ int test_vec3_swizzle_half()
u = v;
Error += (u.x.toFloat() == 1.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 3.0f) ? 0 : 1;
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.toFloat() == 1.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 3.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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.toFloat() == 1.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 3.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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.toFloat() == 1.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 3.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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.toFloat() == 3.0f && u.y.toFloat() == 2.0f && u.z.toFloat() == 1.0f) ? 0 : 1;
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;
@@ -361,9 +361,9 @@ int test_vec3_swizzle_functions()
// glm::dot(u.xy(), v.xy()); <--- Compiles correctly
//
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
float r;
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
// vec2
glm::vec2 a(1, 2);
glm::vec2 b(10, 20);
@@ -397,9 +397,9 @@ int test_vec3_swizzle_partial()
{
int Error = 0;
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
glm::vec3 A(1, 2, 3);
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
{
glm::vec3 B(A.xy, 3.0f);
Error += A == B ? 0 : 1;

View File

@@ -7,7 +7,7 @@
// File : test/core/type_vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_SWIZZLE_OPERATOR
#define GLM_SWIZZLE
#include <glm/glm.hpp>
#include <glm/gtc/half_float.hpp>
#include <vector>
@@ -220,7 +220,7 @@ int test_vec4_swizzle_partial()
glm::vec4 A(1, 2, 3, 4);
#if((GLM_LANG == GLM_LANG_CXX11) || (GLM_LANG == GLM_LANG_CXXMS))
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
{
glm::vec4 B(A.xy, A.zw);
Error += A == B ? 0 : 1;
@@ -246,7 +246,7 @@ int test_vec4_swizzle_partial()
glm::vec4 B(1.0f, A.yzw);
Error += A == B ? 0 : 1;
}
#endif//((GLM_LANG == GLM_LANG_CXX11) || (GLM_LANG == GLM_LANG_CXXMS))
#endif//(GLM_SUPPORT_SWIZZLE_OPERATOR())
return Error;
}