@mapwhit/tilerenderer 0.51.0 → 0.52.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.
Files changed (99) hide show
  1. package/build/min/package.json +1 -1
  2. package/package.json +13 -9
  3. package/src/data/array_types.js +1 -1
  4. package/src/data/bucket/circle_bucket.js +4 -1
  5. package/src/data/bucket/fill_bucket.js +5 -1
  6. package/src/data/bucket/fill_extrusion_bucket.js +5 -1
  7. package/src/data/bucket/line_bucket.js +5 -1
  8. package/src/data/bucket/symbol_bucket.js +3 -2
  9. package/src/geo/transform.js +1 -1
  10. package/src/index.js +2 -2
  11. package/src/render/glyph_atlas.js +1 -1
  12. package/src/render/image_atlas.js +1 -1
  13. package/src/render/image_manager.js +1 -1
  14. package/src/source/geojson_source.js +3 -2
  15. package/src/source/geojson_worker_source.js +4 -4
  16. package/src/source/geojson_wrapper.js +1 -1
  17. package/src/source/image_source.js +2 -2
  18. package/src/source/raster_tile_source.js +1 -1
  19. package/src/source/rtl_text_plugin.js +1 -1
  20. package/src/source/source_cache.js +2 -2
  21. package/src/source/tile.js +1 -1
  22. package/src/source/vector_tile_source.js +3 -2
  23. package/src/source/vector_tile_worker_source.js +1 -0
  24. package/src/source/worker_tile.js +8 -6
  25. package/src/style/evaluation_parameters.js +6 -4
  26. package/src/style/light.js +1 -1
  27. package/src/style/properties.js +4 -0
  28. package/src/style/query_utils.js +1 -1
  29. package/src/style/style.js +80 -3
  30. package/src/style/style_layer/circle_style_layer.js +1 -1
  31. package/src/style/style_layer/fill_extrusion_style_layer.js +1 -1
  32. package/src/style/style_layer/line_style_layer.js +1 -1
  33. package/src/style/style_layer.js +34 -2
  34. package/src/style-spec/feature_filter/index.js +13 -4
  35. package/src/style-spec/reference/v8.json +53 -13
  36. package/src/symbol/anchor.js +1 -1
  37. package/src/symbol/clip_line.js +1 -1
  38. package/src/symbol/collision_feature.js +1 -1
  39. package/src/symbol/collision_index.js +1 -1
  40. package/src/symbol/projection.js +1 -1
  41. package/src/symbol/quads.js +1 -1
  42. package/src/ui/camera.js +2 -2
  43. package/src/ui/map.js +27 -5
  44. package/src/util/config.js +1 -1
  45. package/src/util/find_pole_of_inaccessibility.js +1 -1
  46. package/src/util/intersection_tests.js +1 -1
  47. package/src/util/transfer_registry.js +1 -0
  48. package/src/worker.js +4 -0
  49. package/build/min/src/shaders/_prelude.fragment.glsl.txt +0 -13
  50. package/build/min/src/shaders/_prelude.vertex.glsl.txt +0 -14
  51. package/build/min/src/shaders/background.fragment.glsl.txt +0 -5
  52. package/build/min/src/shaders/background.vertex.glsl.txt +0 -1
  53. package/build/min/src/shaders/background_pattern.fragment.glsl.txt +0 -5
  54. package/build/min/src/shaders/background_pattern.vertex.glsl.txt +0 -1
  55. package/build/min/src/shaders/circle.fragment.glsl.txt +0 -20
  56. package/build/min/src/shaders/circle.vertex.glsl.txt +0 -17
  57. package/build/min/src/shaders/clipping_mask.fragment.glsl.txt +0 -1
  58. package/build/min/src/shaders/clipping_mask.vertex.glsl.txt +0 -1
  59. package/build/min/src/shaders/collision_box.fragment.glsl.txt +0 -1
  60. package/build/min/src/shaders/collision_box.vertex.glsl.txt +0 -1
  61. package/build/min/src/shaders/collision_circle.fragment.glsl.txt +0 -1
  62. package/build/min/src/shaders/collision_circle.vertex.glsl.txt +0 -1
  63. package/build/min/src/shaders/debug.fragment.glsl.txt +0 -1
  64. package/build/min/src/shaders/debug.vertex.glsl.txt +0 -1
  65. package/build/min/src/shaders/fill.fragment.glsl.txt +0 -10
  66. package/build/min/src/shaders/fill.vertex.glsl.txt +0 -7
  67. package/build/min/src/shaders/fill_extrusion.fragment.glsl.txt +0 -5
  68. package/build/min/src/shaders/fill_extrusion.vertex.glsl.txt +0 -9
  69. package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.txt +0 -15
  70. package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.txt +0 -11
  71. package/build/min/src/shaders/fill_outline.fragment.glsl.txt +0 -10
  72. package/build/min/src/shaders/fill_outline.vertex.glsl.txt +0 -7
  73. package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.txt +0 -13
  74. package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.txt +0 -9
  75. package/build/min/src/shaders/fill_pattern.fragment.glsl.txt +0 -13
  76. package/build/min/src/shaders/fill_pattern.vertex.glsl.txt +0 -9
  77. package/build/min/src/shaders/heatmap.fragment.glsl.txt +0 -10
  78. package/build/min/src/shaders/heatmap.vertex.glsl.txt +0 -8
  79. package/build/min/src/shaders/heatmap_texture.fragment.glsl.txt +0 -5
  80. package/build/min/src/shaders/heatmap_texture.vertex.glsl.txt +0 -1
  81. package/build/min/src/shaders/hillshade.fragment.glsl.txt +0 -7
  82. package/build/min/src/shaders/hillshade.vertex.glsl.txt +0 -1
  83. package/build/min/src/shaders/hillshade_prepare.fragment.glsl.txt +0 -8
  84. package/build/min/src/shaders/hillshade_prepare.vertex.glsl.txt +0 -1
  85. package/build/min/src/shaders/line.fragment.glsl.txt +0 -12
  86. package/build/min/src/shaders/line.vertex.glsl.txt +0 -17
  87. package/build/min/src/shaders/line_gradient.fragment.glsl.txt +0 -10
  88. package/build/min/src/shaders/line_gradient.vertex.glsl.txt +0 -16
  89. package/build/min/src/shaders/line_pattern.fragment.glsl.txt +0 -15
  90. package/build/min/src/shaders/line_pattern.vertex.glsl.txt +0 -20
  91. package/build/min/src/shaders/line_sdf.fragment.glsl.txt +0 -17
  92. package/build/min/src/shaders/line_sdf.vertex.glsl.txt +0 -20
  93. package/build/min/src/shaders/raster.fragment.glsl.txt +0 -5
  94. package/build/min/src/shaders/raster.vertex.glsl.txt +0 -1
  95. package/build/min/src/shaders/symbol_icon.fragment.glsl.txt +0 -9
  96. package/build/min/src/shaders/symbol_icon.vertex.glsl.txt +0 -5
  97. package/build/min/src/shaders/symbol_sdf.fragment.glsl.txt +0 -19
  98. package/build/min/src/shaders/symbol_sdf.vertex.glsl.txt +0 -13
  99. package/src/util/evented.js +0 -182
@@ -1,8 +1,9 @@
1
1
  const { filterObject } = require('../util/object');
2
2
 
3
- const { Evented } = require('../util/evented');
3
+ const { Evented } = require('@mapwhit/events');
4
4
  const { Layout, Transitionable, PossiblyEvaluatedPropertyValue } = require('./properties');
5
5
  const { supportsPropertyExpression } = require('@mapwhit/style-expressions');
6
+ const featureFilter = require('../style-spec/feature_filter');
6
7
 
7
8
  const TRANSITION_SUFFIX = '-transition';
8
9
 
@@ -23,9 +24,10 @@ class StyleLayer extends Evented {
23
24
  this.source = layer.source;
24
25
  this.sourceLayer = layer['source-layer'];
25
26
  this.filter = layer.filter;
27
+ this._featureFilter = featureFilter(layer.filter);
26
28
  }
27
29
 
28
- this._featureFilter = () => true;
30
+ this._featureFilter ??= featureFilter.addGlobalStateRefs(() => true);
29
31
 
30
32
  if (properties.layout) {
31
33
  this._unevaluatedLayout = new Layout(properties.layout);
@@ -43,6 +45,11 @@ class StyleLayer extends Evented {
43
45
  this._transitioningPaint = this._transitionablePaint.untransitioned();
44
46
  }
45
47
 
48
+ setFilter(filter) {
49
+ this.filter = filter;
50
+ this._featureFilter = featureFilter(filter);
51
+ }
52
+
46
53
  getCrossfadeParameters() {
47
54
  return this._crossfadeParameters;
48
55
  }
@@ -55,6 +62,31 @@ class StyleLayer extends Evented {
55
62
  return this._unevaluatedLayout.getValue(name);
56
63
  }
57
64
 
65
+ /**
66
+ * Get list of global state references that are used within layout or filter properties.
67
+ * This is used to determine if layer source need to be reloaded when global state property changes.
68
+ *
69
+ */
70
+ getLayoutAffectingGlobalStateRefs() {
71
+ const globalStateRefs = new Set();
72
+
73
+ if (this._unevaluatedLayout) {
74
+ for (const propertyName in this._unevaluatedLayout._values) {
75
+ const value = this._unevaluatedLayout._values[propertyName];
76
+
77
+ for (const globalStateRef of value.getGlobalStateRefs()) {
78
+ globalStateRefs.add(globalStateRef);
79
+ }
80
+ }
81
+ }
82
+
83
+ for (const globalStateRef of this._featureFilter.getGlobalStateRefs()) {
84
+ globalStateRefs.add(globalStateRef);
85
+ }
86
+
87
+ return globalStateRefs;
88
+ }
89
+
58
90
  setLayoutProperty(name, value) {
59
91
  if (name === 'visibility') {
60
92
  this.visibility = value === 'none' ? value : 'visible';
@@ -1,8 +1,9 @@
1
- const { createExpression } = require('@mapwhit/style-expressions');
1
+ const { createExpression, findGlobalStateRefs } = require('@mapwhit/style-expressions');
2
2
 
3
3
  module.exports = createFilter;
4
4
 
5
5
  createFilter.isExpressionFilter = isExpressionFilter;
6
+ createFilter.addGlobalStateRefs = addGlobalStateRefs;
6
7
 
7
8
  function isExpressionFilter(filter) {
8
9
  if (filter === true || filter === false) {
@@ -66,7 +67,7 @@ const filterSpec = {
66
67
  */
67
68
  function createFilter(filter) {
68
69
  if (filter === null || filter === undefined) {
69
- return () => true;
70
+ return addGlobalStateRefs(() => true);
70
71
  }
71
72
 
72
73
  if (!isExpressionFilter(filter)) {
@@ -77,7 +78,15 @@ function createFilter(filter) {
77
78
  if (compiled.result === 'error') {
78
79
  throw new Error(compiled.value.map(err => `${err.key}: ${err.message}`).join(', '));
79
80
  }
80
- return (globalProperties, feature) => compiled.value.evaluate(globalProperties, feature);
81
+ return addGlobalStateRefs(
82
+ (globalProperties, feature) => compiled.value.evaluate(globalProperties, feature),
83
+ () => findGlobalStateRefs(compiled.value.expression)
84
+ );
85
+ }
86
+
87
+ function addGlobalStateRefs(filter, getGlobalStateRefs = () => new Set()) {
88
+ filter.getGlobalStateRefs = getGlobalStateRefs;
89
+ return filter;
81
90
  }
82
91
 
83
92
  // Comparison function to sort numbers and strings
@@ -86,7 +95,7 @@ function compare(a, b) {
86
95
  }
87
96
 
88
97
  function convertFilter(filter) {
89
- if (!filter) return true;
98
+ if (!filter || filter.length === 0) return true;
90
99
  const [op, ...args] = filter;
91
100
  if (filter.length <= 1) return op !== 'any';
92
101
  switch (op) {
@@ -48,6 +48,26 @@
48
48
  "doc": "Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
49
49
  "example": 50
50
50
  },
51
+ "state": {
52
+ "type": "state",
53
+ "default": {},
54
+ "doc": "An object used to define default values when using the [`global-state`](https://maplibre.org/maplibre-style-spec/expressions/#global-state) expression.",
55
+ "example": {
56
+ "chargerType": {
57
+ "default": ["CCS", "CHAdeMO", "Type2"]
58
+ },
59
+ "minPreferredChargingSpeed": {
60
+ "default": 50
61
+ }
62
+ },
63
+ "sdk-support": {
64
+ "basic functionality": {
65
+ "js": "https://github.com/maplibre/maplibre-gl-js/issues/4964",
66
+ "android": "https://github.com/maplibre/maplibre-native/issues/3302",
67
+ "ios": "https://github.com/maplibre/maplibre-native/issues/3302"
68
+ }
69
+ }
70
+ },
51
71
  "light": {
52
72
  "type": "light",
53
73
  "doc": "The global light source.",
@@ -1293,8 +1313,8 @@
1293
1313
  },
1294
1314
  {
1295
1315
  "symbol-placement": [
1296
- "line",
1297
- "line-center"
1316
+ "line",
1317
+ "line-center"
1298
1318
  ]
1299
1319
  }
1300
1320
  ],
@@ -1816,10 +1836,10 @@
1816
1836
  "requires": [
1817
1837
  "text-field",
1818
1838
  {
1819
- "symbol-placement": [
1820
- "line",
1821
- "line-center"
1822
- ]
1839
+ "symbol-placement": [
1840
+ "line",
1841
+ "line-center"
1842
+ ]
1823
1843
  }
1824
1844
  ],
1825
1845
  "sdk-support": {
@@ -1907,10 +1927,10 @@
1907
1927
  "text-rotation-alignment": "map"
1908
1928
  },
1909
1929
  {
1910
- "symbol-placement": [
1911
- "line",
1912
- "line-center"
1913
- ]
1930
+ "symbol-placement": [
1931
+ "line",
1932
+ "line-center"
1933
+ ]
1914
1934
  }
1915
1935
  ],
1916
1936
  "sdk-support": {
@@ -2554,6 +2574,24 @@
2554
2574
  }
2555
2575
  }
2556
2576
  },
2577
+ "global-state": {
2578
+ "doc": "Retrieves a property value from global state that can be set with platform-specific APIs. Defaults can be provided using the [`state`](https://maplibre.org/maplibre-style-spec/root/#state) root property. Returns `null` if no value nor default value is set for the retrieved property.",
2579
+ "group": "Lookup",
2580
+ "example": {
2581
+ "syntax": {
2582
+ "method": ["string"],
2583
+ "result": "value"
2584
+ },
2585
+ "value": ["global-state", "someProperty"]
2586
+ },
2587
+ "sdk-support": {
2588
+ "basic functionality": {
2589
+ "js": "https://github.com/maplibre/maplibre-gl-js/issues/4964",
2590
+ "android": "https://github.com/maplibre/maplibre-native/issues/3302",
2591
+ "ios": "https://github.com/maplibre/maplibre-native/issues/3302"
2592
+ }
2593
+ }
2594
+ },
2557
2595
  "to-string": {
2558
2596
  "doc": "Converts the input value to a string. If the input is `null`, the result is `\"\"`. If the input is a boolean, the result is `\"true\"` or `\"false\"`. If the input is a number, it is converted to a string as specified by the [\"NumberToString\" algorithm](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type) of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form `\"rgba(r,g,b,a)\"`, where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the [`JSON.stringify`](https://tc39.github.io/ecma262/#sec-json.stringify) function of the ECMAScript Language Specification.",
2559
2597
  "group": "Types",
@@ -3722,7 +3760,9 @@
3722
3760
  },
3723
3761
  "expression": {
3724
3762
  "interpolated": false,
3725
- "parameters": ["zoom"]
3763
+ "parameters": [
3764
+ "zoom"
3765
+ ]
3726
3766
  },
3727
3767
  "property-type": "data-constant"
3728
3768
  }
@@ -5232,10 +5272,10 @@
5232
5272
  "type": "enum",
5233
5273
  "values": {
5234
5274
  "map": {
5235
- "doc": "The hillshade illumination is relative to the north direction."
5275
+ "doc": "The hillshade illumination is relative to the north direction."
5236
5276
  },
5237
5277
  "viewport": {
5238
- "doc": "The hillshade illumination is relative to the top of the viewport."
5278
+ "doc": "The hillshade illumination is relative to the top of the viewport."
5239
5279
  }
5240
5280
  },
5241
5281
  "default": "viewport",
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  const { register } = require('../util/transfer_registry');
4
4
 
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  module.exports = clipLine;
4
4
 
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  /**
4
4
  * A CollisionFeature represents the area of the tile covered by a single label.
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  const intersectionTests = require('../util/intersection_tests');
4
4
  const Grid = require('./grid_index');
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  const { mat4, vec4 } = require('@mapbox/gl-matrix');
4
4
  const symbolSize = require('./symbol_size');
@@ -1,4 +1,4 @@
1
- const Point = require('@mapbox/point-geometry');
1
+ const { default: Point } = require('@mapbox/point-geometry');
2
2
 
3
3
  const { GLYPH_PBF_BORDER } = require('../style/parse_glyph_pbf');
4
4
 
package/src/ui/camera.js CHANGED
@@ -5,8 +5,8 @@ const interpolate = require('../util/interpolate');
5
5
  const browser = require('../util/browser');
6
6
  const LngLat = require('../geo/lng_lat');
7
7
  const LngLatBounds = require('../geo/lng_lat_bounds');
8
- const Point = require('@mapbox/point-geometry');
9
- const { Event, Evented } = require('../util/evented');
8
+ const { default: Point } = require('@mapbox/point-geometry');
9
+ const { Event, Evented } = require('@mapwhit/events');
10
10
 
11
11
  /**
12
12
  * Options common to {@link Map#jumpTo}, {@link Map#easeTo}, and {@link Map#flyTo}, controlling the desired location,
package/src/ui/map.js CHANGED
@@ -12,9 +12,9 @@ const Transform = require('../geo/transform');
12
12
  const Camera = require('./camera');
13
13
  const LngLat = require('../geo/lng_lat');
14
14
  const LngLatBounds = require('../geo/lng_lat_bounds');
15
- const Point = require('@mapbox/point-geometry');
15
+ const { default: Point } = require('@mapbox/point-geometry');
16
16
  const { RGBAImage } = require('../util/image');
17
- const { Event, ErrorEvent } = require('../util/evented');
17
+ const { Event, ErrorEvent } = require('@mapwhit/events');
18
18
  const taskQueue = require('../util/task_queue');
19
19
 
20
20
  const defaultMinZoom = 0;
@@ -111,8 +111,6 @@ const defaultOptions = {
111
111
  * @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)
112
112
  */
113
113
  class Map extends Camera {
114
- #mapGestures;
115
-
116
114
  constructor(options) {
117
115
  options = Object.assign({}, defaultOptions, options);
118
116
 
@@ -203,6 +201,29 @@ class Map extends Camera {
203
201
  this.on('dataloading', this._onDataLoading);
204
202
  }
205
203
 
204
+ /**
205
+ * Sets a global state property that can be retrieved with the [`global-state` expression](https://maplibre.org/maplibre-style-spec/expressions/#global-state).
206
+ * If the value is null, it resets the property to its default value defined in the [`state` style property](https://maplibre.org/maplibre-style-spec/root/#state).
207
+ *
208
+ * Note that changing `global-state` values defined in layout properties is not supported, and will be ignored.
209
+ *
210
+ * @param propertyName - The name of the state property to set.
211
+ * @param value - The value of the state property to set.
212
+ */
213
+ setGlobalStateProperty(propertyName, value) {
214
+ this.style.setGlobalStateProperty(propertyName, value);
215
+ return this._update(true);
216
+ }
217
+
218
+ /**
219
+ * Returns the global map state
220
+ *
221
+ * @returns The map state object.
222
+ */
223
+ getGlobalState() {
224
+ return this.style.getGlobalState();
225
+ }
226
+
206
227
  /**
207
228
  * Adds a {@link IControl} to the map, calling `control.onAdd(this)`.
208
229
  *
@@ -1250,7 +1271,8 @@ class Map extends Camera {
1250
1271
  now,
1251
1272
  fadeDuration: this._fadeDuration,
1252
1273
  zoomHistory: this.style.zoomHistory,
1253
- transition: this.style.getTransition()
1274
+ transition: this.style.getTransition(),
1275
+ globalState: this.style.getGlobalState()
1254
1276
  });
1255
1277
 
1256
1278
  const factor = parameters.crossFadingFactor();
@@ -1,4 +1,4 @@
1
- const { Evented } = require('./evented');
1
+ const { Evented } = require('@mapwhit/events');
2
2
 
3
3
  function getDefaultWorkerCount() {
4
4
  const browser = require('./browser');
@@ -1,6 +1,6 @@
1
1
  const { default: Queue } = require('tinyqueue');
2
2
 
3
- const Point = require('@mapbox/point-geometry');
3
+ const { default: Point } = require('@mapbox/point-geometry');
4
4
  const { distToSegmentSquared } = require('./intersection_tests');
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  const { isCounterClockwise } = require('./util');
2
- const Point = require('@mapbox/point-geometry');
2
+ const { default: Point } = require('@mapbox/point-geometry');
3
3
 
4
4
  module.exports = {
5
5
  polygonIntersectsBufferedPoint,
@@ -27,6 +27,7 @@ function register(name, klass, { omit, shallow } = {}) {
27
27
  }
28
28
 
29
29
  register('Object', Object);
30
+ register('Set', Set);
30
31
 
31
32
  /**
32
33
  * Serialize the given object for transfer to or from a web worker.
package/src/worker.js ADDED
@@ -0,0 +1,4 @@
1
+ const worker = require('./source/worker');
2
+
3
+ /* global self */
4
+ worker(self);
@@ -1,13 +0,0 @@
1
- #ifdef GL_ES
2
- precision mediump float;
3
- #else
4
- #if !defined(lowp)
5
- #define lowp
6
- #endif
7
- #if !defined(mediump)
8
- #define mediump
9
- #endif
10
- #if !defined(highp)
11
- #define highp
12
- #endif
13
- #endif
@@ -1,14 +0,0 @@
1
- #ifdef GL_ES
2
- precision highp float;
3
- #else
4
- #if !defined(lowp)
5
- #define lowp
6
- #endif
7
- #if !defined(mediump)
8
- #define mediump
9
- #endif
10
- #if !defined(highp)
11
- #define highp
12
- #endif
13
- #endif
14
- vec2 unpack_float(const float packedValue){int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity){int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.,mod(packedOpacity,2.));}vec4 decode_color(const vec2 encodedColor){return vec4(unpack_float(encodedColor[0])/255.,unpack_float(encodedColor[1])/255.);}float unpack_mix_vec2(const vec2 packedValue,const float t){return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t){vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos){vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.,pattern_size)*256.+pixel_coord_lower,pattern_size);return(tile_units_to_pixels*pos+offset)/pattern_size;}
@@ -1,5 +0,0 @@
1
- uniform vec4 u_color;uniform float u_opacity;void main(){gl_FragColor=u_color*u_opacity;
2
- #ifdef OVERDRAW_INSPECTOR
3
- gl_FragColor=vec4(1.);
4
- #endif
5
- }
@@ -1 +0,0 @@
1
- attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -1,5 +0,0 @@
1
- uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main(){vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
2
- #ifdef OVERDRAW_INSPECTOR
3
- gl_FragColor=vec4(1.);
4
- #endif
5
- }
@@ -1 +0,0 @@
1
- uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}
@@ -1,20 +0,0 @@
1
- #pragma mapbox: define highp vec4 color
2
- #pragma mapbox: define mediump float radius
3
- #pragma mapbox: define lowp float blur
4
- #pragma mapbox: define lowp float opacity
5
- #pragma mapbox: define highp vec4 stroke_color
6
- #pragma mapbox: define mediump float stroke_width
7
- #pragma mapbox: define lowp float stroke_opacity
8
- varying vec3 v_data;void main(){
9
- #pragma mapbox: initialize highp vec4 color
10
- #pragma mapbox: initialize mediump float radius
11
- #pragma mapbox: initialize lowp float blur
12
- #pragma mapbox: initialize lowp float opacity
13
- #pragma mapbox: initialize highp vec4 stroke_color
14
- #pragma mapbox: initialize mediump float stroke_width
15
- #pragma mapbox: initialize lowp float stroke_opacity
16
- vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.,antialiased_blur,extrude_length-1.);float color_t=stroke_width<0.01?0.:smoothstep(antialiased_blur,0.,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
17
- #ifdef OVERDRAW_INSPECTOR
18
- gl_FragColor=vec4(1.);
19
- #endif
20
- }
@@ -1,17 +0,0 @@
1
- uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;
2
- #pragma mapbox: define highp vec4 color
3
- #pragma mapbox: define mediump float radius
4
- #pragma mapbox: define lowp float blur
5
- #pragma mapbox: define lowp float opacity
6
- #pragma mapbox: define highp vec4 stroke_color
7
- #pragma mapbox: define mediump float stroke_width
8
- #pragma mapbox: define lowp float stroke_opacity
9
- varying vec3 v_data;void main(void){
10
- #pragma mapbox: initialize highp vec4 color
11
- #pragma mapbox: initialize mediump float radius
12
- #pragma mapbox: initialize lowp float blur
13
- #pragma mapbox: initialize lowp float opacity
14
- #pragma mapbox: initialize highp vec4 stroke_color
15
- #pragma mapbox: initialize mediump float stroke_width
16
- #pragma mapbox: initialize lowp float stroke_opacity
17
- vec2 extrude=vec2(mod(a_pos,2.)*2.-1.);vec2 circle_center=floor(a_pos*0.5);if(u_pitch_with_map){vec2 corner_position=circle_center;if(u_scale_with_map){corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;}else{vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);}else{gl_Position=u_matrix*vec4(circle_center,0,1);if(u_scale_with_map){gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;}else{gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1./DEVICE_PIXEL_RATIO/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}
@@ -1 +0,0 @@
1
- void main(){gl_FragColor=vec4(1.);}
@@ -1 +0,0 @@
1
- attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -1 +0,0 @@
1
- varying float v_placed;varying float v_notUsed;void main(){float alpha=0.5;gl_FragColor=vec4(1.,0.,0.,1.)*alpha;if(v_placed>0.5){gl_FragColor=vec4(0.,0.,1.,0.5)*alpha;}if(v_notUsed>0.5){gl_FragColor*=.1;}}
@@ -1 +0,0 @@
1
- attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main(){vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.,4.);gl_Position=u_matrix*vec4(a_pos,0.,1.);gl_Position.xy+=a_extrude*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}
@@ -1 +0,0 @@
1
- uniform float u_overscale_factor;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main(){float alpha=0.5;vec4 color=vec4(1.,0.,0.,1.)*alpha;if(v_placed>0.5){color=vec4(0.,0.,1.,0.5)*alpha;}if(v_notUsed>0.5){color*=.2;}float extrude_scale_length=length(v_extrude_scale);float extrude_length=length(v_extrude)*extrude_scale_length;float stroke_width=15.*extrude_scale_length/u_overscale_factor;float radius=v_radius*extrude_scale_length;float distance_to_edge=abs(extrude_length-radius);float opacity_t=smoothstep(-stroke_width,0.,-distance_to_edge);gl_FragColor=opacity_t*color;}
@@ -1 +0,0 @@
1
- attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main(){vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.,4.);gl_Position=u_matrix*vec4(a_pos,0.,1.);highp float padding_factor=1.2;gl_Position.xy+=a_extrude*u_extrude_scale*padding_factor*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;v_radius=abs(a_extrude.y);v_extrude=a_extrude*padding_factor;v_extrude_scale=u_extrude_scale*u_camera_to_center_distance*collision_perspective_ratio;}
@@ -1 +0,0 @@
1
- uniform highp vec4 u_color;void main(){gl_FragColor=u_color;}
@@ -1 +0,0 @@
1
- attribute vec2 a_pos;uniform mat4 u_matrix;void main(){gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -1,10 +0,0 @@
1
- #pragma mapbox: define highp vec4 color
2
- #pragma mapbox: define lowp float opacity
3
- void main(){
4
- #pragma mapbox: initialize highp vec4 color
5
- #pragma mapbox: initialize lowp float opacity
6
- gl_FragColor=color*opacity;
7
- #ifdef OVERDRAW_INSPECTOR
8
- gl_FragColor=vec4(1.);
9
- #endif
10
- }
@@ -1,7 +0,0 @@
1
- attribute vec2 a_pos;uniform mat4 u_matrix;
2
- #pragma mapbox: define highp vec4 color
3
- #pragma mapbox: define lowp float opacity
4
- void main(){
5
- #pragma mapbox: initialize highp vec4 color
6
- #pragma mapbox: initialize lowp float opacity
7
- gl_Position=u_matrix*vec4(a_pos,0,1);}
@@ -1,5 +0,0 @@
1
- varying vec4 v_color;void main(){gl_FragColor=v_color;
2
- #ifdef OVERDRAW_INSPECTOR
3
- gl_FragColor=vec4(1.);
4
- #endif
5
- }
@@ -1,9 +0,0 @@
1
- uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
2
- #pragma mapbox: define highp float base
3
- #pragma mapbox: define highp float height
4
- #pragma mapbox: define highp vec4 color
5
- void main(){
6
- #pragma mapbox: initialize highp float base
7
- #pragma mapbox: initialize highp float height
8
- #pragma mapbox: initialize highp vec4 color
9
- vec3 normal=a_normal_ed.xyz;base=max(0.,base);height=max(0.,height);float t=mod(normal.x,2.);gl_Position=u_matrix*vec4(a_pos,t>0.?height:base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.,0.,0.,1.);vec4 ambientlight=vec4(0.03,0.03,0.03,1.);color+=ambientlight;float directional=clamp(dot(normal/16384.,u_lightpos),0.,1.);directional=mix((1.-u_lightintensity),max((1.-colorvalue+u_lightintensity),1.),directional);if(normal.y!=0.){directional*=((1.-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.,0.5),mix(0.7,0.98,1.-u_lightintensity),1.)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.,0.3,1.-u_lightcolor.r),1.);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.,0.3,1.-u_lightcolor.g),1.);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.,0.3,1.-u_lightcolor.b),1.);v_color*=u_opacity;}
@@ -1,15 +0,0 @@
1
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
2
- #pragma mapbox: define lowp float base
3
- #pragma mapbox: define lowp float height
4
- #pragma mapbox: define lowp vec4 pattern_from
5
- #pragma mapbox: define lowp vec4 pattern_to
6
- void main(){
7
- #pragma mapbox: initialize lowp float base
8
- #pragma mapbox: initialize lowp float height
9
- #pragma mapbox: initialize mediump vec4 pattern_from
10
- #pragma mapbox: initialize mediump vec4 pattern_to
11
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
12
- #ifdef OVERDRAW_INSPECTOR
13
- gl_FragColor=vec4(1.);
14
- #endif
15
- }
@@ -1,11 +0,0 @@
1
- uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec4 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
2
- #pragma mapbox: define lowp float base
3
- #pragma mapbox: define lowp float height
4
- #pragma mapbox: define lowp vec4 pattern_from
5
- #pragma mapbox: define lowp vec4 pattern_to
6
- void main(){
7
- #pragma mapbox: initialize lowp float base
8
- #pragma mapbox: initialize lowp float height
9
- #pragma mapbox: initialize mediump vec4 pattern_from
10
- #pragma mapbox: initialize mediump vec4 pattern_to
11
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);base=max(0.,base);height=max(0.,height);float t=mod(normal.x,2.);float z=t>0.?height:base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.&&normal.y==0.&&normal.z==16384.?a_pos:vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.,0.,0.,1.);float directional=clamp(dot(normal/16383.,u_lightpos),0.,1.);directional=mix((1.-u_lightintensity),max((0.5+u_lightintensity),1.),directional);if(normal.y!=0.){directional*=((1.-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.,0.5),mix(0.7,0.98,1.-u_lightintensity),1.)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.),vec3(0.3),1.-u_lightcolor),vec3(1.));v_lighting*=u_opacity;}
@@ -1,10 +0,0 @@
1
- #pragma mapbox: define highp vec4 outline_color
2
- #pragma mapbox: define lowp float opacity
3
- varying vec2 v_pos;void main(){
4
- #pragma mapbox: initialize highp vec4 outline_color
5
- #pragma mapbox: initialize lowp float opacity
6
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.-smoothstep(0.,1.,dist);gl_FragColor=outline_color*(alpha*opacity);
7
- #ifdef OVERDRAW_INSPECTOR
8
- gl_FragColor=vec4(1.);
9
- #endif
10
- }
@@ -1,7 +0,0 @@
1
- attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
2
- #pragma mapbox: define highp vec4 outline_color
3
- #pragma mapbox: define lowp float opacity
4
- void main(){
5
- #pragma mapbox: initialize highp vec4 outline_color
6
- #pragma mapbox: initialize lowp float opacity
7
- gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.)/2.*u_world;}
@@ -1,13 +0,0 @@
1
- uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
2
- #pragma mapbox: define lowp float opacity
3
- #pragma mapbox: define lowp vec4 pattern_from
4
- #pragma mapbox: define lowp vec4 pattern_to
5
- void main(){
6
- #pragma mapbox: initialize lowp float opacity
7
- #pragma mapbox: initialize mediump vec4 pattern_from
8
- #pragma mapbox: initialize mediump vec4 pattern_to
9
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.-smoothstep(0.,1.,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
10
- #ifdef OVERDRAW_INSPECTOR
11
- gl_FragColor=vec4(1.);
12
- #endif
13
- }
@@ -1,9 +0,0 @@
1
- uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
2
- #pragma mapbox: define lowp float opacity
3
- #pragma mapbox: define lowp vec4 pattern_from
4
- #pragma mapbox: define lowp vec4 pattern_to
5
- void main(){
6
- #pragma mapbox: initialize lowp float opacity
7
- #pragma mapbox: initialize mediump vec4 pattern_from
8
- #pragma mapbox: initialize mediump vec4 pattern_to
9
- vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.)/2.*u_world;}