rename uniforms

This commit is contained in:
do butterflies cry? 2026-02-02 05:02:23 +10:00
parent 1683d2bbe9
commit 53a62f639e
5 changed files with 59 additions and 37 deletions

View file

@ -13,8 +13,8 @@ precision mediump float;
# endif
#endif
uniform float u_time;
uniform vec2 u_resolution;
uniform float uTime;
uniform vec2 uResolution;
/* ==== Text Colouring ==== */
#define PHOSPHOR_COL vec4(196./255., 167./255., 231./255., 1.)
@ -49,9 +49,9 @@ float roundLine(vec2 p, vec2 a, vec2 b) {
b -= a + vec2(1.0,0.);
p -= a;
float f = length(p-clamp(dot(p,b)/dot(b,b),0.0,1.0)*b);
if (u_resolution.y < 320.) // attempt to get rid of aliasing on small resolution
if (uResolution.y < 320.) // attempt to get rid of aliasing on small resolution
return smoothstep(1.0, 0.9, f);
else if (u_resolution.y < 720.)
else if (uResolution.y < 720.)
return smoothstep(0.75, 0.5, f);
else
return smoothstep(1., 0., f);
@ -196,7 +196,7 @@ float vt220Font(vec2 p, float c) {
// https://www.shadertoy.com/view/llSXDV (same author as VT220 font rendering)
//
float textLines(vec2 uvG) {
float wt = 5. * (u_time + 0.5*sin(u_time*1.4) + 0.2*sin(u_time*2.9)); // wobbly time
float wt = 5. * (uTime + 0.5*sin(uTime*1.4) + 0.2*sin(uTime*2.9)); // wobbly time
vec2 uvGt = uvG + vec2(0., floor(wt));
float ll = rand(vec2(uvGt.y, - 1.)) * ROWCOLS.x; // line length
@ -275,7 +275,7 @@ float fbm( in vec2 _st) {
// XXX: TODO: use two shaders, the first on a MUCH lower resolution (one pixel for each text character)
// XXX: TODO: then the second should map those pixel values to higher resolution text characters
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
vec2 uv = gl_FragCoord.xy / uResolution;
vec2 st = uv * SCALE;
// // uvNoise = ceil(uvNoise * ROWCOLS) / ROWCOLS;
@ -295,13 +295,13 @@ void main() {
// gl_FragColor = vt220Font(uvT - uvG * FONT_SIZE, val) * PHOSPHOR_COL + BG_COL;
vec2 q = vec2(
fbm( st + 0.*u_time),
fbm( st + 0.*uTime),
fbm( st + vec2(1.0))
);
vec2 r = vec2(
fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*u_time ),
fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*u_time)
fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*uTime ),
fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*uTime)
);
float f = fbm(st+r);