@mapwhit/tilerenderer 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/LICENSE.txt +87 -0
  2. package/README.md +25 -0
  3. package/build/min/.dir +0 -0
  4. package/build/min/package.json +3 -0
  5. package/build/min/src/shaders/_prelude.fragment.glsl.txt +13 -0
  6. package/build/min/src/shaders/_prelude.vertex.glsl.txt +14 -0
  7. package/build/min/src/shaders/background.fragment.glsl.txt +5 -0
  8. package/build/min/src/shaders/background.vertex.glsl.txt +1 -0
  9. package/build/min/src/shaders/background_pattern.fragment.glsl.txt +5 -0
  10. package/build/min/src/shaders/background_pattern.vertex.glsl.txt +1 -0
  11. package/build/min/src/shaders/circle.fragment.glsl.txt +20 -0
  12. package/build/min/src/shaders/circle.vertex.glsl.txt +17 -0
  13. package/build/min/src/shaders/clipping_mask.fragment.glsl.txt +1 -0
  14. package/build/min/src/shaders/clipping_mask.vertex.glsl.txt +1 -0
  15. package/build/min/src/shaders/collision_box.fragment.glsl.txt +1 -0
  16. package/build/min/src/shaders/collision_box.vertex.glsl.txt +1 -0
  17. package/build/min/src/shaders/collision_circle.fragment.glsl.txt +1 -0
  18. package/build/min/src/shaders/collision_circle.vertex.glsl.txt +1 -0
  19. package/build/min/src/shaders/debug.fragment.glsl.txt +1 -0
  20. package/build/min/src/shaders/debug.vertex.glsl.txt +1 -0
  21. package/build/min/src/shaders/fill.fragment.glsl.txt +10 -0
  22. package/build/min/src/shaders/fill.vertex.glsl.txt +7 -0
  23. package/build/min/src/shaders/fill_extrusion.fragment.glsl.txt +13 -0
  24. package/build/min/src/shaders/fill_extrusion.vertex.glsl.txt +9 -0
  25. package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.txt +15 -0
  26. package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.txt +11 -0
  27. package/build/min/src/shaders/fill_outline.fragment.glsl.txt +10 -0
  28. package/build/min/src/shaders/fill_outline.vertex.glsl.txt +7 -0
  29. package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.txt +13 -0
  30. package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.txt +9 -0
  31. package/build/min/src/shaders/fill_pattern.fragment.glsl.txt +13 -0
  32. package/build/min/src/shaders/fill_pattern.vertex.glsl.txt +9 -0
  33. package/build/min/src/shaders/heatmap.fragment.glsl.txt +10 -0
  34. package/build/min/src/shaders/heatmap.vertex.glsl.txt +8 -0
  35. package/build/min/src/shaders/heatmap_texture.fragment.glsl.txt +5 -0
  36. package/build/min/src/shaders/heatmap_texture.vertex.glsl.txt +1 -0
  37. package/build/min/src/shaders/hillshade.fragment.glsl.txt +7 -0
  38. package/build/min/src/shaders/hillshade.vertex.glsl.txt +1 -0
  39. package/build/min/src/shaders/hillshade_prepare.fragment.glsl.txt +8 -0
  40. package/build/min/src/shaders/hillshade_prepare.vertex.glsl.txt +1 -0
  41. package/build/min/src/shaders/line.fragment.glsl.txt +12 -0
  42. package/build/min/src/shaders/line.vertex.glsl.txt +17 -0
  43. package/build/min/src/shaders/line_gradient.fragment.glsl.txt +10 -0
  44. package/build/min/src/shaders/line_gradient.vertex.glsl.txt +16 -0
  45. package/build/min/src/shaders/line_pattern.fragment.glsl.txt +15 -0
  46. package/build/min/src/shaders/line_pattern.vertex.glsl.txt +20 -0
  47. package/build/min/src/shaders/line_sdf.fragment.glsl.txt +17 -0
  48. package/build/min/src/shaders/line_sdf.vertex.glsl.txt +20 -0
  49. package/build/min/src/shaders/raster.fragment.glsl.txt +5 -0
  50. package/build/min/src/shaders/raster.vertex.glsl.txt +1 -0
  51. package/build/min/src/shaders/symbol_icon.fragment.glsl.txt +9 -0
  52. package/build/min/src/shaders/symbol_icon.vertex.glsl.txt +5 -0
  53. package/build/min/src/shaders/symbol_sdf.fragment.glsl.txt +19 -0
  54. package/build/min/src/shaders/symbol_sdf.vertex.glsl.txt +13 -0
  55. package/package.json +44 -0
  56. package/src/css/mapbox-gl.css +506 -0
  57. package/src/css/svg/mapboxgl-ctrl-attrib.svg +3 -0
  58. package/src/css/svg/mapboxgl-ctrl-compass.svg +4 -0
  59. package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +3 -0
  60. package/src/css/svg/mapboxgl-ctrl-geolocate-background.svg +3 -0
  61. package/src/css/svg/mapboxgl-ctrl-geolocate.svg +3 -0
  62. package/src/css/svg/mapboxgl-ctrl-logo-compact.svg +2 -0
  63. package/src/css/svg/mapboxgl-ctrl-logo.svg +1 -0
  64. package/src/css/svg/mapboxgl-ctrl-shrink.svg +3 -0
  65. package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +3 -0
  66. package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +3 -0
  67. package/src/data/array_types.js +1138 -0
  68. package/src/data/bucket/circle_attributes.js +5 -0
  69. package/src/data/bucket/circle_bucket.js +118 -0
  70. package/src/data/bucket/fill_attributes.js +5 -0
  71. package/src/data/bucket/fill_bucket.js +166 -0
  72. package/src/data/bucket/fill_extrusion_attributes.js +11 -0
  73. package/src/data/bucket/fill_extrusion_bucket.js +247 -0
  74. package/src/data/bucket/heatmap_bucket.js +12 -0
  75. package/src/data/bucket/line_attributes.js +11 -0
  76. package/src/data/bucket/line_bucket.js +625 -0
  77. package/src/data/bucket/pattern_attributes.js +9 -0
  78. package/src/data/bucket/pattern_bucket_features.js +44 -0
  79. package/src/data/bucket/symbol_attributes.js +95 -0
  80. package/src/data/bucket/symbol_bucket.js +697 -0
  81. package/src/data/bucket.js +53 -0
  82. package/src/data/dem_data.js +126 -0
  83. package/src/data/extent.js +17 -0
  84. package/src/data/feature_index.js +254 -0
  85. package/src/data/index_array_type.js +14 -0
  86. package/src/data/load_geometry.js +42 -0
  87. package/src/data/pos_attributes.js +3 -0
  88. package/src/data/program_configuration.js +782 -0
  89. package/src/data/raster_bounds_attributes.js +6 -0
  90. package/src/data/segment.js +63 -0
  91. package/src/geo/coordinate.js +78 -0
  92. package/src/geo/lng_lat.js +129 -0
  93. package/src/geo/lng_lat_bounds.js +253 -0
  94. package/src/geo/transform.js +605 -0
  95. package/src/gl/color_mode.js +21 -0
  96. package/src/gl/context.js +193 -0
  97. package/src/gl/cull_face_mode.js +22 -0
  98. package/src/gl/depth_mode.js +18 -0
  99. package/src/gl/framebuffer.js +28 -0
  100. package/src/gl/index_buffer.js +52 -0
  101. package/src/gl/stencil_mode.js +17 -0
  102. package/src/gl/types.js +0 -0
  103. package/src/gl/value.js +676 -0
  104. package/src/gl/vertex_buffer.js +101 -0
  105. package/src/index.js +50 -0
  106. package/src/render/draw_background.js +60 -0
  107. package/src/render/draw_circle.js +55 -0
  108. package/src/render/draw_collision_debug.js +45 -0
  109. package/src/render/draw_debug.js +429 -0
  110. package/src/render/draw_fill.js +143 -0
  111. package/src/render/draw_fill_extrusion.js +101 -0
  112. package/src/render/draw_heatmap.js +159 -0
  113. package/src/render/draw_hillshade.js +144 -0
  114. package/src/render/draw_line.js +99 -0
  115. package/src/render/draw_raster.js +151 -0
  116. package/src/render/draw_symbol.js +231 -0
  117. package/src/render/glyph_atlas.js +55 -0
  118. package/src/render/glyph_manager.js +145 -0
  119. package/src/render/image_atlas.js +97 -0
  120. package/src/render/image_manager.js +183 -0
  121. package/src/render/line_atlas.js +139 -0
  122. package/src/render/painter.js +483 -0
  123. package/src/render/program/background_program.js +46 -0
  124. package/src/render/program/circle_program.js +40 -0
  125. package/src/render/program/clipping_mask_program.js +11 -0
  126. package/src/render/program/collision_program.js +28 -0
  127. package/src/render/program/debug_program.js +13 -0
  128. package/src/render/program/fill_extrusion_program.js +76 -0
  129. package/src/render/program/fill_program.js +60 -0
  130. package/src/render/program/heatmap_program.js +46 -0
  131. package/src/render/program/hillshade_program.js +77 -0
  132. package/src/render/program/line_program.js +119 -0
  133. package/src/render/program/pattern.js +57 -0
  134. package/src/render/program/program_uniforms.js +46 -0
  135. package/src/render/program/raster_program.js +50 -0
  136. package/src/render/program/symbol_program.js +112 -0
  137. package/src/render/program.js +133 -0
  138. package/src/render/texture.js +88 -0
  139. package/src/render/tile_mask.js +108 -0
  140. package/src/render/uniform_binding.js +129 -0
  141. package/src/render/vertex_array_object.js +155 -0
  142. package/src/shaders/README.md +42 -0
  143. package/src/shaders/_prelude.fragment.glsl +17 -0
  144. package/src/shaders/_prelude.vertex.glsl +73 -0
  145. package/src/shaders/background.fragment.glsl +10 -0
  146. package/src/shaders/background.vertex.glsl +7 -0
  147. package/src/shaders/background_pattern.fragment.glsl +28 -0
  148. package/src/shaders/background_pattern.vertex.glsl +20 -0
  149. package/src/shaders/circle.fragment.glsl +39 -0
  150. package/src/shaders/circle.vertex.glsl +63 -0
  151. package/src/shaders/clipping_mask.fragment.glsl +3 -0
  152. package/src/shaders/clipping_mask.vertex.glsl +7 -0
  153. package/src/shaders/collision_box.fragment.glsl +21 -0
  154. package/src/shaders/collision_box.vertex.glsl +26 -0
  155. package/src/shaders/collision_circle.fragment.glsl +34 -0
  156. package/src/shaders/collision_circle.vertex.glsl +36 -0
  157. package/src/shaders/debug.fragment.glsl +5 -0
  158. package/src/shaders/debug.vertex.glsl +7 -0
  159. package/src/shaders/encode_attribute.js +19 -0
  160. package/src/shaders/fill.fragment.glsl +13 -0
  161. package/src/shaders/fill.vertex.glsl +13 -0
  162. package/src/shaders/fill_extrusion.fragment.glsl +16 -0
  163. package/src/shaders/fill_extrusion.vertex.glsl +66 -0
  164. package/src/shaders/fill_extrusion_pattern.fragment.glsl +41 -0
  165. package/src/shaders/fill_extrusion_pattern.vertex.glsl +76 -0
  166. package/src/shaders/fill_outline.fragment.glsl +17 -0
  167. package/src/shaders/fill_outline.vertex.glsl +17 -0
  168. package/src/shaders/fill_outline_pattern.fragment.glsl +43 -0
  169. package/src/shaders/fill_outline_pattern.vertex.glsl +41 -0
  170. package/src/shaders/fill_pattern.fragment.glsl +36 -0
  171. package/src/shaders/fill_pattern.vertex.glsl +36 -0
  172. package/src/shaders/heatmap.fragment.glsl +21 -0
  173. package/src/shaders/heatmap.vertex.glsl +53 -0
  174. package/src/shaders/heatmap_texture.fragment.glsl +14 -0
  175. package/src/shaders/heatmap_texture.vertex.glsl +11 -0
  176. package/src/shaders/hillshade.fragment.glsl +52 -0
  177. package/src/shaders/hillshade.vertex.glsl +11 -0
  178. package/src/shaders/hillshade_prepare.fragment.glsl +72 -0
  179. package/src/shaders/hillshade_prepare.vertex.glsl +15 -0
  180. package/src/shaders/index.js +194 -0
  181. package/src/shaders/line.fragment.glsl +28 -0
  182. package/src/shaders/line.vertex.glsl +84 -0
  183. package/src/shaders/line_gradient.fragment.glsl +34 -0
  184. package/src/shaders/line_gradient.vertex.glsl +84 -0
  185. package/src/shaders/line_pattern.fragment.glsl +69 -0
  186. package/src/shaders/line_pattern.vertex.glsl +88 -0
  187. package/src/shaders/line_sdf.fragment.glsl +44 -0
  188. package/src/shaders/line_sdf.vertex.glsl +95 -0
  189. package/src/shaders/raster.fragment.glsl +52 -0
  190. package/src/shaders/raster.vertex.glsl +21 -0
  191. package/src/shaders/symbol_icon.fragment.glsl +17 -0
  192. package/src/shaders/symbol_icon.vertex.glsl +91 -0
  193. package/src/shaders/symbol_sdf.fragment.glsl +50 -0
  194. package/src/shaders/symbol_sdf.vertex.glsl +117 -0
  195. package/src/source/geojson_source.js +267 -0
  196. package/src/source/geojson_worker_source.js +210 -0
  197. package/src/source/geojson_wrapper.js +67 -0
  198. package/src/source/image_source.js +213 -0
  199. package/src/source/load_tilejson.js +40 -0
  200. package/src/source/pixels_to_tile_units.js +17 -0
  201. package/src/source/query_features.js +198 -0
  202. package/src/source/raster_dem_tile_source.js +140 -0
  203. package/src/source/raster_dem_tile_worker_source.js +26 -0
  204. package/src/source/raster_tile_source.js +126 -0
  205. package/src/source/rtl_text_plugin.js +63 -0
  206. package/src/source/source.js +75 -0
  207. package/src/source/source_cache.js +794 -0
  208. package/src/source/source_state.js +55 -0
  209. package/src/source/tile.js +332 -0
  210. package/src/source/tile_bounds.js +40 -0
  211. package/src/source/tile_cache.js +122 -0
  212. package/src/source/tile_id.js +150 -0
  213. package/src/source/vector_tile_source.js +144 -0
  214. package/src/source/vector_tile_worker_source.js +126 -0
  215. package/src/source/worker.js +175 -0
  216. package/src/source/worker_source.js +14 -0
  217. package/src/source/worker_tile.js +199 -0
  218. package/src/style/create_style_layer.js +25 -0
  219. package/src/style/evaluation_parameters.js +45 -0
  220. package/src/style/light.js +112 -0
  221. package/src/style/load_glyph_range.js +17 -0
  222. package/src/style/load_sprite.js +26 -0
  223. package/src/style/parse_glyph_pbf.js +45 -0
  224. package/src/style/pauseable_placement.js +88 -0
  225. package/src/style/properties.js +691 -0
  226. package/src/style/query_utils.js +39 -0
  227. package/src/style/style.js +955 -0
  228. package/src/style/style_layer/background_style_layer.js +11 -0
  229. package/src/style/style_layer/background_style_layer_properties.js +25 -0
  230. package/src/style/style_layer/circle_style_layer.js +93 -0
  231. package/src/style/style_layer/circle_style_layer_properties.js +76 -0
  232. package/src/style/style_layer/fill_extrusion_style_layer.js +194 -0
  233. package/src/style/style_layer/fill_extrusion_style_layer_properties.js +56 -0
  234. package/src/style/style_layer/fill_style_layer.js +46 -0
  235. package/src/style/style_layer/fill_style_layer_properties.js +45 -0
  236. package/src/style/style_layer/heatmap_style_layer.js +51 -0
  237. package/src/style/style_layer/heatmap_style_layer_properties.js +52 -0
  238. package/src/style/style_layer/hillshade_style_layer.js +15 -0
  239. package/src/style/style_layer/hillshade_style_layer_properties.js +43 -0
  240. package/src/style/style_layer/line_style_layer.js +129 -0
  241. package/src/style/style_layer/line_style_layer_properties.js +104 -0
  242. package/src/style/style_layer/raster_style_layer.js +11 -0
  243. package/src/style/style_layer/raster_style_layer_properties.js +55 -0
  244. package/src/style/style_layer/symbol_style_layer.js +66 -0
  245. package/src/style/style_layer/symbol_style_layer_properties.js +288 -0
  246. package/src/style/style_layer.js +183 -0
  247. package/src/style/style_layer_index.js +61 -0
  248. package/src/style/zoom_history.js +36 -0
  249. package/src/style-spec/deref.js +51 -0
  250. package/src/style-spec/error/parsing_error.js +8 -0
  251. package/src/style-spec/error/validation_error.js +10 -0
  252. package/src/style-spec/expression/compound_expression.js +118 -0
  253. package/src/style-spec/expression/definitions/array.js +82 -0
  254. package/src/style-spec/expression/definitions/assertion.js +69 -0
  255. package/src/style-spec/expression/definitions/at.js +57 -0
  256. package/src/style-spec/expression/definitions/case.js +73 -0
  257. package/src/style-spec/expression/definitions/coalesce.js +68 -0
  258. package/src/style-spec/expression/definitions/coercion.js +96 -0
  259. package/src/style-spec/expression/definitions/collator.js +102 -0
  260. package/src/style-spec/expression/definitions/equals.js +93 -0
  261. package/src/style-spec/expression/definitions/index.js +407 -0
  262. package/src/style-spec/expression/definitions/interpolate.js +235 -0
  263. package/src/style-spec/expression/definitions/length.js +54 -0
  264. package/src/style-spec/expression/definitions/let.js +60 -0
  265. package/src/style-spec/expression/definitions/literal.js +64 -0
  266. package/src/style-spec/expression/definitions/match.js +142 -0
  267. package/src/style-spec/expression/definitions/step.js +116 -0
  268. package/src/style-spec/expression/definitions/var.js +38 -0
  269. package/src/style-spec/expression/evaluation_context.js +35 -0
  270. package/src/style-spec/expression/index.js +329 -0
  271. package/src/style-spec/expression/is_constant.js +63 -0
  272. package/src/style-spec/expression/parsing_context.js +213 -0
  273. package/src/style-spec/expression/parsing_error.js +9 -0
  274. package/src/style-spec/expression/runtime_error.js +12 -0
  275. package/src/style-spec/expression/scope.js +34 -0
  276. package/src/style-spec/expression/stops.js +37 -0
  277. package/src/style-spec/expression/types.js +77 -0
  278. package/src/style-spec/expression/values.js +126 -0
  279. package/src/style-spec/feature_filter/README.md +55 -0
  280. package/src/style-spec/feature_filter/index.js +158 -0
  281. package/src/style-spec/function/convert.js +256 -0
  282. package/src/style-spec/function/index.js +299 -0
  283. package/src/style-spec/group_by_layout.js +68 -0
  284. package/src/style-spec/reference/v8.json +5356 -0
  285. package/src/style-spec/util/color.js +73 -0
  286. package/src/style-spec/util/color_spaces.js +128 -0
  287. package/src/style-spec/util/eval_support.js +8 -0
  288. package/src/style-spec/util/get_type.js +18 -0
  289. package/src/style-spec/util/interpolate.js +21 -0
  290. package/src/style-spec/util/properties.js +17 -0
  291. package/src/style-spec/util/ref_properties.js +1 -0
  292. package/src/style-spec/util/result.js +19 -0
  293. package/src/symbol/anchor.js +21 -0
  294. package/src/symbol/check_max_angle.js +75 -0
  295. package/src/symbol/clip_line.js +73 -0
  296. package/src/symbol/collision_feature.js +230 -0
  297. package/src/symbol/collision_index.js +379 -0
  298. package/src/symbol/cross_tile_symbol_index.js +270 -0
  299. package/src/symbol/get_anchors.js +177 -0
  300. package/src/symbol/grid_index.js +318 -0
  301. package/src/symbol/mergelines.js +75 -0
  302. package/src/symbol/opacity_state.js +21 -0
  303. package/src/symbol/placement.js +563 -0
  304. package/src/symbol/projection.js +601 -0
  305. package/src/symbol/quads.js +173 -0
  306. package/src/symbol/shaping.js +347 -0
  307. package/src/symbol/symbol_layout.js +519 -0
  308. package/src/symbol/symbol_size.js +110 -0
  309. package/src/symbol/transform_text.js +16 -0
  310. package/src/ui/anchor.js +24 -0
  311. package/src/ui/bind_handlers.js +199 -0
  312. package/src/ui/camera.js +954 -0
  313. package/src/ui/events.js +210 -0
  314. package/src/ui/handler/box_zoom.js +151 -0
  315. package/src/ui/handler/dblclick_zoom.js +91 -0
  316. package/src/ui/handler/drag_pan.js +285 -0
  317. package/src/ui/handler/drag_rotate.js +290 -0
  318. package/src/ui/handler/frame.js +28 -0
  319. package/src/ui/handler/inertia.js +45 -0
  320. package/src/ui/handler/keyboard.js +148 -0
  321. package/src/ui/handler/scroll_zoom.js +284 -0
  322. package/src/ui/handler/touch_zoom_rotate.js +263 -0
  323. package/src/ui/map.js +1645 -0
  324. package/src/util/actor.js +104 -0
  325. package/src/util/async.js +23 -0
  326. package/src/util/browser.js +61 -0
  327. package/src/util/callback.js +26 -0
  328. package/src/util/classify_rings.js +43 -0
  329. package/src/util/color_ramp.js +24 -0
  330. package/src/util/config.js +24 -0
  331. package/src/util/dictionary_coder.js +25 -0
  332. package/src/util/dispatcher.js +68 -0
  333. package/src/util/dom.js +102 -0
  334. package/src/util/evented.js +182 -0
  335. package/src/util/find_pole_of_inaccessibility.js +129 -0
  336. package/src/util/global_worker_pool.js +15 -0
  337. package/src/util/image.js +124 -0
  338. package/src/util/interpolate.js +5 -0
  339. package/src/util/intersection_tests.js +207 -0
  340. package/src/util/is_char_in_unicode_block.js +287 -0
  341. package/src/util/loader/image.js +32 -0
  342. package/src/util/object.js +178 -0
  343. package/src/util/script_detection.js +337 -0
  344. package/src/util/struct_array.js +197 -0
  345. package/src/util/task_queue.js +57 -0
  346. package/src/util/throttle.js +26 -0
  347. package/src/util/tile_cover.js +114 -0
  348. package/src/util/token.js +13 -0
  349. package/src/util/unique_id.js +12 -0
  350. package/src/util/util.js +192 -0
  351. package/src/util/vectortile_to_geojson.js +44 -0
  352. package/src/util/verticalize_punctuation.js +112 -0
  353. package/src/util/warn.js +21 -0
  354. package/src/util/web_worker.js +5 -0
  355. package/src/util/web_worker_transfer.js +228 -0
  356. package/src/util/worker_pool.js +41 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,87 @@
1
+ Copyright (c) 2016, Mapbox
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+ * Neither the name of Mapbox GL JS nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ -------------------------------------------------------------------------------
30
+
31
+ Contains Hershey Simplex Font: http://paulbourke.net/dataformats/hershey/
32
+
33
+ -------------------------------------------------------------------------------
34
+
35
+ Contains code from glfx.js
36
+
37
+ Copyright (C) 2011 by Evan Wallace
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ of this software and associated documentation files (the "Software"), to deal
41
+ in the Software without restriction, including without limitation the rights
42
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ copies of the Software, and to permit persons to whom the Software is
44
+ furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in
47
+ all copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
+ THE SOFTWARE.
56
+
57
+ --------------------------------------------------------------------------------
58
+
59
+ Contains a portion of d3-color https://github.com/d3/d3-color
60
+
61
+ Copyright 2010-2016 Mike Bostock
62
+ All rights reserved.
63
+
64
+ Redistribution and use in source and binary forms, with or without modification,
65
+ are permitted provided that the following conditions are met:
66
+
67
+ * Redistributions of source code must retain the above copyright notice, this
68
+ list of conditions and the following disclaimer.
69
+
70
+ * Redistributions in binary form must reproduce the above copyright notice,
71
+ this list of conditions and the following disclaimer in the documentation
72
+ and/or other materials provided with the distribution.
73
+
74
+ * Neither the name of the author nor the names of contributors may be used to
75
+ endorse or promote products derived from this software without specific prior
76
+ written permission.
77
+
78
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
79
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
80
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
81
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
82
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
83
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
84
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
85
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
87
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ [![NPM version][npm-image]][npm-url]
2
+ [![Build Status][build-image]][build-url]
3
+ [![Dependency Status][deps-image]][deps-url]
4
+
5
+ # @mapwhit/tilerenderer
6
+
7
+ This project began as a fork of the [mapbox-gl-js] with the following changes:
8
+ - slimmed down to concentrate on tile rendering
9
+ - written in idiomatic java script
10
+ - targeting only ever-green browsers
11
+
12
+ ## License
13
+
14
+ [BSD-3-Clause](LICENSE.txt)
15
+
16
+ [mapbox-gl-js]: https://npmjs.org/package/mapbox-gl
17
+
18
+ [npm-image]: https://img.shields.io/npm/v/@mapwhit/tilerenderer
19
+ [npm-url]: https://npmjs.org/package/@mapwhit/tilerenderer
20
+
21
+ [build-url]: https://github.com/mapwhit/tilerenderer/actions/workflows/check.yaml
22
+ [build-image]: https://img.shields.io/github/actions/workflow/status/mapwhit/tilerenderer/check.yaml?branch=main
23
+
24
+ [deps-image]: https://img.shields.io/librariesio/release/npm/@mapwhit/tilerenderer
25
+ [deps-url]: https://libraries.io/npm/@mapwhit%2Ftilerenderer
package/build/min/.dir ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "0.46.2"
3
+ }
@@ -0,0 +1,13 @@
1
+ #ifdef GL_ES
2
+ precision mediump float;
3
+ #else
4
+ #if !defined(lowp)
5
+ #define lowp
6
+ #endif
7
+ #if !defined(mediump)
8
+ #define mediump
9
+ #endif
10
+ #if !defined(highp)
11
+ #define highp
12
+ #endif
13
+ #endif
@@ -0,0 +1,14 @@
1
+ #ifdef GL_ES
2
+ precision highp float;
3
+ #else
4
+ #if !defined(lowp)
5
+ #define lowp
6
+ #endif
7
+ #if !defined(mediump)
8
+ #define mediump
9
+ #endif
10
+ #if !defined(highp)
11
+ #define highp
12
+ #endif
13
+ #endif
14
+ vec2 unpack_float(const float packedValue){int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity){int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.,mod(packedOpacity,2.));}vec4 decode_color(const vec2 encodedColor){return vec4(unpack_float(encodedColor[0])/255.,unpack_float(encodedColor[1])/255.);}float unpack_mix_vec2(const vec2 packedValue,const float t){return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t){vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos){vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.,pattern_size)*256.+pixel_coord_lower,pattern_size);return(tile_units_to_pixels*pos+offset)/pattern_size;}
@@ -0,0 +1,5 @@
1
+ uniform vec4 u_color;uniform float u_opacity;void main(){gl_FragColor=u_color*u_opacity;
2
+ #ifdef OVERDRAW_INSPECTOR
3
+ gl_FragColor=vec4(1.);
4
+ #endif
5
+ }
@@ -0,0 +1 @@
1
+ attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -0,0 +1,5 @@
1
+ uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main(){vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
2
+ #ifdef OVERDRAW_INSPECTOR
3
+ gl_FragColor=vec4(1.);
4
+ #endif
5
+ }
@@ -0,0 +1 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}
@@ -0,0 +1,20 @@
1
+ #pragma mapbox: define highp vec4 color
2
+ #pragma mapbox: define mediump float radius
3
+ #pragma mapbox: define lowp float blur
4
+ #pragma mapbox: define lowp float opacity
5
+ #pragma mapbox: define highp vec4 stroke_color
6
+ #pragma mapbox: define mediump float stroke_width
7
+ #pragma mapbox: define lowp float stroke_opacity
8
+ varying vec3 v_data;void main(){
9
+ #pragma mapbox: initialize highp vec4 color
10
+ #pragma mapbox: initialize mediump float radius
11
+ #pragma mapbox: initialize lowp float blur
12
+ #pragma mapbox: initialize lowp float opacity
13
+ #pragma mapbox: initialize highp vec4 stroke_color
14
+ #pragma mapbox: initialize mediump float stroke_width
15
+ #pragma mapbox: initialize lowp float stroke_opacity
16
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.,antialiased_blur,extrude_length-1.);float color_t=stroke_width<0.01?0.:smoothstep(antialiased_blur,0.,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
17
+ #ifdef OVERDRAW_INSPECTOR
18
+ gl_FragColor=vec4(1.);
19
+ #endif
20
+ }
@@ -0,0 +1,17 @@
1
+ uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;
2
+ #pragma mapbox: define highp vec4 color
3
+ #pragma mapbox: define mediump float radius
4
+ #pragma mapbox: define lowp float blur
5
+ #pragma mapbox: define lowp float opacity
6
+ #pragma mapbox: define highp vec4 stroke_color
7
+ #pragma mapbox: define mediump float stroke_width
8
+ #pragma mapbox: define lowp float stroke_opacity
9
+ varying vec3 v_data;void main(void){
10
+ #pragma mapbox: initialize highp vec4 color
11
+ #pragma mapbox: initialize mediump float radius
12
+ #pragma mapbox: initialize lowp float blur
13
+ #pragma mapbox: initialize lowp float opacity
14
+ #pragma mapbox: initialize highp vec4 stroke_color
15
+ #pragma mapbox: initialize mediump float stroke_width
16
+ #pragma mapbox: initialize lowp float stroke_opacity
17
+ vec2 extrude=vec2(mod(a_pos,2.)*2.-1.);vec2 circle_center=floor(a_pos*0.5);if(u_pitch_with_map){vec2 corner_position=circle_center;if(u_scale_with_map){corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;}else{vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);}else{gl_Position=u_matrix*vec4(circle_center,0,1);if(u_scale_with_map){gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;}else{gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1./DEVICE_PIXEL_RATIO/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}
@@ -0,0 +1 @@
1
+ void main(){gl_FragColor=vec4(1.);}
@@ -0,0 +1 @@
1
+ attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -0,0 +1 @@
1
+ varying float v_placed;varying float v_notUsed;void main(){float alpha=0.5;gl_FragColor=vec4(1.,0.,0.,1.)*alpha;if(v_placed>0.5){gl_FragColor=vec4(0.,0.,1.,0.5)*alpha;}if(v_notUsed>0.5){gl_FragColor*=.1;}}
@@ -0,0 +1 @@
1
+ attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main(){vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.,4.);gl_Position=u_matrix*vec4(a_pos,0.,1.);gl_Position.xy+=a_extrude*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}
@@ -0,0 +1 @@
1
+ uniform float u_overscale_factor;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main(){float alpha=0.5;vec4 color=vec4(1.,0.,0.,1.)*alpha;if(v_placed>0.5){color=vec4(0.,0.,1.,0.5)*alpha;}if(v_notUsed>0.5){color*=.2;}float extrude_scale_length=length(v_extrude_scale);float extrude_length=length(v_extrude)*extrude_scale_length;float stroke_width=15.*extrude_scale_length/u_overscale_factor;float radius=v_radius*extrude_scale_length;float distance_to_edge=abs(extrude_length-radius);float opacity_t=smoothstep(-stroke_width,0.,-distance_to_edge);gl_FragColor=opacity_t*color;}
@@ -0,0 +1 @@
1
+ attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main(){vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.,4.);gl_Position=u_matrix*vec4(a_pos,0.,1.);highp float padding_factor=1.2;gl_Position.xy+=a_extrude*u_extrude_scale*padding_factor*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;v_radius=abs(a_extrude.y);v_extrude=a_extrude*padding_factor;v_extrude_scale=u_extrude_scale*u_camera_to_center_distance*collision_perspective_ratio;}
@@ -0,0 +1 @@
1
+ uniform highp vec4 u_color;void main(){gl_FragColor=u_color;}
@@ -0,0 +1 @@
1
+ attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -0,0 +1,10 @@
1
+ #pragma mapbox: define highp vec4 color
2
+ #pragma mapbox: define lowp float opacity
3
+ void main(){
4
+ #pragma mapbox: initialize highp vec4 color
5
+ #pragma mapbox: initialize lowp float opacity
6
+ gl_FragColor=color*opacity;
7
+ #ifdef OVERDRAW_INSPECTOR
8
+ gl_FragColor=vec4(1.);
9
+ #endif
10
+ }
@@ -0,0 +1,7 @@
1
+ attribute vec2 a_pos;uniform mat4 u_matrix;
2
+ #pragma mapbox: define highp vec4 color
3
+ #pragma mapbox: define lowp float opacity
4
+ void main(){
5
+ #pragma mapbox: initialize highp vec4 color
6
+ #pragma mapbox: initialize lowp float opacity
7
+ gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -0,0 +1,13 @@
1
+ varying vec4 v_color;
2
+ #pragma mapbox: define lowp float base
3
+ #pragma mapbox: define lowp float height
4
+ #pragma mapbox: define highp vec4 color
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float base
7
+ #pragma mapbox: initialize lowp float height
8
+ #pragma mapbox: initialize highp vec4 color
9
+ gl_FragColor=v_color;
10
+ #ifdef OVERDRAW_INSPECTOR
11
+ gl_FragColor=vec4(1.);
12
+ #endif
13
+ }
@@ -0,0 +1,9 @@
1
+ uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
2
+ #pragma mapbox: define lowp float base
3
+ #pragma mapbox: define lowp float height
4
+ #pragma mapbox: define highp vec4 color
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float base
7
+ #pragma mapbox: initialize lowp float height
8
+ #pragma mapbox: initialize highp vec4 color
9
+ vec3 normal=a_normal_ed.xyz;base=max(0.,base);height=max(0.,height);float t=mod(normal.x,2.);gl_Position=u_matrix*vec4(a_pos,t>0.?height:base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.,0.,0.,1.);vec4 ambientlight=vec4(0.03,0.03,0.03,1.);color+=ambientlight;float directional=clamp(dot(normal/16384.,u_lightpos),0.,1.);directional=mix((1.-u_lightintensity),max((1.-colorvalue+u_lightintensity),1.),directional);if(normal.y!=0.){directional*=((1.-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.,0.5),mix(0.7,0.98,1.-u_lightintensity),1.)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.,0.3,1.-u_lightcolor.r),1.);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.,0.3,1.-u_lightcolor.g),1.);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.,0.3,1.-u_lightcolor.b),1.);v_color*=u_opacity;}
@@ -0,0 +1,15 @@
1
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
2
+ #pragma mapbox: define lowp float base
3
+ #pragma mapbox: define lowp float height
4
+ #pragma mapbox: define lowp vec4 pattern_from
5
+ #pragma mapbox: define lowp vec4 pattern_to
6
+ void main(){
7
+ #pragma mapbox: initialize lowp float base
8
+ #pragma mapbox: initialize lowp float height
9
+ #pragma mapbox: initialize mediump vec4 pattern_from
10
+ #pragma mapbox: initialize mediump vec4 pattern_to
11
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
12
+ #ifdef OVERDRAW_INSPECTOR
13
+ gl_FragColor=vec4(1.);
14
+ #endif
15
+ }
@@ -0,0 +1,11 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec4 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
2
+ #pragma mapbox: define lowp float base
3
+ #pragma mapbox: define lowp float height
4
+ #pragma mapbox: define lowp vec4 pattern_from
5
+ #pragma mapbox: define lowp vec4 pattern_to
6
+ void main(){
7
+ #pragma mapbox: initialize lowp float base
8
+ #pragma mapbox: initialize lowp float height
9
+ #pragma mapbox: initialize mediump vec4 pattern_from
10
+ #pragma mapbox: initialize mediump vec4 pattern_to
11
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);base=max(0.,base);height=max(0.,height);float t=mod(normal.x,2.);float z=t>0.?height:base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.&&normal.y==0.&&normal.z==16384.?a_pos:vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.,0.,0.,1.);float directional=clamp(dot(normal/16383.,u_lightpos),0.,1.);directional=mix((1.-u_lightintensity),max((0.5+u_lightintensity),1.),directional);if(normal.y!=0.){directional*=((1.-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.,0.5),mix(0.7,0.98,1.-u_lightintensity),1.)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.),vec3(0.3),1.-u_lightcolor),vec3(1.));v_lighting*=u_opacity;}
@@ -0,0 +1,10 @@
1
+ #pragma mapbox: define highp vec4 outline_color
2
+ #pragma mapbox: define lowp float opacity
3
+ varying vec2 v_pos;void main(){
4
+ #pragma mapbox: initialize highp vec4 outline_color
5
+ #pragma mapbox: initialize lowp float opacity
6
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.-smoothstep(0.,1.,dist);gl_FragColor=outline_color*(alpha*opacity);
7
+ #ifdef OVERDRAW_INSPECTOR
8
+ gl_FragColor=vec4(1.);
9
+ #endif
10
+ }
@@ -0,0 +1,7 @@
1
+ attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
2
+ #pragma mapbox: define highp vec4 outline_color
3
+ #pragma mapbox: define lowp float opacity
4
+ void main(){
5
+ #pragma mapbox: initialize highp vec4 outline_color
6
+ #pragma mapbox: initialize lowp float opacity
7
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.)/2.*u_world;}
@@ -0,0 +1,13 @@
1
+ uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
2
+ #pragma mapbox: define lowp float opacity
3
+ #pragma mapbox: define lowp vec4 pattern_from
4
+ #pragma mapbox: define lowp vec4 pattern_to
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float opacity
7
+ #pragma mapbox: initialize mediump vec4 pattern_from
8
+ #pragma mapbox: initialize mediump vec4 pattern_to
9
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.-smoothstep(0.,1.,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
10
+ #ifdef OVERDRAW_INSPECTOR
11
+ gl_FragColor=vec4(1.);
12
+ #endif
13
+ }
@@ -0,0 +1,9 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
2
+ #pragma mapbox: define lowp float opacity
3
+ #pragma mapbox: define lowp vec4 pattern_from
4
+ #pragma mapbox: define lowp vec4 pattern_to
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float opacity
7
+ #pragma mapbox: initialize mediump vec4 pattern_from
8
+ #pragma mapbox: initialize mediump vec4 pattern_to
9
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.)/2.*u_world;}
@@ -0,0 +1,13 @@
1
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
2
+ #pragma mapbox: define lowp float opacity
3
+ #pragma mapbox: define lowp vec4 pattern_from
4
+ #pragma mapbox: define lowp vec4 pattern_to
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float opacity
7
+ #pragma mapbox: initialize mediump vec4 pattern_from
8
+ #pragma mapbox: initialize mediump vec4 pattern_to
9
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
10
+ #ifdef OVERDRAW_INSPECTOR
11
+ gl_FragColor=vec4(1.);
12
+ #endif
13
+ }
@@ -0,0 +1,9 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
2
+ #pragma mapbox: define lowp float opacity
3
+ #pragma mapbox: define lowp vec4 pattern_from
4
+ #pragma mapbox: define lowp vec4 pattern_to
5
+ void main(){
6
+ #pragma mapbox: initialize lowp float opacity
7
+ #pragma mapbox: initialize mediump vec4 pattern_from
8
+ #pragma mapbox: initialize mediump vec4 pattern_to
9
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}
@@ -0,0 +1,10 @@
1
+ #pragma mapbox: define highp float weight
2
+ uniform highp float u_intensity;varying vec2 v_extrude;
3
+ #define GAUSS_COEF 0.3989422804014327
4
+ void main(){
5
+ #pragma mapbox: initialize highp float weight
6
+ float d=-0.5*3.*3.*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.,1.,1.);
7
+ #ifdef OVERDRAW_INSPECTOR
8
+ gl_FragColor=vec4(1.);
9
+ #endif
10
+ }
@@ -0,0 +1,8 @@
1
+ #pragma mapbox: define highp float weight
2
+ #pragma mapbox: define mediump float radius
3
+ uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;const highp float ZERO=1./255./16.;
4
+ #define GAUSS_COEF 0.3989422804014327
5
+ void main(void){
6
+ #pragma mapbox: initialize highp float weight
7
+ #pragma mapbox: initialize mediump float radius
8
+ vec2 unscaled_extrude=vec2(mod(a_pos,2.)*2.-1.);float S=sqrt(-2.*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}
@@ -0,0 +1,5 @@
1
+ uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main(){float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
2
+ #ifdef OVERDRAW_INSPECTOR
3
+ gl_FragColor=vec4(0.);
4
+ #endif
5
+ }
@@ -0,0 +1 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main(){gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.-a_pos.y;}
@@ -0,0 +1,7 @@
1
+ uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
2
+ #define PI 3.141592653589793
3
+ void main(){vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.)-1.);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x!=0.?atan(deriv.y,-deriv.x):PI/2.*(deriv.y>0.?1.:-1.);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity!=0.5?((pow(base,slope)-1.)/(pow(base,maxValue)-1.))*maxValue:slope;float accent=cos(scaledSlope);vec4 accent_color=(1.-accent)*u_accent*clamp(intensity*2.,0.,1.);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.)-1.);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.,0.,1.);gl_FragColor=accent_color*(1.-shade_color.a)+shade_color;
4
+ #ifdef OVERDRAW_INSPECTOR
5
+ gl_FragColor=vec4(1.);
6
+ #endif
7
+ }
@@ -0,0 +1 @@
1
+ uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.;}
@@ -0,0 +1,8 @@
1
+ #ifdef GL_ES
2
+ precision highp float;
3
+ #endif
4
+ uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;float getElevation(vec2 coord,float bias){vec4 data=texture2D(u_image,coord)*255.;return(data.r+data.g*256.+data.b*256.*256.)/4.;}void main(){vec2 epsilon=1./u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.);float e=getElevation(v_pos,0.);float f=getElevation(v_pos+vec2(epsilon.x,0),0.);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.);float h=getElevation(v_pos+vec2(0,epsilon.y),0.);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.);float exaggeration=u_zoom<2.?0.4:u_zoom<4.5?0.35:0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.+0.5,deriv.y/2.+0.5,1.,1.),0.,1.);
5
+ #ifdef OVERDRAW_INSPECTOR
6
+ gl_FragColor=vec4(1.);
7
+ #endif
8
+ }
@@ -0,0 +1 @@
1
+ uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);vec2 epsilon=1./u_dimension;float scale=(u_dimension.x-2.)/u_dimension.x;v_pos=(a_texture_pos/8192.)*scale+epsilon;}
@@ -0,0 +1,12 @@
1
+ #pragma mapbox: define highp vec4 color
2
+ #pragma mapbox: define lowp float blur
3
+ #pragma mapbox: define lowp float opacity
4
+ varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;void main(){
5
+ #pragma mapbox: initialize highp vec4 color
6
+ #pragma mapbox: initialize lowp float blur
7
+ #pragma mapbox: initialize lowp float opacity
8
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1./DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.,1.);gl_FragColor=color*(alpha*opacity);
9
+ #ifdef OVERDRAW_INSPECTOR
10
+ gl_FragColor=vec4(1.);
11
+ #endif
12
+ }
@@ -0,0 +1,17 @@
1
+ #define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
2
+ #define scale 0.015873016
3
+ attribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
4
+ #pragma mapbox: define highp vec4 color
5
+ #pragma mapbox: define lowp float blur
6
+ #pragma mapbox: define lowp float opacity
7
+ #pragma mapbox: define mediump float gapwidth
8
+ #pragma mapbox: define lowp float offset
9
+ #pragma mapbox: define mediump float width
10
+ void main(){
11
+ #pragma mapbox: initialize highp vec4 color
12
+ #pragma mapbox: initialize lowp float blur
13
+ #pragma mapbox: initialize lowp float opacity
14
+ #pragma mapbox: initialize mediump float gapwidth
15
+ #pragma mapbox: initialize lowp float offset
16
+ #pragma mapbox: initialize mediump float width
17
+ vec2 a_extrude=a_data.xy-128.;float a_direction=mod(a_data.z,4.)-1.;v_linesofar=(floor(a_data.z/4.)+a_data.w*64.)*2.;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.;float halfwidth=width/2.;offset=-1.*offset;float inset=gapwidth+(gapwidth>0.?ANTIALIASING:0.);float outset=gapwidth+halfwidth*(gapwidth>0.?2.:1.)+(halfwidth==0.?0.:ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.,0.);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.,1.)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}
@@ -0,0 +1,10 @@
1
+ #pragma mapbox: define lowp float blur
2
+ #pragma mapbox: define lowp float opacity
3
+ uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;void main(){
4
+ #pragma mapbox: initialize lowp float blur
5
+ #pragma mapbox: initialize lowp float opacity
6
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1./DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.,1.);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);
7
+ #ifdef OVERDRAW_INSPECTOR
8
+ gl_FragColor=vec4(1.);
9
+ #endif
10
+ }
@@ -0,0 +1,16 @@
1
+ #define MAX_LINE_DISTANCE 32767.0
2
+ #define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
3
+ #define scale 0.015873016
4
+ attribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;
5
+ #pragma mapbox: define lowp float blur
6
+ #pragma mapbox: define lowp float opacity
7
+ #pragma mapbox: define mediump float gapwidth
8
+ #pragma mapbox: define lowp float offset
9
+ #pragma mapbox: define mediump float width
10
+ void main(){
11
+ #pragma mapbox: initialize lowp float blur
12
+ #pragma mapbox: initialize lowp float opacity
13
+ #pragma mapbox: initialize mediump float gapwidth
14
+ #pragma mapbox: initialize lowp float offset
15
+ #pragma mapbox: initialize mediump float width
16
+ vec2 a_extrude=a_data.xy-128.;float a_direction=mod(a_data.z,4.)-1.;v_lineprogress=(floor(a_data.z/4.)+a_data.w*64.)*2./MAX_LINE_DISTANCE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.;float halfwidth=width/2.;offset=-1.*offset;float inset=gapwidth+(gapwidth>0.?ANTIALIASING:0.);float outset=gapwidth+halfwidth*(gapwidth>0.?2.:1.)+(halfwidth==0.?0.:ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.,0.);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.,1.)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}
@@ -0,0 +1,15 @@
1
+ uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec4 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;
2
+ #pragma mapbox: define lowp vec4 pattern_from
3
+ #pragma mapbox: define lowp vec4 pattern_to
4
+ #pragma mapbox: define lowp float blur
5
+ #pragma mapbox: define lowp float opacity
6
+ void main(){
7
+ #pragma mapbox: initialize mediump vec4 pattern_from
8
+ #pragma mapbox: initialize mediump vec4 pattern_to
9
+ #pragma mapbox: initialize lowp float blur
10
+ #pragma mapbox: initialize lowp float opacity
11
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float dist=length(v_normal)*v_width2.s;float blur2=(blur+1./DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.,1.);float x_a=mod(v_linesofar/pattern_size_a.x,1.);float x_b=mod(v_linesofar/pattern_size_b.x,1.);float y_a=0.5+(v_normal.y*clamp(v_width2.s,0.,(pattern_size_a.y+2.)/2.)/pattern_size_a.y);float y_b=0.5+(v_normal.y*clamp(v_width2.s,0.,(pattern_size_b.y+2.)/2.)/pattern_size_b.y);vec2 pos_a=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,vec2(x_a,y_a));vec2 pos_b=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,vec2(x_b,y_b));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
12
+ #ifdef OVERDRAW_INSPECTOR
13
+ gl_FragColor=vec4(1.);
14
+ #endif
15
+ }
@@ -0,0 +1,20 @@
1
+ #define scale 0.015873016
2
+ #define LINE_DISTANCE_SCALE 2.0
3
+ #define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
4
+ attribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_gl_units_to_pixels;uniform mediump float u_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;
5
+ #pragma mapbox: define lowp float blur
6
+ #pragma mapbox: define lowp float opacity
7
+ #pragma mapbox: define lowp float offset
8
+ #pragma mapbox: define mediump float gapwidth
9
+ #pragma mapbox: define mediump float width
10
+ #pragma mapbox: define lowp vec4 pattern_from
11
+ #pragma mapbox: define lowp vec4 pattern_to
12
+ void main(){
13
+ #pragma mapbox: initialize lowp float blur
14
+ #pragma mapbox: initialize lowp float opacity
15
+ #pragma mapbox: initialize lowp float offset
16
+ #pragma mapbox: initialize mediump float gapwidth
17
+ #pragma mapbox: initialize mediump float width
18
+ #pragma mapbox: initialize mediump vec4 pattern_from
19
+ #pragma mapbox: initialize mediump vec4 pattern_to
20
+ vec2 a_extrude=a_data.xy-128.;float a_direction=mod(a_data.z,4.)-1.;float a_linesofar=(floor(a_data.z/4.)+a_data.w*64.)*LINE_DISTANCE_SCALE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.;float halfwidth=width/2.;offset=-1.*offset;float inset=gapwidth+(gapwidth>0.?ANTIALIASING:0.);float outset=gapwidth+halfwidth*(gapwidth>0.?2.:1.)+(halfwidth==0.?0.:ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.,0.);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.,1.)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);}
@@ -0,0 +1,17 @@
1
+ uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
2
+ #pragma mapbox: define highp vec4 color
3
+ #pragma mapbox: define lowp float blur
4
+ #pragma mapbox: define lowp float opacity
5
+ #pragma mapbox: define mediump float width
6
+ #pragma mapbox: define lowp float floorwidth
7
+ void main(){
8
+ #pragma mapbox: initialize highp vec4 color
9
+ #pragma mapbox: initialize lowp float blur
10
+ #pragma mapbox: initialize lowp float opacity
11
+ #pragma mapbox: initialize mediump float width
12
+ #pragma mapbox: initialize lowp float floorwidth
13
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1./DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.,1.);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
14
+ #ifdef OVERDRAW_INSPECTOR
15
+ gl_FragColor=vec4(1.);
16
+ #endif
17
+ }
@@ -0,0 +1,20 @@
1
+ #define scale 0.015873016
2
+ #define LINE_DISTANCE_SCALE 2.0
3
+ #define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
4
+ attribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
5
+ #pragma mapbox: define highp vec4 color
6
+ #pragma mapbox: define lowp float blur
7
+ #pragma mapbox: define lowp float opacity
8
+ #pragma mapbox: define mediump float gapwidth
9
+ #pragma mapbox: define lowp float offset
10
+ #pragma mapbox: define mediump float width
11
+ #pragma mapbox: define lowp float floorwidth
12
+ void main(){
13
+ #pragma mapbox: initialize highp vec4 color
14
+ #pragma mapbox: initialize lowp float blur
15
+ #pragma mapbox: initialize lowp float opacity
16
+ #pragma mapbox: initialize mediump float gapwidth
17
+ #pragma mapbox: initialize lowp float offset
18
+ #pragma mapbox: initialize mediump float width
19
+ #pragma mapbox: initialize lowp float floorwidth
20
+ vec2 a_extrude=a_data.xy-128.;float a_direction=mod(a_data.z,4.)-1.;float a_linesofar=(floor(a_data.z/4.)+a_data.w*64.)*LINE_DISTANCE_SCALE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.;float halfwidth=width/2.;offset=-1.*offset;float inset=gapwidth+(gapwidth>0.?ANTIALIASING:0.);float outset=gapwidth+halfwidth*(gapwidth>0.?2.:1.)+(halfwidth==0.?0.:ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.,0.);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.,1.)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}