Skip to content

Commit

Permalink
Clamp negative heights to zero in extrusion shaders (#4518)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Mar 29, 2017
1 parent 2c6b5a4 commit 5ace493
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/shaders/fill_extrusion.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ void main() {
#pragma mapbox: initialize lowp float height
#pragma mapbox: initialize highp vec4 color

base = max(0.0, base);
height = max(0.0, height);

float ed = a_edgedistance; // use each attrib in order to not trip a VAO assert
float t = mod(a_normal.x, 2.0);

Expand Down
3 changes: 3 additions & 0 deletions src/shaders/fill_extrusion_pattern.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ void main() {
#pragma mapbox: initialize lowp float base
#pragma mapbox: initialize lowp float height

base = max(0.0, base);
height = max(0.0, height);

float t = mod(a_normal.x, 2.0);
float z = t > 0.0 ? height : base;

Expand Down

0 comments on commit 5ace493

Please sign in to comment.