From acfac6eefbb91d74b0ce56478322acebd8a02497 Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 17 Jul 2020 10:13:01 -0400 Subject: [PATCH 1/7] Fix cubic-in-out above .5 --- cubic-in-out.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cubic-in-out.glsl b/cubic-in-out.glsl index 32ce665..1b7fe13 100644 --- a/cubic-in-out.glsl +++ b/cubic-in-out.glsl @@ -1,7 +1,7 @@ float cubicInOut(float t) { return t < 0.5 ? 4.0 * t * t * t - : 0.5 * pow(2.0 * t - 2.0, 3.0) + 1.0; + : 1. - 4.0 * pow(1. - t, 3.0); } #pragma glslify: export(cubicInOut) From 3f952b529bf6d7424eeda2e2c2bf8a1bb1dfdc2e Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 17 Jul 2020 10:24:41 -0400 Subject: [PATCH 2/7] Avoid less than zero to pow call. --- quartic-in-out.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartic-in-out.glsl b/quartic-in-out.glsl index 094ab67..c965fb8 100644 --- a/quartic-in-out.glsl +++ b/quartic-in-out.glsl @@ -1,7 +1,7 @@ float quarticInOut(float t) { return t < 0.5 ? +8.0 * pow(t, 4.0) - : -8.0 * pow(t - 1.0, 4.0) + 1.0; + : -8.0 * pow(1.0 - t , 4.0) + 1.0; } #pragma glslify: export(quarticInOut) From 029472f3146802e5ff730637b5696c80bf23add5 Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 17 Jul 2020 15:37:41 -0400 Subject: [PATCH 3/7] Powerless formulation --- cubic-in-out.glsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cubic-in-out.glsl b/cubic-in-out.glsl index 1b7fe13..5450c5b 100644 --- a/cubic-in-out.glsl +++ b/cubic-in-out.glsl @@ -1,7 +1,9 @@ float cubicInOut(float t) { - return t < 0.5 - ? 4.0 * t * t * t - : 1. - 4.0 * pow(1. - t, 3.0); + if (t < 0.5) { + return 4 * t * t * t + } + float u = 1.0 - t; + return 1.0 - 4.0 * u * u * u; } #pragma glslify: export(cubicInOut) From 84a88bd14ab635b10a44267083bbb2f06db8a2a5 Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 17 Jul 2020 15:38:53 -0400 Subject: [PATCH 4/7] Powerless formulation --- quartic-in-out.glsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quartic-in-out.glsl b/quartic-in-out.glsl index c965fb8..fd30b79 100644 --- a/quartic-in-out.glsl +++ b/quartic-in-out.glsl @@ -1,7 +1,9 @@ float quarticInOut(float t) { - return t < 0.5 - ? +8.0 * pow(t, 4.0) - : -8.0 * pow(1.0 - t , 4.0) + 1.0; + if (t < 0.5) { + return 4 * t * t * t * t + } + float u = 1.0 - t; + return 1.0 - 8.0 * u * u * u * u; } #pragma glslify: export(quarticInOut) From ec171987004027d3592f0e7861b66de6896b7307 Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 17 Jul 2020 15:39:27 -0400 Subject: [PATCH 5/7] Update quartic-in-out.glsl --- quartic-in-out.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartic-in-out.glsl b/quartic-in-out.glsl index fd30b79..bf4d51e 100644 --- a/quartic-in-out.glsl +++ b/quartic-in-out.glsl @@ -1,6 +1,6 @@ float quarticInOut(float t) { if (t < 0.5) { - return 4 * t * t * t * t + return 8.0 * t * t * t * t } float u = 1.0 - t; return 1.0 - 8.0 * u * u * u * u; From a83e5f7d99c8a067e13679894d1d05f410e00d3f Mon Sep 17 00:00:00 2001 From: Ben Schmidt Date: Fri, 17 Jul 2020 16:14:24 -0400 Subject: [PATCH 6/7] fix functions, add debug code --- cubic-in-out.glsl | 8 +++++--- quartic-in-out.glsl | 8 +++++--- quartic-out.glsl | 3 ++- quintic-in-out.glsl | 12 +++++++----- quintic-in.glsl | 6 +++--- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/cubic-in-out.glsl b/cubic-in-out.glsl index 32ce665..63164a7 100644 --- a/cubic-in-out.glsl +++ b/cubic-in-out.glsl @@ -1,7 +1,9 @@ float cubicInOut(float t) { - return t < 0.5 - ? 4.0 * t * t * t - : 0.5 * pow(2.0 * t - 2.0, 3.0) + 1.0; + if (t < 0.5) { + return 4.0 * t * t * t; + } + float u = 1.0 - t; + return 1.0 - 4.0 * u * u * u; } #pragma glslify: export(cubicInOut) diff --git a/quartic-in-out.glsl b/quartic-in-out.glsl index 094ab67..0a6a2e4 100644 --- a/quartic-in-out.glsl +++ b/quartic-in-out.glsl @@ -1,7 +1,9 @@ float quarticInOut(float t) { - return t < 0.5 - ? +8.0 * pow(t, 4.0) - : -8.0 * pow(t - 1.0, 4.0) + 1.0; + if (t < 0.5) { + return 8.0 * t * t * t * t; + } + float u = 1.0 - t; + return 1.0 - 8.0 * u * u * u * u; } #pragma glslify: export(quarticInOut) diff --git a/quartic-out.glsl b/quartic-out.glsl index d488d34..43719eb 100644 --- a/quartic-out.glsl +++ b/quartic-out.glsl @@ -1,5 +1,6 @@ float quarticOut(float t) { - return pow(t - 1.0, 3.0) * (1.0 - t) + 1.0; + float u = 1.0 - t; + return 1.0 - u * u * u * u; } #pragma glslify: export(quarticOut) diff --git a/quintic-in-out.glsl b/quintic-in-out.glsl index 6c9c505..1e2f1dd 100644 --- a/quintic-in-out.glsl +++ b/quintic-in-out.glsl @@ -1,7 +1,9 @@ -float qinticInOut(float t) { - return t < 0.5 - ? +16.0 * pow(t, 5.0) - : -0.5 * pow(2.0 * t - 2.0, 5.0) + 1.0; +float quinticInOut(float t) { + if (t < 0.5) { + return 16.0 * t * t * t * t * t; + } + float u = 1.0 - t; + return 1.0 - 16.0 * u * u * u * u * u; } -#pragma glslify: export(qinticInOut) +#pragma glslify: export(quinticInOut) diff --git a/quintic-in.glsl b/quintic-in.glsl index 3bf24e7..7e0df66 100644 --- a/quintic-in.glsl +++ b/quintic-in.glsl @@ -1,5 +1,5 @@ -float qinticIn(float t) { - return pow(t, 5.0); +float quinticIn(float t) { + return t*t*t*t*t; } -#pragma glslify: export(qinticIn) +#pragma glslify: export(quinticIn) From 4a0320be1fa8e08c1b7f38cdd6995d3865e1b14f Mon Sep 17 00:00:00 2001 From: Ben Schmidt Date: Sat, 18 Jul 2020 12:54:50 -0400 Subject: [PATCH 7/7] fix visual test shader name --- test/visual/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/visual/index.js b/test/visual/index.js index 4a9a6f6..a63889b 100644 --- a/test/visual/index.js +++ b/test/visual/index.js @@ -51,7 +51,7 @@ var shaders = { , sineIn : glslify({ frag: './frag.glsl', vert: './sine-in.glsl' })(gl) } -var linear = glslify({ frag: './blue.glsl', vert: './linear.glsl' })(gl) +var linear = glslify({ frag: './frag.glsl', vert: './linear.glsl' })(gl) var names = Object.keys(shaders) var selected = null var model = mat4.create()