From a4ebc303979040f4c3a8daf6023671b5329ee967 Mon Sep 17 00:00:00 2001 From: Leonard Francis Coogan Date: Wed, 10 Sep 2025 11:23:28 -0400 Subject: [PATCH] put non-shader sketch in its place --- shader_test/brownian.frag | 69 -------------------- shader_test/shader.frag | 6 -- shader_test/shader.vert | 23 ------- shader_test/sketch.js | 15 ----- shader_test/test.frag | 36 ---------- leaves.js => vanilla/leaves.js | 0 leaves_layers.js => vanilla/leaves_layers.js | 0 7 files changed, 149 deletions(-) delete mode 100644 shader_test/brownian.frag delete mode 100644 shader_test/shader.frag delete mode 100644 shader_test/shader.vert delete mode 100644 shader_test/sketch.js delete mode 100644 shader_test/test.frag rename leaves.js => vanilla/leaves.js (100%) rename leaves_layers.js => vanilla/leaves_layers.js (100%) diff --git a/shader_test/brownian.frag b/shader_test/brownian.frag deleted file mode 100644 index cf753a5..0000000 --- a/shader_test/brownian.frag +++ /dev/null @@ -1,69 +0,0 @@ -/* -Iterated Fractional Brownian Motion -Based on: - http://www.iquilezles.org/www/articles/warp/warp.htm -*/ - -precision mediump float; - -varying vec2 position; -uniform float time; -uniform vec2 resolution; - -// makes a pseudorandom number between 0 and 1 -float hash(float n) { - return fract(sin(n)*93942.234); -} - -// smoothsteps a grid of random numbers at the integers -float noise(vec2 p) { - vec2 w = floor(p); - vec2 k = fract(p); - k = k*k*(3.-2.*k); // smooth it - - float n = w.x + w.y*57.; - - float a = hash(n); - float b = hash(n+1.); - float c = hash(n+57.); - float d = hash(n+58.); - - return mix( - mix(a, b, k.x), - mix(c, d, k.x), - k.y); -} - -// rotation matrix -mat2 m = mat2(0.6,0.8,-0.8,0.6); - -// fractional brownian motion (i.e. photoshop clouds) -float fbm(vec2 p) { - float f = 0.; - f += 0.5000*noise(p); p *= 2.02*m; - f += 0.2500*noise(p); p *= 2.01*m; - f += 0.1250*noise(p); p *= 2.03*m; - f += 0.0625*noise(p); - f /= 0.9375; - return f; -} - -void main() { - // relative coordinates - vec2 p = vec2(position*6.)*vec2(resolution.x/resolution.y, 1.); - float t = time * .009; - - // calling fbm on itself - vec2 a = vec2(fbm(p+t*3.), fbm(p-t*3.+8.1)); - vec2 b = vec2(fbm(p+t*4. + a*7. + 3.1), fbm(p-t*4. + a*7. + 91.1)); - float c = fbm(b*9. + t*20.); - - // increase contrast - c = smoothstep(0.15,0.98,c); - - // mix in some color - vec3 col = vec3(c); - col.rb += b*0.17; - - gl_FragColor = vec4(col, 1.); -} diff --git a/shader_test/shader.frag b/shader_test/shader.frag deleted file mode 100644 index 12a87ae..0000000 --- a/shader_test/shader.frag +++ /dev/null @@ -1,6 +0,0 @@ -precision highp float; - -void main() { - vec4 myColor = vec4(1.0, 0.0, 0.0, 1.0); - gl_FragColor = myColor; -} diff --git a/shader_test/shader.vert b/shader_test/shader.vert deleted file mode 100644 index d161189..0000000 --- a/shader_test/shader.vert +++ /dev/null @@ -1,23 +0,0 @@ -precision highp float; - -attribute vec3 aPosition; - -// The transform of the object being drawn -uniform mat4 uModelViewMatrix; - -// Transforms 3D coordinates to 2D screen coordinates -uniform mat4 uProjectionMatrix; - -// A custom uniform with the time in milliseconds -uniform float time; - -void main() { - // Apply the camera transform - vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0); - - // Use the time to adjust the position of the vertices - viewModelPosition.x += 10.0 * sin(time * 0.01 + viewModelPosition.y * 0.1); - - // Tell WebGL where the vertex goes - gl_Position = uProjectionMatrix * viewModelPosition; -} diff --git a/shader_test/sketch.js b/shader_test/sketch.js deleted file mode 100644 index bc60cbb..0000000 --- a/shader_test/sketch.js +++ /dev/null @@ -1,15 +0,0 @@ -let myShader; -function preload() { -  // load each shader file (don't worry, we will come back to these!) -  myShader = loadShader('shader.vert', 'shader.frag'); -} -function setup() { -  // the canvas has to be created with WEBGL mode -  createCanvas(windowWidth, windowHeight, WEBGL); -} -function draw() { -  // shader() sets the active shader, which will be applied to what is drawn next -  shader(myShader); -  // apply the shader to a rectangle taking up the full canvas - plane(width, height); -} diff --git a/shader_test/test.frag b/shader_test/test.frag deleted file mode 100644 index 847bac7..0000000 --- a/shader_test/test.frag +++ /dev/null @@ -1,36 +0,0 @@ -// Author @patriciogv - 2015 -// http://patriciogonzalezvivo.com -#ifdef GL_ES -precision mediump float; -#endif - -uniform vec2 u_resolution; -uniform float u_time; - -// YUV to RGB matrix -mat3 yuv2rgb = mat3(1.0, 0.0, 1.13983, - 1.0, -0.39465, -0.58060, - 1.0, 2.03211, 0.0); - -// RGB to YUV matrix -mat3 rgb2yuv = mat3(0.2126, 0.7152, 0.0722, - -0.09991, -0.33609, 0.43600, - 0.615, -0.5586, -0.05639); - -void main(){ - vec2 st = gl_FragCoord.xy/u_resolution; - vec3 color = vec3(0.0); - - // UV values goes from -1 to 1 - // So we need to remap st (0.0 to 1.0) - st -= 0.5; // becomes -0.5 to 0.5 - st *= 2.0; // becomes -1.0 to 1.0 - - // we pass st as the y & z values of - // a three dimensional vector to be - // properly multiply by a 3x3 matrix - color = yuv2rgb * vec3(0.5, st.x, st.y); - - gl_FragColor = vec4(color,1.0); -} - diff --git a/leaves.js b/vanilla/leaves.js similarity index 100% rename from leaves.js rename to vanilla/leaves.js diff --git a/leaves_layers.js b/vanilla/leaves_layers.js similarity index 100% rename from leaves_layers.js rename to vanilla/leaves_layers.js