From e5f8ebbfd70cc500fca10596e43e06801b805e3d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 Dec 2013 20:38:28 +0100 Subject: [PATCH 1/7] Tests to reproduce bug #135, could not reproduce it --- test/gtx/gtx_spline.cpp | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/test/gtx/gtx_spline.cpp b/test/gtx/gtx_spline.cpp index 0f410b9a..79b5698f 100644 --- a/test/gtx/gtx_spline.cpp +++ b/test/gtx/gtx_spline.cpp @@ -11,9 +11,97 @@ #include #include +namespace catmullRom +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::catmullRom( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::catmullRom( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result4 = glm::catmullRom( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + +namespace hermite +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::hermite( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::hermite( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result4 = glm::hermite( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + +namespace cubic +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::cubic( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::cubic( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result = glm::cubic( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + int main() { int Error(0); + Error += catmullRom::test(); + Error += hermite::test(); + Error += cubic::test(); + return Error; } From d252dd243b8e1553737d917e0b0cd0c69a677ebb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 Dec 2013 00:49:53 +0100 Subject: [PATCH 2/7] Added possible static_cast conversion of GLM types (#72) --- glm/detail/type_mat2x2.hpp | 6 +----- glm/detail/type_mat2x2.inl | 12 ------------ glm/detail/type_mat2x3.hpp | 4 ---- glm/detail/type_mat2x3.inl | 16 ++-------------- glm/detail/type_mat2x4.hpp | 4 ---- glm/detail/type_mat2x4.inl | 16 ++-------------- glm/detail/type_mat3x2.hpp | 4 ---- glm/detail/type_mat3x2.inl | 19 +++---------------- glm/detail/type_mat3x3.hpp | 4 ---- glm/detail/type_mat3x3.inl | 13 ------------- glm/detail/type_mat3x4.hpp | 4 ---- glm/detail/type_mat3x4.inl | 13 ------------- glm/detail/type_mat4x2.hpp | 9 +++------ glm/detail/type_mat4x2.inl | 19 +++---------------- glm/detail/type_mat4x3.hpp | 3 --- glm/detail/type_mat4x3.inl | 17 ++--------------- glm/detail/type_mat4x4.hpp | 5 +---- glm/detail/type_mat4x4.inl | 16 ---------------- glm/detail/type_vec2.hpp | 4 ---- glm/detail/type_vec2.inl | 10 ---------- glm/detail/type_vec3.hpp | 6 +----- glm/detail/type_vec3.inl | 11 ----------- glm/detail/type_vec4.hpp | 4 ---- glm/detail/type_vec4.inl | 12 ------------ readme.txt | 3 ++- test/core/core_type_cast.cpp | 5 +++-- test/gtc/gtc_matrix_transform.cpp | 8 +++++++- 27 files changed, 30 insertions(+), 217 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 35d6a408..91351880 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -92,15 +92,11 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat2x2( - U const & x); - template GLM_FUNC_DECL explicit tmat2x2( U const & x1, V const & y1, M const & x2, N const & y2); - + template GLM_FUNC_DECL explicit tmat2x2( tvec2 const & v1, diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 6046d451..e3e77a7a 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -154,18 +154,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec2(static_cast(s), Zero); - this->value[1] = tvec2(Zero, value_type(s)); - } - template template GLM_FUNC_QUALIFIER tmat2x2::tmat2x2 diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 21cc8d01..1299bd22 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -82,10 +82,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat2x3( - U const & x); - template GLM_FUNC_DECL explicit tmat2x3( X1 const & x1, Y1 const & y1, Z1 const & z1, diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 13becfc9..b269908d 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -153,18 +153,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat2x3::tmat2x3 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec3(static_cast(s), Zero, Zero); - this->value[1] = tvec3(Zero, value_type(s), Zero); - } - template template < typename X1, typename Y1, typename Z1, @@ -173,7 +161,7 @@ namespace detail ( X1 const & x1, Y1 const & y1, Z1 const & z1, X2 const & x2, Y2 const & y2, Z2 const & z2 - ) + ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1)); this->value[1] = col_type(static_cast(x2), value_type(y2), value_type(z2)); @@ -185,7 +173,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) { this->value[0] = col_type(v1); this->value[1] = col_type(v2); diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 09b43f02..9d0165f6 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -82,10 +82,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat2x4( - U const & x); - template < typename X1, typename Y1, typename Z1, typename W1, typename X2, typename Y2, typename Z2, typename W2> diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 93b2cc8d..881db381 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -156,18 +156,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat2x4::tmat2x4 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec4(static_cast(s), Zero, Zero, Zero); - this->value[1] = tvec4(Zero, value_type(s), Zero, Zero); - } - template template < typename X1, typename Y1, typename Z1, typename W1, @@ -176,7 +164,7 @@ namespace detail ( X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2 - ) + ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1), value_type(w1)); this->value[1] = col_type(static_cast(x2), value_type(y2), value_type(z2), value_type(w2)); @@ -188,7 +176,7 @@ namespace detail ( tvec4 const & v1, tvec4 const & v2 - ) + ) { this->value[0] = col_type(v1); this->value[1] = col_type(v2); diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 717c6092..76d2f425 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -84,10 +84,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat3x2( - U const & x); - template< typename X1, typename Y1, typename X2, typename Y2, diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 7f96cb4d..3b7d9a4a 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -163,19 +163,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat3x2::tmat3x2 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec2(static_cast(s), Zero); - this->value[1] = tvec2(Zero, value_type(s)); - this->value[2] = tvec2(Zero); - } - template template < typename X1, typename Y1, @@ -186,13 +173,13 @@ namespace detail X1 const & x1, Y1 const & y1, X2 const & x2, Y2 const & y2, X3 const & x3, Y3 const & y3 - ) + ) { this->value[0] = col_type(static_cast(x1), value_type(y1)); this->value[1] = col_type(static_cast(x2), value_type(y2)); this->value[2] = col_type(static_cast(x3), value_type(y3)); } - + template template GLM_FUNC_QUALIFIER tmat3x2::tmat3x2 @@ -200,7 +187,7 @@ namespace detail tvec2 const & v1, tvec2 const & v2, tvec2 const & v3 - ) + ) { this->value[0] = col_type(v1); this->value[1] = col_type(v2); diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 2d2c8243..07112d7c 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -93,10 +93,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat3x3( - U const & x); - template< typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2, diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index f017ff9e..9dff121b 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -166,19 +166,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec3(static_cast(s), Zero, Zero); - this->value[1] = tvec3(Zero, value_type(s), Zero); - this->value[2] = tvec3(Zero, Zero, value_type(s)); - } - template template < typename X1, typename Y1, typename Z1, diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 611b0d3a..b368b274 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -84,10 +84,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat3x4( - U const & x); - template< typename X1, typename Y1, typename Z1, typename W1, typename X2, typename Y2, typename Z2, typename W2, diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 5c39bd84..390a1b84 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -139,19 +139,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat3x4::tmat3x4 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec4(static_cast(s), Zero, Zero, Zero); - this->value[1] = tvec4(Zero, value_type(s), Zero, Zero); - this->value[2] = tvec4(Zero, Zero, value_type(s), Zero); - } - template template < typename X1, typename Y1, typename Z1, typename W1, diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index caecb2c4..2268c179 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -86,10 +86,7 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat4x2( - U const & x); - + template< typename X1, typename Y1, typename X2, typename Y2, @@ -100,7 +97,7 @@ namespace detail X2 const & x2, Y2 const & y2, X3 const & x3, Y3 const & y3, X4 const & x4, Y4 const & y4); - + template GLM_FUNC_DECL explicit tmat4x2( tvec2 const & v1, @@ -111,7 +108,7 @@ namespace detail // Matrix conversions template GLM_FUNC_DECL explicit tmat4x2(tmat4x2 const & m); - + GLM_FUNC_DECL explicit tmat4x2(tmat2x2 const & x); GLM_FUNC_DECL explicit tmat4x2(tmat3x3 const & x); GLM_FUNC_DECL explicit tmat4x2(tmat4x4 const & x); diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 89396ced..211c380d 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -144,20 +144,7 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat4x2::tmat4x2 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec2(static_cast(s), Zero); - this->value[1] = tvec2(Zero, value_type(s)); - this->value[2] = tvec2(Zero, Zero); - this->value[3] = tvec2(Zero, Zero); - } - + template template < typename X1, typename Y1, @@ -170,7 +157,7 @@ namespace detail X2 const & x2, Y2 const & y2, X3 const & x3, Y3 const & y3, X4 const & x4, Y4 const & y4 - ) + ) { this->value[0] = col_type(static_cast(x1), value_type(y1)); this->value[1] = col_type(static_cast(x2), value_type(y2)); @@ -186,7 +173,7 @@ namespace detail tvec2 const & v2, tvec2 const & v3, tvec2 const & v4 - ) + ) { this->value[0] = col_type(v1); this->value[1] = col_type(v2); diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index b5151daf..041a9834 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -86,9 +86,6 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat4x3( - U const & x); template < typename X1, typename Y1, typename Z1, diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index 69a10570..389219a7 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -169,20 +169,7 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat4x3::tmat4x3 - ( - U const & s - ) - { - value_type const Zero(0); - this->value[0] = tvec3(static_cast(s), Zero, Zero); - this->value[1] = tvec3(Zero, value_type(s), Zero); - this->value[2] = tvec3(Zero, Zero, value_type(s)); - this->value[3] = tvec3(Zero, Zero, Zero); - } - + template template < typename X1, typename Y1, typename Z1, @@ -195,7 +182,7 @@ namespace detail X2 const & x2, Y2 const & y2, Z2 const & z2, X3 const & x3, Y3 const & y3, Z3 const & z3, X4 const & x4, Y4 const & y4, Z4 const & z4 - ) + ) { this->value[0] = col_type(static_cast(x1), value_type(y1), value_type(z1)); this->value[1] = col_type(static_cast(x2), value_type(y2), value_type(z2)); diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index f91ef083..9082f65c 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -99,10 +99,7 @@ namespace detail ////////////////////////////////////// // Conversions - template - GLM_FUNC_DECL explicit tmat4x4( - U const & x); - + template < typename X1, typename Y1, typename Z1, typename W1, typename X2, typename Y2, typename Z2, typename W2, diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index a52da05b..01f55d52 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -191,22 +191,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - template - template - GLM_FUNC_QUALIFIER tmat4x4::tmat4x4 - ( - U const & s - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types"); - - value_type const Zero(0); - this->value[0] = tvec4(static_cast(s), Zero, Zero, Zero); - this->value[1] = tvec4(Zero, value_type(s), Zero, Zero); - this->value[2] = tvec4(Zero, Zero, value_type(s), Zero); - this->value[3] = tvec4(Zero, Zero, Zero, value_type(s)); - } - template template < typename X1, typename Y1, typename Z1, typename W1, diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index c093d649..e9a3970c 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -137,10 +137,6 @@ namespace detail ////////////////////////////////////// // Conversion constructors - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2( - U const & x); //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL explicit tvec2( diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 420f60d1..57855e85 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -110,16 +110,6 @@ namespace detail ////////////////////////////////////// // Conversion scalar constructors - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & x - ) : - x(static_cast(x)), - y(static_cast(x)) - {} template template diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index d73e7639..3985d6e4 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -128,16 +128,12 @@ namespace detail ////////////////////////////////////// // Conversion scalar constructors - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3( - U const & x); //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL explicit tvec3( U const & x, V const & y, - W const & z); + W const & z); ////////////////////////////////////// // Conversion vector constructors diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 60b3ba6d..e039a69d 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -117,17 +117,6 @@ namespace detail ////////////////////////////////////// // Conversion scalar constructors - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - U const & s - ) : - x(static_cast(s)), - y(static_cast(s)), - z(static_cast(s)) - {} template template diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 39192c3a..91768c7d 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -131,10 +131,6 @@ namespace detail ////////////////////////////////////// // Conversion scalar constructors - /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4( - U const & x); /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL explicit tvec4( diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index d6688a2e..f7e688de 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -125,18 +125,6 @@ namespace detail ////////////////////////////////////// // Conversion scalar constructors - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - U const & x - ) : - x(static_cast(x)), - y(static_cast(x)), - z(static_cast(x)), - w(static_cast(x)) - {} - template template GLM_FUNC_QUALIFIER tvec4::tvec4 diff --git a/readme.txt b/readme.txt index 90588369..7dda35f3 100644 --- a/readme.txt +++ b/readme.txt @@ -40,7 +40,8 @@ http://glm.g-truc.net/glm.pdf GLM 0.9.5.1: 2014-XX-XX -------------------------------------------------------------------------------- - Fixed angle and orientedAngle that sometimes return NaN values (#145) -- Deprecated degrees for function parameters and display a message. +- Deprecated degrees for function parameters and display a message +- Added possible static_cast conversion of GLM types (#72) ================================================================================ GLM 0.9.5.0: 2013-12-25 diff --git a/test/core/core_type_cast.cpp b/test/core/core_type_cast.cpp index cc5c600c..a58d3c98 100644 --- a/test/core/core_type_cast.cpp +++ b/test/core/core_type_cast.cpp @@ -27,8 +27,9 @@ int test_vec2_cast() glm::mediump_vec2 G = static_cast(A); glm::highp_vec2 H = static_cast(A); - //my_vec2 I; - //glm::vec2 J = static_cast(I); + my_vec2 I; + glm::vec2 J = static_cast(I); + glm::vec2 K(7.8); int Error(0); diff --git a/test/gtc/gtc_matrix_transform.cpp b/test/gtc/gtc_matrix_transform.cpp index 4ecad93e..21a5958f 100644 --- a/test/gtc/gtc_matrix_transform.cpp +++ b/test/gtc/gtc_matrix_transform.cpp @@ -7,15 +7,21 @@ // File : test/gtc/matrix_transform.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// +#define GLM_FORCE_RADIANS #include #include +#include int main() { int Error = 0; - glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); + glm::mat4 Projection = glm::perspective(glm::pi() * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240)); + glm::lowp_vec3 v(1.0); + glm::lowp_mat4 m(0); + glm::lowp_mat4 t = glm::translate(m, v); + return Error; } From 40c772341ac87110e41447379bbd2bf3db6eddcc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 Dec 2013 01:30:19 +0100 Subject: [PATCH 3/7] Fixed white space --- test/gtc/gtc_ulp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/gtc/gtc_ulp.cpp b/test/gtc/gtc_ulp.cpp index e6eb6d1d..acc1a0d8 100644 --- a/test/gtc/gtc_ulp.cpp +++ b/test/gtc/gtc_ulp.cpp @@ -18,7 +18,7 @@ int test_ulp_float_dist() float A = 1.0f; - float B = glm::next_float(A); + float B = glm::next_float(A); Error += A != B ? 0 : 1; float C = glm::prev_float(B); Error += A == C ? 0 : 1; @@ -59,7 +59,7 @@ int test_ulp_double_dist() double A = 1.0; - double B = glm::next_float(A); + double B = glm::next_float(A); Error += A != B ? 0 : 1; double C = glm::prev_float(B); Error += A == C ? 0 : 1; From 78d487b48280e2833bd3758f8e3f5e938b55a8ad Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 Dec 2013 02:20:53 +0100 Subject: [PATCH 4/7] Added ULP comparison between lowp and highp for inversesqrt --- glm/detail/func_common.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glm/detail/func_common.hpp b/glm/detail/func_common.hpp index 9ba6e74a..9e75aa58 100644 --- a/glm/detail/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -37,6 +37,8 @@ #define GLM_FUNC_COMMON_INCLUDED #include "setup.hpp" +#include "precision.hpp" +#include "type_int.hpp" #include "_fixes.hpp" namespace glm From 775c6136fcbff815cd45b6faaa2043651bf5ecef Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 27 Dec 2013 19:23:44 +0100 Subject: [PATCH 5/7] Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146) --- glm/gtc/matrix_transform.inl | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index bd64eae7..38745e44 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -28,6 +28,7 @@ #include "../geometric.hpp" #include "../trigonometric.hpp" +#include "../matrix.hpp" namespace glm { diff --git a/readme.txt b/readme.txt index 7dda35f3..3a27b905 100644 --- a/readme.txt +++ b/readme.txt @@ -42,6 +42,7 @@ GLM 0.9.5.1: 2014-XX-XX - Fixed angle and orientedAngle that sometimes return NaN values (#145) - Deprecated degrees for function parameters and display a message - Added possible static_cast conversion of GLM types (#72) +- Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146) ================================================================================ GLM 0.9.5.0: 2013-12-25 From 71035db795cc1f3953834948e7ad1fa858e95cf1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 28 Dec 2013 03:45:18 +0100 Subject: [PATCH 6/7] Added ULP comparison between lowp and highp for inversesqrt --- test/core/core_func_exponential.cpp | 30 +++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/test/core/core_func_exponential.cpp b/test/core/core_func_exponential.cpp index df83f67e..174e164f 100644 --- a/test/core/core_func_exponential.cpp +++ b/test/core/core_func_exponential.cpp @@ -7,12 +7,38 @@ // File : test/core/func_exponential.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// +#include #include +#include + +namespace inversesqrt +{ + int test() + { + int Error(0); + + glm::uint ulp(0); + float diff(0.0f); + + for(float f = 0.001f; f < 10.f; f *= 1.001f) + { + glm::lowp_fvec1 lowp_v = glm::inversesqrt(glm::lowp_fvec1(f)); + float defaultp_v = glm::inversesqrt(f); + + ulp = glm::max(glm::float_distance(lowp_v.x, defaultp_v), ulp); + diff = glm::abs(lowp_v.x - defaultp_v); + } + + return Error; + } +}//namespace inversesqrt int main() { - int Failed = 0; + int Error(0); - return Failed; + Error += inversesqrt::test(); + + return Error; } From 9b5731568148b7ddfd5b15ce4ae0769f82fb9853 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 28 Dec 2013 19:14:11 +0100 Subject: [PATCH 7/7] Fixed mismatch of GTC_packing declaration and definition prototypes --- glm/gtc/packing.hpp | 16 ++++++++-------- glm/gtc/packing.inl | 2 +- readme.txt | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index 01e4e3e5..51a4cfc0 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -74,7 +74,7 @@ namespace glm /// @see vec4 unpackUnorm4x8(uint32 p) /// @see GLSL unpackUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackUnorm1x8(uint8 pdf); + GLM_FUNC_DECL float unpackUnorm1x8(uint8 const & p); /// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -106,7 +106,7 @@ namespace glm /// @see vec4 unpackUnorm4x8(uint32 p) /// @see GLSL unpackUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p); + GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 const & p); /// First, converts the normalized floating-point value v into 8-bit integer value. /// Then, the results are packed into the returned 8-bit unsigned integer. @@ -132,7 +132,7 @@ namespace glm /// @see vec4 unpackSnorm4x8(uint32 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackSnorm1x8(uint8 p); + GLM_FUNC_DECL float unpackSnorm1x8(uint8 const & p); /// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -164,7 +164,7 @@ namespace glm /// @see vec4 unpackSnorm4x8(uint32 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p); + GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 const & p); /// First, converts the normalized floating-point value v into a 16-bit integer value. /// Then, the results are packed into the returned 16-bit unsigned integer. @@ -177,7 +177,7 @@ namespace glm /// @see uint64 packSnorm4x16(vec4 const & v) /// @see GLSL packUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packUnorm1x16(float v); + GLM_FUNC_DECL uint16 packUnorm1x16(float const & v); /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar. @@ -190,7 +190,7 @@ namespace glm /// @see vec4 unpackUnorm4x16(uint64 p) /// @see GLSL unpackUnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackUnorm1x16(uint16 p); + GLM_FUNC_DECL float unpackUnorm1x16(uint16 const & p); /// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// Then, the results are packed into the returned 64-bit unsigned integer. @@ -235,7 +235,7 @@ namespace glm /// @see uint64 packSnorm4x16(vec4 const & v) /// @see GLSL packSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packSnorm1x16(float v); + GLM_FUNC_DECL uint16 packSnorm1x16(float const & v); /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers. /// Then, each component is converted to a normalized floating-point value to generate the returned scalar. @@ -248,7 +248,7 @@ namespace glm /// @see vec4 unpackSnorm4x16(uint64 p) /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackSnorm1x16(uint16 p); + GLM_FUNC_DECL float unpackSnorm1x16(uint16 const & p); /// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// Then, the results are packed into the returned 64-bit unsigned integer. diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 9c98d3d0..8bedca6e 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -225,7 +225,7 @@ namespace detail GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p) { float Unpack(static_cast(p)); - return Unpack * float(0.0039215686274509803921568627451); // 1 / 255 + return Unpack * static_cast(0.0039215686274509803921568627451); // 1 / 255 } GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v) diff --git a/readme.txt b/readme.txt index 3a27b905..67be8123 100644 --- a/readme.txt +++ b/readme.txt @@ -43,6 +43,7 @@ GLM 0.9.5.1: 2014-XX-XX - Deprecated degrees for function parameters and display a message - Added possible static_cast conversion of GLM types (#72) - Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146) +- Fixed mismatch of GTC_packing declaration and definition prototypes ================================================================================ GLM 0.9.5.0: 2013-12-25