-
Notifications
You must be signed in to change notification settings - Fork 5
/
zoom-fade.yaml
42 lines (40 loc) · 1.61 KB
/
zoom-fade.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import:
- ../space/tile.yaml
styles:
texture-zoom-fade:
doc:
author:
name: Patricio Gonzalez Vivo
twitter: patriciogv
version: 0.0.1
tangram-version: 0.0.7
licence: MIT
description: |
Tile a texture across zoom levels by fading between them
examples:
crosshatch:
url: https://tangrams.github.io/tangram-sandbox/styles/crosshatch.yaml
img: https://tangrams.github.io/tangram-sandbox/styles/crosshatch.png
lines: 76
pericoli:
url: https://tangrams.github.io/tangram-sandbox/styles/pericoli.yaml
img: https://tangrams.github.io/tangram-sandbox/styles/pericoli.png
lines: 121
test:
zoom_fade:
defines:
v_pos: "v_texcoord"
uniforms: { u_tex0: "http://tangrams.github.io/tangram-sandbox/styles/imgs/hatch_1.png" }
blocks:
color: |
color.rgb = vec3(1.);
color.rgb -= TileTexture(u_tex0,1.).a;
mix: space-tile
shaders:
blocks:
global: |
vec4 TileTexture (sampler2D tex, float scale) {
vec2 IN = getTileCoords()*scale;
vec2 OUT = getTileCoords()*scale*2.;
return mix(texture2D(tex,fract(IN)), texture2D(tex,fract(OUT)), fract(u_map_position.z));
}