From d1df6c9ee7b74f880b7cfe6865c46112b3e7d300 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 21 May 2014 14:31:24 +0300 Subject: [PATCH 1/9] underscale by 1 zoom level instead of 3 --- src/text/placement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/placement.cpp b/src/text/placement.cpp index dc8a9c6b6..7969df628 100644 --- a/src/text/placement.cpp +++ b/src/text/placement.cpp @@ -13,7 +13,7 @@ using namespace llmr; const int Placement::tileExtent = 4096; const int Placement::glyphSize = 24; // size in pixels of this glyphs in the tile -const float Placement::minScale = 0.125; // underscale by 3 zoom levels +const float Placement::minScale = 0.5; // underscale by 1 zoom level Placement::Placement(int8_t zoom) : zoom(zoom), From cc4af71d44abc33e478e75f7c5aa648791073864 Mon Sep 17 00:00:00 2001 From: Nicki Dlugash Date: Wed, 21 May 2014 13:22:05 -0400 Subject: [PATCH 2/9] updated night hillshade colors and opacity --- bin/style.js | 8 +++++--- src/shader/shaders_gl.cpp | 36 ++++++++++++++++++------------------ src/shader/shaders_gles2.cpp | 36 ++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 39 deletions(-) diff --git a/bin/style.js b/bin/style.js index 7318ce377..6140c0fd6 100644 --- a/bin/style.js +++ b/bin/style.js @@ -2671,7 +2671,7 @@ module.exports = { "antialias": false, "opacity": [ "stops", - {"z": 15, "val": 0.3}, + {"z": 0, "val": 0.3}, {"z": 17, "val": 0.2}, {"z": 18, "val": 0.1} ] @@ -2683,7 +2683,7 @@ module.exports = { "antialias": false, "opacity": [ "stops", - {"z": 15, "val": 0.3}, + {"z": 0, "val": 0.3}, {"z": 17, "val": 0.2}, {"z": 18, "val": 0.1} ] @@ -2695,6 +2695,7 @@ module.exports = { "antialias": false, "opacity": [ "stops", + {"z": 0, "val": 0.7}, {"z": 15, "val": 0.5}, {"z": 17, "val": 0.3}, {"z": 18, "val": 0.1} @@ -2703,10 +2704,11 @@ module.exports = { "hillshade_medium_highlight": { "transition-color": {"duration": 300}, "transition-opacity": {"duration": 300}, - "color": "#ff9280", + "color": "#ffb680", "antialias": false, "opacity": [ "stops", + {"z": 0, "val": 0.6}, {"z": 15, "val": 0.5}, {"z": 17, "val": 0.3}, {"z": 18, "val": 0.1} diff --git a/src/shader/shaders_gl.cpp b/src/shader/shaders_gl.cpp index b053c3761..09508cec1 100644 --- a/src/shader/shaders_gl.cpp +++ b/src/shader/shaders_gl.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n gl_FragColor = (u_color * texture2D (u_image, ((v_tex + \n ((gl_PointCoord - 0.5) * u_size)\n ) / u_dimension)));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "#version 120\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n float tmpvar_1;\n vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n gl_FragColor = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n gl_FragColor = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n gl_FragColor = (texture2D (u_image, v_pos) * u_opacity);\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n gl_FragColor = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif diff --git a/src/shader/shaders_gles2.cpp b/src/shader/shaders_gles2.cpp index 6baf95066..62ae593c3 100644 --- a/src/shader/shaders_gles2.cpp +++ b/src/shader/shaders_gles2.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n mediump vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n mediump float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n mediump vec2 tmpvar_1;\n tmpvar_1 = ((v_tex + (\n (gl_PointCoord - 0.5)\n * u_size)) / u_dimension);\n lowp vec4 tmpvar_2;\n tmpvar_2 = (u_color * texture2D (u_image, tmpvar_1));\n gl_FragColor = tmpvar_2;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "precision highp float;\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp float tmpvar_1;\n highp vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n highp float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n lowp vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n lowp vec4 tmpvar_1;\n tmpvar_1 = (texture2D (u_image, v_pos) * u_opacity);\n gl_FragColor = tmpvar_1;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n lowp float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif From 429850866a58103f5d28dbf89318a910d828a329 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 10:23:09 -0700 Subject: [PATCH 3/9] width functions as constants --- bin/style.js | 947 +++++++++-------------------------- src/shader/shaders_gl.cpp | 36 +- src/shader/shaders_gles2.cpp | 36 +- 3 files changed, 272 insertions(+), 747 deletions(-) diff --git a/bin/style.js b/bin/style.js index 7318ce377..4fd95ff45 100644 --- a/bin/style.js +++ b/bin/style.js @@ -11,7 +11,7 @@ module.exports = { "cap": "round", "type": "line" }, - "admin_level_2": { + "admin_l2": { "source": "outdoors", "layer": "admin", "field": "admin_level", @@ -20,7 +20,7 @@ module.exports = { "cap": "round", "type": "line" }, - "admin_level_3": { + "admin_l3": { "source": "outdoors", "layer": "admin", "field": "admin_level", @@ -1214,12 +1214,12 @@ module.exports = { "bucket": "bridge_major_rail" }, { - "name": "admin_level_3", - "bucket": "admin_level_3" + "name": "admin_l3", + "bucket": "admin_l3" }, { - "name": "admin_level_2", - "bucket": "admin_level_2" + "name": "admin_l2", + "bucket": "admin_l2" }, { "name": "admin_maritime_cover", @@ -1361,7 +1361,50 @@ module.exports = { "street_night": "#0291b5", "contour_night": "#ffff80", - "road_main_width": [ + "motorway_width": [ + "stops", + {"z": 5, "val": 0}, + {"z": 6, "val": 0.5}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 1}, + {"z": 11, "val": 1.2}, + {"z": 12, "val": 2}, + {"z": 13, "val": 3}, + {"z": 14, "val": 4}, + {"z": 15, "val": 6}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "motorway_casing_width": [ + "stops", + {"z": 7.5, "val": 0.6}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 2.8}, + {"z": 11, "val": 3}, + {"z": 12, "val": 4}, + {"z": 13, "val": 5}, + {"z": 14, "val": 6.5}, + {"z": 15, "val": 9}, + {"z": 16, "val": 12}, + {"z": 17, "val": 15}, + {"z": 18, "val": 17} + ], + "motorway_link_width": [ + "stops", + {"z": 12, "val": 1.2}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3}, + {"z": 18, "val": 4} + ], + "motorway_link_casing_width": [ + "stops", + {"z": 12, "val": 2.8}, + {"z": 14, "val": 3.5}, + {"z": 16, "val": 5}, + {"z": 18, "val": 6} + ], + "main_width": [ "stops", {"z": 5, "val": 1}, {"z": 12, "val": 1}, @@ -1371,7 +1414,113 @@ module.exports = { {"z": 16, "val": 6}, {"z": 17, "val": 10}, {"z": 18, "val": 12} + ], + "main_casing_width": [ + "stops", + {"z": 9, "val": 2.9}, + {"z": 12, "val": 2.9}, + {"z": 13, "val": 3.5}, + {"z": 14, "val": 4}, + {"z": 15, "val": 5.5}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "street_width": [ + "stops", + {"z": 14.5, "val": 0}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 3}, + {"z": 17, "val": 8} + ], + "street_casing_width": [ + "stops", + {"z": 13,"val": 0.4}, + {"z": 14, "val": 1}, + {"z": 15, "val": 2.5}, + {"z": 16, "val": 4}, + {"z": 17, "val": 10} + ], + "service_casing_width": [ + "stops", + {"z": 14, "val": 0.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 18, "val": 5}, + {"z": 19, "val": 6} + ], + "runway_width": [ + "stops", + {"z": 10, "val": 1}, + {"z": 11, "val": 2}, + {"z": 12, "val": 3}, + {"z": 13, "val": 5}, + {"z": 14, "val": 7}, + {"z": 15, "val": 11}, + {"z": 16, "val": 15}, + {"z": 17, "val": 19}, + {"z": 18, "val": 23} + ], + "taxiway_width": [ + "stops", + {"z": 10, "val": 0.2}, + {"z": 12, "val": 0.2}, + {"z": 13, "val": 1}, + {"z": 14, "val": 1.5}, + {"z": 15, "val": 2}, + {"z": 16, "val": 3}, + {"z": 17, "val": 4}, + {"z": 18,"val": 5} + ], + "aerialway_width": [ + "stops", + {"z": 13.5, "val": 0.8}, + {"z": 14, "val": 1.4}, + {"z": 15, "val": 1.6}, + {"z": 16, "val": 2}, + {"z": 17, "val": 2.4}, + {"z": 18, "val": 3} + ], + "aerialway_casing_width": [ + "stops", + {"z": 13.5, "val": 2}, + {"z": 14, "val": 2.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 22, "val": 5} + ], + "path_width": [ + "stops", + {"z": 14, "val": 1.2}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 1.8} + ], + "admin_l2_width": [ + "stops", + {"z": 2, "val": 0.5}, + {"z": 3, "val": 0.7}, + {"z": 4, "val": 0.7}, + {"z": 5, "val": 0.8}, + {"z": 6, "val": 1}, + {"z": 8, "val": 2}, + {"z": 10, "val": 3} + ], + "admin_l3_width": [ + "stops", + {"z": 6, "val": 0.6}, + {"z": 8, "val": 1}, + {"z": 12, "val": 2} + ], + "road_label_size": [ + "stops", + {"z": 0, "val": 12}, + {"z": 14, "val": 12}, + {"z": 15, "val": 13}, + {"z": 22, "val": 13} ] + }, "classes": [ { @@ -1396,21 +1545,12 @@ module.exports = { {"z": 12, "val": 3} ] }, - "admin_level_2": { + "admin_l2": { "transition-color": {"duration": 300}, "color": "#88a", - "width": [ - "stops", - {"z": 2, "val": 0.5}, - {"z": 3, "val": 0.7}, - {"z": 4, "val": 0.7}, - {"z": 5, "val": 0.8}, - {"z": 6, "val": 1}, - {"z": 8, "val": 2}, - {"z": 10, "val": 3} - ] + "width": "admin_l2_width" }, - "admin_level_3": { + "admin_l3": { "transition-color": {"duration": 300}, "color": "#88a", "dasharray": [ @@ -1422,12 +1562,7 @@ module.exports = { {"z": 4, "val": 0}, {"z": 6, "val": 1} ], - "width": [ - "stops", - {"z": 6, "val": 0.6}, - {"z": 8, "val": 1}, - {"z": 12, "val": 2} - ] + "width": "admin_l3_width" }, "waterway_river_canal": { "transition-color": {"duration": 300}, @@ -1634,33 +1769,12 @@ module.exports = { "aeroway_runway": { "transition-color": {"duration": 300}, "color": "#ddd", - "width": [ - "stops", - {"z": 10, "val": 1}, - {"z": 11, "val": 2}, - {"z": 12, "val": 3}, - {"z": 13, "val": 5}, - {"z": 14, "val": 7}, - {"z": 15, "val": 11}, - {"z": 16, "val": 15}, - {"z": 17, "val": 19}, - {"z": 18, "val": 23} - ] + "width": "runway_width" }, "aeroway_taxiway": { "transition-color": {"duration": 300}, "color": "#ddd", - "width": [ - "stops", - {"z": 10, "val": 0.2}, - {"z": 12, "val": 0.2}, - {"z": 13, "val": 1}, - {"z": 14, "val": 1.5}, - {"z": 15, "val": 2}, - {"z": 16, "val": 3}, - {"z": 17, "val": 4}, - {"z": 18,"val": 5} - ] + "width": "taxiway_width" }, "building": { "transition-color": {"duration": 300}, @@ -1699,20 +1813,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -1722,21 +1823,7 @@ module.exports = { "tunnel_motorway": { "transition-color": {"duration": 300}, "color": "#e6cec7", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -1750,17 +1837,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -1769,17 +1846,7 @@ module.exports = { "tunnel_main": { "transition-color": {"duration": 300}, "color": "#e6cec7", - "width": [ - "stops", - {"z": 5, "val": 1}, - {"z": 12, "val": 1}, - {"z": 13, "val": 1.5}, - {"z": 14, "val": 2}, - {"z": 15, "val": 3}, - {"z": 16, "val": 6}, - {"z": 17, "val": 10}, - {"z": 18, "val": 12} - ], + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -1793,47 +1860,22 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "tunnel_motorway_link": { "transition-color": {"duration": 300}, "color": "#e6cec7", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "tunnel_street_casing": { "transition-color": {"duration": 300}, "color": "#d9d5c6", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "tunnel_street": { "transition-color": {"duration": 300}, "color": "#d9d5c6", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "tunnel_service_casing": { "transition-color": {"duration": 300}, @@ -1843,15 +1885,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "tunnel_service": { "transition-color": {"duration": 300}, @@ -1861,20 +1895,7 @@ module.exports = { "road_motorway_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -1884,21 +1905,7 @@ module.exports = { "road_motorway": { "transition-color": {"duration": 300}, "color": "motorway", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -1908,17 +1915,7 @@ module.exports = { "road_main_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -1927,7 +1924,7 @@ module.exports = { "road_main": { "transition-color": {"duration": 300}, "color": "main", - "width": "road_main_width", + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -1937,61 +1934,28 @@ module.exports = { "road_motorway_link_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "road_motorway_link": { "transition-color": {"duration": 300}, "color": "motorway", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "road_street_casing": { "transition-color": {"duration": 300}, "color": "#d9d5c6", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "road_street": { "transition-color": {"duration": 300}, "color": "street", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "road_service_casing": { "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "road_service": { "transition-color": {"duration": 300}, @@ -2016,12 +1980,7 @@ module.exports = { 10, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_path": { "transition-color": {"duration": 300}, @@ -2045,12 +2004,7 @@ module.exports = { 10, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_mtb": { "transition-color": {"duration": 300}, @@ -2059,12 +2013,7 @@ module.exports = { 12, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_piste": { "transition-color": {"duration": 300}, @@ -2073,12 +2022,7 @@ module.exports = { 8, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_steps": { "transition-color": {"duration": 300}, @@ -2106,20 +2050,7 @@ module.exports = { "bridge_motorway_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -2129,21 +2060,7 @@ module.exports = { "bridge_motorway": { "transition-color": {"duration": 300}, "color": "motorway", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -2153,17 +2070,7 @@ module.exports = { "bridge_main_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -2172,17 +2079,7 @@ module.exports = { "bridge_main": { "transition-color": {"duration": 300}, "color": "main", - "width": [ - "stops", - {"z": 5, "val": 1}, - {"z": 12, "val": 1}, - {"z": 13, "val": 1.5}, - {"z": 14, "val": 2}, - {"z": 15, "val": 3}, - {"z": 16, "val": 6}, - {"z": 17, "val": 10}, - {"z": 18, "val": 12} - ], + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -2192,61 +2089,28 @@ module.exports = { "bridge_motorway_link_casing": { "transition-color": {"duration": 300}, "color": "case", - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "bridge_motorway_link": { "transition-color": {"duration": 300}, "color": "motorway", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "bridge_street_casing": { "transition-color": {"duration": 300}, "color": "#d9d5c6", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "bridge_street": { "transition-color": {"duration": 300}, "color": "street", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "bridge_service_casing": { "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "bridge_service": { "transition-color": {"duration": 300}, @@ -2257,29 +2121,13 @@ module.exports = { "transition-color": {"duration": 300}, "color": "white", "opacity": 0.5, - "width": [ - "stops", - {"z": 13.5, "val": 2}, - {"z": 14, "val": 2.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 22, "val": 5} - ] + "width": "aerialway_casing_width" }, "bridge_aerialway": { "transition-color": {"duration": 300}, "color": "#876", "opacity": 0.5, - "width": [ - "stops", - {"z": 13.5, "val": 0.8}, - {"z": 14, "val": 1.4}, - {"z": 15, "val": 1.6}, - {"z": 16, "val": 2}, - {"z": 17, "val": 2.4}, - {"z": 18, "val": 3} - ] + "width": "aerialway_width" }, "country_label": { "transition-color": {"duration": 300}, @@ -2437,13 +2285,7 @@ module.exports = { "stroke": "land", "strokeWidth": 0.6, "strokeBlur": 2, - "size": [ - "stops", - {"z": 0, "val": 12}, - {"z": 14, "val": 12}, - {"z": 15, "val": 13}, - {"z": 22, "val": 13} - ] + "size": "road_label_size" }, "water_label": { "transition-color": {"duration": 300}, @@ -2501,21 +2343,12 @@ module.exports = { {"z": 12, "val": 3} ] }, - "admin_level_2": { + "admin_l2": { "transition-color": {"duration": 300}, "color": "#88a", - "width": [ - "stops", - {"z": 2, "val": 0.5}, - {"z": 3, "val": 0.7}, - {"z": 4, "val": 0.7}, - {"z": 5, "val": 0.8}, - {"z": 6, "val": 1}, - {"z": 8, "val": 2}, - {"z": 10, "val": 3} - ] + "width": "admin_l2_width" }, - "admin_level_3": { + "admin_l3": { "transition-color": {"duration": 300}, "color": "#88a", "dasharray": [ @@ -2527,12 +2360,7 @@ module.exports = { {"z": 4, "val": 0}, {"z": 6, "val": 1} ], - "width": [ - "stops", - {"z": 6, "val": 0.6}, - {"z": 8, "val": 1}, - {"z": 12, "val": 2} - ] + "width": "admin_l3_width" }, "waterway_river_canal": { "transition-color": {"duration": 300}, @@ -2747,33 +2575,12 @@ module.exports = { "aeroway_runway": { "transition-color": {"duration": 300}, "color": "#ddd", - "width": [ - "stops", - {"z": 10, "val": 1}, - {"z": 11, "val": 2}, - {"z": 12, "val": 3}, - {"z": 13, "val": 5}, - {"z": 14, "val": 7}, - {"z": 15, "val": 11}, - {"z": 16, "val": 15}, - {"z": 17, "val": 19}, - {"z": 18, "val": 23} - ] + "width": "runway_width" }, "aeroway_taxiway": { "transition-color": {"duration": 300}, "color": "#ddd", - "width": [ - "stops", - {"z": 10, "val": 0.2}, - {"z": 12, "val": 0.2}, - {"z": 13, "val": 1}, - {"z": 14, "val": 1.5}, - {"z": 15, "val": 2}, - {"z": 16, "val": 3}, - {"z": 17, "val": 4}, - {"z": 18,"val": 5} - ] + "width": "taxiway_width" }, "building": { "transition-color": {"duration": 300}, @@ -2810,20 +2617,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -2833,21 +2627,7 @@ module.exports = { "tunnel_motorway": { "transition-color": {"duration": 300}, "color": "#83b9c8", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -2861,17 +2641,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -2880,17 +2650,7 @@ module.exports = { "tunnel_main": { "transition-color": {"duration": 300}, "color": "#e6cec7", - "width": [ - "stops", - {"z": 5, "val": 1}, - {"z": 12, "val": 1}, - {"z": 13, "val": 1.5}, - {"z": 14, "val": 2}, - {"z": 15, "val": 3}, - {"z": 16, "val": 6}, - {"z": 17, "val": 10}, - {"z": 18, "val": 12} - ], + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -2904,47 +2664,22 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "tunnel_motorway_link": { "transition-color": {"duration": 300}, "color": "#e6cec7", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "tunnel_street_casing": { "transition-color": {"duration": 300}, "color": "street_case_night", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "tunnel_street": { "transition-color": {"duration": 300}, "color": "street_case_night", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "tunnel_service_casing": { "transition-color": {"duration": 300}, @@ -2954,15 +2689,7 @@ module.exports = { 6, 6 ], - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "tunnel_service": { "transition-color": {"duration": 300}, @@ -2972,20 +2699,7 @@ module.exports = { "road_motorway_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -2995,21 +2709,7 @@ module.exports = { "road_motorway": { "transition-color": {"duration": 300}, "color": "motorway_night", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -3019,17 +2719,7 @@ module.exports = { "road_main_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -3038,17 +2728,7 @@ module.exports = { "road_main": { "transition-color": {"duration": 300}, "color": "main_night", - "width": [ - "stops", - {"z": 5, "val": 1}, - {"z": 12, "val": 1}, - {"z": 13, "val": 1.5}, - {"z": 14, "val": 2}, - {"z": 15, "val": 3}, - {"z": 16, "val": 6}, - {"z": 17, "val": 10}, - {"z": 18, "val": 12} - ], + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -3058,61 +2738,28 @@ module.exports = { "road_motorway_link_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "road_motorway_link": { "transition-color": {"duration": 300}, "color": "motorway_night", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "road_street_casing": { "transition-color": {"duration": 300}, "color": "street_case_night", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "road_street": { "transition-color": {"duration": 300}, "color": "street_night", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "road_service_casing": { "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "road_service": { "transition-color": {"duration": 300}, @@ -3130,12 +2777,7 @@ module.exports = { 10, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_path": { "transition-color": {"duration": 300}, @@ -3159,12 +2801,7 @@ module.exports = { 10, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_mtb": { "transition-color": {"duration": 300}, @@ -3173,12 +2810,7 @@ module.exports = { 12, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_piste": { "transition-color": {"duration": 300}, @@ -3187,12 +2819,7 @@ module.exports = { 8, 4 ], - "width": [ - "stops", - {"z": 14, "val": 1.2}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 1.8} - ] + "width": "path_width" }, "road_path_steps": { "transition-color": {"duration": 300}, @@ -3220,20 +2847,7 @@ module.exports = { "bridge_motorway_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 7.5, "val": 0.6}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 2.8}, - {"z": 11, "val": 3}, - {"z": 12, "val": 4}, - {"z": 13, "val": 5}, - {"z": 14, "val": 6.5}, - {"z": 15, "val": 9}, - {"z": 16, "val": 12}, - {"z": 17, "val": 15}, - {"z": 18, "val": 17} - ], + "width": "motorway_casing_width", "opacity": [ "stops", {"z": 9.5, "val": 0}, @@ -3243,21 +2857,7 @@ module.exports = { "bridge_motorway": { "transition-color": {"duration": 300}, "color": "motorway_night", - "width": [ - "stops", - {"z": 5, "val": 0}, - {"z": 6, "val": 0.5}, - {"z": 8, "val": 0.8}, - {"z": 10, "val": 1}, - {"z": 11, "val": 1.2}, - {"z": 12, "val": 2}, - {"z": 13, "val": 3}, - {"z": 14, "val": 4}, - {"z": 15, "val": 6}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "motorway_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -3267,17 +2867,7 @@ module.exports = { "bridge_main_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 9, "val": 2.9}, - {"z": 12, "val": 2.9}, - {"z": 13, "val": 3.5}, - {"z": 14, "val": 4}, - {"z": 15, "val": 5.5}, - {"z": 16, "val": 9}, - {"z": 17, "val": 12}, - {"z": 18, "val": 14} - ], + "width": "main_casing_width", "opacity": ["stops", {"z": 9, "val": 0}, {"z": 10, "val": 1} @@ -3286,17 +2876,7 @@ module.exports = { "bridge_main": { "transition-color": {"duration": 300}, "color": "main_night", - "width": [ - "stops", - {"z": 5, "val": 1}, - {"z": 12, "val": 1}, - {"z": 13, "val": 1.5}, - {"z": 14, "val": 2}, - {"z": 15, "val": 3}, - {"z": 16, "val": 6}, - {"z": 17, "val": 10}, - {"z": 18, "val": 12} - ], + "width": "main_width", "opacity": [ "stops", {"z": 6.5, "val": 0}, @@ -3306,61 +2886,28 @@ module.exports = { "bridge_motorway_link_casing": { "transition-color": {"duration": 300}, "color": "case_night", - "width": [ - "stops", - {"z": 12, "val": 2.8}, - {"z": 14, "val": 3.5}, - {"z": 16, "val": 5}, - {"z": 18, "val": 6} - ] + "width": "motorway_link_casing_width" }, "bridge_motorway_link": { "transition-color": {"duration": 300}, "color": "motorway_night", - "width": [ - "stops", - {"z": 12, "val": 1.2}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3}, - {"z": 18, "val": 4} - ] + "width": "motorway_link_width" }, "bridge_street_casing": { "transition-color": {"duration": 300}, "color": "street_case_night", - "width": [ - "stops", - {"z": 13,"val": 0.4}, - {"z": 14, "val": 1}, - {"z": 15, "val": 2.5}, - {"z": 16, "val": 4}, - {"z": 17, "val": 10} - ] + "width": "street_casing_width" }, "bridge_street": { "transition-color": {"duration": 300}, "color": "street_night", - "width": [ - "stops", - {"z": 14.5, "val": 0}, - {"z": 15, "val": 1.5}, - {"z": 16, "val": 3}, - {"z": 17, "val": 8} - ] + "width": "street_width" }, "bridge_service_casing": { "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, - "width": [ - "stops", - {"z": 14, "val": 0.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 18, "val": 5}, - {"z": 19, "val": 6} - ] + "width": "service_casing_width" }, "bridge_service": { "transition-color": {"duration": 300}, @@ -3371,29 +2918,13 @@ module.exports = { "transition-color": {"duration": 300}, "color": "white", "opacity": 0.5, - "width": [ - "stops", - {"z": 13.5, "val": 2}, - {"z": 14, "val": 2.5}, - {"z": 15, "val": 3}, - {"z": 16, "val": 3.5}, - {"z": 17, "val": 4}, - {"z": 22, "val": 5} - ] + "width": "aerialway_casing_width" }, "bridge_aerialway": { "transition-color": {"duration": 300}, "color": "#876", "opacity": 0.5, - "width": [ - "stops", - {"z": 13.5, "val": 0.8}, - {"z": 14, "val": 1.4}, - {"z": 15, "val": 1.6}, - {"z": 16, "val": 2}, - {"z": 17, "val": 2.4}, - {"z": 18, "val": 3} - ] + "width": "aerialway_width" }, "country_label": { "transition-color": {"duration": 300}, @@ -3553,13 +3084,7 @@ module.exports = { "stroke": "text_stroke_night", "strokeWidth": 0.5, "strokeBlur": 3, - "size": [ - "stops", - {"z": 0, "val": 12}, - {"z": 14, "val": 12}, - {"z": 15, "val": 13}, - {"z": 22, "val": 13} - ] + "size": "road_label_size" }, "water_label": { "transition-color": {"duration": 300}, diff --git a/src/shader/shaders_gl.cpp b/src/shader/shaders_gl.cpp index b053c3761..09508cec1 100644 --- a/src/shader/shaders_gl.cpp +++ b/src/shader/shaders_gl.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n gl_FragColor = (u_color * texture2D (u_image, ((v_tex + \n ((gl_PointCoord - 0.5) * u_size)\n ) / u_dimension)));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "#version 120\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n float tmpvar_1;\n vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n gl_FragColor = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n gl_FragColor = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n gl_FragColor = (texture2D (u_image, v_pos) * u_opacity);\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n gl_FragColor = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif diff --git a/src/shader/shaders_gles2.cpp b/src/shader/shaders_gles2.cpp index 6baf95066..62ae593c3 100644 --- a/src/shader/shaders_gles2.cpp +++ b/src/shader/shaders_gles2.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n mediump vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n mediump float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n mediump vec2 tmpvar_1;\n tmpvar_1 = ((v_tex + (\n (gl_PointCoord - 0.5)\n * u_size)) / u_dimension);\n lowp vec4 tmpvar_2;\n tmpvar_2 = (u_color * texture2D (u_image, tmpvar_1));\n gl_FragColor = tmpvar_2;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "precision highp float;\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp float tmpvar_1;\n highp vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n highp float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n lowp vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n lowp vec4 tmpvar_1;\n tmpvar_1 = (texture2D (u_image, v_pos) * u_opacity);\n gl_FragColor = tmpvar_1;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n lowp float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif From 05f309ac22fae3c73f9aa907b4d4fd9b88f9c849 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 10:38:26 -0700 Subject: [PATCH 4/9] more constants --- bin/style.js | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/bin/style.js b/bin/style.js index f9304059c..88026c150 100644 --- a/bin/style.js +++ b/bin/style.js @@ -1361,6 +1361,20 @@ module.exports = { "street_night": "#0291b5", "contour_night": "#ffff80", + "river_canal_width": [ + "stops", + {"z": 11, "val": 0.5}, + {"z": 12, "val": 1}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3} + ], + "stream_width": [ + "stops", + {"z": 13, "val": 0.25}, + {"z": 14, "val": 0.5}, + {"z": 16, "val": 1.5}, + {"z": 18, "val": 2} + ], "motorway_width": [ "stops", {"z": 5, "val": 0}, @@ -1567,24 +1581,12 @@ module.exports = { "waterway_river_canal": { "transition-color": {"duration": 300}, "color": "#87abaf", - "width": [ - "stops", - {"z": 11, "val": 0.5}, - {"z": 12, "val": 1}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3} - ] + "width": "river_canal_width" }, "waterway_stream": { "transition-color": {"duration": 300}, "color": "#87abaf", - "width": [ - "stops", - {"z": 13, "val": 0.25}, - {"z": 14, "val": 0.5}, - {"z": 16, "val": 1.5}, - {"z": 18, "val": 2} - ] + "width": "stream_width" }, "landcover_wood": { "transition-color": {"duration": 300}, @@ -2365,24 +2367,12 @@ module.exports = { "waterway_river_canal": { "transition-color": {"duration": 300}, "color": "rgb(10,20,71)", - "width": [ - "stops", - {"z": 11, "val": 0.5}, - {"z": 12, "val": 1}, - {"z": 14, "val": 2}, - {"z": 16, "val": 3} - ] + "width": "river_canal_width" }, "waterway_stream": { "transition-color": {"duration": 300}, "color": "rgb(10,20,71)", - "width": [ - "stops", - {"z": 13, "val": 0.25}, - {"z": 14, "val": 0.5}, - {"z": 16, "val": 1.5}, - {"z": 18, "val": 2} - ] + "width": "stream_width" }, "landcover_wood": { "transition-color": {"duration": 300}, From 61dc88bfec04af5b00d6e2045522d2858e9b9466 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 11:25:01 -0700 Subject: [PATCH 5/9] add barrier_line styles --- bin/style.js | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/bin/style.js b/bin/style.js index 88026c150..16c0e76ac 100644 --- a/bin/style.js +++ b/bin/style.js @@ -297,6 +297,13 @@ module.exports = { "value": "land", "type": "line" }, + "barrier_line_land_fill": { + "source": "outdoors", + "layer": "barrier_line", + "field": "class", + "value": "land", + "type": "fill" + }, "barrier_line_cliff": { "source": "outdoors", "layer": "barrier_line", @@ -949,6 +956,10 @@ module.exports = { "name": "barrier_line_land", "bucket": "barrier_line_land" }, + { + "name": "barrier_line_land_fill", + "bucket": "barrier_line_land_fill" + }, { "name": "barrier_line_cliff", "bucket": "barrier_line_cliff" @@ -1533,8 +1544,29 @@ module.exports = { {"z": 14, "val": 12}, {"z": 15, "val": 13}, {"z": 22, "val": 13} + ], + "fence_width": [ + "stops", + {"z": 17, "val": 0.6}, + {"z": 19, "val": 1} + ], + "hedge_width": [ + "stops", + {"z": 16, "val": 0.6}, + {"z": 17, "val": 1.2}, + {"z": 19, "val": 1.6} + ], + "barrier_line_land_width": [ + "stops", + {"z": 14, "val": 0.4}, + {"z": 15, "val": 0.75}, + {"z": 16, "val": 1.5}, + {"z": 17, "val": 3}, + {"z": 18, "val": 6}, + {"z": 19, "val": 12}, + {"z": 20, "val": 24}, + {"z": 21, "val": 48} ] - }, "classes": [ { @@ -1588,6 +1620,29 @@ module.exports = { "color": "#87abaf", "width": "stream_width" }, + "barrier_line_gate": { + "width": 2.5, + "color": "#aab" + }, + "barrier_line_fence": { + "color": "#aeada3", + "width": "fence_width" + }, + "barrier_line_hedge": { + "color": "#8de99b", + "width": "hedge_width" + }, + "barrier_line_land": { + "color": "land", + "width": "barrier_line_land_width" + }, + "barrier_line_land_fill": { + "color": "land" + }, + "barrier_line_cliff": { + "color": "#987", + "width": 4 + }, "landcover_wood": { "transition-color": {"duration": 300}, "color": "wood", @@ -2374,6 +2429,29 @@ module.exports = { "color": "rgb(10,20,71)", "width": "stream_width" }, + "barrier_line_gate": { + "width": 2.5, + "color": "#aab" + }, + "barrier_line_fence": { + "color": "#024e64", + "width": "fence_width" + }, + "barrier_line_hedge": { + "color": "#3aab79", + "width": "hedge_width" + }, + "barrier_line_land": { + "color": "land_night", + "width": "barrier_line_land_width" + }, + "barrier_line_land_fill": { + "color": "land_night" + }, + "barrier_line_cliff": { + "color": "#63574b", + "width": 4 + }, "landcover_wood": { "transition-color": {"duration": 300}, "color": "wood_night", From 3d7906e590d0e4e194e3ddd7767a5f340c135733 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 12:04:26 -0700 Subject: [PATCH 6/9] lighten night admin color --- bin/style.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/style.js b/bin/style.js index 16c0e76ac..a91d0df37 100644 --- a/bin/style.js +++ b/bin/style.js @@ -2402,12 +2402,12 @@ module.exports = { }, "admin_l2": { "transition-color": {"duration": 300}, - "color": "#88a", + "color": "#ccc", "width": "admin_l2_width" }, "admin_l3": { "transition-color": {"duration": 300}, - "color": "#88a", + "color": "#ccc", "dasharray": [ 60, 20 From 9626f3057b3cccce8250749ee40936f2c44e07e1 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 14:36:50 -0700 Subject: [PATCH 7/9] night style updates --- bin/style.js | 74 +++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/bin/style.js b/bin/style.js index a91d0df37..04cafa87b 100644 --- a/bin/style.js +++ b/bin/style.js @@ -1352,7 +1352,7 @@ module.exports = { "grass_night": "#23948a", "scrub_night": "#31a186", "wood_night": "#45b581", - "park_night": "#6ad0a1", + "park_night": "#51bd8b", "snow_night": "#5ad9fe", "rock_night": "#999", "sand_night": "#437162", @@ -1362,14 +1362,15 @@ module.exports = { "hospital_night": "#015e7a", "builtup_night": "#014b60", + "admin_night": "#ffb680", "text_night": "#fff", "text_stroke_night": "#103", - "case_night": "#026986", - "street_case_night": "#056585", + "case_night": "#015e7a", + "street_case_night": "#015b76", "motorway_night": "#eee", - "main_night": "#95ccdb", - "street_night": "#0291b5", + "main_night": "#64b2c9", + "street_night": "#0186ac", "contour_night": "#ffff80", "river_canal_width": [ @@ -2387,12 +2388,12 @@ module.exports = { }, "admin_maritime_cover": { "transition-color": {"duration": 300}, - "color": "water_night", + "color": "#0a1347", "width": 5 }, "admin_maritime": { "transition-color": {"duration": 300}, - "color": "water_night", + "color": "#0a1347", "width": [ "stops", {"z": 6, "val": 1}, @@ -2402,12 +2403,12 @@ module.exports = { }, "admin_l2": { "transition-color": {"duration": 300}, - "color": "#ccc", + "color": "admin_night", "width": "admin_l2_width" }, "admin_l3": { "transition-color": {"duration": 300}, - "color": "#ccc", + "color": "admin_night", "dasharray": [ 60, 20 @@ -2431,14 +2432,14 @@ module.exports = { }, "barrier_line_gate": { "width": 2.5, - "color": "#aab" + "color": "#59596f" }, "barrier_line_fence": { - "color": "#024e64", + "color": "#014b61", "width": "fence_width" }, "barrier_line_hedge": { - "color": "#3aab79", + "color": "#2e7a57", "width": "hedge_width" }, "barrier_line_land": { @@ -2591,23 +2592,22 @@ module.exports = { "antialias": false, "opacity": [ "stops", - {"z": 0, "val": 0.7}, - {"z": 15, "val": 0.5}, - {"z": 17, "val": 0.3}, + {"z": 14, "val": 0.4}, + {"z": 15, "val": 0.3}, + {"z": 17, "val": 0.2}, {"z": 18, "val": 0.1} ] }, "hillshade_medium_highlight": { "transition-color": {"duration": 300}, "transition-opacity": {"duration": 300}, - "color": "#ffb680", + "color": "#ffe1b7", "antialias": false, "opacity": [ "stops", - {"z": 0, "val": 0.6}, - {"z": 15, "val": 0.5}, - {"z": 17, "val": 0.3}, - {"z": 18, "val": 0.1} + {"z": 15, "val": 0.3}, + {"z": 17, "val": 0.2}, + {"z": 18, "val": 0.15} ] }, "contour_line_loud": { @@ -2618,7 +2618,7 @@ module.exports = { "opacity": [ "stops", {"z": 12, "val": 0.1}, - {"z": 13, "val": 0.4} + {"z": 13, "val": 0.2} ] }, "contour_line_regular": { @@ -2640,16 +2640,16 @@ module.exports = { }, "aeroway_fill": { "transition-color": {"duration": 300}, - "color": "#ddd" + "color": "#367" }, "aeroway_runway": { "transition-color": {"duration": 300}, - "color": "#ddd", + "color": "#367", "width": "runway_width" }, "aeroway_taxiway": { "transition-color": {"duration": 300}, - "color": "#ddd", + "color": "#367", "width": "taxiway_width" }, "building": { @@ -2696,7 +2696,7 @@ module.exports = { }, "tunnel_motorway": { "transition-color": {"duration": 300}, - "color": "#83b9c8", + "color": "#78b0c1", "width": "motorway_width", "opacity": [ "stops", @@ -2719,7 +2719,7 @@ module.exports = { }, "tunnel_main": { "transition-color": {"duration": 300}, - "color": "#e6cec7", + "color": "#78b0c1", "width": "main_width", "opacity": [ "stops", @@ -2738,7 +2738,7 @@ module.exports = { }, "tunnel_motorway_link": { "transition-color": {"duration": 300}, - "color": "#e6cec7", + "color": "#78b0c1", "width": "motorway_link_width" }, "tunnel_street_casing": { @@ -2748,7 +2748,7 @@ module.exports = { }, "tunnel_street": { "transition-color": {"duration": 300}, - "color": "street_case_night", + "color": "street_night", "width": "street_width" }, "tunnel_service_casing": { @@ -2763,7 +2763,7 @@ module.exports = { }, "tunnel_service": { "transition-color": {"duration": 300}, - "color": "#e6cec7", + "color": "#017ca0", "width": 2 }, "road_motorway_casing": { @@ -2838,7 +2838,9 @@ module.exports = { }, "road_path_case": { "transition-opacity": {"duration": 300}, - "opacity": 0 + "transition-color": {"duration": 300}, + "color": "land_night", + "opacity": 0.2 }, "road_path_footway": { "transition-color": {"duration": 300}, @@ -2866,7 +2868,7 @@ module.exports = { }, "road_path_cycleway": { "transition-color": {"duration": 300}, - "color": "#fff", + "color": "#94e6ff", "dasharray": [ 10, 4 @@ -2875,7 +2877,7 @@ module.exports = { }, "road_path_mtb": { "transition-color": {"duration": 300}, - "color": "#fff", + "color": "#94e6ff", "dasharray": [ 12, 4 @@ -2884,7 +2886,7 @@ module.exports = { }, "road_path_piste": { "transition-color": {"duration": 300}, - "color": "#fff", + "color": "#715dae", "dasharray": [ 8, 4 @@ -2893,12 +2895,14 @@ module.exports = { }, "road_path_steps": { "transition-color": {"duration": 300}, - "color": "#fff", + "transition-opacity": {"duration": 300}, + "color": "#016684", "dasharray": [ 10, 4 ], - "width": 4 + "opacity": 0.3, + "width": 6 }, "road_major_rail": { "transition-color": {"duration": 300}, From 4f44337ae4c89de0033226964ef605078ec1d823 Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 14:57:52 -0700 Subject: [PATCH 8/9] lighter waterway labels --- bin/style.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/style.js b/bin/style.js index 04cafa87b..9e8c7d77e 100644 --- a/bin/style.js +++ b/bin/style.js @@ -3169,9 +3169,8 @@ module.exports = { "waterway_label": { "transition-color": {"duration": 300}, "transition-stroke": {"duration": 300}, - "color": "water_dark_night", - "strokeWidth": 0.4, - "strokeBlur": 2, + "color": "land_night", + "strokeWidth": 0.8, "stroke": "water_night" }, "poi": { From 1cfa10753a141bae28bc73b1897ef48b4f7f15cb Mon Sep 17 00:00:00 2001 From: Eden Halperin Date: Wed, 21 May 2014 16:01:23 -0700 Subject: [PATCH 9/9] remove transition properties, fix poi label size descrepancy --- bin/style.js | 246 +-------------------------------------------------- 1 file changed, 1 insertion(+), 245 deletions(-) diff --git a/bin/style.js b/bin/style.js index 9e8c7d77e..325d7cbe0 100644 --- a/bin/style.js +++ b/bin/style.js @@ -1574,16 +1574,13 @@ module.exports = { "name": "default", "layers": { "background": { - "transition-color": {"duration": 300}, "color": "land" }, "admin_maritime_cover": { - "transition-color": {"duration": 300}, "color": "water", "width": 5 }, "admin_maritime": { - "transition-color": {"duration": 300}, "color": "#c0d6d6", "width": [ "stops", @@ -1593,12 +1590,10 @@ module.exports = { ] }, "admin_l2": { - "transition-color": {"duration": 300}, "color": "#88a", "width": "admin_l2_width" }, "admin_l3": { - "transition-color": {"duration": 300}, "color": "#88a", "dasharray": [ 60, @@ -1612,12 +1607,10 @@ module.exports = { "width": "admin_l3_width" }, "waterway_river_canal": { - "transition-color": {"duration": 300}, "color": "#87abaf", "width": "river_canal_width" }, "waterway_stream": { - "transition-color": {"duration": 300}, "color": "#87abaf", "width": "stream_width" }, @@ -1645,7 +1638,6 @@ module.exports = { "width": 4 }, "landcover_wood": { - "transition-color": {"duration": 300}, "color": "wood", "opacity": [ "stops", @@ -1655,7 +1647,6 @@ module.exports = { ] }, "landcover_scrub": { - "transition-color": {"duration": 300}, "color": "scrub", "opacity": [ "stops", @@ -1665,7 +1656,6 @@ module.exports = { ] }, "landcover_grass": { - "transition-color": {"duration": 300}, "color": "grass", "opacity": [ "stops", @@ -1675,78 +1665,59 @@ module.exports = { ] }, "landcover_crop": { - "transition-color": {"duration": 300}, "color": "crop" }, "landcover_snow": { - "transition-color": {"duration": 300}, "color": "snow" }, "landuse_wood": { - "transition-color": {"duration": 300}, "color": "wood" }, "landuse_scrub": { - "transition-color": {"duration": 300}, "color": "scrub" }, "landuse_grass": { - "transition-color": {"duration": 300}, "color": "grass" }, "landuse_crop": { - "transition-color": {"duration": 300}, "color": "crop" }, "landuse_snow": { - "transition-color": {"duration": 300}, "color": "snow" }, "landuse_rock": { - "transition-color": {"duration": 300}, "color": "rock" }, "landuse_sand": { - "transition-color": {"duration": 300}, "color": "sand" }, "landuse_park": { - "transition-color": {"duration": 300}, "color": "park" }, "landuse_cemetery": { - "transition-color": {"duration": 300}, "color": "cemetery" }, "landuse_hospital": { - "transition-color": {"duration": 300}, "color": "hospital" }, "landuse_school": { - "transition-color": {"duration": 300}, "color": "school" }, "landuse_pitch": { - "transition-color": {"duration": 300}, "color": "rgba(255,255,255,0.5)", "stroke": "pitch" }, "landuse_industrial": { - "transition-color": {"duration": 300}, "color": "rgba(246,250,255,0.5)" }, "overlay_wetland": { - "transition-color": {"duration": 300}, "color": "rgba(210,225,225,0.2)", "image": "wetland_noveg_64" }, "overlay_breakwater_pier": { - "transition-color": {"duration": 300}, "color": "land" }, "hillshade_full_shadow": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#103", "antialias": false, "opacity": [ @@ -1757,8 +1728,6 @@ module.exports = { ] }, "hillshade_medium_shadow": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#206", "antialias": false, "opacity": [ @@ -1769,8 +1738,6 @@ module.exports = { ] }, "hillshade_full_highlight": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#fffff3", "antialias": false, "opacity": [ @@ -1781,8 +1748,6 @@ module.exports = { ] }, "hillshade_medium_highlight": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#ffd", "antialias": false, "opacity": [ @@ -1793,8 +1758,6 @@ module.exports = { ] }, "contour_line_loud": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#008", "width": 0.9, "opacity": [ @@ -1804,8 +1767,6 @@ module.exports = { ] }, "contour_line_regular": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#008", "width": 0.5, "opacity": [ @@ -1815,32 +1776,24 @@ module.exports = { ] }, "water": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water", "stroke": "#a2bdc0" }, "aeroway_fill": { - "transition-color": {"duration": 300}, "color": "#ddd" }, "aeroway_runway": { - "transition-color": {"duration": 300}, "color": "#ddd", "width": "runway_width" }, "aeroway_taxiway": { - "transition-color": {"duration": 300}, "color": "#ddd", "width": "taxiway_width" }, "building": { - "transition-color": {"duration": 300}, "color": "#ebe7db" }, "building_wall": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#ebe7db", "stroke": "#d5d1c6", "opacity": [ @@ -1850,8 +1803,6 @@ module.exports = { ] }, "building_shadow": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#d5d1c6", "stroke": "#d5d1c6", "translate": [ @@ -1865,7 +1816,6 @@ module.exports = { ] }, "tunnel_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case", "dasharray": [ 6, @@ -1879,7 +1829,6 @@ module.exports = { ] }, "tunnel_motorway": { - "transition-color": {"duration": 300}, "color": "#e6cec7", "width": "motorway_width", "opacity": [ @@ -1889,7 +1838,6 @@ module.exports = { ] }, "tunnel_main_casing": { - "transition-color": {"duration": 300}, "color": "case", "dasharray": [ 6, @@ -1902,7 +1850,6 @@ module.exports = { ] }, "tunnel_main": { - "transition-color": {"duration": 300}, "color": "#e6cec7", "width": "main_width", "opacity": [ @@ -1912,7 +1859,6 @@ module.exports = { ] }, "tunnel_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case", "dasharray": [ 6, @@ -1921,22 +1867,18 @@ module.exports = { "width": "motorway_link_casing_width" }, "tunnel_motorway_link": { - "transition-color": {"duration": 300}, "color": "#e6cec7", "width": "motorway_link_width" }, "tunnel_street_casing": { - "transition-color": {"duration": 300}, "color": "#d9d5c6", "width": "street_casing_width" }, "tunnel_street": { - "transition-color": {"duration": 300}, "color": "#d9d5c6", "width": "street_width" }, "tunnel_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "dasharray": [ @@ -1946,12 +1888,10 @@ module.exports = { "width": "service_casing_width" }, "tunnel_service": { - "transition-color": {"duration": 300}, "color": "#e6cec7", "width": 2 }, "road_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "motorway_casing_width", "opacity": [ @@ -1961,7 +1901,6 @@ module.exports = { ] }, "road_motorway": { - "transition-color": {"duration": 300}, "color": "motorway", "width": "motorway_width", "opacity": [ @@ -1971,7 +1910,6 @@ module.exports = { ] }, "road_main_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "main_casing_width", "opacity": ["stops", @@ -1980,7 +1918,6 @@ module.exports = { ] }, "road_main": { - "transition-color": {"duration": 300}, "color": "main", "width": "main_width", "opacity": [ @@ -1990,39 +1927,31 @@ module.exports = { ] }, "road_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "motorway_link_casing_width" }, "road_motorway_link": { - "transition-color": {"duration": 300}, "color": "motorway", "width": "motorway_link_width" }, "road_street_casing": { - "transition-color": {"duration": 300}, "color": "#d9d5c6", "width": "street_casing_width" }, "road_street": { - "transition-color": {"duration": 300}, "color": "street", "width": "street_width" }, "road_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "width": "service_casing_width" }, "road_service": { - "transition-color": {"duration": 300}, "color": "street", "width": 2 }, "road_path_case": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#ffd", "opacity": 0.4, "width": [ @@ -2032,7 +1961,6 @@ module.exports = { ] }, "road_path_footway": { - "transition-color": {"duration": 300}, "color": "#bba", "dasharray": [ 10, @@ -2041,7 +1969,6 @@ module.exports = { "width": "path_width" }, "road_path_path": { - "transition-color": {"duration": 300}, "color": "#987", "dasharray": [ 10, @@ -2056,7 +1983,6 @@ module.exports = { ] }, "road_path_cycleway": { - "transition-color": {"duration": 300}, "color": "#488", "dasharray": [ 10, @@ -2065,7 +1991,6 @@ module.exports = { "width": "path_width" }, "road_path_mtb": { - "transition-color": {"duration": 300}, "color": "#488", "dasharray": [ 12, @@ -2074,7 +1999,6 @@ module.exports = { "width": "path_width" }, "road_path_piste": { - "transition-color": {"duration": 300}, "color": "#87b", "dasharray": [ 8, @@ -2083,7 +2007,6 @@ module.exports = { "width": "path_width" }, "road_path_steps": { - "transition-color": {"duration": 300}, "color": "#bba", "dasharray": [ 10, @@ -2092,12 +2015,10 @@ module.exports = { "width": 4 }, "road_major_rail": { - "transition-color": {"duration": 300}, "color": "#c8c4c0", "width": 0.8 }, "road_major_rail_hatching": { - "transition-color": {"duration": 300}, "color": "#c8c4c0", "dasharray": [ 2, @@ -2106,7 +2027,6 @@ module.exports = { "width": 5 }, "bridge_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "motorway_casing_width", "opacity": [ @@ -2116,7 +2036,6 @@ module.exports = { ] }, "bridge_motorway": { - "transition-color": {"duration": 300}, "color": "motorway", "width": "motorway_width", "opacity": [ @@ -2126,7 +2045,6 @@ module.exports = { ] }, "bridge_main_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "main_casing_width", "opacity": ["stops", @@ -2135,7 +2053,6 @@ module.exports = { ] }, "bridge_main": { - "transition-color": {"duration": 300}, "color": "main", "width": "main_width", "opacity": [ @@ -2145,51 +2062,41 @@ module.exports = { ] }, "bridge_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case", "width": "motorway_link_casing_width" }, "bridge_motorway_link": { - "transition-color": {"duration": 300}, "color": "motorway", "width": "motorway_link_width" }, "bridge_street_casing": { - "transition-color": {"duration": 300}, "color": "#d9d5c6", "width": "street_casing_width" }, "bridge_street": { - "transition-color": {"duration": 300}, "color": "street", "width": "street_width" }, "bridge_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "width": "service_casing_width" }, "bridge_service": { - "transition-color": {"duration": 300}, "color": "street", "width": 2 }, "bridge_aerialway_casing": { - "transition-color": {"duration": 300}, "color": "white", "opacity": 0.5, "width": "aerialway_casing_width" }, "bridge_aerialway": { - "transition-color": {"duration": 300}, "color": "#876", "opacity": 0.5, "width": "aerialway_width" }, "country_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "country_text", "stroke": "rgba(255,255,255,0.5)", "size": [ @@ -2199,20 +2106,15 @@ module.exports = { ] }, "country_label_line": { - "transition-color": {"duration": 300}, "color": "country_text", "width": 0.5, "opacity": 0.5 }, "marine_label_line": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "marine_text", "stroke": "water" }, "marine_label_point_1": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#a9c4c7", "size": ["stops", {"z": 0, "val": 20}, @@ -2224,8 +2126,6 @@ module.exports = { "stroke": "water" }, "marine_label_point_2": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#a9c4c7", "size": ["stops", {"z": 0, "val": 13}, @@ -2238,8 +2138,6 @@ module.exports = { "stroke": "water" }, "marine_label_point_other": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#a9c4c7", "size": ["stops", {"z": 0, "val": 12}, @@ -2252,8 +2150,6 @@ module.exports = { "stroke": "water" }, "state_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#333", "strokeWidth": 0.4, "strokeBlur": 1, @@ -2267,12 +2163,9 @@ module.exports = { ] }, "place_label_city_point": { - "transition-color": {"duration": 300}, "color": "#4a4032" }, "place_label_city": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#444", "strokeWidth": 0.4, "stroke": "text_stroke", @@ -2295,8 +2188,6 @@ module.exports = { ] }, "place_label_town": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#716656", "strokeWidth": 0.5, "stroke": "text_stroke", @@ -2309,8 +2200,6 @@ module.exports = { ] }, "place_label_village": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#635644", "strokeWidth": 0.5, "stroke": "text_stroke", @@ -2324,8 +2213,6 @@ module.exports = { ] }, "place_label_other": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#7d6c55", "stroke": "text_stroke", "size": [ @@ -2337,8 +2224,6 @@ module.exports = { ] }, "road_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#585042", "stroke": "land", "strokeWidth": 0.6, @@ -2346,27 +2231,20 @@ module.exports = { "size": "road_label_size" }, "water_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark", "stroke": "rgba(255,255,255,0.75)" }, "waterway_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark", "strokeWidth": 0.4, "strokeBlur": 2, "stroke": "text_stroke" }, "poi": { - "transition-color": {"duration": 300}, "color": "rgba(50,50,50,0.9)", "antialias": false }, "poi_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#444", "size": 10, "stroke": "land", @@ -2383,16 +2261,13 @@ module.exports = { "name": "satellite", "layers": { "background": { - "transition-color": {"duration": 300}, "color": "land_night" }, "admin_maritime_cover": { - "transition-color": {"duration": 300}, "color": "#0a1347", "width": 5 }, "admin_maritime": { - "transition-color": {"duration": 300}, "color": "#0a1347", "width": [ "stops", @@ -2402,12 +2277,10 @@ module.exports = { ] }, "admin_l2": { - "transition-color": {"duration": 300}, "color": "admin_night", "width": "admin_l2_width" }, "admin_l3": { - "transition-color": {"duration": 300}, "color": "admin_night", "dasharray": [ 60, @@ -2421,12 +2294,10 @@ module.exports = { "width": "admin_l3_width" }, "waterway_river_canal": { - "transition-color": {"duration": 300}, "color": "rgb(10,20,71)", "width": "river_canal_width" }, "waterway_stream": { - "transition-color": {"duration": 300}, "color": "rgb(10,20,71)", "width": "stream_width" }, @@ -2454,7 +2325,6 @@ module.exports = { "width": 4 }, "landcover_wood": { - "transition-color": {"duration": 300}, "color": "wood_night", "opacity": [ "stops", @@ -2464,7 +2334,6 @@ module.exports = { ] }, "landcover_scrub": { - "transition-color": {"duration": 300}, "color": "scrub_night", "opacity": [ "stops", @@ -2474,7 +2343,6 @@ module.exports = { ] }, "landcover_grass": { - "transition-color": {"duration": 300}, "color": "grass_night", "opacity": [ "stops", @@ -2484,86 +2352,66 @@ module.exports = { ] }, "landcover_crop": { - "transition-color": {"duration": 300}, "color": "crop_night" }, "landcover_snow": { - "transition-color": {"duration": 300}, "color": "snow_night" }, "landuse_wood": { - "transition-color": {"duration": 300}, "color": "wood_night", "opacity": 0.8 }, "landuse_scrub": { - "transition-color": {"duration": 300}, "color": "scrub_night", "opacity": 0.8 }, "landuse_grass": { - "transition-color": {"duration": 300}, "color": "grass_night", "opacity": 0.8 }, "landuse_crop": { - "transition-color": {"duration": 300}, "color": "crop_night", "opacity": 0.8 }, "landuse_snow": { - "transition-color": {"duration": 300}, "color": "snow_night", "opacity": 0.8 }, "landuse_rock": { - "transition-color": {"duration": 300}, "color": "rock_night", "opacity": 0.8 }, "landuse_sand": { - "transition-color": {"duration": 300}, "color": "sand_night", "opacity": 0.8 }, "landuse_park": { - "transition-color": {"duration": 300}, "color": "park_night" }, "landuse_cemetery": { - "transition-color": {"duration": 300}, "color": "cemetery_night" }, "landuse_hospital": { - "transition-color": {"duration": 300}, "color": "hospital_night" }, "landuse_school": { - "transition-color": {"duration": 300}, "color": "school_night" }, "landuse_pitch": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "pitch_night", "stroke": "pitch" }, "landuse_industrial": { - "transition-color": {"duration": 300}, "color": "builtup_night" }, "overlay_wetland": { - "transition-color": {"duration": 300}, "color": "rgba(210,225,225,0.2)", "image": "wetland_noveg_64" }, "overlay_breakwater_pier": { - "transition-color": {"duration": 300}, "color": "land_night" }, "hillshade_full_shadow": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#103", "antialias": false, "opacity": [ @@ -2574,8 +2422,6 @@ module.exports = { ] }, "hillshade_medium_shadow": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#206", "antialias": false, "opacity": [ @@ -2586,8 +2432,6 @@ module.exports = { ] }, "hillshade_full_highlight": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#fdfdad", "antialias": false, "opacity": [ @@ -2599,8 +2443,6 @@ module.exports = { ] }, "hillshade_medium_highlight": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#ffe1b7", "antialias": false, "opacity": [ @@ -2611,8 +2453,6 @@ module.exports = { ] }, "contour_line_loud": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "contour_night", "width": 0.9, "opacity": [ @@ -2622,8 +2462,6 @@ module.exports = { ] }, "contour_line_regular": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "contour_night", "width": 0.5, "opacity": [ @@ -2633,31 +2471,24 @@ module.exports = { ] }, "water": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_night", "stroke": "water_dark_night" }, "aeroway_fill": { - "transition-color": {"duration": 300}, "color": "#367" }, "aeroway_runway": { - "transition-color": {"duration": 300}, "color": "#367", "width": "runway_width" }, "aeroway_taxiway": { - "transition-color": {"duration": 300}, "color": "#367", "width": "taxiway_width" }, "building": { - "transition-color": {"duration": 300}, "color": "#027797" }, "building_wall": { - "transition-color": {"duration": 300}, "color": "#027797", "stroke": "#026688", "opacity": [ @@ -2667,7 +2498,6 @@ module.exports = { ] }, "building_shadow": { - "transition-color": {"duration": 300}, "color": "#026688", "stroke": "#026688", "translate": [ @@ -2681,7 +2511,6 @@ module.exports = { ] }, "tunnel_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "dasharray": [ 6, @@ -2695,7 +2524,6 @@ module.exports = { ] }, "tunnel_motorway": { - "transition-color": {"duration": 300}, "color": "#78b0c1", "width": "motorway_width", "opacity": [ @@ -2705,7 +2533,6 @@ module.exports = { ] }, "tunnel_main_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "dasharray": [ 6, @@ -2718,7 +2545,6 @@ module.exports = { ] }, "tunnel_main": { - "transition-color": {"duration": 300}, "color": "#78b0c1", "width": "main_width", "opacity": [ @@ -2728,7 +2554,6 @@ module.exports = { ] }, "tunnel_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "dasharray": [ 6, @@ -2737,22 +2562,18 @@ module.exports = { "width": "motorway_link_casing_width" }, "tunnel_motorway_link": { - "transition-color": {"duration": 300}, "color": "#78b0c1", "width": "motorway_link_width" }, "tunnel_street_casing": { - "transition-color": {"duration": 300}, "color": "street_case_night", "width": "street_casing_width" }, "tunnel_street": { - "transition-color": {"duration": 300}, "color": "street_night", "width": "street_width" }, "tunnel_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "dasharray": [ @@ -2762,12 +2583,10 @@ module.exports = { "width": "service_casing_width" }, "tunnel_service": { - "transition-color": {"duration": 300}, "color": "#017ca0", "width": 2 }, "road_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "motorway_casing_width", "opacity": [ @@ -2777,7 +2596,6 @@ module.exports = { ] }, "road_motorway": { - "transition-color": {"duration": 300}, "color": "motorway_night", "width": "motorway_width", "opacity": [ @@ -2787,7 +2605,6 @@ module.exports = { ] }, "road_main_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "main_casing_width", "opacity": ["stops", @@ -2796,7 +2613,6 @@ module.exports = { ] }, "road_main": { - "transition-color": {"duration": 300}, "color": "main_night", "width": "main_width", "opacity": [ @@ -2806,44 +2622,35 @@ module.exports = { ] }, "road_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "motorway_link_casing_width" }, "road_motorway_link": { - "transition-color": {"duration": 300}, "color": "motorway_night", "width": "motorway_link_width" }, "road_street_casing": { - "transition-color": {"duration": 300}, "color": "street_case_night", "width": "street_casing_width" }, "road_street": { - "transition-color": {"duration": 300}, "color": "street_night", "width": "street_width" }, "road_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "width": "service_casing_width" }, "road_service": { - "transition-color": {"duration": 300}, "color": "street_night", "width": 2 }, "road_path_case": { - "transition-opacity": {"duration": 300}, - "transition-color": {"duration": 300}, "color": "land_night", "opacity": 0.2 }, "road_path_footway": { - "transition-color": {"duration": 300}, "color": "#fff", "dasharray": [ 10, @@ -2852,7 +2659,6 @@ module.exports = { "width": "path_width" }, "road_path_path": { - "transition-color": {"duration": 300}, "color": "#fff", "dasharray": [ 10, @@ -2867,7 +2673,6 @@ module.exports = { ] }, "road_path_cycleway": { - "transition-color": {"duration": 300}, "color": "#94e6ff", "dasharray": [ 10, @@ -2876,7 +2681,6 @@ module.exports = { "width": "path_width" }, "road_path_mtb": { - "transition-color": {"duration": 300}, "color": "#94e6ff", "dasharray": [ 12, @@ -2885,7 +2689,6 @@ module.exports = { "width": "path_width" }, "road_path_piste": { - "transition-color": {"duration": 300}, "color": "#715dae", "dasharray": [ 8, @@ -2894,8 +2697,6 @@ module.exports = { "width": "path_width" }, "road_path_steps": { - "transition-color": {"duration": 300}, - "transition-opacity": {"duration": 300}, "color": "#016684", "dasharray": [ 10, @@ -2905,12 +2706,10 @@ module.exports = { "width": 6 }, "road_major_rail": { - "transition-color": {"duration": 300}, "color": "#c8c4c0", "width": 0.8 }, "road_major_rail_hatching": { - "transition-color": {"duration": 300}, "color": "#c8c4c0", "dasharray": [ 2, @@ -2919,7 +2718,6 @@ module.exports = { "width": 5 }, "bridge_motorway_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "motorway_casing_width", "opacity": [ @@ -2929,7 +2727,6 @@ module.exports = { ] }, "bridge_motorway": { - "transition-color": {"duration": 300}, "color": "motorway_night", "width": "motorway_width", "opacity": [ @@ -2939,7 +2736,6 @@ module.exports = { ] }, "bridge_main_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "main_casing_width", "opacity": ["stops", @@ -2948,7 +2744,6 @@ module.exports = { ] }, "bridge_main": { - "transition-color": {"duration": 300}, "color": "main_night", "width": "main_width", "opacity": [ @@ -2958,51 +2753,41 @@ module.exports = { ] }, "bridge_motorway_link_casing": { - "transition-color": {"duration": 300}, "color": "case_night", "width": "motorway_link_casing_width" }, "bridge_motorway_link": { - "transition-color": {"duration": 300}, "color": "motorway_night", "width": "motorway_link_width" }, "bridge_street_casing": { - "transition-color": {"duration": 300}, "color": "street_case_night", "width": "street_casing_width" }, "bridge_street": { - "transition-color": {"duration": 300}, "color": "street_night", "width": "street_width" }, "bridge_service_casing": { - "transition-color": {"duration": 300}, "color": "#000", "opacity": 0.04, "width": "service_casing_width" }, "bridge_service": { - "transition-color": {"duration": 300}, "color": "street_night", "width": 2 }, "bridge_aerialway_casing": { - "transition-color": {"duration": 300}, "color": "white", "opacity": 0.5, "width": "aerialway_casing_width" }, "bridge_aerialway": { - "transition-color": {"duration": 300}, "color": "#876", "opacity": 0.5, "width": "aerialway_width" }, "country_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "text_night", "stroke": "text_stroke_night", "size": [ @@ -3012,20 +2797,15 @@ module.exports = { ] }, "country_label_line": { - "transition-color": {"duration": 300}, "color": "text_night", "width": 0.5, "opacity": 0.5 }, "marine_label_line": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark_night", "stroke": "water_night" }, "marine_label_point_1": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark_night", "size": ["stops", {"z": 0, "val": 20}, @@ -3037,8 +2817,6 @@ module.exports = { "stroke": "water_night" }, "marine_label_point_2": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark_night", "size": ["stops", {"z": 0, "val": 13}, @@ -3051,8 +2829,6 @@ module.exports = { "stroke": "water_night" }, "marine_label_point_other": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#a9c4c7", "size": ["stops", {"z": 0, "val": 12}, @@ -3065,8 +2841,6 @@ module.exports = { "stroke": "water_night" }, "state_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#fff", "strokeWidth": 0.4, "strokeBlur": 1, @@ -3080,12 +2854,9 @@ module.exports = { ] }, "place_label_city_point": { - "transition-color": {"duration": 300}, "color": "#ddd" }, "place_label_city": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#fff", "strokeWidth": 0.4, "stroke": "text_stroke_night", @@ -3108,8 +2879,6 @@ module.exports = { ] }, "place_label_town": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "text_night", "strokeWidth": 0.5, "stroke": "text_stroke_night", @@ -3122,8 +2891,6 @@ module.exports = { ] }, "place_label_village": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "text_night", "strokeWidth": 0.5, "stroke": "text_stroke_night", @@ -3137,8 +2904,6 @@ module.exports = { ] }, "place_label_other": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "text_night", "stroke": "text_stroke_night", "strokeWidth": 0.5, @@ -3152,8 +2917,6 @@ module.exports = { ] }, "road_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "text_night", "stroke": "text_stroke_night", "strokeWidth": 0.5, @@ -3161,28 +2924,21 @@ module.exports = { "size": "road_label_size" }, "water_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "water_dark_night", "stroke": "text_stroke_night" }, "waterway_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "land_night", "strokeWidth": 0.8, "stroke": "water_night" }, "poi": { - "transition-color": {"duration": 300}, "color": "white", "antialias": false }, "poi_label": { - "transition-color": {"duration": 300}, - "transition-stroke": {"duration": 300}, "color": "#fff", - "size": 11, + "size": 10, "stroke": "land_night", "strokeWidth": 0.4, "strokeBlur": 0.2,