Quiet most GLM_FORCE_RADIANS messages

This commit is contained in:
Christophe Riccio 2014-01-11 21:12:53 +01:00
parent 3394af0cf2
commit aeba3c6fe7
94 changed files with 435 additions and 411 deletions

View File

@ -29,6 +29,7 @@
/// dummy.cpp exist only a wordaround for CMake file.
///////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#define GLM_MESSAGES
#include "../glm.hpp"
#include <limits>

View File

@ -43,7 +43,10 @@ namespace detail
template <typename T, precision P> struct tmat4x2;
template <typename T, precision P> struct tmat4x3;
template <typename T, precision P> struct tmat4x4;
template <class colType, typename rowType>
struct mat_trait{};
template <template <class, precision> class matType, typename T, precision P>
struct compute_inverse{};
}//namespace detail

View File

@ -396,7 +396,7 @@ namespace detail
template <typename T, precision P>
struct compute_inverse<detail::tmat2x2, T, P>
{
static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
GLM_FUNC_QUALIFIER static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
{
T Determinant = determinant(m);
@ -410,18 +410,6 @@ namespace detail
}
};
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> compute_inverse_mat2(tmat2x2<T, P> const & m)
{
T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
tmat2x2<T, P> Inverse(
+ m[1][1] / Determinant, - m[0][1] / Determinant,
- m[1][0] / Determinant, + m[0][0] / Determinant);
return Inverse;
}
//////////////////////////////////////////////////////////////
// Binary operators

View File

@ -435,22 +435,21 @@ namespace detail
{
static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
{
T Determinant =
T OneOverDeterminant = static_cast<T>(1) / (
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
- m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]));
detail::tmat3x3<T, P> Inverse(detail::tmat3x3<T, P>::_null);
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]);
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
Inverse /= Determinant;
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDeterminant;
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDeterminant;
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDeterminant;
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDeterminant;
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDeterminant;
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDeterminant;
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDeterminant;
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDeterminant;
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDeterminant;
return Inverse;
}

View File

@ -43,6 +43,7 @@
// Dependencies
#include "../detail/setup.hpp"
#include "../detail/precision.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_noise extension included")

View File

@ -41,6 +41,8 @@
// Dependencies
#include "../detail/setup.hpp"
#include "../detail/precision.hpp"
#include "../detail/type_int.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_ulp extension included")

View File

@ -36,6 +36,7 @@
#include "../detail/type_int.hpp"
#include <cmath>
#include <cfloat>
#include <limits>
#if(GLM_COMPILER & GLM_COMPILER_VC)
# pragma warning(push)

View File

@ -10,6 +10,7 @@
//#include <boost/array.hpp>
//#include <boost/date_time/posix_time/posix_time.hpp>
//#include <boost/thread/thread.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/constants.hpp>
#include <glm/gtc/epsilon.hpp>
#include <cstdio>

View File

@ -7,6 +7,7 @@
// File : test/core/func_exponential.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/common.hpp>
#include <glm/exponential.hpp>
#include <glm/gtc/ulp.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/func_geometric.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/geometric.hpp>
#include <glm/gtc/epsilon.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/func_integer.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/integer.hpp>
#include <iostream>

View File

@ -7,6 +7,7 @@
// File : test/core/func_matrix.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/matrix.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/ulp.hpp>

View File

@ -7,6 +7,8 @@
// File : test/core/func_noise.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
int main()
{
int Failed = 0;

View File

@ -7,6 +7,7 @@
// File : test/core/func_packing.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/core_func_swizzle.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#define GLM_MESSAGES
#define GLM_SWIZZLE
#include <glm/glm.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/func_trigonometric.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
int main()

View File

@ -7,6 +7,7 @@
// File : test/core/vector_relational.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
int main()

View File

@ -7,6 +7,7 @@
// File : test/core/type_cast.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
struct my_vec2

View File

@ -7,19 +7,20 @@
// File : test/core/type_float.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#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);
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 (
return (
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1;
}
@ -31,13 +32,10 @@ int test_vec2()
int main()
{
int Error = 0;
Error += test_float_size();
Error += test_float_precision();
int Error = 0;
Error += test_float_size();
Error += test_float_precision();
return Error;
}

View File

@ -7,6 +7,7 @@
// File : test/core/type_int.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
int test_int_size()

View File

@ -7,6 +7,7 @@
// File : test/core/type_length.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
int test_length_mat_non_squared()

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat2x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat2x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat2x3.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat2x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat2x4.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat3x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat3x2.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat3x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat3x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat3x4.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat4x2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat4x2.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat4x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/mat4x3.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_mat4x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/mat4x4.hpp>

View File

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

View File

@ -7,6 +7,7 @@
// File : test/core/type_vec2.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/core/type_vec3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/geometric.hpp>

View File

@ -7,6 +7,7 @@
// File : test/core/type_vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtc/constants.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/constants.hpp>
int test_epsilon()

View File

@ -7,6 +7,7 @@
// File : test/gtc/epsilon.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/vector_relational.hpp>

View File

@ -7,8 +7,17 @@
// File : test/gtc/matrix_access.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/matrix_access.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
#include <glm/mat2x4.hpp>
#include <glm/mat3x2.hpp>
#include <glm/mat3x3.hpp>
#include <glm/mat3x4.hpp>
#include <glm/mat4x2.hpp>
#include <glm/mat4x3.hpp>
#include <glm/mat4x4.hpp>
int test_mat2x2_row_set()
{

View File

@ -7,7 +7,7 @@
// File : test/gtc/matrix_integer.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/matrix_integer.hpp>
int main()

View File

@ -7,7 +7,7 @@
// File : test/gtc/matrix_inverse.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/matrix_inverse.hpp>
int main()

View File

@ -8,7 +8,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/constants.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtc/noise.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/noise.hpp>
#include <gli/gli.hpp>
#include <gli/gtx/loader.hpp>

View File

@ -26,7 +26,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/packing.hpp>
#include <cstdio>
#include <vector>

View File

@ -7,6 +7,7 @@
// File : test/gtc/quaternion.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp>
@ -16,28 +17,28 @@ int test_quat_angle()
int Error = 0;
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.01f) ? 0 : 1;
float A = glm::angle(N);
Error += glm::epsilonEqual(A, 45.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(0, 1, 1)));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::normalize(glm::vec3(0, 1, 1)));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.01f) ? 0 : 1;
float A = glm::angle(N);
Error += glm::epsilonEqual(A, 45.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(1, 2, 3)));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::normalize(glm::vec3(1, 2, 3)));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.01f) ? 0 : 1;
float A = glm::angle(N);
Error += glm::epsilonEqual(A, 45.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
}
return Error;
@ -48,9 +49,9 @@ int test_quat_angleAxis()
int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1;
@ -65,9 +66,9 @@ int test_quat_mix()
int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1;
@ -92,19 +93,19 @@ int test_quat_normalize()
int Error(0);
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.000001f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(0, 0, 2));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 2));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.000001f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(1, 2, 3));
glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(1, 2, 3));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::epsilonEqual(L, 1.0f, 0.000001f) ? 0 : 1;
@ -170,7 +171,7 @@ int test_quat_slerp()
// certainly not a 135° rotation
glm::quat Y45rot3 = glm::slerp(id , -Y90rot, 0.5f);
float Y45angle3 = glm::angle(Y45rot3);
Error += glm::epsilonEqual(Y45angle3, 45.f, Epsilon) ? 0 : 1;
Error += glm::epsilonEqual(Y45angle3, glm::pi<float>() * 0.25f, Epsilon) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(Ym45rot2, Y45rot3, Epsilon)) ? 0 : 1;
// Same, but inverted
@ -188,7 +189,7 @@ int test_quat_slerp()
// Must be 90° rotation on almost any axis that is on the XZ plane
glm::quat XZ90rot = glm::slerp(id, -Y90rot, 0.5f);
float XZ90angle = glm::angle(XZ90rot); // Must be PI/4 = 0.78;
Error += glm::epsilonEqual(XZ90angle, 45.f, Epsilon) ? 0 : 1;
Error += glm::epsilonEqual(XZ90angle, glm::pi<float>() * 0.25f, Epsilon) ? 0 : 1;
// Testing almost equal quaternions (this test should pass through the linear interpolation)
// Must be 0 0.00X 0 0.99999
@ -210,15 +211,15 @@ int test_quat_mul()
glm::quat temp5 = glm::normalize(temp1 * temp2);
glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5);
{
glm::quat temp7;
{
glm::quat temp7;
temp7 *= temp5;
temp7 *= glm::inverse(temp5);
temp7 *= temp5;
temp7 *= glm::inverse(temp5);
Error += temp7 != glm::quat();
}
Error += temp7 != glm::quat();
}
return Error;
}

View File

@ -7,7 +7,7 @@
// File : test/gtc/random.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/random.hpp>
#include <glm/gtc/epsilon.hpp>
#include <iostream>

View File

@ -7,16 +7,12 @@
// File : test/gtc/reciprocal.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/reciprocal.hpp>
int main()
{
int Error(0);
return Error;
}

View File

@ -7,7 +7,7 @@
// File : test/gtc/type_precision.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/quaternion.hpp>
#include <vector>

View File

@ -7,256 +7,256 @@
// File : test/gtc/type_ptr.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_ptr.hpp>
int test_value_ptr_vec()
{
int Error = 0;
{
glm::vec2 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec3 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec4 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec2 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec3 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec4 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
return Error;
int Error = 0;
{
glm::vec2 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec3 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec4 v(1.0);
float * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec2 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec3 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec4 v(1.0);
double * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
return Error;
}
int test_value_ptr_vec_const()
{
int Error = 0;
{
glm::vec2 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec3 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec4 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec2 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec3 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec4 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
return Error;
int Error = 0;
{
glm::vec2 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec3 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::vec4 const v(1.0);
float const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec2 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec3 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
{
glm::dvec4 const v(1.0);
double const * p = glm::value_ptr(v);
Error += p == &v[0] ? 0 : 1;
}
return Error;
}
int test_value_ptr_mat()
{
int Error = 0;
{
glm::mat2x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
return Error;
int Error = 0;
{
glm::mat2x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x2 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x3 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x4 m(1.0);
float * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
return Error;
}
int test_value_ptr_mat_const()
{
int Error = 0;
{
glm::mat2x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
return Error;
int Error = 0;
{
glm::mat2x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat2x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat3x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x2 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x3 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
{
glm::mat4x4 const m(1.0);
float const * p = glm::value_ptr(m);
Error += p == &m[0][0] ? 0 : 1;
}
return Error;
}
int test_make_pointer_mat()
{
int Error = 0;
int Error = 0;
float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
double ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
glm::mat2x2 Mat2x2A = glm::make_mat2x2(ArrayA);
glm::mat2x3 Mat2x3A = glm::make_mat2x3(ArrayA);
glm::mat2x4 Mat2x4A = glm::make_mat2x4(ArrayA);
glm::mat3x2 Mat3x2A = glm::make_mat3x2(ArrayA);
glm::mat3x3 Mat3x3A = glm::make_mat3x3(ArrayA);
glm::mat3x4 Mat3x4A = glm::make_mat3x4(ArrayA);
glm::mat4x2 Mat4x2A = glm::make_mat4x2(ArrayA);
glm::mat4x3 Mat4x3A = glm::make_mat4x3(ArrayA);
glm::mat4x4 Mat4x4A = glm::make_mat4x4(ArrayA);
glm::dmat2x2 Mat2x2B = glm::make_mat2x2(ArrayB);
glm::dmat2x3 Mat2x3B = glm::make_mat2x3(ArrayB);
glm::dmat2x4 Mat2x4B = glm::make_mat2x4(ArrayB);
glm::dmat3x2 Mat3x2B = glm::make_mat3x2(ArrayB);
glm::dmat3x3 Mat3x3B = glm::make_mat3x3(ArrayB);
glm::dmat3x4 Mat3x4B = glm::make_mat3x4(ArrayB);
glm::dmat4x2 Mat4x2B = glm::make_mat4x2(ArrayB);
glm::dmat4x3 Mat4x3B = glm::make_mat4x3(ArrayB);
glm::dmat4x4 Mat4x4B = glm::make_mat4x4(ArrayB);
return Error;
float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
double ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
glm::mat2x2 Mat2x2A = glm::make_mat2x2(ArrayA);
glm::mat2x3 Mat2x3A = glm::make_mat2x3(ArrayA);
glm::mat2x4 Mat2x4A = glm::make_mat2x4(ArrayA);
glm::mat3x2 Mat3x2A = glm::make_mat3x2(ArrayA);
glm::mat3x3 Mat3x3A = glm::make_mat3x3(ArrayA);
glm::mat3x4 Mat3x4A = glm::make_mat3x4(ArrayA);
glm::mat4x2 Mat4x2A = glm::make_mat4x2(ArrayA);
glm::mat4x3 Mat4x3A = glm::make_mat4x3(ArrayA);
glm::mat4x4 Mat4x4A = glm::make_mat4x4(ArrayA);
glm::dmat2x2 Mat2x2B = glm::make_mat2x2(ArrayB);
glm::dmat2x3 Mat2x3B = glm::make_mat2x3(ArrayB);
glm::dmat2x4 Mat2x4B = glm::make_mat2x4(ArrayB);
glm::dmat3x2 Mat3x2B = glm::make_mat3x2(ArrayB);
glm::dmat3x3 Mat3x3B = glm::make_mat3x3(ArrayB);
glm::dmat3x4 Mat3x4B = glm::make_mat3x4(ArrayB);
glm::dmat4x2 Mat4x2B = glm::make_mat4x2(ArrayB);
glm::dmat4x3 Mat4x3B = glm::make_mat4x3(ArrayB);
glm::dmat4x4 Mat4x4B = glm::make_mat4x4(ArrayB);
return Error;
}
int test_make_pointer_vec()
{
int Error = 0;
float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
bool ArrayC[] = {true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false};
glm::vec2 Vec2A = glm::make_vec2(ArrayA);
glm::vec3 Vec3A = glm::make_vec3(ArrayA);
glm::vec4 Vec4A = glm::make_vec4(ArrayA);
glm::ivec2 Vec2B = glm::make_vec2(ArrayB);
glm::ivec3 Vec3B = glm::make_vec3(ArrayB);
glm::ivec4 Vec4B = glm::make_vec4(ArrayB);
glm::bvec2 Vec2C = glm::make_vec2(ArrayC);
glm::bvec3 Vec3C = glm::make_vec3(ArrayC);
glm::bvec4 Vec4C = glm::make_vec4(ArrayC);
return Error;
int Error = 0;
float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
bool ArrayC[] = {true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false};
glm::vec2 Vec2A = glm::make_vec2(ArrayA);
glm::vec3 Vec3A = glm::make_vec3(ArrayA);
glm::vec4 Vec4A = glm::make_vec4(ArrayA);
glm::ivec2 Vec2B = glm::make_vec2(ArrayB);
glm::ivec3 Vec3B = glm::make_vec3(ArrayB);
glm::ivec4 Vec4B = glm::make_vec4(ArrayB);
glm::bvec2 Vec2C = glm::make_vec2(ArrayC);
glm::bvec3 Vec3C = glm::make_vec3(ArrayC);
glm::bvec4 Vec4C = glm::make_vec4(ArrayC);
return Error;
}
int main()
{
int Error = 0;
Error += test_make_pointer_vec();
Error += test_make_pointer_mat();
Error += test_value_ptr_vec();
Error += test_value_ptr_vec_const();
Error += test_value_ptr_mat();
Error += test_value_ptr_mat_const();
Error += test_make_pointer_vec();
Error += test_make_pointer_mat();
Error += test_value_ptr_vec();
Error += test_value_ptr_vec_const();
Error += test_value_ptr_mat();
Error += test_value_ptr_mat_const();
return Error;
}

View File

@ -7,7 +7,7 @@
// File : test/gtc/ulp.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/ulp.hpp>
#include <iostream>
#include <limits>

View File

@ -7,9 +7,7 @@
// File : test/gtx/associated_min_max.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/associated_min_max.hpp>

View File

@ -7,11 +7,11 @@
// File : test/gtx/bit.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#define GLM_FORCE_RADIANS
#include <glm/gtx/bit.hpp>
#include <glm/gtc/type_precision.hpp>
#include <emmintrin.h>
#if(GLM_ARCH != GLM_ARCH_PURE)
# include <glm/detail/intrinsic_integer.hpp>
#endif

View File

@ -7,9 +7,7 @@
// File : test/gtx/associated_min_max.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/associated_min_max.hpp>

View File

@ -7,9 +7,7 @@
// File : test/gtx/color_space.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/color_space.hpp>

View File

@ -7,9 +7,7 @@
// File : test/gtx/color_space_YCoCg.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/color_space_YCoCg.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/compatibility.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/compatibility.hpp>

View File

@ -7,9 +7,7 @@
// File : test/gtx/component_wise.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/component_wise.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtc/gtc_dual_quaternion.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtx/dual_quaternion.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/epsilon.hpp>

View File

@ -1,7 +1,15 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2013-10-25
// Updated : 2014-01-11
// Licence : This source is under MIT licence
// File : test/gtx/euler_angle.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
// Code sample from Filippo Ramaciotti
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/string_cast.hpp>
#include <glm/gtx/euler_angles.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/extend.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/extend.hpp>

View File

@ -7,9 +7,7 @@
// File : test/gtx/associated_min_max.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <emmintrin.h>
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/associated_min_max.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/associated_min_max.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_exponential.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/fast_square_root.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_square_root.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/fast_trigonometry.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_trigonometry.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/gradient_paint.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtx/gradient_paint.hpp>
int test_radialGradient()

View File

@ -7,7 +7,7 @@
// File : test/gtx/handed_coordinate_space.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/handed_coordinate_space.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/inertia.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/inertia.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/gtx_integer.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/epsilon.hpp>
#include <glm/gtx/integer.hpp>
#include <cstdio>

View File

@ -7,7 +7,7 @@
// File : test/gtx/intersect.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/intersect.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/io.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/io.hpp>
#include <iostream>

View File

@ -7,7 +7,7 @@
// File : test/gtx/log_base.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/log_base.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/matrix_cross_product.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/matrix_cross_product.hpp>

View File

@ -7,15 +7,13 @@
// File : test/gtx/matrix_interpolation.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtx/matrix_interpolation.hpp>
int main()
{
int Error(0);
return Error;
}

View File

@ -7,7 +7,7 @@
// File : test/gtx/matrix_major_storage.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/matrix_major_storage.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/matrix_operation.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/matrix_operation.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/matrix_query.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtx/matrix_query.hpp>
int test_isNull()

View File

@ -7,7 +7,7 @@
// File : test/gtx/gtx_multiple.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtx/multiple.hpp>
int test_higher_int()

View File

@ -7,7 +7,7 @@
// File : test/gtx/norm.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/norm.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/normal.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/normal.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/normalize_dot.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/normalize_dot.hpp>

View File

@ -7,7 +7,7 @@
// File : test/gtx/number_precision.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/number_precision.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/optimum_pow.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/optimum_pow.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/orthonormalize.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/orthonormalize.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/perpendicular.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/perpendicular.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/polar_coordinates.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/polar_coordinates.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/projection.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/projection.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/quaternion.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtx/quaternion.hpp>
@ -16,9 +17,9 @@ int test_quat_fastMix()
int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::fastMix(A, B, 0.5f);
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1;
@ -33,9 +34,9 @@ int test_quat_shortMix()
int Error(0);
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::shortMix(A, B, 0.5f);
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1;
@ -78,7 +79,7 @@ int test_rotation()
float Angle = glm::angle(Rotation);
Error += glm::abs(Angle - 90.0f) < glm::epsilon<float>() ? 0 : 1;
Error += glm::abs(Angle - glm::pi<float>() * 0.5f) < glm::epsilon<float>() ? 0 : 1;
return Error;
}

View File

@ -26,12 +26,13 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/rotate_normalized_axis.hpp>
int main()
{
int Error(0);
return Error;
}

View File

@ -7,31 +7,23 @@
// File : test/gtx/rotate_vector.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/constants.hpp>
#include <glm/gtx/rotate_vector.hpp>
int test_rotate()
{
int Error = 0;
glm::vec2 A = glm::rotate(glm::vec2(1, 0), 90.f);
glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), 90.f, glm::vec3(0, 0, 1));
glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), 90.f, glm::vec3(0, 0, 1));
glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f);
glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f);
glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f);
glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f);
glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f);
glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f);
glm::vec2 A = glm::rotate(glm::vec2(1, 0), glm::pi<float>() * 0.5f);
glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), glm::pi<float>() * 0.5f);
glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), glm::pi<float>() * 0.5f);
glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), glm::pi<float>() * 0.5f);
glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1));
return Error;
@ -39,56 +31,54 @@ int test_rotate()
int test_rotateX()
{
int Error = 0;
glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f);
glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f);
return Error;
int Error = 0;
glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), glm::pi<float>() * 0.5f);
return Error;
}
int test_rotateY()
{
int Error = 0;
glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f);
glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f);
return Error;
int Error = 0;
glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), glm::pi<float>() * 0.5f);
return Error;
}
int test_rotateZ()
{
int Error = 0;
glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f);
glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f);
return Error;
int Error = 0;
glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), glm::pi<float>() * 0.5f);
glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), glm::pi<float>() * 0.5f);
return Error;
}
int test_orientation()
{
int Error = 0;
glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1));
return Error;
int Error = 0;
glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1));
return Error;
}
int main()
{
int Error = 0;
Error += test_rotate();
Error += test_rotateX();
Error += test_rotateY();
Error += test_rotateZ();
Error += test_orientation();
Error += test_rotate();
Error += test_rotateX();
Error += test_rotateY();
Error += test_rotateZ();
Error += test_orientation();
return Error;
}

View File

@ -7,6 +7,7 @@
// File : test/gtx/gtx_scalar_relational.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/scalar_relational.hpp>
#include <cstdio>

View File

@ -7,6 +7,7 @@
// File : test/gtx/simd-mat4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/simd-vec4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>
@ -28,7 +29,7 @@ int main()
//printf("C1(%2.3f, %2.3f, %2.3f, %2.3f)\n", C1.x, C1.y, C1.z, C1.w);
//printf("D1(%2.3f, %2.3f, %2.3f, %2.3f)\n", D1.x, D1.y, D1.z, D1.w);
__m128 value;
__m128 value = _mm_set1_ps(0.0f);
__m128 data = _mm_cmpeq_ps(value, value);
__m128 add0 = _mm_add_ps(data, data);

View File

@ -7,6 +7,7 @@
// File : test/gtx/associated_min_max.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/spline.hpp>

View File

@ -7,6 +7,7 @@
// File : test/gtx/string_cast.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/string_cast.hpp>
#include <iostream>

View File

@ -7,7 +7,8 @@
// File : test/gtx/vector_angle.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#define GLM_FORCE_RADIANS
#include <glm/gtc/constants.hpp>
#include <glm/gtx/vector_angle.hpp>
#include <iostream>
#include <limits>
@ -17,11 +18,11 @@ int test_angle()
int Error = 0;
float AngleA = glm::angle(glm::vec2(1, 0), glm::normalize(glm::vec2(1, 1)));
Error += glm::epsilonEqual(AngleA, 45.f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(AngleA, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
float AngleB = glm::angle(glm::vec3(1, 0, 0), glm::normalize(glm::vec3(1, 1, 0)));
Error += glm::epsilonEqual(AngleB, 45.f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(AngleB, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
float AngleC = glm::angle(glm::vec4(1, 0, 0, 0), glm::normalize(glm::vec4(1, 1, 0, 0)));
Error += glm::epsilonEqual(AngleC, 45.f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(AngleC, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1;
return Error;
}
@ -31,11 +32,11 @@ int test_orientedAngle_vec2()
int Error = 0;
float AngleA = glm::orientedAngle(glm::vec2(1, 0), glm::normalize(glm::vec2(1, 1)));
Error += AngleA == 45.f ? 0 : 1;
Error += AngleA == glm::pi<float>() * 0.25f ? 0 : 1;
float AngleB = glm::orientedAngle(glm::vec2(0, 1), glm::normalize(glm::vec2(1, 1)));
Error += AngleB == -45.f ? 0 : 1;
Error += AngleB == -glm::pi<float>() * 0.25f ? 0 : 1;
float AngleC = glm::orientedAngle(glm::normalize(glm::vec2(1, 1)), glm::vec2(0, 1));
Error += AngleC == 45.f ? 0 : 1;
Error += AngleC == glm::pi<float>() * 0.25f ? 0 : 1;
return Error;
}
@ -45,11 +46,11 @@ int test_orientedAngle_vec3()
int Error = 0;
float AngleA = glm::orientedAngle(glm::vec3(1, 0, 0), glm::normalize(glm::vec3(1, 1, 0)), glm::vec3(0, 0, 1));
Error += AngleA == 45.f ? 0 : 1;
Error += AngleA == glm::pi<float>() * 0.25f ? 0 : 1;
float AngleB = glm::orientedAngle(glm::vec3(0, 1, 0), glm::normalize(glm::vec3(1, 1, 0)), glm::vec3(0, 0, 1));
Error += AngleB == -45.f ? 0 : 1;
Error += AngleB == -glm::pi<float>() * 0.25f ? 0 : 1;
float AngleC = glm::orientedAngle(glm::normalize(glm::vec3(1, 1, 0)), glm::vec3(0, 1, 0), glm::vec3(0, 0, 1));
Error += AngleC == 45.f ? 0 : 1;
Error += AngleC == glm::pi<float>() * 0.25f ? 0 : 1;
return Error;
}

View File

@ -7,6 +7,7 @@
// File : test/gtx/vector_query.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/vector_query.hpp>