@mapwhit/tilerenderer 1.0.0 → 1.1.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 (236) hide show
  1. package/build/min/package.json +2 -1
  2. package/build/min/src/shaders/_prelude.fragment.glsl.js +1 -1
  3. package/build/min/src/shaders/_prelude.vertex.glsl.js +1 -1
  4. package/build/min/src/shaders/background.fragment.glsl.js +1 -1
  5. package/build/min/src/shaders/background.vertex.glsl.js +1 -1
  6. package/build/min/src/shaders/background_pattern.fragment.glsl.js +1 -1
  7. package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
  8. package/build/min/src/shaders/circle.fragment.glsl.js +1 -1
  9. package/build/min/src/shaders/circle.vertex.glsl.js +1 -1
  10. package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
  11. package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
  12. package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
  13. package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
  14. package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
  15. package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
  16. package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
  17. package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
  18. package/build/min/src/shaders/fill.fragment.glsl.js +1 -1
  19. package/build/min/src/shaders/fill.vertex.glsl.js +1 -1
  20. package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +1 -1
  21. package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +1 -1
  22. package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +1 -1
  23. package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +1 -1
  24. package/build/min/src/shaders/fill_outline.fragment.glsl.js +1 -1
  25. package/build/min/src/shaders/fill_outline.vertex.glsl.js +1 -1
  26. package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +1 -1
  27. package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +1 -1
  28. package/build/min/src/shaders/fill_pattern.fragment.glsl.js +1 -1
  29. package/build/min/src/shaders/fill_pattern.vertex.glsl.js +1 -1
  30. package/build/min/src/shaders/heatmap.fragment.glsl.js +1 -1
  31. package/build/min/src/shaders/heatmap.vertex.glsl.js +1 -1
  32. package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +1 -1
  33. package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
  34. package/build/min/src/shaders/hillshade.fragment.glsl.js +1 -1
  35. package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
  36. package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +1 -1
  37. package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
  38. package/build/min/src/shaders/line.fragment.glsl.js +1 -1
  39. package/build/min/src/shaders/line.vertex.glsl.js +1 -1
  40. package/build/min/src/shaders/line_gradient.fragment.glsl.js +1 -1
  41. package/build/min/src/shaders/line_gradient.vertex.glsl.js +1 -1
  42. package/build/min/src/shaders/line_pattern.fragment.glsl.js +1 -1
  43. package/build/min/src/shaders/line_pattern.vertex.glsl.js +1 -1
  44. package/build/min/src/shaders/line_sdf.fragment.glsl.js +1 -1
  45. package/build/min/src/shaders/line_sdf.vertex.glsl.js +1 -1
  46. package/build/min/src/shaders/raster.fragment.glsl.js +1 -1
  47. package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
  48. package/build/min/src/shaders/symbol_icon.fragment.glsl.js +1 -1
  49. package/build/min/src/shaders/symbol_icon.vertex.glsl.js +1 -1
  50. package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +1 -1
  51. package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +1 -1
  52. package/package.json +3 -2
  53. package/src/data/array_types.js +54 -81
  54. package/src/data/bucket/circle_attributes.js +2 -4
  55. package/src/data/bucket/circle_bucket.js +19 -13
  56. package/src/data/bucket/fill_attributes.js +2 -4
  57. package/src/data/bucket/fill_bucket.js +38 -24
  58. package/src/data/bucket/fill_extrusion_attributes.js +2 -4
  59. package/src/data/bucket/fill_extrusion_bucket.js +56 -34
  60. package/src/data/bucket/heatmap_bucket.js +2 -7
  61. package/src/data/bucket/line_attributes.js +2 -4
  62. package/src/data/bucket/line_bucket.js +207 -159
  63. package/src/data/bucket/pattern_attributes.js +2 -4
  64. package/src/data/bucket/pattern_bucket_features.js +5 -7
  65. package/src/data/bucket/symbol_attributes.js +12 -26
  66. package/src/data/bucket/symbol_bucket.js +111 -221
  67. package/src/data/bucket/symbol_buffers.js +62 -0
  68. package/src/data/bucket/symbol_collision_buffers.js +33 -0
  69. package/src/data/bucket.js +2 -6
  70. package/src/data/dem_data.js +11 -7
  71. package/src/data/extent.js +1 -1
  72. package/src/data/feature_index.js +35 -20
  73. package/src/data/index_array_type.js +1 -6
  74. package/src/data/load_geometry.js +6 -9
  75. package/src/data/pos_attributes.js +2 -3
  76. package/src/data/program_configuration.js +44 -26
  77. package/src/data/raster_bounds_attributes.js +2 -2
  78. package/src/data/segment.js +4 -3
  79. package/src/geo/coordinate.js +1 -1
  80. package/src/geo/lng_lat.js +3 -3
  81. package/src/geo/lng_lat_bounds.js +8 -4
  82. package/src/geo/transform.js +69 -30
  83. package/src/gl/color_mode.js +2 -2
  84. package/src/gl/context.js +28 -29
  85. package/src/gl/cull_face_mode.js +1 -1
  86. package/src/gl/depth_mode.js +1 -1
  87. package/src/gl/framebuffer.js +8 -4
  88. package/src/gl/index_buffer.js +2 -2
  89. package/src/gl/stencil_mode.js +1 -1
  90. package/src/gl/value.js +33 -68
  91. package/src/gl/vertex_buffer.js +2 -2
  92. package/src/index.js +49 -25
  93. package/src/render/draw_background.js +14 -9
  94. package/src/render/draw_circle.js +11 -8
  95. package/src/render/draw_collision_debug.js +11 -8
  96. package/src/render/draw_debug.js +16 -14
  97. package/src/render/draw_fill.js +19 -12
  98. package/src/render/draw_fill_extrusion.js +12 -9
  99. package/src/render/draw_heatmap.js +17 -12
  100. package/src/render/draw_hillshade.js +12 -9
  101. package/src/render/draw_line.js +30 -16
  102. package/src/render/draw_raster.js +17 -13
  103. package/src/render/draw_symbol.js +22 -17
  104. package/src/render/glyph_atlas.js +9 -5
  105. package/src/render/glyph_manager.js +1 -1
  106. package/src/render/image_atlas.js +4 -7
  107. package/src/render/image_manager.js +6 -9
  108. package/src/render/line_atlas.js +2 -2
  109. package/src/render/painter.js +65 -47
  110. package/src/render/program/background_program.js +6 -13
  111. package/src/render/program/circle_program.js +4 -6
  112. package/src/render/program/clipping_mask_program.js +3 -5
  113. package/src/render/program/collision_program.js +4 -6
  114. package/src/render/program/debug_program.js +3 -5
  115. package/src/render/program/fill_extrusion_program.js +8 -14
  116. package/src/render/program/fill_program.js +10 -21
  117. package/src/render/program/heatmap_program.js +8 -14
  118. package/src/render/program/hillshade_program.js +10 -16
  119. package/src/render/program/line_program.js +11 -22
  120. package/src/render/program/pattern.js +5 -7
  121. package/src/render/program/program_uniforms.js +13 -20
  122. package/src/render/program/raster_program.js +3 -5
  123. package/src/render/program/symbol_program.js +5 -7
  124. package/src/render/program.js +5 -6
  125. package/src/render/texture.js +1 -1
  126. package/src/render/tile_mask.js +6 -4
  127. package/src/render/uniform_binding.js +9 -20
  128. package/src/render/vertex_array_object.js +5 -3
  129. package/src/shaders/encode_attribute.js +2 -6
  130. package/src/shaders/index.js +103 -51
  131. package/src/source/geojson_source.js +11 -7
  132. package/src/source/geojson_worker_source.js +7 -7
  133. package/src/source/geojson_wrapper.js +4 -4
  134. package/src/source/image_source.js +11 -12
  135. package/src/source/load_tilejson.js +3 -3
  136. package/src/source/pixels_to_tile_units.js +3 -3
  137. package/src/source/query_features.js +13 -10
  138. package/src/source/raster_dem_tile_source.js +12 -10
  139. package/src/source/raster_tile_source.js +13 -9
  140. package/src/source/resources/glyphs.js +2 -3
  141. package/src/source/resources/index.js +2 -4
  142. package/src/source/rtl_text_plugin.js +8 -8
  143. package/src/source/source.js +9 -15
  144. package/src/source/source_cache.js +114 -49
  145. package/src/source/source_state.js +37 -14
  146. package/src/source/tile.js +38 -23
  147. package/src/source/tile_bounds.js +15 -8
  148. package/src/source/tile_cache.js +2 -2
  149. package/src/source/tile_id.js +30 -23
  150. package/src/source/vector_tile_source.js +10 -8
  151. package/src/source/vector_tile_worker_source.js +4 -4
  152. package/src/source/worker_tile.js +24 -22
  153. package/src/style/create_style_layer.js +11 -11
  154. package/src/style/evaluation_parameters.js +4 -6
  155. package/src/style/light.js +5 -5
  156. package/src/style/load_sprite.js +6 -6
  157. package/src/style/parse_glyph_pbf.js +21 -17
  158. package/src/style/pauseable_placement.js +3 -4
  159. package/src/style/properties.js +21 -44
  160. package/src/style/query_utils.js +4 -10
  161. package/src/style/style.js +64 -34
  162. package/src/style/style_layer/background_style_layer.js +3 -4
  163. package/src/style/style_layer/background_style_layer_properties.js +2 -2
  164. package/src/style/style_layer/circle_style_layer.js +12 -9
  165. package/src/style/style_layer/circle_style_layer_properties.js +2 -2
  166. package/src/style/style_layer/fill_extrusion_style_layer.js +16 -13
  167. package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
  168. package/src/style/style_layer/fill_style_layer.js +6 -7
  169. package/src/style/style_layer/fill_style_layer_properties.js +2 -2
  170. package/src/style/style_layer/heatmap_style_layer.js +5 -6
  171. package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
  172. package/src/style/style_layer/hillshade_style_layer.js +3 -4
  173. package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
  174. package/src/style/style_layer/line_style_layer.js +10 -11
  175. package/src/style/style_layer/line_style_layer_properties.js +5 -5
  176. package/src/style/style_layer/raster_style_layer.js +3 -4
  177. package/src/style/style_layer/raster_style_layer_properties.js +2 -2
  178. package/src/style/style_layer/symbol_style_layer.js +7 -8
  179. package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
  180. package/src/style/style_layer.js +21 -20
  181. package/src/style/style_layer_index.js +2 -2
  182. package/src/style/zoom_history.js +1 -1
  183. package/src/style-spec/error/parsing_error.js +1 -1
  184. package/src/style-spec/error/validation_error.js +5 -3
  185. package/src/style-spec/feature_filter/convert.js +17 -9
  186. package/src/style-spec/feature_filter/index.js +13 -9
  187. package/src/style-spec/util/eval_support.js +2 -2
  188. package/src/style-spec/util/ref_properties.js +1 -1
  189. package/src/symbol/anchor.js +2 -2
  190. package/src/symbol/check_max_angle.js +13 -5
  191. package/src/symbol/clip_line.js +2 -3
  192. package/src/symbol/collision_feature.js +8 -4
  193. package/src/symbol/collision_index.js +5 -7
  194. package/src/symbol/cross_tile_symbol_index.js +5 -5
  195. package/src/symbol/get_anchors.js +15 -8
  196. package/src/symbol/grid_index.js +5 -3
  197. package/src/symbol/mergelines.js +2 -2
  198. package/src/symbol/opacity_state.js +1 -1
  199. package/src/symbol/placement.js +25 -20
  200. package/src/symbol/projection.js +29 -28
  201. package/src/symbol/quads.js +10 -12
  202. package/src/symbol/shaping.js +27 -19
  203. package/src/symbol/symbol_layout.js +17 -21
  204. package/src/symbol/symbol_size.js +13 -12
  205. package/src/symbol/transform_text.js +3 -3
  206. package/src/ui/camera.js +34 -18
  207. package/src/ui/map.js +54 -34
  208. package/src/util/async.js +11 -5
  209. package/src/util/browser.js +1 -1
  210. package/src/util/callback.js +3 -9
  211. package/src/util/classify_rings.js +13 -8
  212. package/src/util/color_ramp.js +3 -3
  213. package/src/util/config.js +4 -4
  214. package/src/util/dictionary_coder.js +2 -3
  215. package/src/util/dom.js +7 -3
  216. package/src/util/find_pole_of_inaccessibility.js +29 -14
  217. package/src/util/group_layers.js +1 -1
  218. package/src/util/image.js +3 -8
  219. package/src/util/interpolate.js +1 -1
  220. package/src/util/intersection_tests.js +80 -42
  221. package/src/util/is_char_in_unicode_block.js +1 -1
  222. package/src/util/key.js +7 -3
  223. package/src/util/loader/image.js +1 -1
  224. package/src/util/object.js +25 -23
  225. package/src/util/script_detection.js +212 -91
  226. package/src/util/struct_array.js +8 -40
  227. package/src/util/task_queue.js +11 -7
  228. package/src/util/throttle.js +2 -2
  229. package/src/util/tile_cover.js +8 -5
  230. package/src/util/token.js +1 -1
  231. package/src/util/unique_id.js +2 -2
  232. package/src/util/util.js +21 -29
  233. package/src/util/vectortile_to_geojson.js +4 -2
  234. package/src/util/verticalize_punctuation.js +3 -7
  235. package/src/util/warn.js +4 -4
  236. package/src/util/web_worker.js +3 -3
@@ -1,7 +1,8 @@
1
1
  // This file is generated. Edit the template at meta/bin/generate-struct-arrays.js.ejs and instead.
2
2
 
3
- const assert = require('assert');
4
- const { Struct, StructArray } = require('../util/struct_array');
3
+ import assert from 'assert';
4
+
5
+ import { Struct, StructArray } from '../util/struct_array.js';
5
6
 
6
7
  /**
7
8
  * Implementation of the StructArray layout:
@@ -9,7 +10,7 @@ const { Struct, StructArray } = require('../util/struct_array');
9
10
  *
10
11
  * @private
11
12
  */
12
- class StructArrayLayout2i4 extends StructArray {
13
+ export class StructArrayLayout2i4 extends StructArray {
13
14
  _refreshViews() {
14
15
  this.uint8 = new Uint8Array(this.arrayBuffer);
15
16
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -40,7 +41,7 @@ StructArrayLayout2i4.prototype.bytesPerElement = 4;
40
41
  *
41
42
  * @private
42
43
  */
43
- class StructArrayLayout4i8 extends StructArray {
44
+ export class StructArrayLayout4i8 extends StructArray {
44
45
  _refreshViews() {
45
46
  this.uint8 = new Uint8Array(this.arrayBuffer);
46
47
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -76,7 +77,7 @@ StructArrayLayout4i8.prototype.bytesPerElement = 8;
76
77
  *
77
78
  * @private
78
79
  */
79
- class StructArrayLayout2i4i12 extends StructArray {
80
+ export class StructArrayLayout2i4i12 extends StructArray {
80
81
  _refreshViews() {
81
82
  this.uint8 = new Uint8Array(this.arrayBuffer);
82
83
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -116,7 +117,7 @@ StructArrayLayout2i4i12.prototype.bytesPerElement = 12;
116
117
  *
117
118
  * @private
118
119
  */
119
- class StructArrayLayout4i4ub12 extends StructArray {
120
+ export class StructArrayLayout4i4ub12 extends StructArray {
120
121
  _refreshViews() {
121
122
  this.uint8 = new Uint8Array(this.arrayBuffer);
122
123
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -161,7 +162,7 @@ StructArrayLayout4i4ub12.prototype.bytesPerElement = 12;
161
162
  *
162
163
  * @private
163
164
  */
164
- class StructArrayLayout8ui16 extends StructArray {
165
+ export class StructArrayLayout8ui16 extends StructArray {
165
166
  _refreshViews() {
166
167
  this.uint8 = new Uint8Array(this.arrayBuffer);
167
168
  this.uint16 = new Uint16Array(this.arrayBuffer);
@@ -205,7 +206,7 @@ StructArrayLayout8ui16.prototype.bytesPerElement = 16;
205
206
  *
206
207
  * @private
207
208
  */
208
- class StructArrayLayout4i4ui16 extends StructArray {
209
+ export class StructArrayLayout4i4ui16 extends StructArray {
209
210
  _refreshViews() {
210
211
  this.uint8 = new Uint8Array(this.arrayBuffer);
211
212
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -249,7 +250,7 @@ StructArrayLayout4i4ui16.prototype.bytesPerElement = 16;
249
250
  *
250
251
  * @private
251
252
  */
252
- class StructArrayLayout3f12 extends StructArray {
253
+ export class StructArrayLayout3f12 extends StructArray {
253
254
  _refreshViews() {
254
255
  this.uint8 = new Uint8Array(this.arrayBuffer);
255
256
  this.float32 = new Float32Array(this.arrayBuffer);
@@ -282,7 +283,7 @@ StructArrayLayout3f12.prototype.bytesPerElement = 12;
282
283
  *
283
284
  * @private
284
285
  */
285
- class StructArrayLayout1ul4 extends StructArray {
286
+ export class StructArrayLayout1ul4 extends StructArray {
286
287
  _refreshViews() {
287
288
  this.uint8 = new Uint8Array(this.arrayBuffer);
288
289
  this.uint32 = new Uint32Array(this.arrayBuffer);
@@ -314,7 +315,7 @@ StructArrayLayout1ul4.prototype.bytesPerElement = 4;
314
315
  *
315
316
  * @private
316
317
  */
317
- class StructArrayLayout6i1ul2ui2i24 extends StructArray {
318
+ export class StructArrayLayout6i1ul2ui2i24 extends StructArray {
318
319
  _refreshViews() {
319
320
  this.uint8 = new Uint8Array(this.arrayBuffer);
320
321
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -369,7 +370,7 @@ StructArrayLayout6i1ul2ui2i24.prototype.bytesPerElement = 24;
369
370
  *
370
371
  * @private
371
372
  */
372
- class StructArrayLayout2i2i2i12 extends StructArray {
373
+ export class StructArrayLayout2i2i2i12 extends StructArray {
373
374
  _refreshViews() {
374
375
  this.uint8 = new Uint8Array(this.arrayBuffer);
375
376
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -408,7 +409,7 @@ StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;
408
409
  *
409
410
  * @private
410
411
  */
411
- class StructArrayLayout2ub4 extends StructArray {
412
+ export class StructArrayLayout2ub4 extends StructArray {
412
413
  _refreshViews() {
413
414
  this.uint8 = new Uint8Array(this.arrayBuffer);
414
415
  }
@@ -443,7 +444,7 @@ StructArrayLayout2ub4.prototype.bytesPerElement = 4;
443
444
  *
444
445
  * @private
445
446
  */
446
- class StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray {
447
+ export class StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray {
447
448
  _refreshViews() {
448
449
  this.uint8 = new Uint8Array(this.arrayBuffer);
449
450
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -507,7 +508,7 @@ StructArrayLayout2i2ui3ul3ui2f2ub40.prototype.bytesPerElement = 40;
507
508
  *
508
509
  * @private
509
510
  */
510
- class StructArrayLayout4i9ui1ul32 extends StructArray {
511
+ export class StructArrayLayout4i9ui1ul32 extends StructArray {
511
512
  _refreshViews() {
512
513
  this.uint8 = new Uint8Array(this.arrayBuffer);
513
514
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -566,7 +567,7 @@ StructArrayLayout4i9ui1ul32.prototype.bytesPerElement = 32;
566
567
  *
567
568
  * @private
568
569
  */
569
- class StructArrayLayout1f4 extends StructArray {
570
+ export class StructArrayLayout1f4 extends StructArray {
570
571
  _refreshViews() {
571
572
  this.uint8 = new Uint8Array(this.arrayBuffer);
572
573
  this.float32 = new Float32Array(this.arrayBuffer);
@@ -595,7 +596,7 @@ StructArrayLayout1f4.prototype.bytesPerElement = 4;
595
596
  *
596
597
  * @private
597
598
  */
598
- class StructArrayLayout3i6 extends StructArray {
599
+ export class StructArrayLayout3i6 extends StructArray {
599
600
  _refreshViews() {
600
601
  this.uint8 = new Uint8Array(this.arrayBuffer);
601
602
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -629,7 +630,7 @@ StructArrayLayout3i6.prototype.bytesPerElement = 6;
629
630
  *
630
631
  * @private
631
632
  */
632
- class StructArrayLayout1ul2ui8 extends StructArray {
633
+ export class StructArrayLayout1ul2ui8 extends StructArray {
633
634
  _refreshViews() {
634
635
  this.uint8 = new Uint8Array(this.arrayBuffer);
635
636
  this.uint32 = new Uint32Array(this.arrayBuffer);
@@ -665,7 +666,7 @@ StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
665
666
  *
666
667
  * @private
667
668
  */
668
- class StructArrayLayout3ui6 extends StructArray {
669
+ export class StructArrayLayout3ui6 extends StructArray {
669
670
  _refreshViews() {
670
671
  this.uint8 = new Uint8Array(this.arrayBuffer);
671
672
  this.uint16 = new Uint16Array(this.arrayBuffer);
@@ -698,7 +699,7 @@ StructArrayLayout3ui6.prototype.bytesPerElement = 6;
698
699
  *
699
700
  * @private
700
701
  */
701
- class StructArrayLayout2ui4 extends StructArray {
702
+ export class StructArrayLayout2ui4 extends StructArray {
702
703
  _refreshViews() {
703
704
  this.uint8 = new Uint8Array(this.arrayBuffer);
704
705
  this.uint16 = new Uint16Array(this.arrayBuffer);
@@ -729,7 +730,7 @@ StructArrayLayout2ui4.prototype.bytesPerElement = 4;
729
730
  *
730
731
  * @private
731
732
  */
732
- class StructArrayLayout1ui2 extends StructArray {
733
+ export class StructArrayLayout1ui2 extends StructArray {
733
734
  _refreshViews() {
734
735
  this.uint8 = new Uint8Array(this.arrayBuffer);
735
736
  this.uint16 = new Uint16Array(this.arrayBuffer);
@@ -758,7 +759,7 @@ StructArrayLayout1ui2.prototype.bytesPerElement = 2;
758
759
  *
759
760
  * @private
760
761
  */
761
- class StructArrayLayout2f8 extends StructArray {
762
+ export class StructArrayLayout2f8 extends StructArray {
762
763
  _refreshViews() {
763
764
  this.uint8 = new Uint8Array(this.arrayBuffer);
764
765
  this.float32 = new Float32Array(this.arrayBuffer);
@@ -789,7 +790,7 @@ StructArrayLayout2f8.prototype.bytesPerElement = 8;
789
790
  *
790
791
  * @private
791
792
  */
792
- class StructArrayLayout4f16 extends StructArray {
793
+ export class StructArrayLayout4f16 extends StructArray {
793
794
  _refreshViews() {
794
795
  this.uint8 = new Uint8Array(this.arrayBuffer);
795
796
  this.float32 = new Float32Array(this.arrayBuffer);
@@ -818,7 +819,7 @@ class StructArrayLayout4f16 extends StructArray {
818
819
 
819
820
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
820
821
 
821
- class CollisionBoxStruct extends Struct {
822
+ export class CollisionBoxStruct extends Struct {
822
823
  get anchorPointX() {
823
824
  return this._structArray.int16[this._pos2 + 0];
824
825
  }
@@ -895,7 +896,7 @@ CollisionBoxStruct.prototype.size = 24;
895
896
  /**
896
897
  * @private
897
898
  */
898
- class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 {
899
+ export class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 {
899
900
  /**
900
901
  * Return the CollisionBoxStruct at the given location in the array.
901
902
  * @param {number} index The index of the element.
@@ -906,7 +907,7 @@ class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 {
906
907
  }
907
908
  }
908
909
 
909
- class PlacedSymbolStruct extends Struct {
910
+ export class PlacedSymbolStruct extends Struct {
910
911
  get anchorX() {
911
912
  return this._structArray.int16[this._pos2 + 0];
912
913
  }
@@ -998,7 +999,7 @@ PlacedSymbolStruct.prototype.size = 40;
998
999
  /**
999
1000
  * @private
1000
1001
  */
1001
- class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 {
1002
+ export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 {
1002
1003
  /**
1003
1004
  * Return the PlacedSymbolStruct at the given location in the array.
1004
1005
  * @param {number} index The index of the element.
@@ -1009,7 +1010,7 @@ class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 {
1009
1010
  }
1010
1011
  }
1011
1012
 
1012
- class SymbolInstanceStruct extends Struct {
1013
+ export class SymbolInstanceStruct extends Struct {
1013
1014
  get anchorX() {
1014
1015
  return this._structArray.int16[this._pos2 + 0];
1015
1016
  }
@@ -1101,7 +1102,7 @@ SymbolInstanceStruct.prototype.size = 32;
1101
1102
  /**
1102
1103
  * @private
1103
1104
  */
1104
- class SymbolInstanceArray extends StructArrayLayout4i9ui1ul32 {
1105
+ export class SymbolInstanceArray extends StructArrayLayout4i9ui1ul32 {
1105
1106
  /**
1106
1107
  * Return the SymbolInstanceStruct at the given location in the array.
1107
1108
  * @param {number} index The index of the element.
@@ -1112,7 +1113,7 @@ class SymbolInstanceArray extends StructArrayLayout4i9ui1ul32 {
1112
1113
  }
1113
1114
  }
1114
1115
 
1115
- class GlyphOffsetStruct extends Struct {
1116
+ export class GlyphOffsetStruct extends Struct {
1116
1117
  get offsetX() {
1117
1118
  return this._structArray.float32[this._pos4 + 0];
1118
1119
  }
@@ -1126,7 +1127,7 @@ GlyphOffsetStruct.prototype.size = 4;
1126
1127
  /**
1127
1128
  * @private
1128
1129
  */
1129
- class GlyphOffsetArray extends StructArrayLayout1f4 {
1130
+ export class GlyphOffsetArray extends StructArrayLayout1f4 {
1130
1131
  getoffsetX(index) {
1131
1132
  return this.float32[index * 1 + 0];
1132
1133
  }
@@ -1140,7 +1141,7 @@ class GlyphOffsetArray extends StructArrayLayout1f4 {
1140
1141
  }
1141
1142
  }
1142
1143
 
1143
- class SymbolLineVertexStruct extends Struct {
1144
+ export class SymbolLineVertexStruct extends Struct {
1144
1145
  get x() {
1145
1146
  return this._structArray.int16[this._pos2 + 0];
1146
1147
  }
@@ -1166,7 +1167,7 @@ SymbolLineVertexStruct.prototype.size = 6;
1166
1167
  /**
1167
1168
  * @private
1168
1169
  */
1169
- class SymbolLineVertexArray extends StructArrayLayout3i6 {
1170
+ export class SymbolLineVertexArray extends StructArrayLayout3i6 {
1170
1171
  getx(index) {
1171
1172
  return this.int16[index * 3 + 0];
1172
1173
  }
@@ -1186,7 +1187,7 @@ class SymbolLineVertexArray extends StructArrayLayout3i6 {
1186
1187
  }
1187
1188
  }
1188
1189
 
1189
- class FeatureIndexStruct extends Struct {
1190
+ export class FeatureIndexStruct extends Struct {
1190
1191
  get featureIndex() {
1191
1192
  return this._structArray.uint32[this._pos4 + 0];
1192
1193
  }
@@ -1212,7 +1213,7 @@ FeatureIndexStruct.prototype.size = 8;
1212
1213
  /**
1213
1214
  * @private
1214
1215
  */
1215
- class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
1216
+ export class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
1216
1217
  /**
1217
1218
  * Return the FeatureIndexStruct at the given location in the array.
1218
1219
  * @param {number} index The index of the element.
@@ -1223,50 +1224,22 @@ class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
1223
1224
  }
1224
1225
  }
1225
1226
 
1226
- module.exports = {
1227
- StructArrayLayout2i4,
1228
- StructArrayLayout4i8,
1229
- StructArrayLayout2i4i12,
1230
- StructArrayLayout4i4ub12,
1231
- StructArrayLayout8ui16,
1232
- StructArrayLayout4i4ui16,
1233
- StructArrayLayout3f12,
1234
- StructArrayLayout1ul4,
1235
- StructArrayLayout6i1ul2ui2i24,
1236
- StructArrayLayout2i2i2i12,
1237
- StructArrayLayout2ub4,
1238
- StructArrayLayout2i2ui3ul3ui2f2ub40,
1239
- StructArrayLayout4i9ui1ul32,
1240
- StructArrayLayout1f4,
1241
- StructArrayLayout3i6,
1242
- StructArrayLayout1ul2ui8,
1243
- StructArrayLayout3ui6,
1244
- StructArrayLayout2ui4,
1245
- StructArrayLayout1ui2,
1246
- StructArrayLayout2f8,
1247
- StructArrayLayout4f16,
1248
- PosArray: StructArrayLayout2i4,
1249
- RasterBoundsArray: StructArrayLayout4i8,
1250
- CircleLayoutArray: StructArrayLayout2i4,
1251
- FillLayoutArray: StructArrayLayout2i4,
1252
- FillExtrusionLayoutArray: StructArrayLayout2i4i12,
1253
- HeatmapLayoutArray: StructArrayLayout2i4,
1254
- LineLayoutArray: StructArrayLayout4i4ub12,
1255
- PatternLayoutArray: StructArrayLayout8ui16,
1256
- SymbolLayoutArray: StructArrayLayout4i4ui16,
1257
- SymbolDynamicLayoutArray: StructArrayLayout3f12,
1258
- SymbolOpacityArray: StructArrayLayout1ul4,
1259
- CollisionBoxLayoutArray: StructArrayLayout2i2i2i12,
1260
- CollisionCircleLayoutArray: StructArrayLayout2i2i2i12,
1261
- CollisionVertexArray: StructArrayLayout2ub4,
1262
- TriangleIndexArray: StructArrayLayout3ui6,
1263
- LineIndexArray: StructArrayLayout2ui4,
1264
- LineStripIndexArray: StructArrayLayout1ui2,
1265
-
1266
- CollisionBoxArray,
1267
- FeatureIndexArray,
1268
- GlyphOffsetArray,
1269
- PlacedSymbolArray,
1270
- SymbolInstanceArray,
1271
- SymbolLineVertexArray
1227
+ export {
1228
+ StructArrayLayout2i4 as PosArray,
1229
+ StructArrayLayout4i8 as RasterBoundsArray,
1230
+ StructArrayLayout2i4 as CircleLayoutArray,
1231
+ StructArrayLayout2i4 as FillLayoutArray,
1232
+ StructArrayLayout2i4i12 as FillExtrusionLayoutArray,
1233
+ StructArrayLayout2i4 as HeatmapLayoutArray,
1234
+ StructArrayLayout4i4ub12 as LineLayoutArray,
1235
+ StructArrayLayout8ui16 as PatternLayoutArray,
1236
+ StructArrayLayout4i4ui16 as SymbolLayoutArray,
1237
+ StructArrayLayout3f12 as SymbolDynamicLayoutArray,
1238
+ StructArrayLayout1ul4 as SymbolOpacityArray,
1239
+ StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray,
1240
+ StructArrayLayout2i2i2i12 as CollisionCircleLayoutArray,
1241
+ StructArrayLayout2ub4 as CollisionVertexArray,
1242
+ StructArrayLayout3ui6 as TriangleIndexArray,
1243
+ StructArrayLayout2ui4 as LineIndexArray,
1244
+ StructArrayLayout1ui2 as LineStripIndexArray
1272
1245
  };
@@ -1,5 +1,3 @@
1
- const { createLayout } = require('../../util/struct_array');
1
+ import { createLayout } from '../../util/struct_array.js';
2
2
 
3
- const layout = createLayout([{ name: 'a_pos', components: 2, type: 'Int16' }], 4);
4
-
5
- module.exports = layout;
3
+ export default createLayout([{ name: 'a_pos', components: 2, type: 'Int16' }], 4);
@@ -1,12 +1,13 @@
1
- const { CircleLayoutArray } = require('../array_types');
1
+ import EvaluationParameters from '../../style/evaluation_parameters.js';
2
+ import { CircleLayoutArray } from '../array_types.js';
3
+ import EXTENT from '../extent.js';
4
+ import { TriangleIndexArray } from '../index_array_type.js';
5
+ import loadGeometry from '../load_geometry.js';
6
+ import { ProgramConfigurationSet } from '../program_configuration.js';
7
+ import SegmentVector from '../segment.js';
8
+ import layout from './circle_attributes.js';
2
9
 
3
- const { members: layoutAttributes } = require('./circle_attributes');
4
- const SegmentVector = require('../segment');
5
- const { ProgramConfigurationSet } = require('../program_configuration');
6
- const { TriangleIndexArray } = require('../index_array_type');
7
- const loadGeometry = require('../load_geometry');
8
- const EXTENT = require('../extent');
9
- const EvaluationParameters = require('../../style/evaluation_parameters');
10
+ const layoutAttributes = layout.members;
10
11
 
11
12
  function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
12
13
  layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2);
@@ -25,7 +26,6 @@ class CircleBucket {
25
26
  this.globalState = options.globalState;
26
27
  this.overscaling = options.overscaling;
27
28
  this.layers = options.layers;
28
- this.layerIds = this.layers.map(layer => layer.id);
29
29
  this.index = options.index;
30
30
  this.hasPattern = false;
31
31
 
@@ -48,7 +48,9 @@ class CircleBucket {
48
48
  }
49
49
 
50
50
  update(states, vtLayer, imagePositions) {
51
- if (!this.stateDependentLayers.length) return;
51
+ if (!this.stateDependentLayers.length) {
52
+ return;
53
+ }
52
54
  this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, {
53
55
  imagePositions,
54
56
  globalState: this.globalState
@@ -73,7 +75,9 @@ class CircleBucket {
73
75
  }
74
76
 
75
77
  destroy() {
76
- if (!this.layoutVertexBuffer) return;
78
+ if (!this.layoutVertexBuffer) {
79
+ return;
80
+ }
77
81
  this.layoutVertexBuffer.destroy();
78
82
  this.indexBuffer.destroy();
79
83
  this.programConfigurations.destroy();
@@ -87,7 +91,9 @@ class CircleBucket {
87
91
  const y = point.y;
88
92
 
89
93
  // Do not include points that are outside the tile boundaries.
90
- if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;
94
+ if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) {
95
+ continue;
96
+ }
91
97
 
92
98
  // this geometry will be of the Point type, and we'll derive
93
99
  // two triangles from it.
@@ -121,4 +127,4 @@ class CircleBucket {
121
127
  }
122
128
  }
123
129
 
124
- module.exports = CircleBucket;
130
+ export default CircleBucket;
@@ -1,5 +1,3 @@
1
- const { createLayout } = require('../../util/struct_array');
1
+ import { createLayout } from '../../util/struct_array.js';
2
2
 
3
- const layout = createLayout([{ name: 'a_pos', components: 2, type: 'Int16' }], 4);
4
-
5
- module.exports = layout;
3
+ export default createLayout([{ name: 'a_pos', components: 2, type: 'Int16' }], 4);
@@ -1,16 +1,17 @@
1
- const { FillLayoutArray } = require('../array_types');
2
-
3
- const { members: layoutAttributes } = require('./fill_attributes');
4
- const SegmentVector = require('../segment');
5
- const { ProgramConfigurationSet } = require('../program_configuration');
6
- const { LineIndexArray, TriangleIndexArray } = require('../index_array_type');
7
- const { default: earcut } = require('earcut');
8
- const classifyRings = require('../../util/classify_rings');
9
- const assert = require('assert');
1
+ import assert from 'assert';
2
+ import earcut from 'earcut';
3
+ import EvaluationParameters from '../../style/evaluation_parameters.js';
4
+ import classifyRings from '../../util/classify_rings.js';
5
+ import { FillLayoutArray } from '../array_types.js';
6
+ import { LineIndexArray, TriangleIndexArray } from '../index_array_type.js';
7
+ import loadGeometry from '../load_geometry.js';
8
+ import { ProgramConfigurationSet } from '../program_configuration.js';
9
+ import SegmentVector from '../segment.js';
10
+ import layout from './fill_attributes.js';
11
+ import { addPatternDependencies, hasPattern } from './pattern_bucket_features.js';
12
+
10
13
  const EARCUT_MAX_RINGS = 500;
11
- const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
12
- const loadGeometry = require('../load_geometry');
13
- const EvaluationParameters = require('../../style/evaluation_parameters');
14
+ const layoutAttributes = layout.members;
14
15
 
15
16
  class FillBucket {
16
17
  constructor(options) {
@@ -18,7 +19,6 @@ class FillBucket {
18
19
  this.globalState = options.globalState;
19
20
  this.overscaling = options.overscaling;
20
21
  this.layers = options.layers;
21
- this.layerIds = this.layers.map(layer => layer.id);
22
22
  this.index = options.index;
23
23
  this.hasPattern = false;
24
24
 
@@ -37,8 +37,9 @@ class FillBucket {
37
37
  for (const { feature, index, sourceLayerIndex } of features) {
38
38
  if (
39
39
  !this.layers[0]._featureFilter(new EvaluationParameters(this.zoom, { globalState: this.globalState }), feature)
40
- )
40
+ ) {
41
41
  continue;
42
+ }
42
43
 
43
44
  const geometry = loadGeometry(feature);
44
45
 
@@ -56,7 +57,15 @@ class FillBucket {
56
57
  }
57
58
 
58
59
  if (this.hasPattern) {
59
- this.features.push(addPatternDependencies('fill', this.layers, patternFeature, this.zoom, options));
60
+ this.features.push(
61
+ addPatternDependencies(
62
+ 'fill',
63
+ this.layers,
64
+ patternFeature,
65
+ { zoom: this.zoom, globalState: this.globalState },
66
+ options
67
+ )
68
+ );
60
69
  } else {
61
70
  this.addFeature(patternFeature, geometry, index, {});
62
71
  }
@@ -66,7 +75,9 @@ class FillBucket {
66
75
  }
67
76
 
68
77
  update(states, vtLayer, imagePositions) {
69
- if (!this.stateDependentLayers.length) return;
78
+ if (!this.stateDependentLayers.length) {
79
+ return;
80
+ }
70
81
  this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, {
71
82
  imagePositions,
72
83
  globalState: this.globalState
@@ -87,6 +98,7 @@ class FillBucket {
87
98
  uploadPending() {
88
99
  return !this.uploaded || this.programConfigurations.needsUpload;
89
100
  }
101
+
90
102
  upload(context) {
91
103
  if (!this.uploaded) {
92
104
  this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);
@@ -98,7 +110,9 @@ class FillBucket {
98
110
  }
99
111
 
100
112
  destroy() {
101
- if (!this.layoutVertexBuffer) return;
113
+ if (!this.layoutVertexBuffer) {
114
+ return;
115
+ }
102
116
  this.layoutVertexBuffer.destroy();
103
117
  this.indexBuffer.destroy();
104
118
  this.indexBuffer2.destroy();
@@ -132,16 +146,16 @@ class FillBucket {
132
146
  const lineSegment = this.segments2.prepareSegment(ring.length, this.layoutVertexArray, this.indexArray2);
133
147
  const lineIndex = lineSegment.vertexLength;
134
148
 
135
- this.layoutVertexArray.emplaceBack(ring[0].x, ring[0].y);
149
+ const { x, y } = ring[0];
150
+ this.layoutVertexArray.emplaceBack(x, y);
136
151
  this.indexArray2.emplaceBack(lineIndex + ring.length - 1, lineIndex);
137
- flattened.push(ring[0].x);
138
- flattened.push(ring[0].y);
152
+ flattened.push(x, y);
139
153
 
140
154
  for (let i = 1; i < ring.length; i++) {
141
- this.layoutVertexArray.emplaceBack(ring[i].x, ring[i].y);
155
+ const { x, y } = ring[i];
156
+ this.layoutVertexArray.emplaceBack(x, y);
142
157
  this.indexArray2.emplaceBack(lineIndex + i - 1, lineIndex + i);
143
- flattened.push(ring[i].x);
144
- flattened.push(ring[i].y);
158
+ flattened.push(x, y);
145
159
  }
146
160
 
147
161
  lineSegment.vertexLength += ring.length;
@@ -170,4 +184,4 @@ class FillBucket {
170
184
  }
171
185
  }
172
186
 
173
- module.exports = FillBucket;
187
+ export default FillBucket;
@@ -1,11 +1,9 @@
1
- const { createLayout } = require('../../util/struct_array');
1
+ import { createLayout } from '../../util/struct_array.js';
2
2
 
3
- const layout = createLayout(
3
+ export default createLayout(
4
4
  [
5
5
  { name: 'a_pos', components: 2, type: 'Int16' },
6
6
  { name: 'a_normal_ed', components: 4, type: 'Int16' }
7
7
  ],
8
8
  4
9
9
  );
10
-
11
- module.exports = layout;