From 0ff1026dbb85b7a070632db2df8e734cbfc9a23d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 8 Sep 2013 02:30:16 +0200 Subject: [PATCH] Removed value_type and size_type --- glm/core/func_common.inl | 35 +++------ glm/core/func_geometric.inl | 44 ++++++------ glm/core/func_packing.inl | 2 +- glm/core/func_vector_relational.inl | 18 ++--- glm/core/type_mat2x2.hpp | 16 ++--- glm/core/type_mat2x2.inl | 16 ++--- glm/core/type_mat2x3.hpp | 12 ++-- glm/core/type_mat2x3.inl | 12 ++-- glm/core/type_mat2x4.hpp | 12 ++-- glm/core/type_mat2x4.inl | 12 ++-- glm/core/type_mat3x2.hpp | 12 ++-- glm/core/type_mat3x2.inl | 12 ++-- glm/core/type_mat3x3.hpp | 16 ++--- glm/core/type_mat3x3.inl | 16 ++--- glm/core/type_mat3x4.hpp | 12 ++-- glm/core/type_mat3x4.inl | 12 ++-- glm/core/type_mat4x2.hpp | 12 ++-- glm/core/type_mat4x2.inl | 12 ++-- glm/core/type_mat4x3.hpp | 12 ++-- glm/core/type_mat4x3.inl | 12 ++-- glm/core/type_mat4x4.hpp | 16 ++--- glm/core/type_mat4x4.inl | 16 ++--- glm/core/type_vec1.hpp | 12 ++-- glm/core/type_vec1.inl | 14 ++-- glm/core/type_vec2.hpp | 22 +++--- glm/core/type_vec2.inl | 10 +-- glm/core/type_vec3.hpp | 20 +++--- glm/core/type_vec3.inl | 11 ++- glm/core/type_vec4.hpp | 62 ++++++++-------- glm/core/type_vec4.inl | 102 ++++++++------------------- glm/gtc/matrix_access.inl | 20 +++--- glm/gtc/quaternion.hpp | 12 ++-- glm/gtc/quaternion.inl | 76 ++++++++++---------- glm/gtx/component_wise.inl | 32 ++++----- glm/gtx/dual_quaternion.hpp | 14 ++-- glm/gtx/dual_quaternion.inl | 12 ++-- glm/gtx/matrix_query.inl | 40 +++++------ glm/gtx/quaternion.inl | 4 +- glm/gtx/rotate_normalized_axis.inl | 6 +- glm/gtx/vector_angle.inl | 30 ++++++-- glm/gtx/vector_query.inl | 34 ++++----- test/external/gli/core/operation.inl | 2 +- 42 files changed, 412 insertions(+), 462 deletions(-) diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index bd9ed682..ba152c3f 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -346,8 +346,8 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec3 clamp ( detail::tvec3 const & x, - typename detail::tvec3::T const & minVal, - typename detail::tvec3::T const & maxVal + T const & minVal, + T const & maxVal ) { return detail::tvec3( @@ -360,8 +360,8 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec4 clamp ( detail::tvec4 const & x, - typename detail::tvec4::T const & minVal, - typename detail::tvec4::T const & maxVal + T const & minVal, + T const & maxVal ) { return detail::tvec4( @@ -585,14 +585,9 @@ namespace detail GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); detail::tvec2 result; - for - ( - typename detail::tvec2::size_type i = 0; - i < x.length(); ++i - ) - { + for(int i = 0; i < x.length(); ++i) result[i] = a[i] ? y[i] : x[i]; - } + return result; } @@ -607,14 +602,9 @@ namespace detail GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); detail::tvec3 result; - for - ( - typename detail::tvec3::size_type i = 0; - i < x.length(); ++i - ) - { + for(int i = 0; i < x.length(); ++i) result[i] = a[i] ? y[i] : x[i]; - } + return result; } @@ -629,14 +619,9 @@ namespace detail GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); detail::tvec4 result; - for - ( - typename detail::tvec4::size_type i = 0; - i < x.length(); ++i - ) - { + for(int i = 0; i < x.length(); ++i) result[i] = a[i] ? y[i] : x[i]; - } + return result; } diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index 1f8e0f7c..b0d50d9e 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -46,7 +46,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; + T sqr = v.x * v.x + v.y * v.y; return sqrt(sqr); } @@ -55,7 +55,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; + T sqr = v.x * v.x + v.y * v.y + v.z * v.z; return sqrt(sqr); } @@ -64,7 +64,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec4::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; + T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; return sqrt(sqr); } @@ -82,7 +82,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER typename detail::tvec2::value_type distance + GLM_FUNC_QUALIFIER T distance ( detail::tvec2 const & p0, detail::tvec2 const & p1 @@ -94,7 +94,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER typename detail::tvec3::value_type distance + GLM_FUNC_QUALIFIER T distance ( detail::tvec3 const & p0, detail::tvec3 const & p1 @@ -106,7 +106,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER typename detail::tvec4::value_type distance + GLM_FUNC_QUALIFIER T distance ( detail::tvec4 const & p0, detail::tvec4 const & p1 @@ -131,7 +131,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER typename detail::tvec2::value_type dot + GLM_FUNC_QUALIFIER T dot ( detail::tvec2 const & x, detail::tvec2 const & y @@ -219,7 +219,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - typename detail::tvec2::value_type sqr = x.x * x.x + x.y * x.y; + T sqr = x.x * x.x + x.y * x.y; return x * inversesqrt(sqr); } @@ -231,7 +231,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - typename detail::tvec3::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; + T sqr = x.x * x.x + x.y * x.y + x.z * x.z; return x * inversesqrt(sqr); } @@ -243,7 +243,7 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - typename detail::tvec4::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; return x * inversesqrt(sqr); } @@ -279,8 +279,7 @@ namespace glm genType const & eta ) { - //It could be a vector - //GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float, "'refract' only accept floating-point inputs"); genType dotValue = dot(N, I); genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue); @@ -290,21 +289,20 @@ namespace glm return eta * I - (eta * dotValue + sqrt(k)) * N; } - template - GLM_FUNC_QUALIFIER genType refract + template class vecType> + GLM_FUNC_QUALIFIER vecType refract ( - genType const & I, - genType const & N, - typename genType::T const & eta + vecType const & I, + vecType const & N, + T const & eta ) { - //It could be a vector - //GLM_STATIC_ASSERT(detail::type::is_float); + GLM_STATIC_ASSERT(detail::type::is_float, "'refract' only accept floating-point inputs"); - typename genType::value_type dotValue = dot(N, I); - typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); - if(k < typename genType::value_type(0)) - return genType(0); + T dotValue = dot(N, I); + T k = T(1) - eta * eta * (T(1) - dotValue * dotValue); + if(k < T(0)) + return vecType(0); else return eta * I - (eta * dotValue + sqrt(k)) * N; } diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index 44040bb1..0d21a20b 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -97,7 +97,7 @@ namespace glm uint8 u; } A, B, C, D; - glm::vec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f; + glm::vec4 Unpack = clamp(v,-1.0f, 1.0f) * 127.0f; A.i = int8(round(Unpack.x)); B.i = int8(round(Unpack.y)); C.i = int8(round(Unpack.z)); diff --git a/glm/core/func_vector_relational.inl b/glm/core/func_vector_relational.inl index c11515ab..da0a4933 100644 --- a/glm/core/func_vector_relational.inl +++ b/glm/core/func_vector_relational.inl @@ -42,7 +42,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; return Result; @@ -62,7 +62,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; } @@ -81,7 +81,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; } @@ -100,7 +100,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; } @@ -117,7 +117,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] == y[i]; return Result; } @@ -134,7 +134,7 @@ namespace glm assert(x.length() == y.length()); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] != y[i]; return Result; } @@ -146,7 +146,7 @@ namespace glm // "Invalid template instantiation of 'any', GLM boolean vector types required"); bool Result = false; - for(typename vecType::size_type i = 0; i < v.length(); ++i) + for(int i = 0; i < v.length(); ++i) Result = Result || v[i]; return Result; } @@ -158,7 +158,7 @@ namespace glm // "Invalid template instantiation of 'all', GLM boolean vector types required"); bool Result = true; - for(typename vecType::size_type i = 0; i < v.length(); ++i) + for(int i = 0; i < v.length(); ++i) Result = Result && v[i]; return Result; } @@ -170,7 +170,7 @@ namespace glm // "Invalid template instantiation of 'not_', GLM vector types required"); typename vecType::bool_type Result(vecType::_null); - for(typename vecType::size_type i = 0; i < v.length(); ++i) + for(int i = 0; i < v.length(); ++i) Result[i] = !v[i]; return Result; } diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp index f1be3e9e..ac6ea704 100644 --- a/glm/core/type_mat2x2.hpp +++ b/glm/core/type_mat2x2.hpp @@ -151,11 +151,11 @@ namespace detail template GLM_FUNC_DECL tmat2x2 operator+ ( tmat2x2 const & m, - typename tmat2x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x2 operator+ ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m); template @@ -166,11 +166,11 @@ namespace detail template GLM_FUNC_DECL tmat2x2 operator- ( tmat2x2 const & m, - typename tmat2x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x2 operator- ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m); template @@ -181,11 +181,11 @@ namespace detail template GLM_FUNC_DECL tmat2x2 operator* ( tmat2x2 const & m, - typename tmat2x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x2 operator* ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m); template @@ -216,11 +216,11 @@ namespace detail template GLM_FUNC_DECL tmat2x2 operator/ ( tmat2x2 const & m, - typename tmat2x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x2 operator/ ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m); template diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index adc34f09..decae56f 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -444,7 +444,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x2 operator+ ( tmat2x2 const & m, - typename tmat2x2::T const & s + T const & s ) { return tmat2x2( @@ -455,7 +455,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2 operator+ ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m ) { @@ -480,7 +480,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x2 operator- ( tmat2x2 const & m, - typename tmat2x2::T const & s + T const & s ) { return tmat2x2( @@ -491,7 +491,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2 operator- ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m ) { @@ -516,7 +516,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x2 operator* ( tmat2x2 const & m, - typename tmat2x2::T const & s + T const & s ) { return tmat2x2( @@ -527,7 +527,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2 operator* ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m ) { @@ -612,7 +612,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x2 operator/ ( tmat2x2 const & m, - typename tmat2x2::T const & s + T const & s ) { return tmat2x2( @@ -623,7 +623,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x2 operator/ ( - typename tmat2x2::T const & s, + T const & s, tmat2x2 const & m ) { diff --git a/glm/core/type_mat2x3.hpp b/glm/core/type_mat2x3.hpp index 434f3777..1198bbbc 100644 --- a/glm/core/type_mat2x3.hpp +++ b/glm/core/type_mat2x3.hpp @@ -140,7 +140,7 @@ namespace detail template GLM_FUNC_DECL tmat2x3 operator+ ( tmat2x3 const & m, - typename tmat2x3::T const & s); + T const & s); template tmat2x3 operator+ ( @@ -150,7 +150,7 @@ namespace detail template GLM_FUNC_DECL tmat2x3 operator- ( tmat2x3 const & m, - typename tmat2x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x3 operator- ( @@ -160,11 +160,11 @@ namespace detail template GLM_FUNC_DECL tmat2x3 operator* ( tmat2x3 const & m, - typename tmat2x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x3 operator* ( - typename tmat2x3::T const & s, + T const & s, tmat2x3 const & m); template @@ -195,11 +195,11 @@ namespace detail template GLM_FUNC_DECL tmat2x3 operator/ ( tmat2x3 const & m, - typename tmat2x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x3 operator/ ( - typename tmat2x3::T const & s, + T const & s, tmat2x3 const & m); // Unary constant operators diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl index 454099e7..adc850ed 100644 --- a/glm/core/type_mat2x3.inl +++ b/glm/core/type_mat2x3.inl @@ -421,7 +421,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x3 operator+ ( tmat2x3 const & m, - typename tmat2x3::T const & s + T const & s ) { return tmat2x3( @@ -445,7 +445,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x3 operator- ( tmat2x3 const & m, - typename tmat2x3::T const & s + T const & s ) { return tmat2x3( @@ -469,7 +469,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x3 operator* ( tmat2x3 const & m, - typename tmat2x3::T const & s + T const & s ) { return tmat2x3( @@ -480,7 +480,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x3 operator* ( - typename tmat2x3::T const & s, + T const & s, tmat2x3 const & m ) { @@ -588,7 +588,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x3 operator/ ( tmat2x3 const & m, - typename tmat2x3::T const & s + T const & s ) { return tmat2x3( @@ -599,7 +599,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x3 operator/ ( - typename tmat2x3::T const & s, + T const & s, tmat2x3 const & m ) { diff --git a/glm/core/type_mat2x4.hpp b/glm/core/type_mat2x4.hpp index 18be6808..be830776 100644 --- a/glm/core/type_mat2x4.hpp +++ b/glm/core/type_mat2x4.hpp @@ -142,7 +142,7 @@ namespace detail template GLM_FUNC_DECL tmat2x4 operator+ ( tmat2x4 const & m, - typename tmat2x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x4 operator+ ( @@ -152,7 +152,7 @@ namespace detail template GLM_FUNC_DECL tmat2x4 operator- ( tmat2x4 const & m, - typename tmat2x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x4 operator- ( @@ -162,11 +162,11 @@ namespace detail template GLM_FUNC_DECL tmat2x4 operator* ( tmat2x4 const & m, - typename tmat2x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x4 operator* ( - typename tmat2x4::T const & s, + T const & s, tmat2x4 const & m); template @@ -197,11 +197,11 @@ namespace detail template GLM_FUNC_DECL tmat2x4 operator/ ( tmat2x4 const & m, - typename tmat2x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat2x4 operator/ ( - typename tmat2x4::T const & s, + T const & s, tmat2x4 const & m); // Unary constant operators diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index b94be0a2..7a21b024 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -424,7 +424,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x4 operator+ ( tmat2x4 const & m, - typename tmat2x4::T const & s + T const & s ) { return tmat2x4( @@ -448,7 +448,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x4 operator- ( tmat2x4 const & m, - typename tmat2x4::T const & s + T const & s ) { return tmat2x4( @@ -472,7 +472,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x4 operator* ( tmat2x4 const & m, - typename tmat2x4::T const & s + T const & s ) { return tmat2x4( @@ -483,7 +483,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x4 operator* ( - typename tmat2x4::T const & s, + T const & s, tmat2x4 const & m ) { @@ -607,7 +607,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat2x4 operator/ ( tmat2x4 const & m, - typename tmat2x4::T const & s + T const & s ) { return tmat2x4( @@ -618,7 +618,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat2x4 operator/ ( - typename tmat2x4::T const & s, + T const & s, tmat2x4 const & m ) { diff --git a/glm/core/type_mat3x2.hpp b/glm/core/type_mat3x2.hpp index 239d62a8..6e305299 100644 --- a/glm/core/type_mat3x2.hpp +++ b/glm/core/type_mat3x2.hpp @@ -145,7 +145,7 @@ namespace detail template GLM_FUNC_DECL tmat3x2 operator+ ( tmat3x2 const & m, - typename tmat3x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x2 operator+ ( @@ -155,7 +155,7 @@ namespace detail template GLM_FUNC_DECL tmat3x2 operator- ( tmat3x2 const & m, - typename tmat3x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x2 operator- ( @@ -165,11 +165,11 @@ namespace detail template GLM_FUNC_DECL tmat3x2 operator* ( tmat3x2 const & m, - typename tmat3x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x2 operator* ( - typename tmat3x2::T const & s, + T const & s, tmat3x2 const & m); template @@ -200,11 +200,11 @@ namespace detail template GLM_FUNC_DECL tmat3x2 operator/ ( tmat3x2 const & m, - typename tmat3x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x2 operator/ ( - typename tmat3x2::T const & s, + T const & s, tmat3x2 const & m); // Unary constant operators diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index d0ddd6ec..acfc4dc4 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -454,7 +454,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x2 operator+ ( tmat3x2 const & m, - typename tmat3x2::T const & s + T const & s ) { return tmat3x2( @@ -480,7 +480,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x2 operator- ( tmat3x2 const & m, - typename tmat3x2::T const & s + T const & s ) { return tmat3x2( @@ -506,7 +506,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x2 operator* ( tmat3x2 const & m, - typename tmat3x2::T const & s + T const & s ) { return tmat3x2( @@ -518,7 +518,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x2 operator* ( - typename tmat3x2::T const & s, + T const & s, tmat3x2 const & m ) { @@ -618,7 +618,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x2 operator/ ( tmat3x2 const & m, - typename tmat3x2::T const & s + T const & s ) { return tmat3x2( @@ -630,7 +630,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x2 operator/ ( - typename tmat3x2::T const & s, + T const & s, tmat3x2 const & m ) { diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp index 7843d660..26f44aec 100644 --- a/glm/core/type_mat3x3.hpp +++ b/glm/core/type_mat3x3.hpp @@ -153,11 +153,11 @@ namespace detail template GLM_FUNC_DECL tmat3x3 operator+ ( tmat3x3 const & m, - typename tmat3x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x3 operator+ ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m); template @@ -168,11 +168,11 @@ namespace detail template GLM_FUNC_DECL tmat3x3 operator- ( tmat3x3 const & m, - typename tmat3x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x3 operator- ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m); template @@ -183,11 +183,11 @@ namespace detail template GLM_FUNC_DECL tmat3x3 operator* ( tmat3x3 const & m, - typename tmat3x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x3 operator* ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m); template @@ -218,11 +218,11 @@ namespace detail template GLM_FUNC_DECL tmat3x3 operator/ ( tmat3x3 const & m, - typename tmat3x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x3 operator/ ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m); template diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl index 1e7b389d..368dc687 100644 --- a/glm/core/type_mat3x3.inl +++ b/glm/core/type_mat3x3.inl @@ -512,7 +512,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x3 operator+ ( tmat3x3 const & m, - typename tmat3x3::T const & s + T const & s ) { return tmat3x3( @@ -524,7 +524,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x3 operator+ ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m ) { @@ -551,7 +551,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x3 operator- ( tmat3x3 const & m, - typename tmat3x3::T const & s + T const & s ) { return tmat3x3( @@ -563,7 +563,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x3 operator- ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m ) { @@ -590,7 +590,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x3 operator* ( tmat3x3 const & m, - typename tmat3x3::T const & s + T const & s ) { return tmat3x3( @@ -602,7 +602,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x3 operator* ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m ) { @@ -720,7 +720,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x3 operator/ ( tmat3x3 const & m, - typename tmat3x3::T const & s + T const & s ) { return tmat3x3( @@ -732,7 +732,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x3 operator/ ( - typename tmat3x3::T const & s, + T const & s, tmat3x3 const & m ) { diff --git a/glm/core/type_mat3x4.hpp b/glm/core/type_mat3x4.hpp index 6ecb8636..eab4cd44 100644 --- a/glm/core/type_mat3x4.hpp +++ b/glm/core/type_mat3x4.hpp @@ -145,7 +145,7 @@ namespace detail template GLM_FUNC_DECL tmat3x4 operator+ ( tmat3x4 const & m, - typename tmat3x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x4 operator+ ( @@ -155,7 +155,7 @@ namespace detail template GLM_FUNC_DECL tmat3x4 operator- ( tmat3x4 const & m, - typename tmat3x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x4 operator- ( @@ -165,11 +165,11 @@ namespace detail template GLM_FUNC_DECL tmat3x4 operator* ( tmat3x4 const & m, - typename tmat3x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x4 operator* ( - typename tmat3x4::T const & s, + T const & s, tmat3x4 const & m); template @@ -200,11 +200,11 @@ namespace detail template GLM_FUNC_DECL tmat3x4 operator/ ( tmat3x4 const & m, - typename tmat3x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat3x4 operator/ ( - typename tmat3x4::T const & s, + T const & s, tmat3x4 const & m); // Unary constant operators diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl index a8a10dec..65fa94e5 100644 --- a/glm/core/type_mat3x4.inl +++ b/glm/core/type_mat3x4.inl @@ -453,7 +453,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x4 operator+ ( tmat3x4 const & m, - typename tmat3x4::T const & s + T const & s ) { return tmat3x4( @@ -479,7 +479,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x4 operator- ( tmat3x4 const & m, - typename tmat3x4::T const & s + T const & s ) { return tmat3x4( @@ -505,7 +505,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x4 operator* ( tmat3x4 const & m, - typename tmat3x4::T const & s + T const & s ) { return tmat3x4( @@ -517,7 +517,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x4 operator* ( - typename tmat3x4::T const & s, + T const & s, tmat3x4 const & m ) { @@ -651,7 +651,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat3x4 operator/ ( tmat3x4 const & m, - typename tmat3x4::T const & s + T const & s ) { return tmat3x4( @@ -663,7 +663,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat3x4 operator/ ( - typename tmat3x4::T const & s, + T const & s, tmat3x4 const & m ) { diff --git a/glm/core/type_mat4x2.hpp b/glm/core/type_mat4x2.hpp index 8e928a49..62e30517 100644 --- a/glm/core/type_mat4x2.hpp +++ b/glm/core/type_mat4x2.hpp @@ -150,7 +150,7 @@ namespace detail template GLM_FUNC_DECL tmat4x2 operator+ ( tmat4x2 const & m, - typename tmat4x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x2 operator+ ( @@ -160,7 +160,7 @@ namespace detail template GLM_FUNC_DECL tmat4x2 operator- ( tmat4x2 const & m, - typename tmat4x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x2 operator- ( @@ -170,11 +170,11 @@ namespace detail template GLM_FUNC_DECL tmat4x2 operator* ( tmat4x2 const & m, - typename tmat4x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x2 operator* ( - typename tmat4x2::T const & s, + T const & s, tmat4x2 const & m); template @@ -205,11 +205,11 @@ namespace detail template GLM_FUNC_DECL tmat4x2 operator/ ( tmat4x2 const & m, - typename tmat4x2::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x2 operator/ ( - typename tmat4x2::T const & s, + T const & s, tmat4x2 const & m); // Unary constant operators diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index 5f9d2b73..df00250f 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -483,7 +483,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x2 operator+ ( tmat4x2 const & m, - typename tmat4x2::T const & s + T const & s ) { return tmat4x2( @@ -511,7 +511,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x2 operator- ( tmat4x2 const & m, - typename tmat4x2::T const & s + T const & s ) { return tmat4x2( @@ -539,7 +539,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x2 operator* ( tmat4x2 const & m, - typename tmat4x2::T const & s + T const & s ) { return tmat4x2( @@ -552,7 +552,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x2 operator* ( - typename tmat4x2::T const & s, + T const & s, tmat4x2 const & m ) { @@ -660,7 +660,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x2 operator/ ( tmat4x2 const & m, - typename tmat4x2::T const & s + T const & s ) { return tmat4x2( @@ -673,7 +673,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x2 operator/ ( - typename tmat4x2::T const & s, + T const & s, tmat4x2 const & m ) { diff --git a/glm/core/type_mat4x3.hpp b/glm/core/type_mat4x3.hpp index 95b58201..0b83a596 100644 --- a/glm/core/type_mat4x3.hpp +++ b/glm/core/type_mat4x3.hpp @@ -150,7 +150,7 @@ namespace detail template GLM_FUNC_DECL tmat4x3 operator+ ( tmat4x3 const & m, - typename tmat4x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x3 operator+ ( @@ -160,7 +160,7 @@ namespace detail template GLM_FUNC_DECL tmat4x3 operator- ( tmat4x3 const & m, - typename tmat4x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x3 operator- ( @@ -170,11 +170,11 @@ namespace detail template GLM_FUNC_DECL tmat4x3 operator* ( tmat4x3 const & m, - typename tmat4x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x3 operator* ( - typename tmat4x3::T const & s, + T const & s, tmat4x3 const & m); template @@ -205,11 +205,11 @@ namespace detail template GLM_FUNC_DECL tmat4x3 operator/ ( tmat4x3 const & m, - typename tmat4x3::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x3 operator/ ( - typename tmat4x3::T const & s, + T const & s, tmat4x3 const & m); // Unary constant operators diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index 997cd200..39957387 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -466,7 +466,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x3 operator+ ( tmat4x3 const & m, - typename tmat4x3::T const & s) + T const & s) { return tmat4x3( m[0] + s, @@ -490,7 +490,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x3 operator- ( tmat4x3 const & m, - typename tmat4x3::T const & s) + T const & s) { return tmat4x3( m[0] - s, @@ -514,7 +514,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x3 operator* ( tmat4x3 const & m, - typename tmat4x3::T const & s) + T const & s) { return tmat4x3( m[0] * s, @@ -525,7 +525,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x3 operator* ( - typename tmat4x3::T const & s, + T const & s, tmat4x3 const & m) { return tmat4x3( @@ -648,7 +648,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x3 operator/ ( tmat4x3 const & m, - typename tmat4x3::T const & s + T const & s ) { return tmat4x3( @@ -661,7 +661,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x3 operator/ ( - typename tmat4x3::T const & s, + T const & s, tmat4x3 const & m ) { diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp index e1f53add..809ee5de 100644 --- a/glm/core/type_mat4x4.hpp +++ b/glm/core/type_mat4x4.hpp @@ -158,11 +158,11 @@ namespace detail template GLM_FUNC_DECL tmat4x4 operator+ ( tmat4x4 const & m, - typename tmat4x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x4 operator+ ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m); template @@ -173,11 +173,11 @@ namespace detail template GLM_FUNC_DECL tmat4x4 operator- ( tmat4x4 const & m, - typename tmat4x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x4 operator- ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m); template @@ -188,11 +188,11 @@ namespace detail template GLM_FUNC_DECL tmat4x4 operator* ( tmat4x4 const & m, - typename tmat4x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x4 operator* ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m); template @@ -223,11 +223,11 @@ namespace detail template GLM_FUNC_DECL tmat4x4 operator/ ( tmat4x4 const & m, - typename tmat4x4::T const & s); + T const & s); template GLM_FUNC_DECL tmat4x4 operator/ ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m); template diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index a6fad1eb..9b2b52ab 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -606,7 +606,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x4 operator+ ( tmat4x4 const & m, - typename tmat4x4::T const & s + T const & s ) { return tmat4x4( @@ -619,7 +619,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x4 operator+ ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m ) { @@ -648,7 +648,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x4 operator- ( tmat4x4 const & m, - typename tmat4x4::T const & s + T const & s ) { return tmat4x4( @@ -661,7 +661,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x4 operator- ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m ) { @@ -690,7 +690,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x4 operator* ( tmat4x4 const & m, - typename tmat4x4::value_type const & s + T const & s ) { return tmat4x4( @@ -703,7 +703,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x4 operator* ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m ) { @@ -845,7 +845,7 @@ namespace detail GLM_FUNC_QUALIFIER tmat4x4 operator/ ( tmat4x4 const & m, - typename tmat4x4::T const & s + T const & s ) { return tmat4x4( @@ -858,7 +858,7 @@ namespace detail template GLM_FUNC_QUALIFIER tmat4x4 operator/ ( - typename tmat4x4::T const & s, + T const & s, tmat4x4 const & m ) { diff --git a/glm/core/type_vec1.hpp b/glm/core/type_vec1.hpp index fd07f5c7..2cba334a 100644 --- a/glm/core/type_vec1.hpp +++ b/glm/core/type_vec1.hpp @@ -41,8 +41,6 @@ namespace detail { enum ctor{_null}; - typedef T value_type; - typedef std::size_t size_type; typedef tvec1 type; typedef tvec1 bool_type; @@ -52,16 +50,16 @@ namespace detail // Data # if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW) - value_type x; + T x; # else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES) - union {value_type x, r, s;}; + union {T x, r, s;}; # endif//GLM_COMPONENT ////////////////////////////////////// // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; + GLM_FUNC_DECL T & operator[](int i); + GLM_FUNC_DECL T const & operator[](int i) const; ////////////////////////////////////// // Implicit basic constructors @@ -170,7 +168,7 @@ namespace detail ////////////////////////////////////// // Swizzle operators - GLM_FUNC_DECL value_type swizzle(comp X) const; + GLM_FUNC_DECL T swizzle(comp X) const; GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index 330f5ec0..d07cf620 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -39,22 +39,16 @@ namespace detail // Accesses template - GLM_FUNC_QUALIFIER typename tvec1::value_type & tvec1::operator[] - ( - size_type i - ) + GLM_FUNC_QUALIFIER T & tvec1::operator[](int i) { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } template - GLM_FUNC_QUALIFIER typename tvec1::T const & tvec1::operator[] - ( - size_type i - ) const + GLM_FUNC_QUALIFIER T const & tvec1::operator[](int i) const { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 6b06828e..2fc69e62 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -41,8 +41,6 @@ namespace detail { enum ctor{_null}; - typedef T value_type; - typedef std::size_t size_type; typedef tvec2 type; typedef tvec2 bool_type; @@ -54,9 +52,9 @@ namespace detail # if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) union { - struct{ value_type x, y; }; - struct{ value_type r, g; }; - struct{ value_type s, t; }; + struct{ T x, y; }; + struct{ T r, g; }; + struct{ T s, t; }; _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y) _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g) @@ -69,20 +67,20 @@ namespace detail _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t) }; # else - union {value_type x, r, s;}; - union {value_type y, g, t;}; + union {T x, r, s;}; + union {T y, g, t;}; # if(defined(GLM_SWIZZLE)) - //GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2) - GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) + //GLM_SWIZZLE_GEN_REF_FROM_VEC2(T, P, detail::tvec2, detail::tref2) + GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4) # endif//(defined(GLM_SWIZZLE)) # endif//GLM_LANG ////////////////////////////////////// // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; + GLM_FUNC_DECL T & operator[](int i); + GLM_FUNC_DECL T const & operator[](int i) const; ////////////////////////////////////// // Implicit basic constructors @@ -203,7 +201,7 @@ namespace detail ////////////////////////////////////// // Swizzle operators - GLM_FUNC_DECL value_type swizzle(comp X) const; + GLM_FUNC_DECL T swizzle(comp X) const; GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index 36ba51b2..c732059d 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -39,16 +39,16 @@ namespace detail // Accesses template - GLM_FUNC_QUALIFIER T & tvec2::operator[](size_type i) + GLM_FUNC_QUALIFIER T & tvec2::operator[](int i) { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } template - GLM_FUNC_QUALIFIER T const & tvec2::operator[](size_type i) const + GLM_FUNC_QUALIFIER T const & tvec2::operator[](int i) const { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } @@ -509,7 +509,7 @@ namespace detail // Swizzle operators template - GLM_FUNC_QUALIFIER typename tvec2::value_type tvec2::swizzle + GLM_FUNC_QUALIFIER T tvec2::swizzle ( comp x ) const diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 0c5615bf..1adb9108 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -41,8 +41,6 @@ namespace detail { enum ctor{_null}; - typedef T value_type; - typedef std::size_t size_type; typedef tvec3 type; typedef tvec3 bool_type; @@ -54,9 +52,9 @@ namespace detail # if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) union { - struct{ value_type x, y, z; }; - struct{ value_type r, g, b; }; - struct{ value_type s, t, p; }; + struct{ T x, y, z; }; + struct{ T r, g, b; }; + struct{ T s, t, p; }; _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z) _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b) @@ -69,9 +67,9 @@ namespace detail _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p) }; # else - union { value_type x, r, s; }; - union { value_type y, g, t; }; - union { value_type z, b, p; }; + union { T x, r, s; }; + union { T y, g, t; }; + union { T z, b, p; }; # if(defined(GLM_SWIZZLE)) //GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3) @@ -82,8 +80,8 @@ namespace detail ////////////////////////////////////// // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; + GLM_FUNC_DECL T & operator[](int i); + GLM_FUNC_DECL T const & operator[](int i) const; ////////////////////////////////////// // Implicit basic constructors @@ -227,7 +225,7 @@ namespace detail ////////////////////////////////////// // Swizzle operators - GLM_FUNC_DECL value_type swizzle(comp X) const; + GLM_FUNC_DECL T swizzle(comp X) const; GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index ff0f2c1e..8d0c6520 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -39,16 +39,16 @@ namespace detail // Accesses template - GLM_FUNC_QUALIFIER T & tvec3::operator[](size_type i) + GLM_FUNC_QUALIFIER T & tvec3::operator[](int i) { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } template - GLM_FUNC_QUALIFIER T const & tvec3::operator[](size_type i) const + GLM_FUNC_QUALIFIER T const & tvec3::operator[](int i) const { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } @@ -583,8 +583,7 @@ namespace detail // Swizzle operators template - GLM_FUNC_QUALIFIER typename tvec3::value_type - tvec3::swizzle + GLM_FUNC_QUALIFIER T tvec3::swizzle ( comp x ) const diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index 9f0ece97..eb703fca 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -41,8 +41,6 @@ namespace detail { enum ctor{_null}; - typedef T value_type; - typedef std::size_t size_type; typedef tvec4 type; typedef tvec4 bool_type; @@ -54,9 +52,9 @@ namespace detail # if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE)) union { - struct { value_type r, g, b, a; }; - struct { value_type s, t, p, q; }; - struct { value_type x, y, z, w;}; + struct { T r, g, b, a; }; + struct { T s, t, p, q; }; + struct { T x, y, z, w;}; _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w) _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a) @@ -69,10 +67,10 @@ namespace detail _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q) }; # else - union { value_type x, r, s; }; - union { value_type y, g, t; }; - union { value_type z, b, p; }; - union { value_type w, a, q; }; + union { T x, r, s; }; + union { T y, g, t; }; + union { T z, b, p; }; + union { T w, a, q; }; # if(defined(GLM_SWIZZLE)) //GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4) @@ -83,8 +81,8 @@ namespace detail ////////////////////////////////////// // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; + GLM_FUNC_DECL T & operator[](int i); + GLM_FUNC_DECL T const & operator[](int i) const; ////////////////////////////////////// // Implicit basic constructors @@ -282,7 +280,7 @@ namespace detail ////////////////////////////////////// // Swizzle operators - GLM_FUNC_DECL value_type swizzle(comp X) const; + GLM_FUNC_DECL T swizzle(comp X) const; GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; @@ -310,37 +308,37 @@ namespace detail GLM_DETAIL_IS_VECTOR(tvec4); template - GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator+(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator+(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator-(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator-(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator- (tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator*(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator*(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator/(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator/(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator/(tvec4 const & v1, tvec4 const & v2); @@ -355,55 +353,55 @@ namespace detail GLM_FUNC_DECL bool operator!=(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator%(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator%(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator%(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator%(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator%(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator&(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator&(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator&(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator&(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator&(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator|(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator|(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator|(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator|(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator|(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator^(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator^(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator^(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator^(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator^(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator<<(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator<<(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator<<(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator<<(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator<<(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator>>(tvec4 const & v, typename tvec4::T const & s); + GLM_FUNC_DECL tvec4 operator>>(tvec4 const & v, T const & s); template - GLM_FUNC_DECL tvec4 operator>>(typename tvec4::T const & s, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator>>(T const & s, tvec4 const & v); template GLM_FUNC_DECL tvec4 operator>>(tvec4 const & v1, tvec4 const & v2); diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index f739f29f..431db1c7 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -39,22 +39,16 @@ namespace detail // Accesses template - GLM_FUNC_QUALIFIER T & tvec4::operator[] - ( - size_type i - ) + GLM_FUNC_QUALIFIER T & tvec4::operator[](int i) { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } template - GLM_FUNC_QUALIFIER T const & tvec4::operator[] - ( - size_type i - ) const + GLM_FUNC_QUALIFIER T const & tvec4::operator[](int i) const { - assert(i < this->length()); + assert(i >= 0 && i < this->length()); return (&x)[i]; } @@ -730,21 +724,13 @@ namespace detail // Swizzle operators template - GLM_FUNC_QUALIFIER typename tvec4::value_type - tvec4::swizzle - ( - comp x - ) const + GLM_FUNC_QUALIFIER T tvec4::swizzle(comp x) const { return (*this)[x]; } template - GLM_FUNC_QUALIFIER tvec2 tvec4::swizzle - ( - comp x, - comp y - ) const + GLM_FUNC_QUALIFIER tvec2 tvec4::swizzle(comp x, comp y) const { return tvec2( (*this)[x], @@ -752,12 +738,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec3 tvec4::swizzle - ( - comp x, - comp y, - comp z - ) const + GLM_FUNC_QUALIFIER tvec3 tvec4::swizzle(comp x, comp y, comp z) const { return tvec3( (*this)[x], @@ -766,13 +747,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec4 tvec4::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) const + GLM_FUNC_QUALIFIER tvec4 tvec4::swizzle(comp x, comp y, comp z, comp w) const { return tvec4( (*this)[x], @@ -782,11 +757,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tref2 tvec4::swizzle - ( - comp x, - comp y - ) + GLM_FUNC_QUALIFIER tref2 tvec4::swizzle(comp x, comp y) { return tref2( (*this)[x], @@ -794,12 +765,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tref3 tvec4::swizzle - ( - comp x, - comp y, - comp z - ) + GLM_FUNC_QUALIFIER tref3 tvec4::swizzle(comp x, comp y, comp z) { return tref3( (*this)[x], @@ -808,13 +774,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tref4 tvec4::swizzle - ( - comp x, - comp y, - comp z, - comp w - ) + GLM_FUNC_QUALIFIER tref4 tvec4::swizzle(comp x, comp y, comp z, comp w) { return tref4( (*this)[x], @@ -830,7 +790,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator+ ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -843,7 +803,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator+ ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -873,7 +833,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator- ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -886,7 +846,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator- ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -916,7 +876,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator* ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -929,7 +889,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator* ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -959,7 +919,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator/ ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -972,7 +932,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator/ ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1041,7 +1001,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator% ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1054,7 +1014,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator% ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1083,7 +1043,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator& ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1096,7 +1056,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator& ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1125,7 +1085,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator| ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1138,7 +1098,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator| ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1167,7 +1127,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator^ ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1180,7 +1140,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator^ ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1209,7 +1169,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator<< ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1222,7 +1182,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator<< ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { @@ -1251,7 +1211,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec4 operator>> ( tvec4 const & v, - typename tvec4::T const & s + T const & s ) { return tvec4( @@ -1264,7 +1224,7 @@ namespace detail template GLM_FUNC_QUALIFIER tvec4 operator>> ( - typename tvec4::T const & s, + T const & s, tvec4 const & v ) { diff --git a/glm/gtc/matrix_access.inl b/glm/gtc/matrix_access.inl index de59d5e4..763ecf52 100644 --- a/glm/gtc/matrix_access.inl +++ b/glm/gtc/matrix_access.inl @@ -32,14 +32,14 @@ namespace glm GLM_FUNC_QUALIFIER genType row ( genType const & m, - typename genType::size_type const & index, + int const & index, typename genType::row_type const & x ) { - assert(index < m.col_size()); + assert(index >= 0 && index < m.col_size()); genType Result = m; - for(typename genType::size_type i = 0; i < genType::row_size(); ++i) + for(int i = 0; i < genType::row_size(); ++i) Result[i][index] = x[i]; return Result; } @@ -48,13 +48,13 @@ namespace glm GLM_FUNC_QUALIFIER typename genType::row_type row ( genType const & m, - typename genType::size_type const & index + int const & index ) { - assert(index < m.col_size()); + assert(index >= 0 && index < m.col_size()); typename genType::row_type Result; - for(typename genType::size_type i = 0; i < genType::row_size(); ++i) + for(int i = 0; i < genType::row_size(); ++i) Result[i] = m[i][index]; return Result; } @@ -63,11 +63,11 @@ namespace glm GLM_FUNC_QUALIFIER genType column ( genType const & m, - typename genType::size_type const & index, + int const & index, typename genType::col_type const & x ) { - assert(index < m.row_size()); + assert(index >= 0 && index < m.row_size()); genType Result = m; Result[index] = x; @@ -78,10 +78,10 @@ namespace glm GLM_FUNC_QUALIFIER typename genType::col_type column ( genType const & m, - typename genType::size_type const & index + int const & index ) { - assert(index < m.row_size()); + assert(index >= 0 && index < m.row_size()); return m[index]; } diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 5f549576..ab30875f 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -52,18 +52,16 @@ namespace glm{ namespace detail { template - struct tquat// : public genType + struct tquat { enum ctor{null}; - typedef T value_type; - typedef std::size_t size_type; typedef tvec4 bool_type; public: - value_type x, y, z, w; + T x, y, z, w; - GLM_FUNC_DECL size_type length() const; + GLM_FUNC_DECL int length() const; // Constructors tquat(); @@ -90,8 +88,8 @@ namespace detail tmat4x4 const & m); // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; + GLM_FUNC_DECL T & operator[](int i); + GLM_FUNC_DECL T const & operator[](int i) const; // Operators GLM_FUNC_DECL tquat & operator*=(T const & s); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index a2c4962d..ed05ff03 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -32,7 +32,7 @@ namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER typename tquat::size_type tquat::length() const + GLM_FUNC_QUALIFIER int tquat::length() const { return 4; } @@ -110,8 +110,8 @@ namespace detail tvec3 const & eulerAngle ) { - tvec3 c = glm::cos(eulerAngle * value_type(0.5)); - tvec3 s = glm::sin(eulerAngle * value_type(0.5)); + tvec3 c = glm::cos(eulerAngle * T(0.5)); + tvec3 s = glm::sin(eulerAngle * T(0.5)); this->w = c.x * c.y * c.z + s.x * s.y * s.z; this->x = s.x * c.y * c.z - c.x * s.y * s.z; @@ -141,14 +141,16 @@ namespace detail // tquat accesses template - GLM_FUNC_QUALIFIER T & tquat::operator[] (size_type i) + GLM_FUNC_QUALIFIER T & tquat::operator[] (int i) { + assert(i >= 0 && i < this->length()); return (&x)[i]; } template - GLM_FUNC_QUALIFIER T const & tquat::operator[] (size_type i) const + GLM_FUNC_QUALIFIER T const & tquat::operator[] (int i) const { + assert(i >= 0 && i < this->length()); return (&x)[i]; } @@ -229,7 +231,7 @@ namespace detail detail::tvec3 const & v ) { - typename detail::tquat::value_type Two(2); + T Two(2); detail::tvec3 uv, uuv; detail::tvec3 QuatVector(q.x, q.y, q.z); @@ -344,10 +346,10 @@ namespace detail detail::tquat const & q ) { - typename detail::tquat::value_type len = length(q); - if(len <= typename detail::tquat::value_type(0)) // Problem + T len = length(q); + if(len <= T(0)) // Problem return detail::tquat(1, 0, 0, 0); - typename detail::tquat::value_type oneOverLen = typename detail::tquat::value_type(1) / len; + T oneOverLen = T(1) / len; return detail::tquat(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); } @@ -384,12 +386,12 @@ namespace detail typename detail::tquat::T const & a ) { - if(a <= typename detail::tquat::value_type(0)) return x; - if(a >= typename detail::tquat::value_type(1)) return y; + if(a <= T(0)) return x; + if(a >= T(1)) return y; float fCos = dot(x, y); detail::tquat y2(y); //BUG!!! tquat y2; - if(fCos < typename detail::tquat::value_type(0)) + if(fCos < T(0)) { y2 = -y; fCos = -fCos; @@ -397,18 +399,18 @@ namespace detail //if(fCos > 1.0f) // problem float k0, k1; - if(fCos > typename detail::tquat::value_type(0.9999)) + if(fCos > T(0.9999)) { - k0 = typename detail::tquat::value_type(1) - a; - k1 = typename detail::tquat::value_type(0) + a; //BUG!!! 1.0f + a; + k0 = T(1) - a; + k1 = T(0) + a; //BUG!!! 1.0f + a; } else { - typename detail::tquat::value_type fSin = sqrt(T(1) - fCos * fCos); - typename detail::tquat::value_type fAngle = atan(fSin, fCos); - typename detail::tquat::value_type fOneOverSin = static_cast(1) / fSin; - k0 = sin((typename detail::tquat::value_type(1) - a) * fAngle) * fOneOverSin; - k1 = sin((typename detail::tquat::value_type(0) + a) * fAngle) * fOneOverSin; + T fSin = sqrt(T(1) - fCos * fCos); + T fAngle = atan(fSin, fCos); + T fOneOverSin = static_cast(1) / fSin; + k0 = sin((T(1) - a) * fAngle) * fOneOverSin; + k1 = sin((T(0) + a) * fAngle) * fOneOverSin; } return detail::tquat( @@ -566,7 +568,7 @@ namespace detail detail::tvec3 Tmp = v; // Axis of rotation must be normalised - typename detail::tquat::value_type len = glm::length(Tmp); + T len = glm::length(Tmp); if(abs(len - T(1)) > T(0.001)) { T oneOverLen = static_cast(1) / len; @@ -576,11 +578,11 @@ namespace detail } #ifdef GLM_FORCE_RADIANS - typename detail::tquat::value_type const AngleRad(angle); + T const AngleRad(angle); #else - typename detail::tquat::value_type const AngleRad = radians(angle); + T const AngleRad = radians(angle); #endif - typename detail::tquat::value_type const Sin = sin(AngleRad * T(0.5)); + T const Sin = sin(AngleRad * T(0.5)); return q * detail::tquat(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); //return gtc::quaternion::cross(q, detail::tquat(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); @@ -670,13 +672,13 @@ namespace detail detail::tmat3x3 const & m ) { - typename detail::tquat::value_type fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2]; - typename detail::tquat::value_type fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2]; - typename detail::tquat::value_type fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1]; - typename detail::tquat::value_type fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2]; + T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2]; + T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2]; + T fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1]; + T fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2]; int biggestIndex = 0; - typename detail::tquat::value_type fourBiggestSquaredMinus1 = fourWSquaredMinus1; + T fourBiggestSquaredMinus1 = fourWSquaredMinus1; if(fourXSquaredMinus1 > fourBiggestSquaredMinus1) { fourBiggestSquaredMinus1 = fourXSquaredMinus1; @@ -693,8 +695,8 @@ namespace detail biggestIndex = 3; } - typename detail::tquat::value_type biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5); - typename detail::tquat::value_type mult = static_cast(0.25) / biggestVal; + T biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5); + T mult = static_cast(0.25) / biggestVal; detail::tquat Result; switch(biggestIndex) @@ -797,7 +799,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; return Result; @@ -811,7 +813,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; } @@ -824,7 +826,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; } @@ -837,7 +839,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; } @@ -850,7 +852,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] == y[i]; return Result; } @@ -863,7 +865,7 @@ namespace detail ) { typename detail::tquat::bool_type Result; - for(typename detail::tquat::size_type i = 0; i < x.length(); ++i) + for(int i = 0; i < x.length(); ++i) Result[i] = x[i] != y[i]; return Result; } diff --git a/glm/gtx/component_wise.inl b/glm/gtx/component_wise.inl index 8baea62b..76147101 100644 --- a/glm/gtx/component_wise.inl +++ b/glm/gtx/component_wise.inl @@ -9,38 +9,38 @@ namespace glm { - template - GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v) + template class vecType> + GLM_FUNC_QUALIFIER T compAdd(vecType const & v) { - typename genType::value_type result = typename genType::value_type(0); - for(typename genType::size_type i = 0; i < v.length(); ++i) + T result(0); + for(int i = 0; i < v.length(); ++i) result += v[i]; return result; } - template - GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) + template class vecType> + GLM_FUNC_QUALIFIER T compMul(vecType const & v) { - typename genType::value_type result = typename genType::value_type(1); - for(typename genType::size_type i = 0; i < v.length(); ++i) + T result(1); + for(int i = 0; i < v.length(); ++i) result *= v[i]; return result; } - template - GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) + template class vecType> + GLM_FUNC_QUALIFIER T compMin(vecType const & v) { - typename genType::value_type result = typename genType::value_type(v[0]); - for(typename genType::size_type i = 1; i < v.length(); ++i) + T result(v[0]); + for(int i = 1; i < v.length(); ++i) result = min(result, v[i]); return result; } - template - GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) + template class vecType> + GLM_FUNC_QUALIFIER T compMax(vecType const & v) { - typename genType::value_type result = typename genType::value_type(v[0]); - for(typename genType::size_type i = 1; i < v.length(); ++i) + T result(v[0]); + for(int i = 1; i < v.length(); ++i) result = max(result, v[i]); return result; } diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index faea885f..e22d124a 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -54,18 +54,16 @@ namespace glm{ namespace detail { template - struct tdualquat// : public genType + struct tdualquat { enum ctor{null}; - typedef T value_type; typedef glm::detail::tquat part_type; - typedef std::size_t size_type; public: glm::detail::tquat real, dual; - GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const; + GLM_FUNC_DECL GLM_CONSTEXPR int length() const; // Constructors tdualquat(); @@ -124,17 +122,17 @@ namespace detail template detail::tdualquat operator* ( detail::tdualquat const & q, - typename detail::tdualquat::T const & s); + T const & s); template detail::tdualquat operator* ( - typename detail::tdualquat::T const & s, + T const & s, detail::tdualquat const & q); template detail::tdualquat operator/ ( detail::tdualquat const & q, - typename detail::tdualquat::T const & s); + T const & s); } //namespace detail /// @addtogroup gtc_dual_quaternion @@ -154,7 +152,7 @@ namespace detail detail::tdualquat lerp( detail::tdualquat const & x, detail::tdualquat const & y, - typename detail::tdualquat::T const & a); + T const & a); /// Returns the q inverse. /// diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 9dd00730..fee1d119 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -32,7 +32,7 @@ namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat::size_type tdualquat::length() const + GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tdualquat::length() const { return 8; } @@ -102,12 +102,14 @@ namespace detail template GLM_FUNC_QUALIFIER typename tdualquat::part_type & tdualquat::operator [] (int i) { + assert(i >= 0 && i < this->length()); return (&real)[i]; } template GLM_FUNC_QUALIFIER typename tdualquat::part_type const & tdualquat::operator [] (int i) const { + assert(i >= 0 && i < this->length()); return (&real)[i]; } @@ -215,7 +217,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tdualquat operator* ( detail::tdualquat const & q, - typename detail::tdualquat::T const & s + T const & s ) { return detail::tdualquat(q.real * s, q.dual * s); @@ -224,7 +226,7 @@ namespace detail template GLM_FUNC_QUALIFIER detail::tdualquat operator* ( - typename detail::tdualquat::T const & s, + T const & s, detail::tdualquat const & q ) { @@ -235,7 +237,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tdualquat operator/ ( detail::tdualquat const & q, - typename detail::tdualquat::T const & s + T const & s ) { return detail::tdualquat(q.real / s, q.dual / s); @@ -279,7 +281,7 @@ namespace detail ( detail::tdualquat const & x, detail::tdualquat const & y, - typename detail::tdualquat::T const & a + T const & a ) { // Dual Quaternion Linear blend aka DLB: diff --git a/glm/gtx/matrix_query.inl b/glm/gtx/matrix_query.inl index 16cab65a..0f3b60f7 100644 --- a/glm/gtx/matrix_query.inl +++ b/glm/gtx/matrix_query.inl @@ -50,21 +50,21 @@ namespace glm return result; } - template + template class matType> GLM_FUNC_QUALIFIER bool isIdentity ( - genType const & m, - typename genType::T const & epsilon + matType const & m, + T const & epsilon ) { bool result = true; - for(typename genType::size_type i = typename genType::size_type(0); result && i < genType::col_size(); ++i) + for(int i(0); result && i < matType::col_size(); ++i) { - for(typename genType::size_type j = typename genType::size_type(0); result && j < i ; ++j) + for(int j(0); result && j < i ; ++j) result = abs(m[i][j]) <= epsilon; if(result) - result = abs(m[i][i] - typename genType::value_type(1)) <= epsilon; - for(typename genType::size_type j = i + typename genType::size_type(1); result && j < genType::row_size(); ++j) + result = abs(m[i][i] - 1) <= epsilon; + for(int j(i + 1); result && j < matType::row_size(); ++j) result = abs(m[i][j]) <= epsilon; } return result; @@ -78,12 +78,12 @@ namespace glm ) { bool result(true); - for(typename detail::tmat2x2::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(typename detail::tmat2x2::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) { typename detail::tmat2x2::col_type v; - for(typename detail::tmat2x2::size_type j(0); j < m.length(); ++j) + for(int j(0); j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -98,12 +98,12 @@ namespace glm ) { bool result(true); - for(typename detail::tmat3x3::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(typename detail::tmat3x3::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) { typename detail::tmat3x3::col_type v; - for(typename detail::tmat3x3::size_type j(0); j < m.length(); ++j) + for(int j(0); j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -118,12 +118,12 @@ namespace glm ) { bool result(true); - for(typename detail::tmat4x4::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) result = isNormalized(m[i], epsilon); - for(typename detail::tmat4x4::size_type i(0); result && i < m.length(); ++i) + for(int i(0); result && i < m.length(); ++i) { typename detail::tmat4x4::col_type v; - for(typename detail::tmat4x4::size_type j(0); j < m.length(); ++j) + for(int j(0); j < m.length(); ++j) v[j] = m[j][i]; result = isNormalized(v, epsilon); } @@ -138,15 +138,15 @@ namespace glm ) { bool result(true); - for(typename matType::size_type i(0); result && i < m.length() - 1; ++i) - for(typename matType::size_type j(i + 1); result && j < m.length(); ++j) + for(int i(0); result && i < m.length() - 1; ++i) + for(int j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(m[i], m[j], epsilon); if(result) { matType tmp = transpose(m); - for(typename matType::size_type i(0); result && i < m.length() - 1 ; ++i) - for(typename matType::size_type j(i + 1); result && j < m.length(); ++j) + for(int i(0); result && i < m.length() - 1 ; ++i) + for(int j(i + 1); result && j < m.length(); ++j) result = areOrthogonal(tmp[i], tmp[j], epsilon); } return result; diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 9b3a6a7f..d1f8b677 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -170,8 +170,8 @@ namespace glm T const & a ) { - if(a <= typename detail::tquat::value_type(0)) return x; - if(a >= typename detail::tquat::value_type(1)) return y; + if(a <= T(0)) return x; + if(a >= T(1)) return y; T fCos = dot(x, y); detail::tquat y2(y); //BUG!!! tquat y2; diff --git a/glm/gtx/rotate_normalized_axis.inl b/glm/gtx/rotate_normalized_axis.inl index 71bb4ace..e9aa3cee 100644 --- a/glm/gtx/rotate_normalized_axis.inl +++ b/glm/gtx/rotate_normalized_axis.inl @@ -80,11 +80,11 @@ namespace glm detail::tvec3 Tmp = v; #ifdef GLM_FORCE_RADIANS - typename detail::tquat::value_type const AngleRad(angle); + T const AngleRad(angle); #else - typename detail::tquat::value_type const AngleRad = radians(angle); + T const AngleRad = radians(angle); #endif - typename detail::tquat::value_type const Sin = sin(AngleRad * T(0.5)); + T const Sin = sin(AngleRad * T(0.5)); return q * detail::tquat(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); //return gtc::quaternion::cross(q, detail::tquat(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl index 60382717..a3f4ead0 100644 --- a/glm/gtx/vector_angle.inl +++ b/glm/gtx/vector_angle.inl @@ -9,13 +9,31 @@ namespace glm { - template - GLM_FUNC_QUALIFIER typename genType::value_type angle + template + GLM_FUNC_QUALIFIER T angle ( - genType const & x, - genType const & y + T const & x, + T const & y ) { + GLM_STATIC_ASSERT(detail::type::is_float, "'angle' only accept floating-point inputs"); + +#ifdef GLM_FORCE_RADIANS + return acos(dot(x, y)); +#else + return degrees(acos(dot(x, y))); +#endif + } + + template class vecType> + GLM_FUNC_QUALIFIER T angle + ( + vecType const & x, + vecType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'angle' only accept floating-point inputs"); + #ifdef GLM_FORCE_RADIANS return acos(dot(x, y)); #else @@ -31,6 +49,8 @@ namespace glm detail::tvec2 const & y ) { + GLM_STATIC_ASSERT(detail::type::is_float, "'orientedAngle' only accept floating-point inputs"); + #ifdef GLM_FORCE_RADIANS T const Angle(acos(dot(x, y))); #else @@ -51,6 +71,8 @@ namespace glm detail::tvec3 const & ref ) { + GLM_STATIC_ASSERT(detail::type::is_float, "'orientedAngle' only accept floating-point inputs"); + #ifdef GLM_FORCE_RADIANS T const Angle(acos(dot(x, y))); #else diff --git a/glm/gtx/vector_query.inl b/glm/gtx/vector_query.inl index a3538bf3..52962afd 100644 --- a/glm/gtx/vector_query.inl +++ b/glm/gtx/vector_query.inl @@ -19,7 +19,7 @@ namespace glm ( detail::tvec2 const & v0, detail::tvec2 const & v1, - typename detail::tvec2::T const & epsilon + T const & epsilon ) { return length(cross(detail::tvec3(v0, T(0)), detail::tvec3(v1, T(0)))) < epsilon; @@ -30,7 +30,7 @@ namespace glm ( detail::tvec3 const & v0, detail::tvec3 const & v1, - typename detail::tvec3::T const & epsilon + T const & epsilon ) { return length(cross(v0, v1)) < epsilon; @@ -41,35 +41,35 @@ namespace glm ( detail::tvec4 const & v0, detail::tvec4 const & v1, - typename detail::tvec4::T const & epsilon + T const & epsilon ) { return length(cross(detail::tvec3(v0), detail::tvec3(v1))) < epsilon; } - template + template class vecType> GLM_FUNC_QUALIFIER bool areOrthogonal ( - genType const & v0, - genType const & v1, - typename genType::T const & epsilon + vecType const & v0, + vecType const & v1, + T const & epsilon ) { return abs(dot(v0, v1)) <= max( - typename genType::value_type(1), + T(1), length(v0)) * max( - typename genType::value_type(1), + T(1), length(v1)) * epsilon; } - template class vecType> + template class vecType> GLM_FUNC_QUALIFIER bool isNormalized ( - vecType const & v, - genType const & epsilon + vecType const & v, + T const & epsilon ) { - return abs(length(v) - genType(1)) <= genType(2) * epsilon; + return abs(length(v) - T(1)) <= T(2) * epsilon; } template @@ -150,12 +150,12 @@ namespace glm abs(v.w) < epsilon); } - template + template class vecType> GLM_FUNC_QUALIFIER bool areOrthonormal ( - genType const & v0, - genType const & v1, - typename genType::T const & epsilon + vecType const & v0, + vecType const & v1, + T const & epsilon ) { return isNormalized(v0, epsilon) && isNormalized(v1, epsilon) && (abs(dot(v0, v1)) <= epsilon); diff --git a/test/external/gli/core/operation.inl b/test/external/gli/core/operation.inl index 58b6428f..ef3394ef 100644 --- a/test/external/gli/core/operation.inl +++ b/test/external/gli/core/operation.inl @@ -75,7 +75,7 @@ namespace gli for(gli::texture2D::size_type t = 0; t < TexelCount; ++t) for(gli::texture2D::size_type c = 0; c < Mipmap.components(); ++c) { - gli::texture2D::size_type IndexSrc = t * Mipmap.components() + Channel[glm::uvec4::size_type(c)]; + gli::texture2D::size_type IndexSrc = t * Mipmap.components() + Channel[static_cast(c)]; gli::texture2D::size_type IndexDst = t * Mipmap.components() + c; memcpy(DataDst + IndexDst, DataSrc + IndexSrc, CompSize);