remove old dash support from line shader
This commit is contained in:
@@ -131,7 +131,6 @@ void Painter::renderLine(LineBucket& bucket, util::ptr<StyleLayer> layer_desc, c
|
||||
lineShader->u_blur = blur;
|
||||
|
||||
lineShader->u_color = color;
|
||||
lineShader->u_dasharray = {{ 1, -1 }};
|
||||
|
||||
bucket.drawLines(*lineShader);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ uniform vec2 u_linewidth;
|
||||
uniform vec4 u_color;
|
||||
uniform float u_blur;
|
||||
|
||||
uniform vec2 u_dasharray;
|
||||
|
||||
varying vec2 v_normal;
|
||||
varying float v_linesofar;
|
||||
|
||||
void main() {
|
||||
// Calculate the distance of the pixel from the line in pixels.
|
||||
@@ -16,10 +13,5 @@ void main() {
|
||||
// (v_linewidth.s)
|
||||
float alpha = clamp(min(dist - (u_linewidth.t - u_blur), u_linewidth.s - dist) / u_blur, 0.0, 1.0);
|
||||
|
||||
// Calculate the antialiasing fade factor based on distance to the dash.
|
||||
// Only affects alpha when line is dashed
|
||||
float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);
|
||||
alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));
|
||||
|
||||
gl_FragColor = u_color * alpha;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,9 @@ uniform vec2 u_linewidth;
|
||||
uniform vec4 u_color;
|
||||
|
||||
varying vec2 v_normal;
|
||||
varying float v_linesofar;
|
||||
|
||||
void main() {
|
||||
vec2 a_extrude = a_data.xy;
|
||||
float a_linesofar = a_data.z * 128.0 + a_data.w;
|
||||
|
||||
// We store the texture normals in the most insignificant bit
|
||||
// transform y so that 0 => -1 and 1 => 1
|
||||
@@ -43,5 +41,4 @@ void main() {
|
||||
// because we're extruding the line in pixel space, regardless of the current
|
||||
// tile's zoom level.
|
||||
gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;
|
||||
v_linesofar = a_linesofar * u_ratio;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
UniformMatrix<4> u_exmatrix = {"u_exmatrix", *this};
|
||||
Uniform<std::array<float, 4>> u_color = {"u_color", *this};
|
||||
Uniform<std::array<float, 2>> u_linewidth = {"u_linewidth", *this};
|
||||
Uniform<std::array<float, 2>> u_dasharray = {"u_dasharray", *this};
|
||||
Uniform<float> u_ratio = {"u_ratio", *this};
|
||||
Uniform<float> u_blur = {"u_blur", *this};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user