aboutsummaryrefslogtreecommitdiff
path: root/src/render_helpers/shaders/crossfade.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/render_helpers/shaders/crossfade.frag')
-rw-r--r--src/render_helpers/shaders/crossfade.frag31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/render_helpers/shaders/crossfade.frag b/src/render_helpers/shaders/crossfade.frag
new file mode 100644
index 00000000..56280ad2
--- /dev/null
+++ b/src/render_helpers/shaders/crossfade.frag
@@ -0,0 +1,31 @@
+#version 100
+
+precision mediump float;
+
+uniform sampler2D tex_from;
+uniform vec2 tex_from_loc;
+uniform vec2 tex_from_size;
+
+uniform sampler2D tex_to;
+uniform vec2 tex_to_loc;
+uniform vec2 tex_to_size;
+
+uniform float alpha;
+uniform float amount;
+
+uniform vec2 size;
+varying vec2 v_coords;
+
+void main() {
+ vec2 coords_from = (v_coords - tex_from_loc) / tex_from_size;
+ vec2 coords_to = (v_coords - tex_to_loc) / tex_to_size;
+
+ vec4 color_from = texture2D(tex_from, coords_from);
+ vec4 color_to = texture2D(tex_to, coords_to);
+
+ vec4 color = mix(color_from, color_to, amount);
+ color = color * alpha;
+
+ gl_FragColor = color;
+}
+