Circle map style #122

This commit is contained in:
Emux
2016-12-04 11:25:55 +02:00
parent 2821d8ddb8
commit 3a191fb513
5 changed files with 122 additions and 37 deletions

View File

@@ -2,15 +2,11 @@
precision highp float;
#endif
uniform mat4 u_mvp;
uniform float u_radius;
uniform vec2 u_screen;
uniform float u_scale;
attribute vec2 a_pos;
varying vec2 v_tex;
void
main(){
gl_Position = u_mvp * vec4(a_pos, 0.0, 1.0);
v_tex = a_pos;
void main() {
gl_Position = u_mvp * vec4(a_pos, 0.0, 1.0);
gl_PointSize = 2.0 * u_scale / gl_Position.z;
}
$$
@@ -18,13 +14,10 @@ $$
#ifdef GLES
precision highp float;
#endif
varying vec2 v_tex;
uniform float u_radius;
uniform vec4 u_color;
uniform vec2 u_screen;
void
main(){
float len = 1.0 - length(v_tex - u_screen);
gl_FragColor = u_color * smoothstep(0.0, u_radius, len);
void main() {
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
float r = dot(cxy, cxy);
float len = 1.0 - length(r);
gl_FragColor = u_color * len;
}