🚚 Move whirl code to common.glsl

This commit is contained in:
Simon Schneegans
2022-12-19 20:13:55 +01:00
parent 0d3a3ccbb0
commit d32bc74580
2 changed files with 10 additions and 6 deletions
+1 -6
View File
@@ -23,8 +23,6 @@ uniform float uRandomness;
const float ACTOR_SCALE = 2.0;
const float PADDING = ACTOR_SCALE / 2.0 - 0.5;
// The math for the whirling is inspired by this post:
// http://www.geeks3d.com/20110428/shader-library-swirl-post-processing-filter-in-glsl
void main() {
// We simply inverse the progress for opening windows.
float progress = uForOpening ? 1.0 - uProgress : uProgress;
@@ -44,10 +42,7 @@ void main() {
coords += progress * coords / dist * 0.5 * uSuction;
// Apply some whirling.
float angle = pow(1.0 - dist, 2.0) * uTwirl * progress;
float s = sin(angle);
float c = cos(angle);
coords = vec2(dot(coords, vec2(c, -s)), dot(coords, vec2(s, c)));
coords = whirl(coords, uTwirl * progress, 0.0);
// Fade out the window texture.
vec4 oColor = getInputColor(coords + center);