From 93b0308b1de9672990f5bd3873aa2e9631dee7cc Mon Sep 17 00:00:00 2001 From: Pete Feltham Date: Tue, 14 Nov 2017 21:55:59 +1100 Subject: [PATCH 1/2] Add a blue.glsl fragment shader to get the visual tests working --- test/visual/.gitignore | 1 + test/visual/blue.glsl | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 test/visual/blue.glsl diff --git a/test/visual/.gitignore b/test/visual/.gitignore index 67e6103..d2c1aeb 100644 --- a/test/visual/.gitignore +++ b/test/visual/.gitignore @@ -1,3 +1,4 @@ *.glsl !_base.glsl !frag.glsl +!blue.glsl diff --git a/test/visual/blue.glsl b/test/visual/blue.glsl new file mode 100644 index 0000000..2ce7e2e --- /dev/null +++ b/test/visual/blue.glsl @@ -0,0 +1,5 @@ +precision mediump float; + +void main() { + gl_FragColor = vec4(0.2, 0.6, 0.9, 1.0); +} From 9523fc431f41e9bf441a2c83d9106baa9b4f4149 Mon Sep 17 00:00:00 2001 From: Pete Feltham Date: Tue, 14 Nov 2017 22:11:26 +1100 Subject: [PATCH 2/2] Adjust use of pow(x,y) such that x is never less than zero --- cubic-in-out.glsl | 2 +- quartic-in-out.glsl | 2 +- quartic-out.glsl | 2 +- quintic-in-out.glsl | 2 +- quintic-out.glsl | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cubic-in-out.glsl b/cubic-in-out.glsl index 32ce665..8c5defa 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; + : 0.5 * -pow(2.0 - 2.0 * t, 3.0) + 1.0; } #pragma glslify: export(cubicInOut) diff --git a/quartic-in-out.glsl b/quartic-in-out.glsl index 094ab67..bc026ff 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) diff --git a/quartic-out.glsl b/quartic-out.glsl index d488d34..68b830d 100644 --- a/quartic-out.glsl +++ b/quartic-out.glsl @@ -1,5 +1,5 @@ float quarticOut(float t) { - return pow(t - 1.0, 3.0) * (1.0 - t) + 1.0; + return pow(1.0 - t, 3.0) * (t - 1.0) + 1.0; } #pragma glslify: export(quarticOut) diff --git a/quintic-in-out.glsl b/quintic-in-out.glsl index 6c9c505..85178c3 100644 --- a/quintic-in-out.glsl +++ b/quintic-in-out.glsl @@ -1,7 +1,7 @@ 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; + : -0.5 * pow(2.0 - 2.0 * t, 5.0) + 1.0; } #pragma glslify: export(qinticInOut) diff --git a/quintic-out.glsl b/quintic-out.glsl index 5e9e946..108bfb6 100644 --- a/quintic-out.glsl +++ b/quintic-out.glsl @@ -1,5 +1,5 @@ float qinticOut(float t) { - return 1.0 - (pow(t - 1.0, 5.0)); + return 1.0 - pow(1.0 - t, 5.0); } #pragma glslify: export(qinticOut)