26 lines
645 B
Forth
26 lines
645 B
Forth
|
#version 330
|
||
|
|
||
|
uniform sampler2D tex0;
|
||
|
uniform sampler2D tex1;
|
||
|
uniform float progress;
|
||
|
|
||
|
in vec2 vsoTexCoord;
|
||
|
out vec4 fragColor;
|
||
|
|
||
|
void main() {
|
||
|
vec2 center = vec2(.5);
|
||
|
vec2 offset = vsoTexCoord - center;
|
||
|
|
||
|
float angle = progress * radians(180) * 2;
|
||
|
float sinTheta = sin(angle);
|
||
|
float cosTheta = cos(angle);
|
||
|
vec2 rotatedOffset = vec2(cosTheta * offset.x - sinTheta * offset.y, sinTheta * offset.x + cosTheta * offset.y);
|
||
|
|
||
|
vec2 distortedTexCoord = center + rotatedOffset;
|
||
|
|
||
|
vec4 color1 = texture(tex0, vsoTexCoord);
|
||
|
vec4 color2 = texture(tex1, distortedTexCoord);
|
||
|
|
||
|
fragColor = mix(color1, color2, smoothstep(0., 1., progress));
|
||
|
}
|