From d17e389b3a1c096548a7386dd56a5a454046e964 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 16:07:22 +0100 Subject: [PATCH 1/7] Updated message and precision tests --- test/core/CMakeLists.txt | 2 ++ test/core/core_setup_message.cpp | 30 +++++++++++++++++ test/core/core_setup_precision.cpp | 53 ++++++++++++++++++++++++++++++ test/core/core_type_mat4x4.cpp | 1 - test/gtc/gtc_half_float.cpp | 1 - test/gtc/gtc_matrix_access.cpp | 1 - test/gtc/gtc_matrix_integer.cpp | 1 - test/gtc/gtc_matrix_transform.cpp | 1 - test/gtc/gtc_swizzle.cpp | 1 - test/gtc/gtc_type_ptr.cpp | 1 - 10 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 test/core/core_setup_message.cpp create mode 100644 test/core/core_setup_precision.cpp diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index d851ac7d..989d48ef 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -23,6 +23,8 @@ glmCreateTestGTC(core_func_noise) glmCreateTestGTC(core_func_packing) glmCreateTestGTC(core_func_trigonometric) glmCreateTestGTC(core_func_vector_relational) +glmCreateTestGTC(core_setup_message) +glmCreateTestGTC(core_setup_precision) diff --git a/test/core/core_setup_message.cpp b/test/core/core_setup_message.cpp new file mode 100644 index 00000000..8b02243b --- /dev/null +++ b/test/core/core_setup_message.cpp @@ -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 + +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; +} diff --git a/test/core/core_setup_precision.cpp b/test/core/core_setup_precision.cpp new file mode 100644 index 00000000..05decb5f --- /dev/null +++ b/test/core/core_setup_precision.cpp @@ -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 + +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; +} diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 7028d280..577aac24 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -7,7 +7,6 @@ // File : test/core/type_mat4x4.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #define GLM_PRECISION_HIGHP_FLOAT #include #include diff --git a/test/gtc/gtc_half_float.cpp b/test/gtc/gtc_half_float.cpp index 0b9bc908..38b69d03 100644 --- a/test/gtc/gtc_half_float.cpp +++ b/test/gtc/gtc_half_float.cpp @@ -7,7 +7,6 @@ // File : test/gtc/matrix_transform.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include diff --git a/test/gtc/gtc_matrix_access.cpp b/test/gtc/gtc_matrix_access.cpp index 02b90105..b853b506 100644 --- a/test/gtc/gtc_matrix_access.cpp +++ b/test/gtc/gtc_matrix_access.cpp @@ -7,7 +7,6 @@ // File : test/gtc/matrix_access.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include diff --git a/test/gtc/gtc_matrix_integer.cpp b/test/gtc/gtc_matrix_integer.cpp index 48686de0..2e8aa78a 100644 --- a/test/gtc/gtc_matrix_integer.cpp +++ b/test/gtc/gtc_matrix_integer.cpp @@ -7,7 +7,6 @@ // File : test/gtc/matrix_integer.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include diff --git a/test/gtc/gtc_matrix_transform.cpp b/test/gtc/gtc_matrix_transform.cpp index 1ca84115..43ae2bae 100644 --- a/test/gtc/gtc_matrix_transform.cpp +++ b/test/gtc/gtc_matrix_transform.cpp @@ -7,7 +7,6 @@ // File : test/gtc/matrix_transform.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include diff --git a/test/gtc/gtc_swizzle.cpp b/test/gtc/gtc_swizzle.cpp index 70f266a5..5ed77ae1 100644 --- a/test/gtc/gtc_swizzle.cpp +++ b/test/gtc/gtc_swizzle.cpp @@ -7,7 +7,6 @@ // File : test/gtc/swizzle.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include diff --git a/test/gtc/gtc_type_ptr.cpp b/test/gtc/gtc_type_ptr.cpp index 043e0db8..f746a1b7 100644 --- a/test/gtc/gtc_type_ptr.cpp +++ b/test/gtc/gtc_type_ptr.cpp @@ -7,7 +7,6 @@ // File : test/gtc/type_ptr.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#define GLM_MESSAGES #include #include From ffb940cbdf597bab1057b8fab9291f1f3314eca1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 16:15:21 +0100 Subject: [PATCH 2/7] Fixed missing precision matrix types --- glm/core/type_mat2x2.hpp | 30 +++++++++++++++++++++++++----- glm/core/type_mat3x3.hpp | 28 +++++++++++++++++++++++----- glm/core/type_mat4x4.hpp | 30 +++++++++++++++++++++++++----- 3 files changed, 73 insertions(+), 15 deletions(-) diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index aade1ef4..8d6a3918 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -224,17 +224,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_mat2x2; + typedef detail::tmat2x2 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_mat2x2; + typedef detail::tmat2x2 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_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_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_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_mat2x2; } diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp index bf18c167..3f4725dc 100644 --- a/glm/core/type_mat3x3.hpp +++ b/glm/core/type_mat3x3.hpp @@ -223,17 +223,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_mat3x3; + typedef detail::tmat3x3 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_mat3x3; + typedef detail::tmat3x3 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_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_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_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_mat3x3; } diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index 6aa1f68a..e992ddaf 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -223,17 +223,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_mat4x4; + typedef detail::tmat4x4 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_mat4x4; + typedef detail::tmat4x4 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_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_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_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_mat4x4; } From b3c293f8b4fde0c92b3552f4033ee66f66a67aac Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 16:18:14 +0100 Subject: [PATCH 3/7] Fixed missing precision quaternion types --- glm/gtc/quaternion.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 949f08f7..9aea66f4 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -221,6 +221,17 @@ namespace quaternion ///< GLM_GTC_quaternion extension: Quaternion types and fun //! From GLM_GTC_quaternion extension. typedef detail::tquat dquat; + //! Quaternion of low precision floating-point numbers. + //! From GLM_GTC_quaternion extension. + typedef detail::tquat lowp_quat; + + //! Quaternion of medium precision floating-point numbers. + //! From GLM_GTC_quaternion extension. + typedef detail::tquat mediump_quat; + + //! Quaternion of high precision floating-point numbers. + //! From GLM_GTC_quaternion extension. + typedef detail::tquat highp_quat; ///@} } //namespace quaternion From 6ff27ec9f9cf38da7550a889783c8a3f67d9283a Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 16:45:41 +0100 Subject: [PATCH 4/7] Added half type tests --- test/gtc/gtc_half_float.cpp | 57 +++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/test/gtc/gtc_half_float.cpp b/test/gtc/gtc_half_float.cpp index 38b69d03..adfe1efa 100644 --- a/test/gtc/gtc_half_float.cpp +++ b/test/gtc/gtc_half_float.cpp @@ -1,18 +1,63 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// // 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 /////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include +#include + +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 main() { - int Failed = 0; + int Error = 0; - return Failed; + Error += test_half_precision_scalar(); + Error += test_half_precision_vec(); + Error += test_half_precision_mat(); + + return Error; } From 9fbf421f13b5f22d4cc025f2a0c60e604b2750bc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 16:46:13 +0100 Subject: [PATCH 5/7] Added quaternion test --- test/gtc/gtc_quaternion.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 7bd07c07..a84b03be 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -11,6 +11,16 @@ #include #include +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(); From 6fab8113d78063cc2f6144239434d7f68e057614 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 17:25:16 +0100 Subject: [PATCH 6/7] Fixed contructor of mat2 and added tests --- glm/core/type_mat2x2.hpp | 19 +++++++++++++++++ glm/core/type_mat2x2.inl | 42 +++++++++++++++++++++++++++++++++++-- glm/core/type_vec2.hpp | 2 +- test/gtc/gtc_half_float.cpp | 28 +++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index 8d6a3918..7f0df2c7 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -56,10 +56,12 @@ namespace glm GLM_FUNC_DECL tmat2x2 _inverse() const; private: + ////////////////////////////////////// // Data col_type value[2]; public: + ////////////////////////////////////// // Constructors GLM_FUNC_DECL tmat2x2(); GLM_FUNC_DECL tmat2x2( @@ -76,6 +78,23 @@ namespace glm col_type const & v1, col_type const & v2); + ////////////////////////////////////// + // Convertion constructors + 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, + // tvec2 const & v2); + + ////////////////////////////////////// // Conversions template GLM_FUNC_DECL explicit tmat2x2(tmat2x2 const & m); diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index 7a53a969..11a3f11c 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -107,8 +107,46 @@ namespace detail this->value[1] = v1; } + ////////////////////////////////////// + // Convertion constructors + template + template + GLM_FUNC_DECL tmat2x2::tmat2x2 + ( + U const & s + ) + { + value_type const Zero(0); + this->value[0] = tvec2(value_type(s), Zero); + this->value[1] = tvec2(Zero, value_type(s)); + } + + template + template + GLM_FUNC_DECL tmat2x2::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 + //template + //GLM_FUNC_DECL tmat2x2::tmat2x2 + //( + // tvec2 const & v1, + // tvec2 const & v2 + //) + //{ + // this->value[0] = col_type(v1); + // this->value[1] = col_type(v2); + //} + ////////////////////////////////////////////////////////////// - // mat2 conversions + // mat2x2 conversions template template @@ -215,7 +253,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 diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 29d641ce..afaf8f8d 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -93,7 +93,7 @@ namespace glm tvec2(tref2 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 diff --git a/test/gtc/gtc_half_float.cpp b/test/gtc/gtc_half_float.cpp index adfe1efa..92b968b0 100644 --- a/test/gtc/gtc_half_float.cpp +++ b/test/gtc/gtc_half_float.cpp @@ -51,10 +51,38 @@ int test_half_precision_mat() 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 Error = 0; + Error += test_half_ctor_mat2x2(); Error += test_half_precision_scalar(); Error += test_half_precision_vec(); Error += test_half_precision_mat(); From 69c6bdd7a8d19a2b0bb716ea850acac1e46378cb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 31 May 2011 17:41:21 +0100 Subject: [PATCH 7/7] Fixed warnings on Visual C++ --- CMakeLists.txt | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85ae87a4..4115667c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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(".")