mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Merge branch '0.9.2' into 0.9.3
This commit is contained in:
commit
b1a0af8b87
@ -5,15 +5,18 @@ project(glm)
|
||||
enable_testing()
|
||||
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
#add_definitions(/Za)
|
||||
#add_definitions(-pedantic)
|
||||
#add_definitions(-S)
|
||||
#add_definitions(-s)
|
||||
add_definitions(-msse2)
|
||||
#add_definitions(-m32)
|
||||
#add_definitions(-mfpmath=387)
|
||||
#add_definitions(-ffast-math)
|
||||
#add_definitions(-O3)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
#add_definitions(/Za)
|
||||
#add_definitions(-pedantic)
|
||||
#add_definitions(-S)
|
||||
#add_definitions(-s)
|
||||
add_definitions(-msse2)
|
||||
#add_definitions(-m32)
|
||||
#add_definitions(-mfpmath=387)
|
||||
#add_definitions(-ffast-math)
|
||||
#add_definitions(-O3)
|
||||
endif()
|
||||
|
||||
include_directories(".")
|
||||
|
||||
|
@ -204,9 +204,10 @@ GLM_FUNC_QUALIFIER __m128 sse_mod_ps(__m128 x, __m128 y)
|
||||
return sub0;
|
||||
}
|
||||
|
||||
/// TODO
|
||||
GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i)
|
||||
{
|
||||
|
||||
return __m128();
|
||||
}
|
||||
|
||||
//GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y)
|
||||
|
@ -548,8 +548,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac0 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac1;
|
||||
@ -570,8 +568,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac1 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
|
||||
@ -593,9 +589,7 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac2 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
}
|
||||
|
||||
__m128 Fac3;
|
||||
{
|
||||
@ -615,8 +609,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac3 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac4;
|
||||
@ -637,8 +629,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac4 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac5;
|
||||
@ -659,8 +649,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac5 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);
|
||||
@ -781,8 +769,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac0 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac1;
|
||||
@ -803,8 +789,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac1 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
|
||||
@ -826,8 +810,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac2 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac3;
|
||||
@ -848,8 +830,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac3 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac4;
|
||||
@ -870,8 +850,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac4 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 Fac5;
|
||||
@ -892,8 +870,6 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
|
||||
__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);
|
||||
__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);
|
||||
Fac5 = _mm_sub_ps(Mul00, Mul01);
|
||||
|
||||
bool stop = true;
|
||||
}
|
||||
|
||||
__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);
|
||||
|
@ -57,10 +57,12 @@ namespace glm
|
||||
GLM_FUNC_DECL tmat2x2<T> _inverse() const;
|
||||
|
||||
private:
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
col_type value[2];
|
||||
|
||||
public:
|
||||
//////////////////////////////////////
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x2();
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
@ -77,6 +79,23 @@ namespace glm
|
||||
col_type const & v1,
|
||||
col_type const & v2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion constructors
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
U const & x);
|
||||
|
||||
template <typename U, typename V, typename M, typename N>
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
U const & x1, V const & y1,
|
||||
M const & x2, N const & y2);
|
||||
|
||||
//template <typename U, typename V, typename M, typename N>
|
||||
//GLM_FUNC_DECL explicit tmat2x2(
|
||||
// tvec2<U, V> const & v1,
|
||||
// tvec2<M, N> const & v2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversions
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U> const & m);
|
||||
@ -225,17 +244,37 @@ namespace glm
|
||||
{
|
||||
//! 2 columns of 2 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<lowp_float> lowp_mat2x2;
|
||||
typedef detail::tmat2x2<lowp_float> lowp_mat2;
|
||||
|
||||
//! 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<mediump_float> mediump_mat2x2;
|
||||
typedef detail::tmat2x2<mediump_float> mediump_mat2;
|
||||
|
||||
//! 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<highp_float> highp_mat2;
|
||||
|
||||
//! 2 columns of 2 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<lowp_float> lowp_mat2x2;
|
||||
|
||||
//! 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<mediump_float> mediump_mat2x2;
|
||||
|
||||
//! 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat2x2<highp_float> highp_mat2x2;
|
||||
}
|
||||
|
@ -113,8 +113,46 @@ namespace detail
|
||||
this->value[1] = v1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion constructors
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T>::tmat2x2
|
||||
(
|
||||
U const & s
|
||||
)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = tvec2<T>(value_type(s), Zero);
|
||||
this->value[1] = tvec2<T>(Zero, value_type(s));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename U, typename V, typename M, typename N>
|
||||
GLM_FUNC_DECL tmat2x2<T>::tmat2x2
|
||||
(
|
||||
U const & x1, V const & y1,
|
||||
M const & x2, N const & y2
|
||||
)
|
||||
{
|
||||
this->value[0] = col_type(value_type(x1), value_type(y1));
|
||||
this->value[1] = col_type(value_type(x2), value_type(y2));
|
||||
}
|
||||
|
||||
//template <typename T>
|
||||
//template <typename U, typename V, typename M, typename N>
|
||||
//GLM_FUNC_DECL tmat2x2<T>::tmat2x2
|
||||
//(
|
||||
// tvec2<U, V> const & v1,
|
||||
// tvec2<M, N> const & v2
|
||||
//)
|
||||
//{
|
||||
// this->value[0] = col_type(v1);
|
||||
// this->value[1] = col_type(v2);
|
||||
//}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// mat2 conversions
|
||||
// mat2x2 conversions
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
@ -221,7 +259,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// mat3 operators
|
||||
// mat2x2 operators
|
||||
|
||||
// This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared
|
||||
template <typename T>
|
||||
|
@ -224,17 +224,35 @@ namespace glm
|
||||
{
|
||||
//! 3 columns of 3 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<lowp_float> lowp_mat3x3;
|
||||
typedef detail::tmat3x3<lowp_float> lowp_mat3;
|
||||
//! 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<mediump_float> mediump_mat3x3;
|
||||
typedef detail::tmat3x3<mediump_float> mediump_mat3;
|
||||
//! 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<highp_float> highp_mat3;
|
||||
|
||||
//! 3 columns of 3 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<lowp_float> lowp_mat3x3;
|
||||
|
||||
//! 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<mediump_float> mediump_mat3x3;
|
||||
|
||||
//! 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat3x3<highp_float> highp_mat3x3;
|
||||
}
|
||||
|
@ -59,8 +59,6 @@ namespace detail
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T>::tmat3x4()
|
||||
{
|
||||
value_type const Zero(0);
|
||||
value_type const One(1);
|
||||
this->value[0] = col_type(1, 0, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0, 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
|
@ -224,17 +224,37 @@ namespace glm
|
||||
{
|
||||
//! 4 columns of 4 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<lowp_float> lowp_mat4x4;
|
||||
typedef detail::tmat4x4<lowp_float> lowp_mat4;
|
||||
|
||||
//! 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<mediump_float> mediump_mat4x4;
|
||||
typedef detail::tmat4x4<mediump_float> mediump_mat4;
|
||||
|
||||
//! 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers)
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<highp_float> highp_mat4;
|
||||
|
||||
//! 4 columns of 4 components matrix of low precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<lowp_float> lowp_mat4x4;
|
||||
|
||||
//! 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<mediump_float> mediump_mat4x4;
|
||||
|
||||
//! 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
//! There is no guarantee on the actual precision.
|
||||
//! From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers
|
||||
//! \ingroup core_precision
|
||||
typedef detail::tmat4x4<highp_float> highp_mat4x4;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace glm
|
||||
tvec2(tref2<T> const & r);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
// Convertion constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
|
@ -227,6 +227,17 @@ namespace quaternion ///< GLM_GTC_quaternion extension: Quaternion types and fun
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<double> dquat;
|
||||
|
||||
//! Quaternion of low precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<lowp_float> lowp_quat;
|
||||
|
||||
//! Quaternion of medium precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<mediump_float> mediump_quat;
|
||||
|
||||
//! Quaternion of high precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<highp_float> highp_quat;
|
||||
///@}
|
||||
|
||||
} //namespace quaternion
|
||||
|
@ -430,7 +430,7 @@ namespace quaternion{
|
||||
)
|
||||
{
|
||||
T angle = acos(dot(x, y));
|
||||
return (sin((T(1) - a) * angle) * x + sin(a * angle) * y) / sin(angle);
|
||||
return (glm::sin((T(1) - a) * angle) * x + glm::sin(a * angle) * y) / glm::sin(angle);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -24,6 +24,8 @@ glmCreateTestGTC(core_func_noise)
|
||||
glmCreateTestGTC(core_func_packing)
|
||||
glmCreateTestGTC(core_func_trigonometric)
|
||||
glmCreateTestGTC(core_func_vector_relational)
|
||||
glmCreateTestGTC(core_setup_message)
|
||||
glmCreateTestGTC(core_setup_precision)
|
||||
|
||||
|
||||
|
||||
|
30
test/core/core_setup_message.cpp
Normal file
30
test/core/core_setup_message.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-05-31
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT License
|
||||
// File : test/core/setup_message.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
static int test_operators()
|
||||
{
|
||||
glm::vec3 A(1.0f);
|
||||
glm::vec3 B(1.0f);
|
||||
bool R = A != B;
|
||||
bool S = A == B;
|
||||
|
||||
return (S && !R) ? 0 : 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators();
|
||||
|
||||
return Error;
|
||||
}
|
53
test/core/core_setup_precision.cpp
Normal file
53
test/core/core_setup_precision.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-05-31
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT License
|
||||
// File : test/core/setup_precision_highp.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_PRECISION_HIGHP_FLOAT
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
static int test_mat()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::mat2) == sizeof(glm::highp_mat2) ? 0 : 1;
|
||||
Error += sizeof(glm::mat3) == sizeof(glm::highp_mat3) ? 0 : 1;
|
||||
Error += sizeof(glm::mat4) == sizeof(glm::highp_mat4) ? 0 : 1;
|
||||
|
||||
Error += sizeof(glm::mat2x2) == sizeof(glm::highp_mat2x2) ? 0 : 1;
|
||||
Error += sizeof(glm::mat2x3) == sizeof(glm::highp_mat2x3) ? 0 : 1;
|
||||
Error += sizeof(glm::mat2x4) == sizeof(glm::highp_mat2x4) ? 0 : 1;
|
||||
Error += sizeof(glm::mat3x2) == sizeof(glm::highp_mat3x2) ? 0 : 1;
|
||||
Error += sizeof(glm::mat3x3) == sizeof(glm::highp_mat3x3) ? 0 : 1;
|
||||
Error += sizeof(glm::mat3x4) == sizeof(glm::highp_mat3x4) ? 0 : 1;
|
||||
Error += sizeof(glm::mat4x2) == sizeof(glm::highp_mat4x2) ? 0 : 1;
|
||||
Error += sizeof(glm::mat4x3) == sizeof(glm::highp_mat4x3) ? 0 : 1;
|
||||
Error += sizeof(glm::mat4x4) == sizeof(glm::highp_mat4x4) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
static int test_vec()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::vec2) == sizeof(glm::highp_vec2) ? 0 : 1;
|
||||
Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1;
|
||||
Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_mat();
|
||||
Error += test_vec();
|
||||
|
||||
return Error;
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
// File : test/core/type_mat4x4.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#define GLM_PRECISION_HIGHP_FLOAT
|
||||
#include <glm/glm.hpp>
|
||||
#include <cstdio>
|
||||
|
@ -2,28 +2,101 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2008-08-31
|
||||
// Updated : 2008-08-31
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT License
|
||||
// File : test/core/type_vec2.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
static int test_operators()
|
||||
int test_vec2_operators()
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 B(1.0f);
|
||||
bool R = A != B;
|
||||
bool S = A == B;
|
||||
|
||||
return (S && !R) ? 0 : 1;
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 B(1.0f);
|
||||
Error += A != B ? 1 : 0;
|
||||
Error += A == B ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 C = A + 1.0f;
|
||||
A += 1.0f;
|
||||
Error += A.x == 2.0f && A.y == 2.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 B(2.0f,-1.0f);
|
||||
glm::vec2 C = A + B;
|
||||
A += B;
|
||||
Error += A.x == 3.0f && A.y == 0.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 C = A - 1.0f;
|
||||
A -= 1.0f;
|
||||
Error += A.x == 0.0f && A.y == 0.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 B(2.0f,-1.0f);
|
||||
glm::vec2 C = A - B;
|
||||
A -= B;
|
||||
Error += A.x == -1.0f && A.y == 2.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f);
|
||||
glm::vec2 C = A * 2.0f;
|
||||
A *= 2.0f;
|
||||
Error += A.x == 2.0f && A.y == 2.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec2 A(2.0f);
|
||||
glm::vec2 B(2.0f);
|
||||
glm::vec2 C = A / B;
|
||||
A /= B;
|
||||
Error += A.x == 1.0f && A.y == 1.0f ? 0 : 1;
|
||||
Error += A.x == C.x && A.y == C.y ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_vec2_ctor()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::vec2 A = glm::vec2(2.0f);
|
||||
glm::vec2 B = glm::vec2(2.0f, 3.0f);
|
||||
glm::vec2 C = glm::vec2(2.0f, 3.0);
|
||||
//glm::vec2 D = glm::dvec2(2.0); // Build error TODO: What does the specification says?
|
||||
glm::vec2 E(glm::dvec2(2.0));
|
||||
glm::vec2 F(glm::ivec2(2));
|
||||
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_operators();
|
||||
Error += test_vec2_ctor();
|
||||
Error += test_vec2_operators();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -1,19 +1,91 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2010-09-16
|
||||
// Updated : 2010-09-16
|
||||
// Created : 2011-05-32
|
||||
// Updated : 2011-05-32
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtc/matrix_transform.cpp
|
||||
// File : test/gtc/half_float.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
|
||||
int test_half_precision_scalar()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::half) == 2 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_precision_vec()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::hvec2) == 4 ? 0 : 1;
|
||||
Error += sizeof(glm::hvec3) == 6 ? 0 : 1;
|
||||
Error += sizeof(glm::hvec4) == 8 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_precision_mat()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::hmat2) == 8 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat3) == 18 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat4) == 32 ? 0 : 1;
|
||||
|
||||
Error += sizeof(glm::hmat2x2) == 8 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat2x3) == 12 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat2x4) == 16 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat3x2) == 12 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat3x3) == 18 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat3x4) == 24 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat4x2) == 16 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat4x3) == 24 ? 0 : 1;
|
||||
Error += sizeof(glm::hmat4x4) == 32 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_half_ctor_mat2x2()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::hvec2 A(1, 2);
|
||||
glm::hvec2 B(3, 4);
|
||||
glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f);
|
||||
glm::hmat2 D(1, 2, 3, 4);
|
||||
|
||||
Error += C[0] == D[0] ? 0 : 1;
|
||||
Error += C[1] == D[1] ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::hvec2 A(1, 2.0);
|
||||
glm::hvec2 B(3, 4.0);
|
||||
glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f);
|
||||
glm::hmat2 D(1, 2.0, 3u, 4.0f);
|
||||
|
||||
Error += C[0] == D[0] ? 0 : 1;
|
||||
Error += C[1] == D[1] ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Failed = 0;
|
||||
int Error = 0;
|
||||
|
||||
return Failed;
|
||||
Error += test_half_ctor_mat2x2();
|
||||
Error += test_half_precision_scalar();
|
||||
Error += test_half_precision_vec();
|
||||
Error += test_half_precision_mat();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
// File : test/gtc/matrix_access.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
// File : test/gtc/matrix_integer.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_integer.hpp>
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
// File : test/gtc/matrix_transform.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
|
@ -11,6 +11,16 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/epsilon.hpp>
|
||||
|
||||
int test_quat_precision()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += sizeof(glm::lowp_quat) <= sizeof(glm::mediump_quat) ? 0 : 1;
|
||||
Error += sizeof(glm::mediump_quat) <= sizeof(glm::highp_quat) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_quat_type()
|
||||
{
|
||||
glm::quat A;
|
||||
@ -75,6 +85,7 @@ int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_quat_precision();
|
||||
Error += test_quat_type();
|
||||
Error += test_quat_slerp();
|
||||
Error += test_quat_length();
|
||||
|
@ -7,7 +7,6 @@
|
||||
// File : test/gtc/swizzle.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/swizzle.hpp>
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
// File : test/gtc/type_ptr.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-05-25
|
||||
// Updated : 2011-05-25
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/quaternion.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -11,6 +11,40 @@
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtx/epsilon.hpp>
|
||||
|
||||
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 C = glm::fastMix(A, B, 0.5f);
|
||||
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
|
||||
|
||||
Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
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 C = glm::shortMix(A, B, 0.5f);
|
||||
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
|
||||
|
||||
Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_quat_angleAxis()
|
||||
{
|
||||
int Error = 0;
|
||||
@ -66,6 +100,8 @@ int main()
|
||||
|
||||
Error += test_quat_angle();
|
||||
Error += test_quat_angleAxis();
|
||||
Error += test_quat_fastMix();
|
||||
Error += test_quat_shortMix();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user