From a0256b5946cd5ebfa3c9762bc7f55f8c6a0845f1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 2 Jun 2011 09:58:20 +0100 Subject: [PATCH] Fixed build on Visual C++, completed extended matrix cast #105 --- glm/core/intrinsic_common.inl | 12 +----- glm/core/type_mat2x4.hpp | 8 ++-- glm/core/type_mat2x4.inl | 4 +- glm/core/type_mat3x2.inl | 2 +- glm/core/type_mat4x2.inl | 32 ++++++++------ glm/core/type_mat4x3.inl | 54 ++++++++++++++++++++++- glm/core/type_mat4x4.hpp | 8 ++-- glm/core/type_mat4x4.inl | 81 +++++++++++++++++++++++++++++++++++ 8 files changed, 164 insertions(+), 37 deletions(-) diff --git a/glm/core/intrinsic_common.inl b/glm/core/intrinsic_common.inl index b4cccd35..8080bb35 100644 --- a/glm/core/intrinsic_common.inl +++ b/glm/core/intrinsic_common.inl @@ -205,19 +205,11 @@ GLM_FUNC_QUALIFIER __m128 sse_mod_ps(__m128 x, __m128 y) } /// TODO -<<<<<<< HEAD -/* GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i) { - return __m128(); + __m128 empty; + return empty; } -*/ -======= -//GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i) -//{ -// return __m128(); -//} ->>>>>>> d373c85b676bf28e721f3b30fd3fb0b1ceadd0d2 //GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y) diff --git a/glm/core/type_mat2x4.hpp b/glm/core/type_mat2x4.hpp index 8eee4105..cf21c6f8 100644 --- a/glm/core/type_mat2x4.hpp +++ b/glm/core/type_mat2x4.hpp @@ -77,14 +77,12 @@ namespace glm GLM_FUNC_DECL explicit tmat2x4( U const & x); - template - < + template < typename X1, typename Y1, typename Z1, typename W1, - typename X2, typename Y2, typename Z2, typename W2 - > + typename X2, typename Y2, typename Z2, typename W2> GLM_FUNC_DECL explicit tmat2x4( X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,); + X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2); template GLM_FUNC_DECL explicit tmat2x4( diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index 0a644d99..2c12df43 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -125,12 +125,12 @@ namespace detail template template < - typename X1, typename Y1, typename Z1, typename W1 + typename X1, typename Y1, typename Z1, typename W1, typename X2, typename Y2, typename Z2, typename W2> GLM_FUNC_DECL tmat2x4::tmat2x4 ( X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, + X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2 ) { this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1)); diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index 4138208f..1c45e58a 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -146,7 +146,7 @@ namespace detail } template - template + template GLM_FUNC_DECL tmat3x2::tmat3x2 ( tvec2 const & v1, diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index 60c54df9..4cd8b063 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -133,10 +133,10 @@ namespace detail ) { value_type const Zero(0); - this->value[0] = tvec4(value_type(s), Zero); - this->value[1] = tvec4(Zero, value_type(s)); - this->value[2] = tvec4(Zero, Zero); - this->value[3] = tvec4(Zero, Zero); + this->value[0] = tvec2(value_type(s), Zero); + this->value[1] = tvec2(Zero, value_type(s)); + this->value[2] = tvec2(Zero, Zero); + this->value[3] = tvec2(Zero, Zero); } template @@ -147,28 +147,32 @@ namespace detail typename X4, typename Y4> GLM_FUNC_DECL tmat4x2::tmat4x2 ( - X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, - X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, - X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3 + X1 const & x1, Y1 const & y1, + X2 const & x2, Y2 const & y2, + X3 const & x3, Y3 const & y3, + X4 const & x4, Y4 const & y4 ) { - this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1)); - this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2)); - this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3)); + this->value[0] = col_type(value_type(x1), value_type(y1)); + this->value[1] = col_type(value_type(x2), value_type(y2)); + this->value[2] = col_type(value_type(x3), value_type(y3)); + this->value[3] = col_type(value_type(x4), value_type(y4)); } template - template + template GLM_FUNC_DECL tmat4x2::tmat4x2 ( - tvec4 const & v1, - tvec4 const & v2, - tvec4 const & v3 + tvec2 const & v1, + tvec2 const & v2, + tvec2 const & v3, + tvec2 const & v4 ) { this->value[0] = col_type(v1); this->value[1] = col_type(v2); this->value[2] = col_type(v3); + this->value[3] = col_type(v4); } // Conversion diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index b882af27..87e3dcea 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -123,8 +123,60 @@ namespace detail this->value[3] = v3; } + ////////////////////////////////////// + // Convertion constructors + template + template + GLM_FUNC_DECL tmat4x3::tmat4x3 + ( + U const & s + ) + { + value_type const Zero(0); + this->value[0] = tvec3(value_type(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, + typename X2, typename Y2, typename Z2, + typename X3, typename Y3, typename Z3, + typename X4, typename Y4, typename Z4> + GLM_FUNC_DECL tmat4x3::tmat4x3 + ( + X1 const & x1, Y1 const & y1, Z1 const & z1, + 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(value_type(x1), value_type(y1), value_type(z1)); + this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2)); + this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3)); + this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4)); + } + + template + template + GLM_FUNC_DECL tmat4x3::tmat4x3 + ( + tvec3 const & v1, + tvec3 const & v2, + tvec3 const & v3, + tvec3 const & v4 + ) + { + this->value[0] = col_type(v1); + this->value[1] = col_type(v2); + this->value[2] = col_type(v3); + this->value[3] = col_type(v4); + } + ////////////////////////////////////////////////////////////// - // Conversions + // Matrix conversions template template diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index a470f34a..4ff29db9 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -86,10 +86,10 @@ namespace glm U const & x); template < - typename X1, typename Y1, typename Z1, - typename X2, typename Y2, typename Z2, - typename X3, typename Y3, typename Z3, - typename X4, typename Y4, typename Z4> + typename X1, typename Y1, typename Z1, typename W1, + typename X2, typename Y2, typename Z2, typename W2, + typename X3, typename Y3, typename Z3, typename W3, + typename X4, typename Y4, typename Z4, typename W4> GLM_FUNC_DECL explicit tmat4x4( X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index 8df4b062..765491b7 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -136,6 +136,87 @@ namespace detail this->value[3] = col_type(m[3]); } + ////////////////////////////////////// + // Convertion constructors + template + template + GLM_FUNC_DECL tmat4x4::tmat4x4 + ( + U const & s + ) + { + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types"); + + value_type const Zero(0); + this->value[0] = tvec4(value_type(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, + typename X2, typename Y2, typename Z2, typename W2, + typename X3, typename Y3, typename Z3, typename W3, + typename X4, typename Y4, typename Z4, typename W4> + GLM_FUNC_DECL tmat4x4::tmat4x4 + ( + X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, + X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, + X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3, + X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid."); + + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid."); + + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid."); + + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid."); + + this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1)); + this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2)); + this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3)); + this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4), value_type(w4)); + } + + template + template + GLM_FUNC_DECL tmat4x4::tmat4x4 + ( + tvec4 const & v1, + tvec4 const & v2, + tvec4 const & v3, + tvec4 const & v4 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid."); + GLM_STATIC_ASSERT(detail::type::is_float || std::numeric_limits::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid."); + + this->value[0] = col_type(v1); + this->value[1] = col_type(v2); + this->value[2] = col_type(v3); + this->value[3] = col_type(v4); + } + + ////////////////////////////////////// + // Matrix convertion constructors template GLM_FUNC_QUALIFIER tmat4x4::tmat4x4 (