summaryrefslogtreecommitdiff
path: root/src/mbgl/shader/pattern.fragment.glsl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-12-04 18:29:42 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-12-04 20:02:50 +0100
commitabafb52f37beb5659efc2105ccd1568e1f754898 (patch)
tree6a60636d3497560ca61e5aae5f6d7061c4f18553 /src/mbgl/shader/pattern.fragment.glsl
parentbff6aeb4da41dee1f5f1cfa0be81b6c257257253 (diff)
downloadqtlocation-mapboxgl-abafb52f37beb5659efc2105ccd1568e1f754898.tar.gz
make most headers private
Diffstat (limited to 'src/mbgl/shader/pattern.fragment.glsl')
-rw-r--r--src/mbgl/shader/pattern.fragment.glsl21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mbgl/shader/pattern.fragment.glsl b/src/mbgl/shader/pattern.fragment.glsl
new file mode 100644
index 0000000000..ba6aed3023
--- /dev/null
+++ b/src/mbgl/shader/pattern.fragment.glsl
@@ -0,0 +1,21 @@
+uniform float u_opacity;
+uniform vec2 u_pattern_tl;
+uniform vec2 u_pattern_br;
+uniform float u_mix;
+
+uniform sampler2D u_image;
+
+varying vec2 v_pos;
+
+void main() {
+
+ vec2 imagecoord = mod(v_pos, 1.0);
+ vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);
+ vec4 color1 = texture2D(u_image, pos);
+
+ vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);
+ vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);
+ vec4 color2 = texture2D(u_image, pos2);
+
+ gl_FragColor = mix(color1, color2, u_mix) * u_opacity;
+}