@mapwhit/tilerenderer 1.0.0 → 1.1.0
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.
- package/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +1 -1
- package/build/min/src/shaders/_prelude.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
- package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +1 -1
- package/build/min/src/shaders/raster.fragment.glsl.js +1 -1
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +1 -1
- package/package.json +3 -2
- package/src/data/array_types.js +54 -81
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -13
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -24
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -34
- package/src/data/bucket/heatmap_bucket.js +2 -7
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +207 -159
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +5 -7
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +111 -221
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +2 -6
- package/src/data/dem_data.js +11 -7
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +35 -20
- package/src/data/index_array_type.js +1 -6
- package/src/data/load_geometry.js +6 -9
- package/src/data/pos_attributes.js +2 -3
- package/src/data/program_configuration.js +44 -26
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -3
- package/src/geo/coordinate.js +1 -1
- package/src/geo/lng_lat.js +3 -3
- package/src/geo/lng_lat_bounds.js +8 -4
- package/src/geo/transform.js +69 -30
- package/src/gl/color_mode.js +2 -2
- package/src/gl/context.js +28 -29
- package/src/gl/cull_face_mode.js +1 -1
- package/src/gl/depth_mode.js +1 -1
- package/src/gl/framebuffer.js +8 -4
- package/src/gl/index_buffer.js +2 -2
- package/src/gl/stencil_mode.js +1 -1
- package/src/gl/value.js +33 -68
- package/src/gl/vertex_buffer.js +2 -2
- package/src/index.js +49 -25
- package/src/render/draw_background.js +14 -9
- package/src/render/draw_circle.js +11 -8
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +19 -12
- package/src/render/draw_fill_extrusion.js +12 -9
- package/src/render/draw_heatmap.js +17 -12
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +30 -16
- package/src/render/draw_raster.js +17 -13
- package/src/render/draw_symbol.js +22 -17
- package/src/render/glyph_atlas.js +9 -5
- package/src/render/glyph_manager.js +1 -1
- package/src/render/image_atlas.js +4 -7
- package/src/render/image_manager.js +6 -9
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +65 -47
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +4 -6
- package/src/render/program/clipping_mask_program.js +3 -5
- package/src/render/program/collision_program.js +4 -6
- package/src/render/program/debug_program.js +3 -5
- package/src/render/program/fill_extrusion_program.js +8 -14
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +8 -14
- package/src/render/program/hillshade_program.js +10 -16
- package/src/render/program/line_program.js +11 -22
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +3 -5
- package/src/render/program/symbol_program.js +5 -7
- package/src/render/program.js +5 -6
- package/src/render/texture.js +1 -1
- package/src/render/tile_mask.js +6 -4
- package/src/render/uniform_binding.js +9 -20
- package/src/render/vertex_array_object.js +5 -3
- package/src/shaders/encode_attribute.js +2 -6
- package/src/shaders/index.js +103 -51
- package/src/source/geojson_source.js +11 -7
- package/src/source/geojson_worker_source.js +7 -7
- package/src/source/geojson_wrapper.js +4 -4
- package/src/source/image_source.js +11 -12
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +13 -10
- package/src/source/raster_dem_tile_source.js +12 -10
- package/src/source/raster_tile_source.js +13 -9
- package/src/source/resources/glyphs.js +2 -3
- package/src/source/resources/index.js +2 -4
- package/src/source/rtl_text_plugin.js +8 -8
- package/src/source/source.js +9 -15
- package/src/source/source_cache.js +105 -47
- package/src/source/source_state.js +37 -14
- package/src/source/tile.js +38 -23
- package/src/source/tile_bounds.js +15 -8
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -23
- package/src/source/vector_tile_source.js +10 -8
- package/src/source/vector_tile_worker_source.js +4 -4
- package/src/source/worker_tile.js +24 -22
- package/src/style/create_style_layer.js +11 -11
- package/src/style/evaluation_parameters.js +4 -6
- package/src/style/light.js +5 -5
- package/src/style/load_sprite.js +6 -6
- package/src/style/parse_glyph_pbf.js +21 -17
- package/src/style/pauseable_placement.js +3 -4
- package/src/style/properties.js +21 -44
- package/src/style/query_utils.js +4 -10
- package/src/style/style.js +58 -33
- package/src/style/style_layer/background_style_layer.js +3 -4
- package/src/style/style_layer/background_style_layer_properties.js +2 -2
- package/src/style/style_layer/circle_style_layer.js +12 -9
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +16 -13
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +6 -7
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +5 -6
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +3 -4
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +10 -11
- package/src/style/style_layer/line_style_layer_properties.js +5 -5
- package/src/style/style_layer/raster_style_layer.js +3 -4
- package/src/style/style_layer/raster_style_layer_properties.js +2 -2
- package/src/style/style_layer/symbol_style_layer.js +7 -8
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +21 -20
- package/src/style/style_layer_index.js +2 -2
- package/src/style/zoom_history.js +1 -1
- package/src/style-spec/error/parsing_error.js +1 -1
- package/src/style-spec/error/validation_error.js +5 -3
- package/src/style-spec/feature_filter/convert.js +17 -9
- package/src/style-spec/feature_filter/index.js +13 -9
- package/src/style-spec/util/eval_support.js +2 -2
- package/src/style-spec/util/ref_properties.js +1 -1
- package/src/symbol/anchor.js +2 -2
- package/src/symbol/check_max_angle.js +13 -5
- package/src/symbol/clip_line.js +2 -3
- package/src/symbol/collision_feature.js +8 -4
- package/src/symbol/collision_index.js +5 -7
- package/src/symbol/cross_tile_symbol_index.js +5 -5
- package/src/symbol/get_anchors.js +15 -8
- package/src/symbol/grid_index.js +5 -3
- package/src/symbol/mergelines.js +2 -2
- package/src/symbol/opacity_state.js +1 -1
- package/src/symbol/placement.js +25 -20
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +10 -12
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +17 -21
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +3 -3
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +53 -33
- package/src/util/async.js +11 -5
- package/src/util/browser.js +1 -1
- package/src/util/callback.js +3 -9
- package/src/util/classify_rings.js +13 -8
- package/src/util/color_ramp.js +3 -3
- package/src/util/config.js +4 -4
- package/src/util/dictionary_coder.js +2 -3
- package/src/util/dom.js +7 -3
- package/src/util/find_pole_of_inaccessibility.js +29 -14
- package/src/util/group_layers.js +1 -1
- package/src/util/image.js +3 -8
- package/src/util/interpolate.js +1 -1
- package/src/util/intersection_tests.js +80 -42
- package/src/util/is_char_in_unicode_block.js +1 -1
- package/src/util/key.js +7 -3
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +25 -23
- package/src/util/script_detection.js +212 -91
- package/src/util/struct_array.js +8 -40
- package/src/util/task_queue.js +11 -7
- package/src/util/throttle.js +2 -2
- package/src/util/tile_cover.js +8 -5
- package/src/util/token.js +1 -1
- package/src/util/unique_id.js +2 -2
- package/src/util/util.js +21 -29
- package/src/util/vectortile_to_geojson.js +4 -2
- package/src/util/verticalize_punctuation.js +3 -7
- package/src/util/warn.js +4 -4
- package/src/util/web_worker.js +3 -3
package/src/gl/context.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { deepEqual } from '../util/object.js';
|
|
2
|
+
import ColorMode from './color_mode.js';
|
|
3
|
+
import Framebuffer from './framebuffer.js';
|
|
4
|
+
import IndexBuffer from './index_buffer.js';
|
|
5
|
+
import {
|
|
6
|
+
ActiveTextureUnit,
|
|
7
|
+
BindElementBuffer,
|
|
8
|
+
BindFramebuffer,
|
|
9
|
+
BindRenderbuffer,
|
|
10
|
+
BindTexture,
|
|
11
|
+
BindVertexArrayOES,
|
|
12
|
+
BindVertexBuffer,
|
|
13
|
+
Blend,
|
|
14
|
+
BlendColor,
|
|
15
|
+
BlendFunc,
|
|
8
16
|
ClearColor,
|
|
9
17
|
ClearDepth,
|
|
10
18
|
ClearStencil,
|
|
11
19
|
ColorMask,
|
|
20
|
+
CullFace,
|
|
21
|
+
CullFaceSide,
|
|
22
|
+
DepthFunc,
|
|
12
23
|
DepthMask,
|
|
13
|
-
StencilMask,
|
|
14
|
-
StencilFunc,
|
|
15
|
-
StencilOp,
|
|
16
|
-
StencilTest,
|
|
17
24
|
DepthRange,
|
|
18
25
|
DepthTest,
|
|
19
|
-
DepthFunc,
|
|
20
|
-
Blend,
|
|
21
|
-
BlendFunc,
|
|
22
|
-
BlendColor,
|
|
23
|
-
CullFace,
|
|
24
|
-
CullFaceSide,
|
|
25
26
|
FrontFace,
|
|
26
|
-
Program,
|
|
27
|
-
ActiveTextureUnit,
|
|
28
|
-
Viewport,
|
|
29
|
-
BindFramebuffer,
|
|
30
|
-
BindRenderbuffer,
|
|
31
|
-
BindTexture,
|
|
32
|
-
BindVertexBuffer,
|
|
33
|
-
BindElementBuffer,
|
|
34
|
-
BindVertexArrayOES,
|
|
35
27
|
PixelStoreUnpack,
|
|
36
|
-
PixelStoreUnpackPremultiplyAlpha
|
|
37
|
-
|
|
28
|
+
PixelStoreUnpackPremultiplyAlpha,
|
|
29
|
+
Program,
|
|
30
|
+
StencilFunc,
|
|
31
|
+
StencilMask,
|
|
32
|
+
StencilOp,
|
|
33
|
+
StencilTest,
|
|
34
|
+
Viewport
|
|
35
|
+
} from './value.js';
|
|
36
|
+
import VertexBuffer from './vertex_buffer.js';
|
|
38
37
|
|
|
39
38
|
class Context {
|
|
40
39
|
constructor(gl) {
|
|
@@ -190,4 +189,4 @@ class Context {
|
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
|
|
193
|
-
|
|
192
|
+
export default Context;
|
package/src/gl/cull_face_mode.js
CHANGED
package/src/gl/depth_mode.js
CHANGED
package/src/gl/framebuffer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ColorAttachment, DepthAttachment } from './value.js';
|
|
2
2
|
|
|
3
3
|
class Framebuffer {
|
|
4
4
|
constructor(context, width, height) {
|
|
@@ -16,13 +16,17 @@ class Framebuffer {
|
|
|
16
16
|
const gl = this.context.gl;
|
|
17
17
|
|
|
18
18
|
const texture = this.colorAttachment.get();
|
|
19
|
-
if (texture)
|
|
19
|
+
if (texture) {
|
|
20
|
+
gl.deleteTexture(texture);
|
|
21
|
+
}
|
|
20
22
|
|
|
21
23
|
const renderbuffer = this.depthAttachment.get();
|
|
22
|
-
if (renderbuffer)
|
|
24
|
+
if (renderbuffer) {
|
|
25
|
+
gl.deleteRenderbuffer(renderbuffer);
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
gl.deleteFramebuffer(this.framebuffer);
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
export default Framebuffer;
|
package/src/gl/index_buffer.js
CHANGED
package/src/gl/stencil_mode.js
CHANGED
package/src/gl/value.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Color } from '@mapwhit/style-expressions';
|
|
2
2
|
|
|
3
|
-
class ClearColor {
|
|
3
|
+
export class ClearColor {
|
|
4
4
|
constructor(context) {
|
|
5
5
|
this.context = context;
|
|
6
6
|
this.current = Color.transparent;
|
|
@@ -19,7 +19,7 @@ class ClearColor {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
class ClearDepth {
|
|
22
|
+
export class ClearDepth {
|
|
23
23
|
constructor(context) {
|
|
24
24
|
this.context = context;
|
|
25
25
|
this.current = 1;
|
|
@@ -37,7 +37,7 @@ class ClearDepth {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
class ClearStencil {
|
|
40
|
+
export class ClearStencil {
|
|
41
41
|
constructor(context) {
|
|
42
42
|
this.context = context;
|
|
43
43
|
this.current = 0;
|
|
@@ -55,7 +55,7 @@ class ClearStencil {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
class ColorMask {
|
|
58
|
+
export class ColorMask {
|
|
59
59
|
constructor(context) {
|
|
60
60
|
this.context = context;
|
|
61
61
|
this.current = [true, true, true, true];
|
|
@@ -74,7 +74,7 @@ class ColorMask {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
class DepthMask {
|
|
77
|
+
export class DepthMask {
|
|
78
78
|
constructor(context) {
|
|
79
79
|
this.context = context;
|
|
80
80
|
this.current = true;
|
|
@@ -92,7 +92,7 @@ class DepthMask {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
class StencilMask {
|
|
95
|
+
export class StencilMask {
|
|
96
96
|
constructor(context) {
|
|
97
97
|
this.context = context;
|
|
98
98
|
this.current = 0xff;
|
|
@@ -110,7 +110,7 @@ class StencilMask {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
class StencilFunc {
|
|
113
|
+
export class StencilFunc {
|
|
114
114
|
constructor(context) {
|
|
115
115
|
this.context = context;
|
|
116
116
|
this.current = {
|
|
@@ -133,7 +133,7 @@ class StencilFunc {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
class StencilOp {
|
|
136
|
+
export class StencilOp {
|
|
137
137
|
constructor(context) {
|
|
138
138
|
this.context = context;
|
|
139
139
|
const gl = this.context.gl;
|
|
@@ -153,7 +153,7 @@ class StencilOp {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
class StencilTest {
|
|
156
|
+
export class StencilTest {
|
|
157
157
|
constructor(context) {
|
|
158
158
|
this.context = context;
|
|
159
159
|
this.current = false;
|
|
@@ -176,7 +176,7 @@ class StencilTest {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
class DepthRange {
|
|
179
|
+
export class DepthRange {
|
|
180
180
|
constructor(context) {
|
|
181
181
|
this.context = context;
|
|
182
182
|
this.current = [0, 1];
|
|
@@ -195,7 +195,7 @@ class DepthRange {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
class DepthTest {
|
|
198
|
+
export class DepthTest {
|
|
199
199
|
constructor(context) {
|
|
200
200
|
this.context = context;
|
|
201
201
|
this.current = false;
|
|
@@ -218,7 +218,7 @@ class DepthTest {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
class DepthFunc {
|
|
221
|
+
export class DepthFunc {
|
|
222
222
|
constructor(context) {
|
|
223
223
|
this.context = context;
|
|
224
224
|
this.current = context.gl.LESS;
|
|
@@ -236,7 +236,7 @@ class DepthFunc {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
class Blend {
|
|
239
|
+
export class Blend {
|
|
240
240
|
constructor(context) {
|
|
241
241
|
this.context = context;
|
|
242
242
|
this.current = false;
|
|
@@ -259,7 +259,7 @@ class Blend {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
class BlendFunc {
|
|
262
|
+
export class BlendFunc {
|
|
263
263
|
constructor(context) {
|
|
264
264
|
this.context = context;
|
|
265
265
|
const gl = this.context.gl;
|
|
@@ -279,7 +279,7 @@ class BlendFunc {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
class BlendColor {
|
|
282
|
+
export class BlendColor {
|
|
283
283
|
constructor(context) {
|
|
284
284
|
this.context = context;
|
|
285
285
|
this.current = Color.transparent;
|
|
@@ -298,7 +298,7 @@ class BlendColor {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
class CullFace {
|
|
301
|
+
export class CullFace {
|
|
302
302
|
constructor(context) {
|
|
303
303
|
this.context = context;
|
|
304
304
|
this.default = false;
|
|
@@ -328,7 +328,7 @@ class CullFace {
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
class CullFaceSide {
|
|
331
|
+
export class CullFaceSide {
|
|
332
332
|
constructor(context) {
|
|
333
333
|
this.context = context;
|
|
334
334
|
const gl = this.context.gl;
|
|
@@ -355,7 +355,7 @@ class CullFaceSide {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
class FrontFace {
|
|
358
|
+
export class FrontFace {
|
|
359
359
|
constructor(context) {
|
|
360
360
|
this.context = context;
|
|
361
361
|
const gl = this.context.gl;
|
|
@@ -382,7 +382,7 @@ class FrontFace {
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
class Program {
|
|
385
|
+
export class Program {
|
|
386
386
|
constructor(context) {
|
|
387
387
|
this.context = context;
|
|
388
388
|
this.current = null;
|
|
@@ -400,7 +400,7 @@ class Program {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
class ActiveTextureUnit {
|
|
403
|
+
export class ActiveTextureUnit {
|
|
404
404
|
constructor(context) {
|
|
405
405
|
this.context = context;
|
|
406
406
|
this.current = context.gl.TEXTURE0;
|
|
@@ -418,7 +418,7 @@ class ActiveTextureUnit {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
class Viewport {
|
|
421
|
+
export class Viewport {
|
|
422
422
|
constructor(context) {
|
|
423
423
|
this.context = context;
|
|
424
424
|
const gl = this.context.gl;
|
|
@@ -438,7 +438,7 @@ class Viewport {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
class BindFramebuffer {
|
|
441
|
+
export class BindFramebuffer {
|
|
442
442
|
constructor(context) {
|
|
443
443
|
this.context = context;
|
|
444
444
|
this.current = null;
|
|
@@ -457,7 +457,7 @@ class BindFramebuffer {
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
class BindRenderbuffer {
|
|
460
|
+
export class BindRenderbuffer {
|
|
461
461
|
constructor(context) {
|
|
462
462
|
this.context = context;
|
|
463
463
|
this.current = null;
|
|
@@ -476,7 +476,7 @@ class BindRenderbuffer {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
-
class BindTexture {
|
|
479
|
+
export class BindTexture {
|
|
480
480
|
constructor(context) {
|
|
481
481
|
this.context = context;
|
|
482
482
|
this.current = null;
|
|
@@ -495,7 +495,7 @@ class BindTexture {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
class BindVertexBuffer {
|
|
498
|
+
export class BindVertexBuffer {
|
|
499
499
|
constructor(context) {
|
|
500
500
|
this.context = context;
|
|
501
501
|
this.current = null;
|
|
@@ -514,7 +514,7 @@ class BindVertexBuffer {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
-
class BindElementBuffer {
|
|
517
|
+
export class BindElementBuffer {
|
|
518
518
|
constructor(context) {
|
|
519
519
|
this.context = context;
|
|
520
520
|
this.current = null;
|
|
@@ -532,7 +532,7 @@ class BindElementBuffer {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
class BindVertexArrayOES {
|
|
535
|
+
export class BindVertexArrayOES {
|
|
536
536
|
constructor(context) {
|
|
537
537
|
this.context = context;
|
|
538
538
|
this.current = null;
|
|
@@ -550,7 +550,7 @@ class BindVertexArrayOES {
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
class PixelStoreUnpack {
|
|
553
|
+
export class PixelStoreUnpack {
|
|
554
554
|
constructor(context) {
|
|
555
555
|
this.context = context;
|
|
556
556
|
this.current = 4;
|
|
@@ -569,7 +569,7 @@ class PixelStoreUnpack {
|
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
-
class PixelStoreUnpackPremultiplyAlpha {
|
|
572
|
+
export class PixelStoreUnpackPremultiplyAlpha {
|
|
573
573
|
constructor(context) {
|
|
574
574
|
this.context = context;
|
|
575
575
|
this.current = false;
|
|
@@ -592,7 +592,7 @@ class PixelStoreUnpackPremultiplyAlpha {
|
|
|
592
592
|
* Framebuffer values
|
|
593
593
|
* @private
|
|
594
594
|
*/
|
|
595
|
-
class FramebufferValue {
|
|
595
|
+
export class FramebufferValue {
|
|
596
596
|
constructor(context, parent) {
|
|
597
597
|
this.context = context;
|
|
598
598
|
this.current = null;
|
|
@@ -604,7 +604,7 @@ class FramebufferValue {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
-
class ColorAttachment extends FramebufferValue {
|
|
607
|
+
export class ColorAttachment extends FramebufferValue {
|
|
608
608
|
constructor(context, parent) {
|
|
609
609
|
super(context, parent);
|
|
610
610
|
this.dirty = false;
|
|
@@ -627,7 +627,7 @@ class ColorAttachment extends FramebufferValue {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
class DepthAttachment extends FramebufferValue {
|
|
630
|
+
export class DepthAttachment extends FramebufferValue {
|
|
631
631
|
set(v) {
|
|
632
632
|
if (this.current !== v) {
|
|
633
633
|
const gl = this.context.gl;
|
|
@@ -639,38 +639,3 @@ class DepthAttachment extends FramebufferValue {
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
|
|
643
|
-
module.exports = {
|
|
644
|
-
ClearColor,
|
|
645
|
-
ClearDepth,
|
|
646
|
-
ClearStencil,
|
|
647
|
-
ColorMask,
|
|
648
|
-
DepthMask,
|
|
649
|
-
StencilMask,
|
|
650
|
-
StencilFunc,
|
|
651
|
-
StencilOp,
|
|
652
|
-
StencilTest,
|
|
653
|
-
DepthRange,
|
|
654
|
-
DepthTest,
|
|
655
|
-
DepthFunc,
|
|
656
|
-
Blend,
|
|
657
|
-
BlendFunc,
|
|
658
|
-
BlendColor,
|
|
659
|
-
CullFace,
|
|
660
|
-
CullFaceSide,
|
|
661
|
-
FrontFace,
|
|
662
|
-
Program,
|
|
663
|
-
ActiveTextureUnit,
|
|
664
|
-
Viewport,
|
|
665
|
-
BindFramebuffer,
|
|
666
|
-
BindRenderbuffer,
|
|
667
|
-
BindTexture,
|
|
668
|
-
BindVertexBuffer,
|
|
669
|
-
BindElementBuffer,
|
|
670
|
-
BindVertexArrayOES,
|
|
671
|
-
PixelStoreUnpack,
|
|
672
|
-
PixelStoreUnpackPremultiplyAlpha,
|
|
673
|
-
FramebufferValue,
|
|
674
|
-
ColorAttachment,
|
|
675
|
-
DepthAttachment
|
|
676
|
-
};
|
package/src/gl/vertex_buffer.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,33 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
version: require('../package.json').version,
|
|
5
|
-
setRTLTextPlugin: require('./source/rtl_text_plugin').setRTLTextPlugin,
|
|
6
|
-
Map: require('./ui/map'),
|
|
7
|
-
Style: require('./style/style'),
|
|
8
|
-
LngLat: require('./geo/lng_lat'),
|
|
9
|
-
LngLatBounds: require('./geo/lng_lat_bounds'),
|
|
10
|
-
Point: require('@mapbox/point-geometry').default,
|
|
11
|
-
Evented: require('@mapwhit/events').Evented,
|
|
12
|
-
config: require('./util/config'),
|
|
13
|
-
|
|
14
|
-
get workerCount() {
|
|
15
|
-
return this.config.WORKER_COUNT;
|
|
16
|
-
},
|
|
1
|
+
import './util/polyfill.js';
|
|
17
2
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
import { default as Point } from '@mapbox/point-geometry';
|
|
4
|
+
import { Evented } from '@mapwhit/events';
|
|
5
|
+
import packageJSON from '../package.json' with { type: 'json' };
|
|
6
|
+
import { default as LngLat } from './geo/lng_lat.js';
|
|
7
|
+
import { default as LngLatBounds } from './geo/lng_lat_bounds.js';
|
|
8
|
+
import { setRTLTextPlugin } from './source/rtl_text_plugin.js';
|
|
9
|
+
import { default as Style } from './style/style.js';
|
|
10
|
+
import { default as Map } from './ui/map.js';
|
|
11
|
+
import config from './util/config.js';
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const { version } = packageJSON;
|
|
14
|
+
|
|
15
|
+
export { version, config, setRTLTextPlugin, Point, LngLat, LngLatBounds, Style, Map, Evented };
|
|
16
|
+
|
|
17
|
+
// for commonjs backward compatibility
|
|
18
|
+
const mapwhit = {
|
|
19
|
+
version,
|
|
20
|
+
config,
|
|
21
|
+
setRTLTextPlugin,
|
|
22
|
+
Point,
|
|
23
|
+
LngLat,
|
|
24
|
+
LngLatBounds,
|
|
25
|
+
Style,
|
|
26
|
+
Map,
|
|
27
|
+
Evented
|
|
28
|
+
};
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
const properties = {
|
|
31
|
+
workerCount: {
|
|
32
|
+
get() {
|
|
33
|
+
return config.WORKER_COUNT;
|
|
34
|
+
},
|
|
35
|
+
set(count) {
|
|
36
|
+
config.WORKER_COUNT = count;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
workerUrl: {
|
|
40
|
+
get() {
|
|
41
|
+
return config.WORKER_URL;
|
|
42
|
+
},
|
|
43
|
+
set(url) {
|
|
44
|
+
config.WORKER_URL = url;
|
|
45
|
+
}
|
|
28
46
|
}
|
|
29
47
|
};
|
|
30
48
|
|
|
49
|
+
Object.defineProperties(mapwhit, properties);
|
|
50
|
+
Object.defineProperties(config, properties);
|
|
51
|
+
|
|
52
|
+
export default mapwhit;
|
|
53
|
+
|
|
31
54
|
/**
|
|
32
55
|
* The version of Mapbox GL JS in use as specified in `package.json`,
|
|
33
56
|
* `CHANGELOG.md`, and the GitHub release.
|
|
@@ -48,5 +71,6 @@ module.exports = {
|
|
|
48
71
|
*/
|
|
49
72
|
|
|
50
73
|
// canary assert: used to confirm that asserts have been removed from production build
|
|
51
|
-
|
|
74
|
+
import assert from 'assert';
|
|
75
|
+
|
|
52
76
|
assert(true, 'canary assert');
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module.exports = drawBackground;
|
|
1
|
+
import CullFaceMode from '../gl/cull_face_mode.js';
|
|
2
|
+
import DepthMode from '../gl/depth_mode.js';
|
|
3
|
+
import StencilMode from '../gl/stencil_mode.js';
|
|
4
|
+
import { backgroundPatternUniformValues, backgroundUniformValues } from './program/background_program.js';
|
|
5
|
+
export default drawBackground;
|
|
7
6
|
|
|
8
7
|
function drawBackground(painter, sourceCache, layer) {
|
|
9
8
|
const color = layer._paint.get('background-color');
|
|
10
9
|
const opacity = layer._paint.get('background-opacity');
|
|
11
10
|
|
|
12
|
-
if (opacity === 0)
|
|
11
|
+
if (opacity === 0) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
13
14
|
|
|
14
15
|
const context = painter.context;
|
|
15
16
|
const gl = context.gl;
|
|
16
17
|
const transform = painter.transform;
|
|
17
18
|
const tileSize = transform.tileSize;
|
|
18
19
|
const image = layer._paint.get('background-pattern');
|
|
19
|
-
if (painter.isPatternMissing(image))
|
|
20
|
+
if (painter.isPatternMissing(image)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
const pass =
|
|
22
25
|
!image && color.a === 1 && opacity === 1 && painter.opaquePassEnabledForLayer() ? 'opaque' : 'translucent';
|
|
23
|
-
if (painter.renderPass !== pass)
|
|
26
|
+
if (painter.renderPass !== pass) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
24
29
|
|
|
25
30
|
const stencilMode = StencilMode.disabled;
|
|
26
31
|
const depthMode = painter.depthModeForSublayer(0, pass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module.exports = drawCircles;
|
|
1
|
+
import CullFaceMode from '../gl/cull_face_mode.js';
|
|
2
|
+
import DepthMode from '../gl/depth_mode.js';
|
|
3
|
+
import StencilMode from '../gl/stencil_mode.js';
|
|
4
|
+
import { circleUniformValues } from './program/circle_program.js';
|
|
5
|
+
export default drawCircles;
|
|
7
6
|
|
|
8
7
|
function drawCircles(painter, sourceCache, layer, coords) {
|
|
9
|
-
if (painter.renderPass !== 'translucent')
|
|
8
|
+
if (painter.renderPass !== 'translucent') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
const opacity = layer._paint.get('circle-opacity');
|
|
12
13
|
const strokeWidth = layer._paint.get('circle-stroke-width');
|
|
@@ -30,7 +31,9 @@ function drawCircles(painter, sourceCache, layer, coords) {
|
|
|
30
31
|
|
|
31
32
|
const tile = sourceCache.getTile(coord);
|
|
32
33
|
const bucket = tile.getBucket(layer);
|
|
33
|
-
if (!bucket)
|
|
34
|
+
if (!bucket) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
34
37
|
|
|
35
38
|
const programConfiguration = bucket.programConfigurations.get(layer.id);
|
|
36
39
|
const program = painter.useProgram('circle', programConfiguration);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module.exports = drawCollisionDebug;
|
|
1
|
+
import CullFaceMode from '../gl/cull_face_mode.js';
|
|
2
|
+
import DepthMode from '../gl/depth_mode.js';
|
|
3
|
+
import StencilMode from '../gl/stencil_mode.js';
|
|
4
|
+
import { collisionUniformValues } from './program/collision_program.js';
|
|
5
|
+
export default drawCollisionDebug;
|
|
7
6
|
|
|
8
7
|
function drawCollisionDebugGeometry(painter, sourceCache, layer, coords, drawCircles) {
|
|
9
8
|
const context = painter.context;
|
|
@@ -14,9 +13,13 @@ function drawCollisionDebugGeometry(painter, sourceCache, layer, coords, drawCir
|
|
|
14
13
|
const coord = coords[i];
|
|
15
14
|
const tile = sourceCache.getTile(coord);
|
|
16
15
|
const bucket = tile.getBucket(layer);
|
|
17
|
-
if (!bucket)
|
|
16
|
+
if (!bucket) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
18
19
|
const buffers = drawCircles ? bucket.collisionCircle : bucket.collisionBox;
|
|
19
|
-
if (!buffers)
|
|
20
|
+
if (!buffers) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
program.draw(
|
|
22
25
|
context,
|