Circles (GL points) stroke #268
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
precision highp float;
|
||||
#endif
|
||||
uniform mat4 u_mvp;
|
||||
uniform float u_scale;
|
||||
uniform float u_radius;
|
||||
attribute vec2 a_pos;
|
||||
void main() {
|
||||
gl_Position = u_mvp * vec4(a_pos, 0.0, 1.0);
|
||||
gl_PointSize = 2.0 * u_scale / gl_Position.z;
|
||||
gl_PointSize = 2.0 * u_radius / gl_Position.z;
|
||||
}
|
||||
|
||||
$$
|
||||
@@ -17,11 +17,16 @@ $$
|
||||
#ifdef GLES
|
||||
precision highp float;
|
||||
#endif
|
||||
uniform vec4 u_color;
|
||||
uniform vec4 u_fill;
|
||||
uniform float u_radius;
|
||||
uniform vec4 u_stroke;
|
||||
uniform float u_width;
|
||||
void main() {
|
||||
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
|
||||
float r = dot(cxy, cxy);
|
||||
float delta = fwidth(r);
|
||||
float alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);
|
||||
gl_FragColor = u_color * alpha;
|
||||
float edge = 1.0 - u_width / u_radius;
|
||||
float stroke = 1.0 - smoothstep(edge - delta, edge + delta, r);
|
||||
gl_FragColor = mix(u_stroke, u_fill, stroke) * alpha;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,11 @@ $$
|
||||
#ifdef GLES
|
||||
precision highp float;
|
||||
#endif
|
||||
uniform vec4 u_color;
|
||||
uniform float u_scale;
|
||||
uniform vec4 u_fill;
|
||||
uniform float u_radius;
|
||||
uniform vec4 u_stroke;
|
||||
uniform float u_width;
|
||||
varying vec2 v_pos;
|
||||
void main() {
|
||||
gl_FragColor = u_color;
|
||||
gl_FragColor = u_fill;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user