From f9b944bd31d2f9fcd90611fac5b622a10b3e9f99 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 8 Sep 2013 03:14:31 +0200 Subject: [PATCH] Fixed an overload resolution bug generating chains of convertions. --- glm/core/_vectorize.hpp | 6 +++--- glm/core/func_common.inl | 6 +++--- glm/gtc/noise.inl | 38 +++++++++++++++++++------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/glm/core/_vectorize.hpp b/glm/core/_vectorize.hpp index b1fb60e6..fc28be05 100644 --- a/glm/core/_vectorize.hpp +++ b/glm/core/_vectorize.hpp @@ -72,7 +72,7 @@ GLM_FUNC_QUALIFIER detail::tvec2 func \ ( \ detail::tvec2 const & x, \ - typename detail::tvec2::T const & y \ + T const & y \ ) \ { \ return detail::tvec2( \ @@ -85,7 +85,7 @@ GLM_FUNC_QUALIFIER detail::tvec3 func \ ( \ detail::tvec3 const & x, \ - typename detail::tvec3::T const & y \ + T const & y \ ) \ { \ return detail::tvec3( \ @@ -99,7 +99,7 @@ GLM_FUNC_QUALIFIER detail::tvec4 func \ ( \ detail::tvec4 const & x, \ - typename detail::tvec4::T const & y \ + T const & y \ ) \ { \ return detail::tvec4( \ diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index ba152c3f..fb74f983 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -641,7 +641,7 @@ namespace detail template GLM_FUNC_QUALIFIER detail::tvec2 step ( - typename detail::tvec2::T const & edge, + T const & edge, detail::tvec2 const & x ) { @@ -653,7 +653,7 @@ namespace detail template GLM_FUNC_QUALIFIER detail::tvec3 step ( - typename detail::tvec3::T const & edge, + T const & edge, detail::tvec3 const & x ) { @@ -666,7 +666,7 @@ namespace detail template GLM_FUNC_QUALIFIER detail::tvec4 step ( - typename detail::tvec4::T const & edge, + T const & edge, detail::tvec4 const & x ) { diff --git a/glm/gtc/noise.inl b/glm/gtc/noise.inl index c0445a37..c1a0a8f8 100644 --- a/glm/gtc/noise.inl +++ b/glm/gtc/noise.inl @@ -502,11 +502,11 @@ namespace glm GLM_FUNC_QUALIFIER T perlin(detail::tvec3 const & Position, detail::tvec3 const & rep) { detail::tvec3 Pi0 = mod(floor(Position), rep); // Integer part, modulo period - detail::tvec3 Pi1 = mod(Pi0 + detail::tvec3(1.0), rep); // Integer part + 1, mod period + detail::tvec3 Pi1 = mod(Pi0 + detail::tvec3(T(1)), rep); // Integer part + 1, mod period Pi0 = mod(Pi0, T(289)); Pi1 = mod(Pi1, T(289)); detail::tvec3 Pf0 = fract(Position); // Fractional part for interpolation - detail::tvec3 Pf1 = Pf0 - detail::tvec3(1.0); // Fractional part - 1.0 + detail::tvec3 Pf1 = Pf0 - detail::tvec3(T(1)); // Fractional part - 1.0 detail::tvec4 ix = detail::tvec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); detail::tvec4 iy = detail::tvec4(Pi0.y, Pi0.y, Pi1.y, Pi1.y); detail::tvec4 iz0(Pi0.z); @@ -521,16 +521,16 @@ namespace glm gx0 = fract(gx0); detail::tvec4 gz0 = detail::tvec4(0.5) - abs(gx0) - abs(gy0); detail::tvec4 sz0 = step(gz0, detail::tvec4(0)); - gx0 -= sz0 * (step(0.0, gx0) - T(0.5)); - gy0 -= sz0 * (step(0.0, gy0) - T(0.5)); + gx0 -= sz0 * (step(T(0), gx0) - T(0.5)); + gy0 -= sz0 * (step(T(0), gy0) - T(0.5)); detail::tvec4 gx1 = ixy1 / T(7); detail::tvec4 gy1 = fract(floor(gx1) / T(7)) - T(0.5); gx1 = fract(gx1); detail::tvec4 gz1 = detail::tvec4(0.5) - abs(gx1) - abs(gy1); - detail::tvec4 sz1 = step(gz1, detail::tvec4(0.0)); - gx1 -= sz1 * (step(0.0, gx1) - T(0.5)); - gy1 -= sz1 * (step(0.0, gy1) - T(0.5)); + detail::tvec4 sz1 = step(gz1, detail::tvec4(T(0))); + gx1 -= sz1 * (step(T(0), gx1) - T(0.5)); + gy1 -= sz1 * (step(T(0), gy1) - T(0.5)); detail::tvec3 g000 = detail::tvec3(gx0.x, gy0.x, gz0.x); detail::tvec3 g100 = detail::tvec3(gx0.y, gy0.y, gz0.y); @@ -599,8 +599,8 @@ namespace glm gz00 = fract(gz00) - T(0.5); detail::tvec4 gw00 = detail::tvec4(0.75) - abs(gx00) - abs(gy00) - abs(gz00); detail::tvec4 sw00 = step(gw00, detail::tvec4(0)); - gx00 -= sw00 * (step(0.0, gx00) - T(0.5)); - gy00 -= sw00 * (step(0.0, gy00) - T(0.5)); + gx00 -= sw00 * (step(T(0), gx00) - T(0.5)); + gy00 -= sw00 * (step(T(0), gy00) - T(0.5)); detail::tvec4 gx01 = ixy01 / T(7); detail::tvec4 gy01 = floor(gx01) / T(7); @@ -610,8 +610,8 @@ namespace glm gz01 = fract(gz01) - T(0.5); detail::tvec4 gw01 = detail::tvec4(0.75) - abs(gx01) - abs(gy01) - abs(gz01); detail::tvec4 sw01 = step(gw01, detail::tvec4(0.0)); - gx01 -= sw01 * (step(0.0, gx01) - T(0.5)); - gy01 -= sw01 * (step(0.0, gy01) - T(0.5)); + gx01 -= sw01 * (step(T(0), gx01) - T(0.5)); + gy01 -= sw01 * (step(T(0), gy01) - T(0.5)); detail::tvec4 gx10 = ixy10 / T(7); detail::tvec4 gy10 = floor(gx10) / T(7); @@ -621,8 +621,8 @@ namespace glm gz10 = fract(gz10) - T(0.5); detail::tvec4 gw10 = detail::tvec4(0.75) - abs(gx10) - abs(gy10) - abs(gz10); detail::tvec4 sw10 = step(gw10, detail::tvec4(0.0)); - gx10 -= sw10 * (step(0.0, gx10) - T(0.5)); - gy10 -= sw10 * (step(0.0, gy10) - T(0.5)); + gx10 -= sw10 * (step(T(0), gx10) - T(0.5)); + gy10 -= sw10 * (step(T(0), gy10) - T(0.5)); detail::tvec4 gx11 = ixy11 / T(7); detail::tvec4 gy11 = floor(gx11) / T(7); @@ -631,9 +631,9 @@ namespace glm gy11 = fract(gy11) - T(0.5); gz11 = fract(gz11) - T(0.5); detail::tvec4 gw11 = detail::tvec4(0.75) - abs(gx11) - abs(gy11) - abs(gz11); - detail::tvec4 sw11 = step(gw11, detail::tvec4(0.0)); - gx11 -= sw11 * (step(0.0, gx11) - T(0.5)); - gy11 -= sw11 * (step(0.0, gy11) - T(0.5)); + detail::tvec4 sw11 = step(gw11, detail::tvec4(T(0))); + gx11 -= sw11 * (step(T(0), gx11) - T(0.5)); + gy11 -= sw11 * (step(T(0), gy11) - T(0.5)); detail::tvec4 g0000(gx00.x, gy00.x, gz00.x, gw00.x); detail::tvec4 g1000(gx00.y, gy00.y, gz00.y, gw00.y); @@ -869,9 +869,9 @@ namespace glm i0.w += static_cast(1) - isYZ.z; // i0 now contains the unique values 0,1,2,3 in each channel - detail::tvec4 i3 = clamp(i0, 0.0, 1.0); - detail::tvec4 i2 = clamp(i0 - 1.0, 0.0, 1.0); - detail::tvec4 i1 = clamp(i0 - 2.0, 0.0, 1.0); + detail::tvec4 i3 = clamp(i0, T(0), T(1)); + detail::tvec4 i2 = clamp(i0 - T(1), T(0), T(1)); + detail::tvec4 i1 = clamp(i0 - T(2), T(0), T(1)); // x0 = x0 - 0.0 + 0.0 * C.xxxx // x1 = x0 - i1 + 0.0 * C.xxxx