Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Commit

Permalink
Merge pull request #16 from mapbox/vec4-icecream-float
Browse files Browse the repository at this point in the history
vec4 => float for blur/opacity in circle shader
  • Loading branch information
yhahn authored Jun 10, 2016
2 parents 6bb73bb + f0b94dc commit 291041c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/circle.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ precision mediump float;
#endif

#pragma mapbox: define lowp vec4 color
#pragma mapbox: define lowp vec4 blur
#pragma mapbox: define lowp vec4 opacity
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity

varying vec2 v_extrude;
varying lowp float v_antialiasblur;

void main() {
#pragma mapbox: initialize lowp vec4 color
#pragma mapbox: initialize lowp vec4 blur
#pragma mapbox: initialize lowp vec4 opacity
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity

float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));
gl_FragColor = color * (1.0 - t) * opacity;
Expand Down
8 changes: 4 additions & 4 deletions src/circle.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ attribute vec2 a_pos;

#pragma mapbox: define lowp vec4 color
#pragma mapbox: define mediump float radius
#pragma mapbox: define lowp vec4 blur
#pragma mapbox: define lowp vec4 opacity
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity

varying vec2 v_extrude;
varying lowp float v_antialiasblur;

void main(void) {
#pragma mapbox: initialize lowp vec4 color
#pragma mapbox: initialize mediump float radius
#pragma mapbox: initialize lowp vec4 blur
#pragma mapbox: initialize lowp vec4 opacity
#pragma mapbox: initialize lowp float blur
#pragma mapbox: initialize lowp float opacity

// unencode the extrusion vector that we snuck into the a_pos vector
v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);
Expand Down

0 comments on commit 291041c

Please sign in to comment.