@mapwhit/tilerenderer 0.52.1 → 1.0.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/README.md +7 -0
- package/build/min/package.json +1 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +2 -2
- package/build/min/src/shaders/_prelude.vertex.glsl.js +2 -2
- package/build/min/src/shaders/background.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +2 -2
- package/build/min/src/shaders/circle.vertex.glsl.js +2 -2
- 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 +2 -2
- package/build/min/src/shaders/fill.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +2 -2
- package/build/min/src/shaders/raster.fragment.glsl.js +2 -2
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +2 -2
- package/package.json +3 -3
- package/src/data/array_types.js +1 -36
- package/src/data/bucket/circle_bucket.js +0 -3
- package/src/data/bucket/fill_bucket.js +0 -3
- package/src/data/bucket/fill_extrusion_bucket.js +0 -3
- package/src/data/bucket/heatmap_bucket.js +0 -4
- package/src/data/bucket/line_bucket.js +1 -4
- package/src/data/bucket/pattern_bucket_features.js +2 -2
- package/src/data/bucket/symbol_bucket.js +87 -126
- package/src/data/bucket.js +26 -21
- package/src/data/dem_data.js +0 -3
- package/src/data/feature_index.js +3 -8
- package/src/data/program_configuration.js +3 -12
- package/src/data/segment.js +0 -4
- package/src/render/draw_background.js +3 -3
- package/src/render/draw_circle.js +4 -4
- package/src/render/draw_fill.js +8 -8
- package/src/render/draw_fill_extrusion.js +8 -8
- package/src/render/draw_heatmap.js +4 -4
- package/src/render/draw_line.js +6 -6
- package/src/render/draw_raster.js +6 -6
- package/src/render/draw_symbol.js +16 -16
- package/src/render/glyph_atlas.js +0 -3
- package/src/render/glyph_manager.js +1 -2
- package/src/render/image_atlas.js +0 -4
- package/src/render/image_manager.js +33 -19
- package/src/render/painter.js +13 -14
- package/src/render/program/circle_program.js +4 -4
- package/src/render/program/fill_extrusion_program.js +1 -1
- package/src/render/program/heatmap_program.js +1 -1
- package/src/render/program/hillshade_program.js +6 -6
- package/src/render/program/line_program.js +3 -3
- package/src/render/program/raster_program.js +6 -6
- package/src/source/geojson_source.js +15 -24
- package/src/source/geojson_worker_source.js +40 -68
- package/src/source/geojson_wrapper.js +9 -1
- package/src/source/image_source.js +6 -16
- package/src/source/query_features.js +4 -5
- package/src/source/raster_dem_tile_source.js +45 -64
- package/src/source/raster_tile_source.js +1 -6
- package/src/source/resources/glyphs.js +2 -2
- package/src/source/resources/index.js +3 -9
- package/src/source/rtl_text_plugin.js +58 -31
- package/src/source/source.js +11 -13
- package/src/source/source_cache.js +135 -151
- package/src/source/source_state.js +101 -12
- package/src/source/tile.js +32 -46
- package/src/source/tile_bounds.js +26 -26
- package/src/source/tile_id.js +2 -5
- package/src/source/vector_tile_source.js +14 -14
- package/src/source/vector_tile_worker_source.js +19 -23
- package/src/source/worker_tile.js +120 -117
- package/src/style/create_style_layer.js +1 -1
- package/src/style/pauseable_placement.js +4 -5
- package/src/style/properties.js +1 -8
- package/src/style/query_utils.js +3 -3
- package/src/style/style.js +263 -195
- package/src/style/style_layer/circle_style_layer.js +13 -11
- package/src/style/style_layer/fill_extrusion_style_layer.js +42 -27
- package/src/style/style_layer/fill_style_layer.js +5 -5
- package/src/style/style_layer/heatmap_style_layer.js +1 -1
- package/src/style/style_layer/hillshade_style_layer.js +1 -1
- package/src/style/style_layer/line_style_layer.js +23 -19
- package/src/style/style_layer/symbol_style_layer.js +13 -13
- package/src/style/style_layer.js +48 -30
- package/src/style/style_layer_index.js +16 -41
- package/src/symbol/anchor.js +0 -4
- package/src/symbol/cross_tile_symbol_index.js +2 -5
- package/src/symbol/opacity_state.js +0 -4
- package/src/symbol/placement.js +3 -3
- package/src/symbol/quads.js +4 -4
- package/src/symbol/symbol_layout.js +7 -7
- package/src/symbol/transform_text.js +1 -1
- package/src/ui/map.js +49 -11
- package/src/util/group_layers.js +41 -0
- package/src/util/image.js +0 -5
- package/src/util/key.js +21 -0
- package/src/util/object.js +8 -53
- package/src/worker.js +1 -4
- package/src/source/resources/images.js +0 -68
- package/src/source/worker.js +0 -110
- package/src/source/worker_source.js +0 -14
- package/src/style-spec/deref.js +0 -51
- package/src/style-spec/group_by_layout.js +0 -46
- package/src/util/actor.js +0 -108
- package/src/util/dispatcher.js +0 -65
- package/src/util/global_worker_pool.js +0 -15
- package/src/util/transfer_registry.js +0 -168
- package/src/util/web_worker_transfer.js +0 -43
- package/src/util/worker_pool.js +0 -41
package/src/data/bucket.js
CHANGED
|
@@ -11,43 +11,48 @@
|
|
|
11
11
|
* properties and the zoom level to populate the attributes needed for
|
|
12
12
|
* data-driven styling.
|
|
13
13
|
*
|
|
14
|
-
* Buckets are designed to be built
|
|
15
|
-
*
|
|
16
|
-
* bucket's vertex, index, and attribute data is stored in `bucket.arrays:
|
|
17
|
-
* ArrayGroup`. When a bucket's data is serialized and sent back to the main
|
|
18
|
-
* thread, is gets deserialized (using `new Bucket(serializedBucketData)`, with
|
|
19
|
-
* the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups
|
|
20
|
-
* hold the same data as ArrayGroups, but are tuned for consumption by WebGL.
|
|
14
|
+
* Buckets are designed to be built when tile is loaded and then converted (uploaded)
|
|
15
|
+
* to tune bucket's vertex, index, and attribute data for consumption by WebGL.
|
|
21
16
|
*
|
|
22
17
|
* @private
|
|
23
18
|
*/
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
// style may have changed between creating a bucket when tile was loaded and rendering it
|
|
21
|
+
function updateBuckets(buckets, style) {
|
|
22
|
+
if (!style._changed) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
28
25
|
// Guard against the case where the map's style has been set to null while
|
|
29
26
|
// this bucket has been parsing.
|
|
30
|
-
if (!style)
|
|
27
|
+
if (!style) {
|
|
28
|
+
for (const bucket of buckets.values()) {
|
|
29
|
+
bucket.destroy();
|
|
30
|
+
}
|
|
31
|
+
buckets.clear();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const updatedAlready = new Set();
|
|
36
|
+
for (const [id, bucket] of buckets) {
|
|
37
|
+
if (updatedAlready.has(id)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
updatedAlready.add(id);
|
|
31
41
|
|
|
32
|
-
for (const bucket of input) {
|
|
33
42
|
const layers = bucket.layerIds.map(id => style.getLayer(id)).filter(Boolean);
|
|
34
43
|
|
|
35
44
|
if (layers.length === 0) {
|
|
45
|
+
bucket.destroy();
|
|
46
|
+
buckets.delete(id);
|
|
36
47
|
continue;
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
//
|
|
40
|
-
// want to waste time serializing/copying them from the worker)
|
|
50
|
+
// swap out the layers in the bucket with the current style layers
|
|
41
51
|
bucket.layers = layers;
|
|
42
|
-
bucket.stateDependentLayers = layers.filter(
|
|
43
|
-
for (const layer of layers) {
|
|
44
|
-
output[layer.id] = bucket;
|
|
45
|
-
}
|
|
52
|
+
bucket.stateDependentLayers = layers.filter(layer => layer.isStateDependent());
|
|
46
53
|
}
|
|
47
|
-
|
|
48
|
-
return output;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
module.exports = {
|
|
52
|
-
|
|
57
|
+
updateBuckets
|
|
53
58
|
};
|
package/src/data/dem_data.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const { RGBAImage } = require('../util/image');
|
|
2
2
|
|
|
3
3
|
const warn = require('../util/warn');
|
|
4
|
-
const { register } = require('../util/transfer_registry');
|
|
5
4
|
|
|
6
5
|
// DEMData is a data structure for decoding, backfilling, and storing elevation data for processing in the hillshade shaders
|
|
7
6
|
// data can be populated either from a pngraw image tile or from serliazed data sent back from a worker. When data is initially
|
|
@@ -121,6 +120,4 @@ class DEMData {
|
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
register('DEMData', DEMData);
|
|
125
|
-
|
|
126
123
|
module.exports = DEMData;
|
|
@@ -3,11 +3,8 @@ const EXTENT = require('./extent');
|
|
|
3
3
|
const featureFilter = require('../style-spec/feature_filter');
|
|
4
4
|
const Grid = require('grid-index');
|
|
5
5
|
const dictionaryCoder = require('../util/dictionary_coder');
|
|
6
|
-
const vt = require('@mapwhit/vector-tile');
|
|
7
|
-
const Protobuf = require('@mapwhit/pbf');
|
|
8
6
|
const GeoJSONFeature = require('../util/vectortile_to_geojson');
|
|
9
7
|
const { arraysIntersect } = require('../util/object');
|
|
10
|
-
const { register } = require('../util/transfer_registry');
|
|
11
8
|
const EvaluationParameters = require('../style/evaluation_parameters');
|
|
12
9
|
const { polygonIntersectsBox } = require('../util/intersection_tests');
|
|
13
10
|
|
|
@@ -37,7 +34,7 @@ class FeatureIndex {
|
|
|
37
34
|
|
|
38
35
|
loadVTLayers() {
|
|
39
36
|
if (!this.vtLayers) {
|
|
40
|
-
this.vtLayers =
|
|
37
|
+
this.vtLayers = this.vectorTile?.layers;
|
|
41
38
|
this.sourceLayerCoder = dictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers) : ['_geojsonTileLayer']);
|
|
42
39
|
}
|
|
43
40
|
return this.vtLayers;
|
|
@@ -153,7 +150,7 @@ class FeatureIndex {
|
|
|
153
150
|
continue;
|
|
154
151
|
}
|
|
155
152
|
|
|
156
|
-
const styleLayer = styleLayers
|
|
153
|
+
const styleLayer = styleLayers.get(layerID);
|
|
157
154
|
if (!styleLayer) continue;
|
|
158
155
|
|
|
159
156
|
const intersectionZ = !intersectionTest || intersectionTest(feature, styleLayer);
|
|
@@ -163,7 +160,7 @@ class FeatureIndex {
|
|
|
163
160
|
}
|
|
164
161
|
|
|
165
162
|
const geojsonFeature = new GeoJSONFeature(feature, z, x, y);
|
|
166
|
-
geojsonFeature.layer = styleLayer
|
|
163
|
+
geojsonFeature.layer = styleLayer;
|
|
167
164
|
const layerResult = (result[layerID] ??= []);
|
|
168
165
|
layerResult.push({ featureIndex, feature: geojsonFeature, intersectionZ });
|
|
169
166
|
}
|
|
@@ -192,8 +189,6 @@ class FeatureIndex {
|
|
|
192
189
|
}
|
|
193
190
|
}
|
|
194
191
|
|
|
195
|
-
register('FeatureIndex', FeatureIndex, { omit: ['rawTileData', 'sourceLayerCoder'] });
|
|
196
|
-
|
|
197
192
|
module.exports = FeatureIndex;
|
|
198
193
|
|
|
199
194
|
function getBounds(geometry) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { packUint8ToFloat } = require('../shaders/encode_attribute');
|
|
2
2
|
const { supportsPropertyExpression } = require('@mapwhit/style-expressions');
|
|
3
|
-
const { register } = require('../util/transfer_registry');
|
|
4
3
|
const { PossiblyEvaluatedPropertyValue } = require('../style/properties');
|
|
5
4
|
const {
|
|
6
5
|
StructArrayLayout1f4,
|
|
@@ -486,9 +485,9 @@ class ProgramConfiguration {
|
|
|
486
485
|
const self = new ProgramConfiguration();
|
|
487
486
|
const keys = [];
|
|
488
487
|
|
|
489
|
-
for (const property in layer.
|
|
488
|
+
for (const property in layer._paint._values) {
|
|
490
489
|
if (!filterProperties(property)) continue;
|
|
491
|
-
const value = layer.
|
|
490
|
+
const value = layer._paint.get(property);
|
|
492
491
|
if (
|
|
493
492
|
!(value instanceof PossiblyEvaluatedPropertyValue) ||
|
|
494
493
|
!supportsPropertyExpression(value.property.specification)
|
|
@@ -586,7 +585,7 @@ class ProgramConfiguration {
|
|
|
586
585
|
if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder) continue;
|
|
587
586
|
if (binder.expression.isStateDependent === true) {
|
|
588
587
|
//AHM: Remove after https://github.com/mapbox/mapbox-gl-js/issues/6255
|
|
589
|
-
const value = layer.
|
|
588
|
+
const value = layer._paint.get(property);
|
|
590
589
|
binder.expression = value.value;
|
|
591
590
|
binder.updatePaintArray(pos.start, pos.end, feature, featureState, options);
|
|
592
591
|
dirty = true;
|
|
@@ -777,14 +776,6 @@ function layoutType(property, type, binderType) {
|
|
|
777
776
|
return layoutException?.[binderType] || defaultLayouts[type][binderType];
|
|
778
777
|
}
|
|
779
778
|
|
|
780
|
-
register('ConstantBinder', ConstantBinder);
|
|
781
|
-
register('CrossFadedConstantBinder', CrossFadedConstantBinder);
|
|
782
|
-
register('SourceExpressionBinder', SourceExpressionBinder);
|
|
783
|
-
register('CrossFadedCompositeBinder', CrossFadedCompositeBinder);
|
|
784
|
-
register('CompositeExpressionBinder', CompositeExpressionBinder);
|
|
785
|
-
register('ProgramConfiguration', ProgramConfiguration, { omit: ['_buffers'] });
|
|
786
|
-
register('ProgramConfigurationSet', ProgramConfigurationSet);
|
|
787
|
-
|
|
788
779
|
ProgramConfiguration.ProgramConfigurationSet = ProgramConfigurationSet;
|
|
789
780
|
|
|
790
781
|
module.exports = ProgramConfiguration;
|
package/src/data/segment.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const warn = require('../util/warn');
|
|
2
2
|
|
|
3
|
-
const { register } = require('../util/transfer_registry');
|
|
4
|
-
|
|
5
3
|
class SegmentVector {
|
|
6
4
|
constructor(segments = []) {
|
|
7
5
|
this.segments = segments;
|
|
@@ -58,6 +56,4 @@ class SegmentVector {
|
|
|
58
56
|
*/
|
|
59
57
|
SegmentVector.MAX_VERTEX_ARRAY_LENGTH = 2 ** 16 - 1;
|
|
60
58
|
|
|
61
|
-
register('SegmentVector', SegmentVector);
|
|
62
|
-
|
|
63
59
|
module.exports = SegmentVector;
|
|
@@ -6,8 +6,8 @@ const { backgroundUniformValues, backgroundPatternUniformValues } = require('./p
|
|
|
6
6
|
module.exports = drawBackground;
|
|
7
7
|
|
|
8
8
|
function drawBackground(painter, sourceCache, layer) {
|
|
9
|
-
const color = layer.
|
|
10
|
-
const opacity = layer.
|
|
9
|
+
const color = layer._paint.get('background-color');
|
|
10
|
+
const opacity = layer._paint.get('background-opacity');
|
|
11
11
|
|
|
12
12
|
if (opacity === 0) return;
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ function drawBackground(painter, sourceCache, layer) {
|
|
|
15
15
|
const gl = context.gl;
|
|
16
16
|
const transform = painter.transform;
|
|
17
17
|
const tileSize = transform.tileSize;
|
|
18
|
-
const image = layer.
|
|
18
|
+
const image = layer._paint.get('background-pattern');
|
|
19
19
|
if (painter.isPatternMissing(image)) return;
|
|
20
20
|
|
|
21
21
|
const pass =
|
|
@@ -8,9 +8,9 @@ module.exports = drawCircles;
|
|
|
8
8
|
function drawCircles(painter, sourceCache, layer, coords) {
|
|
9
9
|
if (painter.renderPass !== 'translucent') return;
|
|
10
10
|
|
|
11
|
-
const opacity = layer.
|
|
12
|
-
const strokeWidth = layer.
|
|
13
|
-
const strokeOpacity = layer.
|
|
11
|
+
const opacity = layer._paint.get('circle-opacity');
|
|
12
|
+
const strokeWidth = layer._paint.get('circle-stroke-width');
|
|
13
|
+
const strokeOpacity = layer._paint.get('circle-stroke-opacity');
|
|
14
14
|
|
|
15
15
|
if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {
|
|
16
16
|
return;
|
|
@@ -47,7 +47,7 @@ function drawCircles(painter, sourceCache, layer, coords) {
|
|
|
47
47
|
bucket.layoutVertexBuffer,
|
|
48
48
|
bucket.indexBuffer,
|
|
49
49
|
bucket.segments,
|
|
50
|
-
layer.
|
|
50
|
+
layer._paint,
|
|
51
51
|
painter.transform.zoom,
|
|
52
52
|
programConfiguration
|
|
53
53
|
);
|
package/src/render/draw_fill.js
CHANGED
|
@@ -11,8 +11,8 @@ const {
|
|
|
11
11
|
module.exports = drawFill;
|
|
12
12
|
|
|
13
13
|
function drawFill(painter, sourceCache, layer, coords) {
|
|
14
|
-
const color = layer.
|
|
15
|
-
const opacity = layer.
|
|
14
|
+
const color = layer._paint.get('fill-color');
|
|
15
|
+
const opacity = layer._paint.get('fill-opacity');
|
|
16
16
|
|
|
17
17
|
if (opacity.constantOr(1) === 0) {
|
|
18
18
|
return;
|
|
@@ -20,7 +20,7 @@ function drawFill(painter, sourceCache, layer, coords) {
|
|
|
20
20
|
|
|
21
21
|
const colorMode = painter.colorModeForRenderPass();
|
|
22
22
|
|
|
23
|
-
const pattern = layer.
|
|
23
|
+
const pattern = layer._paint.get('fill-pattern');
|
|
24
24
|
const pass =
|
|
25
25
|
painter.opaquePassEnabledForLayer() &&
|
|
26
26
|
!pattern.constantOr(1) &&
|
|
@@ -39,7 +39,7 @@ function drawFill(painter, sourceCache, layer, coords) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Draw stroke
|
|
42
|
-
if (painter.renderPass === 'translucent' && layer.
|
|
42
|
+
if (painter.renderPass === 'translucent' && layer._paint.get('fill-antialias')) {
|
|
43
43
|
// If we defined a different color for the fill outline, we are
|
|
44
44
|
// going to ignore the bits in 0x07 and just care about the global
|
|
45
45
|
// clipping mask.
|
|
@@ -59,7 +59,7 @@ function drawFill(painter, sourceCache, layer, coords) {
|
|
|
59
59
|
function drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode, isOutline) {
|
|
60
60
|
const gl = painter.context.gl;
|
|
61
61
|
|
|
62
|
-
const patternProperty = layer.
|
|
62
|
+
const patternProperty = layer._paint.get('fill-pattern');
|
|
63
63
|
const image = patternProperty?.constantOr(1);
|
|
64
64
|
const crossfade = layer.getCrossfadeParameters();
|
|
65
65
|
|
|
@@ -103,8 +103,8 @@ function drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode
|
|
|
103
103
|
const tileMatrix = painter.translatePosMatrix(
|
|
104
104
|
coord.posMatrix,
|
|
105
105
|
tile,
|
|
106
|
-
layer.
|
|
107
|
-
layer.
|
|
106
|
+
layer._paint.get('fill-translate'),
|
|
107
|
+
layer._paint.get('fill-translate-anchor')
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
if (!isOutline) {
|
|
@@ -135,7 +135,7 @@ function drawFillTiles(painter, sourceCache, layer, coords, depthMode, colorMode
|
|
|
135
135
|
bucket.layoutVertexBuffer,
|
|
136
136
|
indexBuffer,
|
|
137
137
|
segments,
|
|
138
|
-
layer.
|
|
138
|
+
layer._paint,
|
|
139
139
|
painter.transform.zoom,
|
|
140
140
|
programConfiguration
|
|
141
141
|
);
|
|
@@ -7,7 +7,7 @@ const { fillExtrusionUniformValues, fillExtrusionPatternUniformValues } = requir
|
|
|
7
7
|
module.exports = draw;
|
|
8
8
|
|
|
9
9
|
function draw(painter, source, layer, coords) {
|
|
10
|
-
const opacity = layer.
|
|
10
|
+
const opacity = layer._paint.get('fill-extrusion-opacity');
|
|
11
11
|
if (opacity === 0) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ function draw(painter, source, layer, coords) {
|
|
|
15
15
|
if (painter.renderPass === 'translucent') {
|
|
16
16
|
const depthMode = new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D);
|
|
17
17
|
|
|
18
|
-
if (opacity === 1 && !layer.
|
|
18
|
+
if (opacity === 1 && !layer._paint.get('fill-extrusion-pattern').constantOr(1)) {
|
|
19
19
|
const colorMode = painter.colorModeForRenderPass();
|
|
20
20
|
drawExtrusionTiles(painter, source, layer, coords, depthMode, StencilMode.disabled, colorMode);
|
|
21
21
|
} else {
|
|
@@ -43,10 +43,10 @@ function drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMo
|
|
|
43
43
|
const context = painter.context;
|
|
44
44
|
const gl = context.gl;
|
|
45
45
|
|
|
46
|
-
const patternProperty = layer.
|
|
46
|
+
const patternProperty = layer._paint.get('fill-extrusion-pattern');
|
|
47
47
|
const image = patternProperty.constantOr(1);
|
|
48
48
|
const crossfade = layer.getCrossfadeParameters();
|
|
49
|
-
const opacity = layer.
|
|
49
|
+
const opacity = layer._paint.get('fill-extrusion-opacity');
|
|
50
50
|
|
|
51
51
|
for (const coord of coords) {
|
|
52
52
|
const tile = source.getTile(coord);
|
|
@@ -72,11 +72,11 @@ function drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMo
|
|
|
72
72
|
const matrix = painter.translatePosMatrix(
|
|
73
73
|
coord.posMatrix,
|
|
74
74
|
tile,
|
|
75
|
-
layer.
|
|
76
|
-
layer.
|
|
75
|
+
layer._paint.get('fill-extrusion-translate'),
|
|
76
|
+
layer._paint.get('fill-extrusion-translate-anchor')
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
const shouldUseVerticalGradient = layer.
|
|
79
|
+
const shouldUseVerticalGradient = layer._paint.get('fill-extrusion-vertical-gradient');
|
|
80
80
|
const uniformValues = image
|
|
81
81
|
? fillExtrusionPatternUniformValues(matrix, painter, shouldUseVerticalGradient, opacity, coord, crossfade, tile)
|
|
82
82
|
: fillExtrusionUniformValues(matrix, painter, shouldUseVerticalGradient, opacity);
|
|
@@ -93,7 +93,7 @@ function drawExtrusionTiles(painter, source, layer, coords, depthMode, stencilMo
|
|
|
93
93
|
bucket.layoutVertexBuffer,
|
|
94
94
|
bucket.indexBuffer,
|
|
95
95
|
bucket.segments,
|
|
96
|
-
layer.
|
|
96
|
+
layer._paint,
|
|
97
97
|
painter.transform.zoom,
|
|
98
98
|
programConfiguration
|
|
99
99
|
);
|
|
@@ -9,7 +9,7 @@ const { heatmapUniformValues, heatmapTextureUniformValues } = require('./program
|
|
|
9
9
|
module.exports = drawHeatmap;
|
|
10
10
|
|
|
11
11
|
function drawHeatmap(painter, sourceCache, layer, coords) {
|
|
12
|
-
if (layer.
|
|
12
|
+
if (layer._paint.get('heatmap-opacity') === 0) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -51,12 +51,12 @@ function drawHeatmap(painter, sourceCache, layer, coords) {
|
|
|
51
51
|
stencilMode,
|
|
52
52
|
colorMode,
|
|
53
53
|
CullFaceMode.disabled,
|
|
54
|
-
heatmapUniformValues(coord.posMatrix, tile, zoom, layer.
|
|
54
|
+
heatmapUniformValues(coord.posMatrix, tile, zoom, layer._paint.get('heatmap-intensity')),
|
|
55
55
|
layer.id,
|
|
56
56
|
bucket.layoutVertexBuffer,
|
|
57
57
|
bucket.indexBuffer,
|
|
58
58
|
bucket.segments,
|
|
59
|
-
layer.
|
|
59
|
+
layer._paint,
|
|
60
60
|
painter.transform.zoom,
|
|
61
61
|
programConfiguration
|
|
62
62
|
);
|
|
@@ -153,7 +153,7 @@ function renderTextureToMap(painter, layer) {
|
|
|
153
153
|
painter.viewportBuffer,
|
|
154
154
|
painter.quadTriangleIndexBuffer,
|
|
155
155
|
painter.viewportSegments,
|
|
156
|
-
layer.
|
|
156
|
+
layer._paint,
|
|
157
157
|
painter.transform.zoom
|
|
158
158
|
);
|
|
159
159
|
}
|
package/src/render/draw_line.js
CHANGED
|
@@ -11,17 +11,17 @@ const {
|
|
|
11
11
|
module.exports = function drawLine(painter, sourceCache, layer, coords) {
|
|
12
12
|
if (painter.renderPass !== 'translucent') return;
|
|
13
13
|
|
|
14
|
-
const opacity = layer.
|
|
15
|
-
const width = layer.
|
|
14
|
+
const opacity = layer._paint.get('line-opacity');
|
|
15
|
+
const width = layer._paint.get('line-width');
|
|
16
16
|
if (opacity.constantOr(1) === 0 || width.constantOr(1) === 0) return;
|
|
17
17
|
|
|
18
18
|
const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);
|
|
19
19
|
const colorMode = painter.colorModeForRenderPass();
|
|
20
20
|
|
|
21
|
-
const dasharray = layer.
|
|
22
|
-
const patternProperty = layer.
|
|
21
|
+
const dasharray = layer._paint.get('line-dasharray');
|
|
22
|
+
const patternProperty = layer._paint.get('line-pattern');
|
|
23
23
|
const image = patternProperty.constantOr(1);
|
|
24
|
-
const gradient = layer.
|
|
24
|
+
const gradient = layer._paint.get('line-gradient');
|
|
25
25
|
const crossfade = layer.getCrossfadeParameters();
|
|
26
26
|
|
|
27
27
|
const programId = dasharray ? 'lineSDF' : image ? 'linePattern' : gradient ? 'lineGradient' : 'line';
|
|
@@ -88,7 +88,7 @@ module.exports = function drawLine(painter, sourceCache, layer, coords) {
|
|
|
88
88
|
bucket.layoutVertexBuffer,
|
|
89
89
|
bucket.indexBuffer,
|
|
90
90
|
bucket.segments,
|
|
91
|
-
layer.
|
|
91
|
+
layer._paint,
|
|
92
92
|
painter.transform.zoom,
|
|
93
93
|
programConfiguration
|
|
94
94
|
);
|
|
@@ -11,7 +11,7 @@ module.exports = drawRaster;
|
|
|
11
11
|
|
|
12
12
|
function drawRaster(painter, sourceCache, layer, coords) {
|
|
13
13
|
if (painter.renderPass !== 'translucent') return;
|
|
14
|
-
if (layer.
|
|
14
|
+
if (layer._paint.get('raster-opacity') === 0) return;
|
|
15
15
|
|
|
16
16
|
const context = painter.context;
|
|
17
17
|
const gl = context.gl;
|
|
@@ -27,14 +27,14 @@ function drawRaster(painter, sourceCache, layer, coords) {
|
|
|
27
27
|
// Use gl.LESS to prevent double drawing in areas where tiles overlap.
|
|
28
28
|
const depthMode = painter.depthModeForSublayer(
|
|
29
29
|
coord.overscaledZ - minTileZ,
|
|
30
|
-
layer.
|
|
30
|
+
layer._paint.get('raster-opacity') === 1 ? DepthMode.ReadWrite : DepthMode.ReadOnly,
|
|
31
31
|
gl.LESS
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
const tile = sourceCache.getTile(coord);
|
|
35
35
|
const posMatrix = painter.transform.calculatePosMatrix(coord.toUnwrapped(), align);
|
|
36
36
|
|
|
37
|
-
tile.registerFadeDuration(layer.
|
|
37
|
+
tile.registerFadeDuration(layer._paint.get('raster-fade-duration'));
|
|
38
38
|
|
|
39
39
|
const parentTile = sourceCache.findLoadedParent(coord, 0);
|
|
40
40
|
const fade = getFadeValues(tile, parentTile, sourceCache, layer, painter.transform);
|
|
@@ -42,7 +42,7 @@ function drawRaster(painter, sourceCache, layer, coords) {
|
|
|
42
42
|
let parentScaleBy;
|
|
43
43
|
let parentTL;
|
|
44
44
|
|
|
45
|
-
const textureFilter = layer.
|
|
45
|
+
const textureFilter = layer._paint.get('raster-resampling') === 'nearest' ? gl.NEAREST : gl.LINEAR;
|
|
46
46
|
|
|
47
47
|
context.activeTexture.set(gl.TEXTURE0);
|
|
48
48
|
tile.texture.bind(textureFilter, gl.CLAMP_TO_EDGE, gl.LINEAR_MIPMAP_NEAREST);
|
|
@@ -86,7 +86,7 @@ function drawRaster(painter, sourceCache, layer, coords) {
|
|
|
86
86
|
tile.maskedBoundsBuffer,
|
|
87
87
|
tile.maskedIndexBuffer,
|
|
88
88
|
tile.segments,
|
|
89
|
-
layer.
|
|
89
|
+
layer._paint,
|
|
90
90
|
painter.transform.zoom
|
|
91
91
|
);
|
|
92
92
|
} else {
|
|
@@ -108,7 +108,7 @@ function drawRaster(painter, sourceCache, layer, coords) {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function getFadeValues(tile, parentTile, sourceCache, layer, transform) {
|
|
111
|
-
const fadeDuration = layer.
|
|
111
|
+
const fadeDuration = layer._paint.get('raster-fade-duration');
|
|
112
112
|
|
|
113
113
|
if (fadeDuration > 0) {
|
|
114
114
|
const now = browser.now();
|
|
@@ -21,35 +21,35 @@ function drawSymbols(painter, sourceCache, layer, coords) {
|
|
|
21
21
|
const stencilMode = StencilMode.disabled;
|
|
22
22
|
const colorMode = painter.colorModeForRenderPass();
|
|
23
23
|
|
|
24
|
-
if (layer.
|
|
24
|
+
if (layer._paint.get('icon-opacity').constantOr(1) !== 0) {
|
|
25
25
|
drawLayerSymbols(
|
|
26
26
|
painter,
|
|
27
27
|
sourceCache,
|
|
28
28
|
layer,
|
|
29
29
|
coords,
|
|
30
30
|
false,
|
|
31
|
-
layer.
|
|
32
|
-
layer.
|
|
33
|
-
layer.
|
|
34
|
-
layer.
|
|
35
|
-
layer.
|
|
31
|
+
layer._paint.get('icon-translate'),
|
|
32
|
+
layer._paint.get('icon-translate-anchor'),
|
|
33
|
+
layer._layout.get('icon-rotation-alignment'),
|
|
34
|
+
layer._layout.get('icon-pitch-alignment'),
|
|
35
|
+
layer._layout.get('icon-keep-upright'),
|
|
36
36
|
stencilMode,
|
|
37
37
|
colorMode
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (layer.
|
|
41
|
+
if (layer._paint.get('text-opacity').constantOr(1) !== 0) {
|
|
42
42
|
drawLayerSymbols(
|
|
43
43
|
painter,
|
|
44
44
|
sourceCache,
|
|
45
45
|
layer,
|
|
46
46
|
coords,
|
|
47
47
|
true,
|
|
48
|
-
layer.
|
|
49
|
-
layer.
|
|
50
|
-
layer.
|
|
51
|
-
layer.
|
|
52
|
-
layer.
|
|
48
|
+
layer._paint.get('text-translate'),
|
|
49
|
+
layer._paint.get('text-translate-anchor'),
|
|
50
|
+
layer._layout.get('text-rotation-alignment'),
|
|
51
|
+
layer._layout.get('text-pitch-alignment'),
|
|
52
|
+
layer._layout.get('text-keep-upright'),
|
|
53
53
|
stencilMode,
|
|
54
54
|
colorMode
|
|
55
55
|
);
|
|
@@ -80,7 +80,7 @@ function drawLayerSymbols(
|
|
|
80
80
|
|
|
81
81
|
const rotateWithMap = rotationAlignment === 'map';
|
|
82
82
|
const pitchWithMap = pitchAlignment === 'map';
|
|
83
|
-
const alongLine = rotateWithMap && layer.
|
|
83
|
+
const alongLine = rotateWithMap && layer._layout.get('symbol-placement') !== 'point';
|
|
84
84
|
// Line label rotation happens in `updateLineLabels`
|
|
85
85
|
// Pitched point labels are automatically rotated by the labelPlaneMatrix projection
|
|
86
86
|
// Unpitched point labels need to have their rotation applied after projection
|
|
@@ -119,7 +119,7 @@ function drawLayerSymbols(
|
|
|
119
119
|
tile.glyphAtlasTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
|
|
120
120
|
texSize = tile.glyphAtlasTexture.size;
|
|
121
121
|
} else {
|
|
122
|
-
const iconScaled = layer.
|
|
122
|
+
const iconScaled = layer._layout.get('icon-size').constantOr(0) !== 1 || bucket.iconsNeedLinear;
|
|
123
123
|
const iconTransformed = pitchWithMap || tr.pitch !== 0;
|
|
124
124
|
|
|
125
125
|
tile.imageAtlasTexture.bind(
|
|
@@ -167,7 +167,7 @@ function drawLayerSymbols(
|
|
|
167
167
|
|
|
168
168
|
let uniformValues;
|
|
169
169
|
if (isSDF) {
|
|
170
|
-
const hasHalo = layer.
|
|
170
|
+
const hasHalo = layer._paint.get(isText ? 'text-halo-width' : 'icon-halo-width').constantOr(1) !== 0;
|
|
171
171
|
|
|
172
172
|
uniformValues = symbolSDFUniformValues(
|
|
173
173
|
sizeData.functionType,
|
|
@@ -222,7 +222,7 @@ function drawSymbolElements(buffers, layer, painter, program, depthMode, stencil
|
|
|
222
222
|
buffers.layoutVertexBuffer,
|
|
223
223
|
buffers.indexBuffer,
|
|
224
224
|
buffers.segments,
|
|
225
|
-
layer.
|
|
225
|
+
layer._paint,
|
|
226
226
|
painter.transform.zoom,
|
|
227
227
|
buffers.programConfigurations.get(layer.id),
|
|
228
228
|
buffers.dynamicLayoutVertexBuffer,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { AlphaImage } = require('../util/image');
|
|
2
|
-
const { register } = require('../util/transfer_registry');
|
|
3
2
|
const { default: potpack } = require('potpack');
|
|
4
3
|
|
|
5
4
|
const padding = 1;
|
|
@@ -47,6 +46,4 @@ class GlyphAtlas {
|
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
register('GlyphAtlas', GlyphAtlas);
|
|
51
|
-
|
|
52
49
|
module.exports = GlyphAtlas;
|
|
@@ -8,8 +8,7 @@ class GlyphManager {
|
|
|
8
8
|
async loadGlyphRange(stack, range) {
|
|
9
9
|
this.#cache[stack] ??= {};
|
|
10
10
|
const promise = (this.#cache[stack][range] ??= this.loader(stack, range));
|
|
11
|
-
|
|
12
|
-
return response.slice();
|
|
11
|
+
return await promise;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { RGBAImage } = require('../util/image');
|
|
2
|
-
const { register } = require('../util/transfer_registry');
|
|
3
2
|
const { default: potpack } = require('potpack');
|
|
4
3
|
|
|
5
4
|
const padding = 1;
|
|
@@ -89,6 +88,3 @@ class ImageAtlas {
|
|
|
89
88
|
|
|
90
89
|
ImageAtlas.ImagePosition = ImagePosition;
|
|
91
90
|
module.exports = ImageAtlas;
|
|
92
|
-
|
|
93
|
-
register('ImagePosition', ImagePosition);
|
|
94
|
-
register('ImageAtlas', ImageAtlas);
|