-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better symbol fading with texture lookups
- this is simpler than prediction opacity based on current zooming speed - this is smoother: Symbols don't flicker when changing zoom speed or zooming in and out rapidly. fix #590
- Loading branch information
Showing
7 changed files
with
71 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
precision mediump float; | ||
|
||
uniform sampler2D u_texture; | ||
uniform sampler2D u_fadetexture; | ||
uniform lowp float u_opacity; | ||
|
||
varying vec2 v_tex; | ||
varying float v_alpha; | ||
varying vec2 v_fade_tex; | ||
|
||
void main() { | ||
gl_FragColor = texture2D(u_texture, v_tex) * v_alpha; | ||
lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity; | ||
gl_FragColor = texture2D(u_texture, v_tex) * alpha; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
precision mediump float; | ||
|
||
uniform sampler2D u_texture; | ||
uniform sampler2D u_fadetexture; | ||
uniform lowp vec4 u_color; | ||
uniform lowp float u_buffer; | ||
uniform lowp float u_gamma; | ||
|
||
varying vec2 v_tex; | ||
varying float v_alpha; | ||
varying vec2 v_fade_tex; | ||
varying float v_gamma_scale; | ||
|
||
void main() { | ||
lowp float gamma = u_gamma * v_gamma_scale; | ||
lowp float dist = texture2D(u_texture, v_tex).a; | ||
lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * v_alpha; | ||
lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a; | ||
lowp float gamma = u_gamma * v_gamma_scale; | ||
lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha; | ||
gl_FragColor = u_color * alpha; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters