Merge branch '0.9.2' of ssh://ogl-math.git.sourceforge.net/gitroot/ogl-math/ogl-math into 0.9.2

This commit is contained in:
Christophe Riccio
2011-05-31 21:41:26 +01:00
18 changed files with 331 additions and 40 deletions

View File

@@ -23,6 +23,8 @@ glmCreateTestGTC(core_func_noise)
glmCreateTestGTC(core_func_packing)
glmCreateTestGTC(core_func_trigonometric)
glmCreateTestGTC(core_func_vector_relational)
glmCreateTestGTC(core_setup_message)
glmCreateTestGTC(core_setup_precision)

View File

@@ -0,0 +1,30 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2011-05-31
// Updated : 2011-05-31
// Licence : This source is under MIT License
// File : test/core/setup_message.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
static int test_operators()
{
glm::vec3 A(1.0f);
glm::vec3 B(1.0f);
bool R = A != B;
bool S = A == B;
return (S && !R) ? 0 : 1;
}
int main()
{
int Error = 0;
Error += test_operators();
return Error;
}

View File

@@ -0,0 +1,53 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2011-05-31
// Updated : 2011-05-31
// Licence : This source is under MIT License
// File : test/core/setup_precision_highp.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_PRECISION_HIGHP_FLOAT
#include <glm/glm.hpp>
static int test_mat()
{
int Error = 0;
Error += sizeof(glm::mat2) == sizeof(glm::highp_mat2) ? 0 : 1;
Error += sizeof(glm::mat3) == sizeof(glm::highp_mat3) ? 0 : 1;
Error += sizeof(glm::mat4) == sizeof(glm::highp_mat4) ? 0 : 1;
Error += sizeof(glm::mat2x2) == sizeof(glm::highp_mat2x2) ? 0 : 1;
Error += sizeof(glm::mat2x3) == sizeof(glm::highp_mat2x3) ? 0 : 1;
Error += sizeof(glm::mat2x4) == sizeof(glm::highp_mat2x4) ? 0 : 1;
Error += sizeof(glm::mat3x2) == sizeof(glm::highp_mat3x2) ? 0 : 1;
Error += sizeof(glm::mat3x3) == sizeof(glm::highp_mat3x3) ? 0 : 1;
Error += sizeof(glm::mat3x4) == sizeof(glm::highp_mat3x4) ? 0 : 1;
Error += sizeof(glm::mat4x2) == sizeof(glm::highp_mat4x2) ? 0 : 1;
Error += sizeof(glm::mat4x3) == sizeof(glm::highp_mat4x3) ? 0 : 1;
Error += sizeof(glm::mat4x4) == sizeof(glm::highp_mat4x4) ? 0 : 1;
return Error;
}
static int test_vec()
{
int Error = 0;
Error += sizeof(glm::vec2) == sizeof(glm::highp_vec2) ? 0 : 1;
Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1;
Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_mat();
Error += test_vec();
return Error;
}

View File

@@ -7,7 +7,6 @@
// File : test/core/type_mat4x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#define GLM_PRECISION_HIGHP_FLOAT
#include <glm/glm.hpp>
#include <cstdio>

View File

@@ -1,19 +1,91 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2010-09-16
// Updated : 2010-09-16
// Created : 2011-05-32
// Updated : 2011-05-32
// Licence : This source is under MIT licence
// File : test/gtc/matrix_transform.cpp
// File : test/gtc/half_float.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/half_float.hpp>
int test_half_precision_scalar()
{
int Error = 0;
Error += sizeof(glm::half) == 2 ? 0 : 1;
return Error;
}
int test_half_precision_vec()
{
int Error = 0;
Error += sizeof(glm::hvec2) == 4 ? 0 : 1;
Error += sizeof(glm::hvec3) == 6 ? 0 : 1;
Error += sizeof(glm::hvec4) == 8 ? 0 : 1;
return Error;
}
int test_half_precision_mat()
{
int Error = 0;
Error += sizeof(glm::hmat2) == 8 ? 0 : 1;
Error += sizeof(glm::hmat3) == 18 ? 0 : 1;
Error += sizeof(glm::hmat4) == 32 ? 0 : 1;
Error += sizeof(glm::hmat2x2) == 8 ? 0 : 1;
Error += sizeof(glm::hmat2x3) == 12 ? 0 : 1;
Error += sizeof(glm::hmat2x4) == 16 ? 0 : 1;
Error += sizeof(glm::hmat3x2) == 12 ? 0 : 1;
Error += sizeof(glm::hmat3x3) == 18 ? 0 : 1;
Error += sizeof(glm::hmat3x4) == 24 ? 0 : 1;
Error += sizeof(glm::hmat4x2) == 16 ? 0 : 1;
Error += sizeof(glm::hmat4x3) == 24 ? 0 : 1;
Error += sizeof(glm::hmat4x4) == 32 ? 0 : 1;
return Error;
}
int test_half_ctor_mat2x2()
{
int Error = 0;
{
glm::hvec2 A(1, 2);
glm::hvec2 B(3, 4);
glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f);
glm::hmat2 D(1, 2, 3, 4);
Error += C[0] == D[0] ? 0 : 1;
Error += C[1] == D[1] ? 0 : 1;
}
{
glm::hvec2 A(1, 2.0);
glm::hvec2 B(3, 4.0);
glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f);
glm::hmat2 D(1, 2.0, 3u, 4.0f);
Error += C[0] == D[0] ? 0 : 1;
Error += C[1] == D[1] ? 0 : 1;
}
return Error;
}
int main()
{
int Failed = 0;
int Error = 0;
return Failed;
Error += test_half_ctor_mat2x2();
Error += test_half_precision_scalar();
Error += test_half_precision_vec();
Error += test_half_precision_mat();
return Error;
}

View File

@@ -7,7 +7,6 @@
// File : test/gtc/matrix_access.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/matrix_access.hpp>

View File

@@ -7,7 +7,6 @@
// File : test/gtc/matrix_integer.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/matrix_integer.hpp>

View File

@@ -7,7 +7,6 @@
// File : test/gtc/matrix_transform.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

View File

@@ -11,6 +11,16 @@
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/epsilon.hpp>
int test_quat_precision()
{
int Error = 0;
Error += sizeof(glm::lowp_quat) <= sizeof(glm::mediump_quat) ? 0 : 1;
Error += sizeof(glm::mediump_quat) <= sizeof(glm::highp_quat) ? 0 : 1;
return Error;
}
int test_quat_type()
{
glm::quat A;
@@ -75,6 +85,7 @@ int main()
{
int Error = 0;
Error += test_quat_precision();
Error += test_quat_type();
Error += test_quat_slerp();
Error += test_quat_length();

View File

@@ -7,7 +7,6 @@
// File : test/gtc/swizzle.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/swizzle.hpp>

View File

@@ -7,7 +7,6 @@
// File : test/gtc/type_ptr.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>