Improve compatibility with GLES back-end

This commit is contained in:
Edwin Jakobs
2024-03-10 18:39:21 +01:00
parent b9b1b95ca0
commit e3f5e07b86
62 changed files with 182 additions and 195 deletions

View File

@@ -22,7 +22,7 @@ void main() {
float ar = targetSize.y / targetSize.x;
vec4 nb = b.a > 0? b/b.a : vec4(0.0);
vec4 nb = b.a > 0.0? b/b.a : vec4(0.0);
vec2 offset = (nb.rg - vec2(offset))*vec2(gain) * nb.a;
offset = rm * offset * vec2(1.0, ar);

View File

@@ -34,11 +34,11 @@ uniform float blend;
out vec4 o_color;
float getRot(vec2 pos, vec2 b) {
vec2 Res = textureSize(tex0, 0);
vec2 Res = vec2(textureSize(tex0, 0));
vec2 p = b;
float rot = 0.0;
for (int i = 0; i < RotNum; i++) {
rot += dot(texture(tex0, fract((pos + p) / Res.xy)).xy -vec2(0.5), p.yx * vec2(1, -1));
rot += dot(texture(tex0, fract((pos + p) / Res.xy)).xy -vec2(0.5), p.yx * vec2(1.0, -1.0));
p = m * p;
}
return rot / float(RotNum)/dot(b, b);
@@ -46,10 +46,10 @@ float getRot(vec2 pos, vec2 b) {
void main() {
vec2 pos = v_texCoord0 * targetSize;
vec2 Res = textureSize(tex0, 0);
vec2 Res = vec2(textureSize(tex0, 0));
vec2 b = vec2(cos(ang * random), sin(ang * random));
vec2 v = vec2(0);
vec2 v = vec2(0.0);
float bbMax = 0.5 * Res.y;
bbMax *= bbMax;
for (int l = 0; l < 20; l++) {

View File

@@ -18,7 +18,7 @@ void main() {
float ca = cos(radians(rotation));
float sa = sin(radians(rotation));
vec2 ts = textureSize(tex0, 0);
vec2 ts = vec2(textureSize(tex0, 0));
mat2 rm = mat2(1.0, 0.0, 0.0, ts.x / ts.y) * mat2(vec2(ca, sa), vec2(-sa, ca)) * mat2(1.0, 0.0, 0.0, ts.y / ts.x);
vec2 ruv = (uv - blockCenter);
vec2 luv;

View File

@@ -11,11 +11,11 @@ uniform float rotation;
out vec4 o_color;
void main() {
vec2 origin = vec2((xOrigin+1.0)/2.0, (yOrigin+1.0)/2.0);
vec2 ts = textureSize(tex0, 0);
vec2 ts = vec2(textureSize(tex0, 0));
float r = ts.x/ts.y;
vec2 offset = vec2(1.0, r) * vec2(xOffset, yOffset);
vec2 uv = v_texCoord0 - vec2(origin);
float rad = (rotation/180) * 3.1415926535;
float rad = (rotation / 180.0) * 3.1415926535;
vec2 cs0 = vec2(cos(rad), -sin(rad));
vec2 cs1 = vec2(sin(rad), cos(rad));
mat2 rotStep = mat2(cs0, cs1);
@@ -24,7 +24,7 @@ void main() {
vec4 c = texture(tex0, v_texCoord0);
for (int i = 1; i <= repeats; ++i) {
//vec2 s = (uv * (1.0 + zoom) * i) + vec2(0.5);
vec2 s = (rot * uv * pow(1.0 + zoom,i*1.0) )+ vec2(origin) + vec2(offset) * i;
vec2 s = (rot * uv * pow(1.0 + zoom, float(i) * 1.0))+ vec2(origin) + vec2(offset) * float(i);
float f = s.x >= 0.0 && s.y > 0.0 && s.x < 1.0 && s.y < 1.0? 1.0 : 0.0;
vec4 sc = texture(tex0, s) * f;
@@ -34,7 +34,5 @@ void main() {
}
rot *= rotStep;
}
o_color = c;
}

View File

@@ -35,19 +35,19 @@ void main() {
o_output = vec4(0.0);
for (int k = 0; k < 10; ++k ) {
vec2 duv = v_texCoord0;
duv.y += smoothstep(pow(cos(time+k*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.0, v_texCoord0.x)*deformAmplitude * cos((time+k*dk)*deformFrequency);
duv.y += smoothstep(pow(1.0-cos(time+k*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.9, v_texCoord0.x)*deformAmplitude * cos((time+k*dk)*deformFrequency);
duv.y += smoothstep(pow(cos(time+float(k)*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.0, v_texCoord0.x)*deformAmplitude * cos((time+float(k)*dk)*deformFrequency);
duv.y += smoothstep(pow(1.0-cos(time+float(k)*dk+v_texCoord0.y*1.0),10.0)*0.1+0.1, 0.9, v_texCoord0.x)*deformAmplitude * cos((time+float(k)*dk)*deformFrequency);
duv.y += sin(v_texCoord0.x*3.1415926535)*0.0;
float bc = floor(hash22(vec2(time+k*dk, (time+k*dk)*0.1)).x*20.0);
float bc = floor(hash22(vec2(time+float(k)*dk, (time+float(k)*dk)*0.1)).x*20.0);
float gb3 = floor(duv.y*bc)/bc;
vec2 v = hash22(duv.xy*0.003+time+k*dk);
vec2 v2 = hash22(duv.xy*0.03+time+k*dk);
vec2 v2b = hash22(duv.yx*0.03+time+k*dk);
float stretch = (cos(time+k*dk)*0.001+0.002)*0.3+0.001;
vec2 h = hash22(duv.yy*stretch+time+k*dk);
float gap = smoothstep(gapLow, gapHigh, cos(gb3*(gapFrequency+duv.y*gapFrequency + (time+k*dk)*gapFrequency) +duv.x*gapFrequency)) * (cos(gb3)*0.5+0.5);
vec2 v = hash22(duv.xy*0.003+time+float(k)*dk);
vec2 v2 = hash22(duv.xy*0.03+time+float(k)*dk);
vec2 v2b = hash22(duv.yx*0.03+time+float(k)*dk);
float stretch = (cos(time+float(k)*dk)*0.001+0.002)*0.3+0.001;
vec2 h = hash22(duv.yy*stretch+time+float(k)*dk);
float gap = smoothstep(gapLow, gapHigh, cos(gb3*(gapFrequency+duv.y*gapFrequency + (time+float(k)*dk)*gapFrequency) +duv.x*gapFrequency)) * (cos(gb3)*0.5+0.5);
float r = smoothstep(noiseLow, noiseHigh, h.x*gap*v2.x)*1.0;
float g = smoothstep(noiseLow, noiseHigh, h.x*gap*v2.y)*1.0;

View File

@@ -30,8 +30,8 @@ vec4 getVideo(vec2 uv, float amplitude, float seconds) {
float iTime = seconds;
vec2 look = mod(uv, vec2(1.0));
float window = 1.0/(1.0 + 20.0*(look.y-mod(iTime*vfreq, 1.0))*(look.y-mod(iTime*vfreq, 1.)));
look.x = look.x + sin(look.y*pfreq + poffset * 3.1415)/50 *(1.+cos(iTime*hfreq))*window*amplitude;
look.y = mod(look.y, 1.);
look.x = look.x + sin(look.y*pfreq + poffset * 3.1415)/50.0 *(1.0+cos(iTime*hfreq))*window*amplitude;
look.y = mod(look.y, 1.0);
vec4 video = texture(tex0, look);
return video;
@@ -48,11 +48,11 @@ void main() {
float ds = scrollOffset1 - scrollOffset0;
if (aa > 0.0 || ds > 0.0) {
for (int i = 1; i < 16; ++i) {
vec4 lc = getVideo(v_texCoord0 + vec2(0.0, scrollOffset0+ds*i), aa, time-i/(16*60.0));
vec4 lc = getVideo(v_texCoord0 + vec2(0.0, scrollOffset0+ds*float(i)), aa, time-float(i)/(16.0*60.0));
if (!linearInput) {
lc.rgb = pow(lc.rgb, vec3(2.2));
}
c += lc * (3.0/16.0) * aberrationColor(i/16.0);
c += lc * (3.0/16.0) * aberrationColor(float(i)/16.0);
}
o_output = c;
} else {
@@ -63,6 +63,6 @@ void main() {
o_output = lc;
}
if (!linearOutput) {
o_output.rgb = pow(o_output.rgb, vec3(1/2.2));
o_output.rgb = pow(o_output.rgb, vec3(1.0/2.2));
}
}