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. /// dummy.cpp exist only a wordaround for CMake file.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#define GLM_MESSAGES #define GLM_MESSAGES
#include "../glm.hpp" #include "../glm.hpp"
#include <limits> #include <limits>

View File

@ -43,7 +43,10 @@ namespace detail
template <typename T, precision P> struct tmat4x2; template <typename T, precision P> struct tmat4x2;
template <typename T, precision P> struct tmat4x3; template <typename T, precision P> struct tmat4x3;
template <typename T, precision P> struct tmat4x4; 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> template <template <class, precision> class matType, typename T, precision P>
struct compute_inverse{}; struct compute_inverse{};
}//namespace detail }//namespace detail

View File

@ -396,7 +396,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_inverse<detail::tmat2x2, T, 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); 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 // Binary operators

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,8 +7,17 @@
// File : test/gtc/matrix_access.cpp // File : test/gtc/matrix_access.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp> #define GLM_FORCE_RADIANS
#include <glm/gtc/matrix_access.hpp> #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() int test_mat2x2_row_set()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@
// File : test/gtc/gtc_dual_quaternion.cpp // File : test/gtc/gtc_dual_quaternion.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtx/dual_quaternion.hpp> #include <glm/gtx/dual_quaternion.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/epsilon.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 // Code sample from Filippo Ramaciotti
#define GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/string_cast.hpp> #include <glm/gtx/string_cast.hpp>
#include <glm/gtx/euler_angles.hpp> #include <glm/gtx/euler_angles.hpp>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@
// File : test/gtx/quaternion.cpp // File : test/gtx/quaternion.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp> #include <glm/gtc/epsilon.hpp>
#include <glm/gtx/quaternion.hpp> #include <glm/gtx/quaternion.hpp>
@ -16,9 +17,9 @@ int test_quat_fastMix()
int Error = 0; int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1)); 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 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.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 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); int Error(0);
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1)); 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 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.x, D.x, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(C.y, D.y, 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); 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; return Error;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@
// File : test/gtx/simd-vec4.cpp // File : test/gtx/simd-vec4.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp> #include <glm/gtx/simd_vec4.hpp>
#include <cstdio> #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("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); //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 data = _mm_cmpeq_ps(value, value);
__m128 add0 = _mm_add_ps(data, data); __m128 add0 = _mm_add_ps(data, data);

View File

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

View File

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

View File

@ -7,7 +7,8 @@
// File : test/gtx/vector_angle.cpp // 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 <glm/gtx/vector_angle.hpp>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
@ -17,11 +18,11 @@ int test_angle()
int Error = 0; int Error = 0;
float AngleA = glm::angle(glm::vec2(1, 0), glm::normalize(glm::vec2(1, 1))); 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))); 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))); 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; return Error;
} }
@ -31,11 +32,11 @@ int test_orientedAngle_vec2()
int Error = 0; int Error = 0;
float AngleA = glm::orientedAngle(glm::vec2(1, 0), glm::normalize(glm::vec2(1, 1))); 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))); 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)); 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; return Error;
} }
@ -45,11 +46,11 @@ int test_orientedAngle_vec3()
int Error = 0; int Error = 0;
float AngleA = glm::orientedAngle(glm::vec3(1, 0, 0), glm::normalize(glm::vec3(1, 1, 0)), glm::vec3(0, 0, 1)); 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)); 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)); 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; return Error;
} }

View File

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