trying something ahah

This commit is contained in:
Mylloon 2023-05-25 10:43:26 +02:00
parent 1ab6876cad
commit c81125e480
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -7,19 +7,27 @@ uniform float progress;
in vec2 vsoTexCoord; in vec2 vsoTexCoord;
out vec4 fragColor; out vec4 fragColor;
void main() { // Fonction de déformation
vec2 center = vec2(.5); vec2 deform(float progression) {
vec2 center = vec2(0.5);
vec2 offset = vsoTexCoord - center; vec2 offset = vsoTexCoord - center;
float angle = progress * radians(180) * 2; // Torsion
float sinTheta = sin(angle); float angle = offset.y * progression * radians(180) * 2;
float cosTheta = cos(angle); float cosTheta = cos(angle);
vec2 rotatedOffset = vec2(cosTheta * offset.x - sinTheta * offset.y, sinTheta * offset.x + cosTheta * offset.y); float sinTheta = sin(angle);
vec2 twistedOffset = vec2(cosTheta * offset.x - sinTheta * offset.y, sinTheta * offset.x + cosTheta * offset.y);
vec2 distortedTexCoord = center + rotatedOffset; // Vague
float wave = sin(twistedOffset.y * 20);
vec2 deformedUV = twistedOffset + vec2(wave * progression, 0);
vec4 color1 = texture(tex0, vsoTexCoord); return center + deformedUV;
vec4 color2 = texture(tex1, distortedTexCoord); }
void main() {
vec4 color1 = texture(tex0, deform(progress));
vec4 color2 = texture(tex1, deform(1. - progress));
fragColor = mix(color1, color2, smoothstep(0., 1., progress)); fragColor = mix(color1, color2, smoothstep(0., 1., progress));
} }