isard 0.3.0 → 0.5.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 (62) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +11 -3
  3. package/dist/basemap.worker.d.ts +10 -3
  4. package/dist/basemap.worker.js +2 -2
  5. package/dist/basemap.worker.js.map +4 -4
  6. package/dist/decoder.worker.js +4 -4
  7. package/dist/decoder.worker.js.map +7 -6
  8. package/dist/decoders.d.ts +3 -2
  9. package/dist/decoders.js +28 -5
  10. package/dist/decoders.js.map +1 -1
  11. package/dist/engine-loader.d.ts +8 -4
  12. package/dist/engine-loader.js +10 -3
  13. package/dist/engine-loader.js.map +1 -1
  14. package/dist/formats.d.ts +11 -0
  15. package/dist/formats.js +12 -0
  16. package/dist/formats.js.map +1 -0
  17. package/dist/glyphs.d.ts +3 -0
  18. package/dist/glyphs.js +12 -2
  19. package/dist/glyphs.js.map +1 -1
  20. package/dist/icons.d.ts +146 -0
  21. package/dist/icons.js +333 -0
  22. package/dist/icons.js.map +1 -0
  23. package/dist/index.d.ts +8 -5
  24. package/dist/index.js +2 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/isard_bg.wasm +0 -0
  27. package/dist/isard_core_bg.wasm +0 -0
  28. package/dist/isard_points_bg.wasm +0 -0
  29. package/dist/layers.d.ts +88 -1
  30. package/dist/layers.js +165 -4
  31. package/dist/layers.js.map +1 -1
  32. package/dist/loader.d.ts +9 -3
  33. package/dist/loader.js +22 -3
  34. package/dist/loader.js.map +1 -1
  35. package/dist/map.d.ts +37 -3
  36. package/dist/map.js +76 -10
  37. package/dist/map.js.map +1 -1
  38. package/dist/pointclouds.d.ts +98 -0
  39. package/dist/pointclouds.js +232 -0
  40. package/dist/pointclouds.js.map +1 -0
  41. package/dist/projections.d.ts +13 -0
  42. package/dist/projections.js +13 -0
  43. package/dist/projections.js.map +1 -0
  44. package/dist/protocol.d.ts +17 -0
  45. package/dist/protocol.js.map +1 -1
  46. package/dist/symbols.d.ts +42 -8
  47. package/dist/symbols.js +160 -35
  48. package/dist/symbols.js.map +1 -1
  49. package/dist/types.d.ts +8 -3
  50. package/dist/types.js.map +1 -1
  51. package/dist/vectorstyle.d.ts +32 -3
  52. package/dist/vectorstyle.js.map +1 -1
  53. package/dist/vectortiles.d.ts +10 -5
  54. package/dist/vectortiles.js +54 -29
  55. package/dist/vectortiles.js.map +1 -1
  56. package/dist/wasm/isard.d.ts +168 -11
  57. package/dist/wasm/isard.js +234 -9
  58. package/dist/wasm/isard_core.d.ts +28 -3
  59. package/dist/wasm/isard_core.js +77 -4
  60. package/dist/wasm/isard_points.d.ts +43 -0
  61. package/dist/wasm/isard_points.js +212 -0
  62. package/package.json +17 -1
@@ -29,6 +29,18 @@ export class Engine {
29
29
  }
30
30
  return ret[0] >>> 0;
31
31
  }
32
+ /**
33
+ * A layer drawn by the page: `render()` is called at its place in every frame (`customMatrix` gives the
34
+ * matrices of that frame meanwhile); `depth`: with the depth buffer of the 3D layers (`3d` mode), else over
35
+ * what is drawn before it
36
+ * @param {() => void} render
37
+ * @param {boolean} depth
38
+ * @returns {number}
39
+ */
40
+ addCustomLayer(render, depth) {
41
+ const ret = wasm.engine_addCustomLayer(this.__wbg_ptr, render, depth);
42
+ return ret >>> 0;
43
+ }
32
44
  /**
33
45
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
34
46
  * @returns {number}
@@ -110,6 +122,26 @@ export class Engine {
110
122
  }
111
123
  return ret[0] >>> 0;
112
124
  }
125
+ /**
126
+ * A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
127
+ * (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
128
+ * `ground`: altitudes above the relief, else above the ellipsoid
129
+ * @param {string} url
130
+ * @param {Float64Array} instances
131
+ * @param {boolean} ground
132
+ * @returns {number}
133
+ */
134
+ addModels(url, instances, ground) {
135
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ const len0 = WASM_VECTOR_LEN;
137
+ const ptr1 = passArrayF64ToWasm0(instances, wasm.__wbindgen_malloc);
138
+ const len1 = WASM_VECTOR_LEN;
139
+ const ret = wasm.engine_addModels(this.__wbg_ptr, ptr0, len0, ptr1, len1, ground);
140
+ if (ret[2]) {
141
+ throw takeFromExternrefTable0(ret[1]);
142
+ }
143
+ return ret[0] >>> 0;
144
+ }
113
145
  /**
114
146
  * Network of `mercator.length / 2` nodes (Mercator [0, 1], y towards the south, interleaved: converted by the
115
147
  * JavaScript side, where `Math.tan` and `Math.log` are much faster than in WebAssembly) and `edges.length / 2`
@@ -143,6 +175,23 @@ export class Engine {
143
175
  }
144
176
  return ret[0] >>> 0;
145
177
  }
178
+ /**
179
+ * A COPC point cloud from its URL (HTTP range requests). `resolve(wkt)` gives the CRS of the file from its WKT
180
+ * (undefined if it has none): its inverse projection, whether its altitudes are above the geoid, the metres of
181
+ * a unit of z; it may throw (an unknown CRS), the layer then stays empty
182
+ * @param {string} url
183
+ * @param {(wkt: string | undefined) => PointCloudCrs} resolve
184
+ * @returns {number}
185
+ */
186
+ addPointCloud(url, resolve) {
187
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
188
+ const len0 = WASM_VECTOR_LEN;
189
+ const ret = wasm.engine_addPointCloud(this.__wbg_ptr, ptr0, len0, resolve);
190
+ if (ret[2]) {
191
+ throw takeFromExternrefTable0(ret[1]);
192
+ }
193
+ return ret[0] >>> 0;
194
+ }
146
195
  /**
147
196
  * Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
148
197
  * default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
@@ -213,6 +262,24 @@ export class Engine {
213
262
  clearPreload() {
214
263
  wasm.engine_clearPreload(this.__wbg_ptr);
215
264
  }
265
+ /**
266
+ * Model-view-projection matrix (16 numbers, column-major, for `uniformMatrix4fv`) of the local frame at a
267
+ * longitude, latitude (degrees) and altitude (metres): x east, y north, z up, in metres. Undefined outside the
268
+ * callback of a custom layer. Static: the engine is borrowed while it draws
269
+ * @param {number} lon
270
+ * @param {number} lat
271
+ * @param {number} altitude
272
+ * @returns {Float32Array | undefined}
273
+ */
274
+ static customMatrix(lon, lat, altitude) {
275
+ const ret = wasm.engine_customMatrix(lon, lat, altitude);
276
+ let v1;
277
+ if (ret[0] !== 0) {
278
+ v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
279
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
280
+ }
281
+ return v1;
282
+ }
216
283
  /**
217
284
  * Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
218
285
  * @param {number} x
@@ -294,6 +361,35 @@ export class Engine {
294
361
  const ret = wasm.engine_pick(this.__wbg_ptr, x, y, !isLikeNone(radius), isLikeNone(radius) ? 0 : radius, ptr0, len0);
295
362
  return ret;
296
363
  }
364
+ /**
365
+ * What a point cloud says of itself, undefined before its head is read
366
+ * @param {number} id
367
+ * @returns {PointCloudInfo | undefined}
368
+ */
369
+ pointCloudInfo(id) {
370
+ const ret = wasm.engine_pointCloudInfo(this.__wbg_ptr, id);
371
+ return ret;
372
+ }
373
+ /**
374
+ * The point of a point cloud picked by `pick` or `pollPick` (its index there), read back from the GPU; undefined
375
+ * once it is no longer drawn
376
+ * @param {number} id
377
+ * @param {number} index
378
+ * @returns {PointCloudPoint | undefined}
379
+ */
380
+ pointCloudPoint(id, index) {
381
+ const ret = wasm.engine_pointCloudPoint(this.__wbg_ptr, id, index);
382
+ return ret;
383
+ }
384
+ /**
385
+ * Counters of a point cloud layer, undefined if there is none with this id
386
+ * @param {number} id
387
+ * @returns {PointCloudStats | undefined}
388
+ */
389
+ pointCloudStats(id) {
390
+ const ret = wasm.engine_pointCloudStats(this.__wbg_ptr, id);
391
+ return ret;
392
+ }
297
393
  /**
298
394
  * The answer to the last `requestPick` once the GPU has delivered it (then forgotten), undefined while it is not
299
395
  * there yet (or nothing was asked, or the context was lost)
@@ -667,6 +763,18 @@ export class Engine {
667
763
  setGroundVisible(id, visible) {
668
764
  wasm.engine_setGroundVisible(this.__wbg_ptr, id, visible);
669
765
  }
766
+ /**
767
+ * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
768
+ * and empty (`updateIconAtlas` fills it)
769
+ * @param {number} width
770
+ * @param {number} height
771
+ */
772
+ setIconAtlas(width, height) {
773
+ const ret = wasm.engine_setIconAtlas(this.__wbg_ptr, width, height);
774
+ if (ret[1]) {
775
+ throw takeFromExternrefTable0(ret[0]);
776
+ }
777
+ }
670
778
  /**
671
779
  * How tiles load and show: `true`, immediately (everything visible loads, no fade, the default); `false`,
672
780
  * smoothly (levels skipped during flights, off-center tiles waiting while the camera moves, fade-in)
@@ -710,6 +818,17 @@ export class Engine {
710
818
  setMaxPitch(max) {
711
819
  wasm.engine_setMaxPitch(this.__wbg_ptr, max);
712
820
  }
821
+ /**
822
+ * Replaces the instances of a model layer (as for `addModels`) and the reference of their altitudes
823
+ * @param {number} id
824
+ * @param {Float64Array} instances
825
+ * @param {boolean} ground
826
+ */
827
+ setModelInstances(id, instances, ground) {
828
+ const ptr0 = passArrayF64ToWasm0(instances, wasm.__wbindgen_malloc);
829
+ const len0 = WASM_VECTOR_LEN;
830
+ wasm.engine_setModelInstances(this.__wbg_ptr, id, ptr0, len0, ground);
831
+ }
713
832
  /**
714
833
  * Costs of a network's edges (see `addNetwork`), when the way it is travelled changes; null: interpolated values
715
834
  * @param {number} id
@@ -762,6 +881,23 @@ export class Engine {
762
881
  const len0 = WASM_VECTOR_LEN;
763
882
  wasm.engine_setNetworkValues(this.__wbg_ptr, id, ptr0, len0);
764
883
  }
884
+ /**
885
+ * The style of a point cloud: 14 numbers (see `Style::parse`), the colors of the 256 classes (RGBA,
886
+ * alpha 0 hides a class) and the ramp of the altitudes (256 RGBA texels)
887
+ * @param {number} id
888
+ * @param {Float64Array} style
889
+ * @param {Uint8Array} palette
890
+ * @param {Uint8Array} ramp
891
+ */
892
+ setPointCloudStyle(id, style, palette, ramp) {
893
+ const ptr0 = passArrayF64ToWasm0(style, wasm.__wbindgen_malloc);
894
+ const len0 = WASM_VECTOR_LEN;
895
+ const ptr1 = passArray8ToWasm0(palette, wasm.__wbindgen_malloc);
896
+ const len1 = WASM_VECTOR_LEN;
897
+ const ptr2 = passArray8ToWasm0(ramp, wasm.__wbindgen_malloc);
898
+ const len2 = WASM_VECTOR_LEN;
899
+ wasm.engine_setPointCloudStyle(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2);
900
+ }
765
901
  /**
766
902
  * @param {number} id
767
903
  * @param {number} opacity
@@ -795,9 +931,9 @@ export class Engine {
795
931
  wasm.engine_setSymbolLayer(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, min_zoom, max_zoom, visible);
796
932
  }
797
933
  /**
798
- * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), boxes (min x, min y, max x, max y,
799
- * CSS pixels from the anchor), styles (20 floats each, see `LABEL_FLOATS`) and glyph quads (10 floats each: label, x, y, width, height from the anchor, atlas u0, v0, u1, v1 in
800
- * texels, font scale)
934
+ * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
935
+ * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
936
+ * (11 floats each, see `QUAD_FLOATS`)
801
937
  * @param {number} id
802
938
  * @param {Float64Array} anchors
803
939
  * @param {Float32Array} boxes
@@ -851,13 +987,14 @@ export class Engine {
851
987
  wasm.engine_setTileLoader(this.__wbg_ptr, loader);
852
988
  }
853
989
  /**
854
- * Screen-space error threshold and opacity of a 3D Tiles layer
990
+ * Screen-space error threshold, opacity and size of the points (CSS pixels, 2 if not given) of a 3D Tiles layer
855
991
  * @param {number} id
856
992
  * @param {number} max_error
857
993
  * @param {number} opacity
994
+ * @param {number | null} [point_size]
858
995
  */
859
- setTiles3dStyle(id, max_error, opacity) {
860
- wasm.engine_setTiles3dStyle(this.__wbg_ptr, id, max_error, opacity);
996
+ setTiles3dStyle(id, max_error, opacity, point_size) {
997
+ wasm.engine_setTiles3dStyle(this.__wbg_ptr, id, max_error, opacity, !isLikeNone(point_size), isLikeNone(point_size) ? 0 : point_size);
861
998
  }
862
999
  /**
863
1000
  * @param {number} min
@@ -939,6 +1076,19 @@ export class Engine {
939
1076
  throw takeFromExternrefTable0(ret[0]);
940
1077
  }
941
1078
  }
1079
+ /**
1080
+ * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
1081
+ * @param {number} x
1082
+ * @param {number} y
1083
+ * @param {number} width
1084
+ * @param {number} height
1085
+ * @param {Uint8Array} data
1086
+ */
1087
+ updateIconAtlas(x, y, width, height, data) {
1088
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
1089
+ const len0 = WASM_VECTOR_LEN;
1090
+ wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
1091
+ }
942
1092
  /**
943
1093
  * @param {number} delta
944
1094
  * @param {number} x
@@ -951,8 +1101,9 @@ export class Engine {
951
1101
  if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
952
1102
 
953
1103
  /**
954
- * Decodes a `.b3dm` / `.glb` tile: `{ anchor: Float64Array(3), primitives: [{ vertices: Float32Array (x, y, z, u,
955
- * v per vertex, relative to the anchor), indices: Uint32Array, image?: Uint8Array, mime?: string }] }`.
1104
+ * Decodes a `.b3dm` / `.pnts` / `.glb` tile: `{ anchor: Float64Array(3), primitives: [{ vertices: Float32Array (x,
1105
+ * y, z, u, v per vertex, relative to the anchor), indices: Uint32Array, image?: Uint8Array, mime?: string, color?:
1106
+ * Float32Array (the material's base color, when not white) }], points: [Uint8Array] (the points' vertices) }`.
956
1107
  * `transform`: the tile's world transform (16 numbers, column-major).
957
1108
  * `draco`: the decoded geometries of its Draco primitives (`dracoRequests`), if any.
958
1109
  * @param {Uint8Array} bytes
@@ -1002,6 +1153,10 @@ function __wbg_get_imports() {
1002
1153
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1003
1154
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1004
1155
  },
1156
+ __wbg___wbindgen_is_falsy_16bd49b68658263e: function(arg0) {
1157
+ const ret = !arg0;
1158
+ return ret;
1159
+ },
1005
1160
  __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
1006
1161
  const ret = typeof(arg0) === 'function';
1007
1162
  return ret;
@@ -1096,6 +1251,12 @@ function __wbg_get_imports() {
1096
1251
  __wbg_bindVertexArray_f58af0a346185ec5: function(arg0, arg1) {
1097
1252
  arg0.bindVertexArray(arg1);
1098
1253
  },
1254
+ __wbg_blendEquation_5fb8aee6a55cf900: function(arg0, arg1) {
1255
+ arg0.blendEquation(arg1 >>> 0);
1256
+ },
1257
+ __wbg_blendEquation_d21914e937b14896: function(arg0, arg1) {
1258
+ arg0.blendEquation(arg1 >>> 0);
1259
+ },
1099
1260
  __wbg_blendFuncSeparate_28abe082febb1a26: function(arg0, arg1, arg2, arg3, arg4) {
1100
1261
  arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
1101
1262
  },
@@ -1158,6 +1319,12 @@ function __wbg_get_imports() {
1158
1319
  __wbg_clearColor_796427e8ac60fe14: function(arg0, arg1, arg2, arg3, arg4) {
1159
1320
  arg0.clearColor(arg1, arg2, arg3, arg4);
1160
1321
  },
1322
+ __wbg_clearDepth_4840a5497ae51286: function(arg0, arg1) {
1323
+ arg0.clearDepth(arg1);
1324
+ },
1325
+ __wbg_clearDepth_5a119c24c5d193bc: function(arg0, arg1) {
1326
+ arg0.clearDepth(arg1);
1327
+ },
1161
1328
  __wbg_clearStencil_1b8b8c727f598eec: function(arg0, arg1) {
1162
1329
  arg0.clearStencil(arg1);
1163
1330
  },
@@ -1252,6 +1419,12 @@ function __wbg_get_imports() {
1252
1419
  const ret = arg0.createVertexArray();
1253
1420
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1254
1421
  },
1422
+ __wbg_cullFace_12123c1c97f1ba2c: function(arg0, arg1) {
1423
+ arg0.cullFace(arg1 >>> 0);
1424
+ },
1425
+ __wbg_cullFace_1a01f0b6d5aeb687: function(arg0, arg1) {
1426
+ arg0.cullFace(arg1 >>> 0);
1427
+ },
1255
1428
  __wbg_deleteBuffer_070e58aaaf2a7a8b: function(arg0, arg1) {
1256
1429
  arg0.deleteBuffer(arg1);
1257
1430
  },
@@ -1309,6 +1482,12 @@ function __wbg_get_imports() {
1309
1482
  __wbg_depthMask_0d7c3dec3b8405ee: function(arg0, arg1) {
1310
1483
  arg0.depthMask(arg1 !== 0);
1311
1484
  },
1485
+ __wbg_depthRange_24c7969249461e8e: function(arg0, arg1, arg2) {
1486
+ arg0.depthRange(arg1, arg2);
1487
+ },
1488
+ __wbg_depthRange_6a4e169ccf314148: function(arg0, arg1, arg2) {
1489
+ arg0.depthRange(arg1, arg2);
1490
+ },
1312
1491
  __wbg_detachShader_1ed15fc2d289cf15: function(arg0, arg1, arg2) {
1313
1492
  arg0.detachShader(arg1, arg2);
1314
1493
  },
@@ -1493,6 +1672,13 @@ function __wbg_get_imports() {
1493
1672
  const ret = Reflect.get(arg0, arg1);
1494
1673
  return ret;
1495
1674
  }, arguments); },
1675
+ __wbg_get_f75619e20cb68514: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1676
+ const ret = arg1.get(getStringFromWasm0(arg2, arg3));
1677
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1678
+ var len1 = WASM_VECTOR_LEN;
1679
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1680
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1681
+ }, arguments); },
1496
1682
  __wbg_get_index_f4750150bb3083b3: function(arg0, arg1) {
1497
1683
  const ret = arg0[arg1 >>> 0];
1498
1684
  return ret;
@@ -1501,6 +1687,10 @@ function __wbg_get_imports() {
1501
1687
  const ret = arg0[arg1 >>> 0];
1502
1688
  return ret;
1503
1689
  },
1690
+ __wbg_headers_eba93595f8944c2f: function(arg0) {
1691
+ const ret = arg0.headers;
1692
+ return ret;
1693
+ },
1504
1694
  __wbg_height_9dca4d43c3e4b84b: function(arg0) {
1505
1695
  const ret = arg0.height;
1506
1696
  return ret;
@@ -1525,6 +1715,16 @@ function __wbg_get_imports() {
1525
1715
  const ret = result;
1526
1716
  return ret;
1527
1717
  },
1718
+ __wbg_instanceof_Error_80a725f81f2e102d: function(arg0) {
1719
+ let result;
1720
+ try {
1721
+ result = arg0 instanceof Error;
1722
+ } catch (_) {
1723
+ result = false;
1724
+ }
1725
+ const ret = result;
1726
+ return ret;
1727
+ },
1528
1728
  __wbg_instanceof_Float32Array_595afb0f28b828c9: function(arg0) {
1529
1729
  let result;
1530
1730
  try {
@@ -1653,6 +1853,10 @@ function __wbg_get_imports() {
1653
1853
  __wbg_linkProgram_acdc299c43d734a0: function(arg0, arg1) {
1654
1854
  arg0.linkProgram(arg1);
1655
1855
  },
1856
+ __wbg_message_5f8387f0c32b90a7: function(arg0) {
1857
+ const ret = arg0.message;
1858
+ return ret;
1859
+ },
1656
1860
  __wbg_name_91a697e9ff1634bf: function(arg0, arg1) {
1657
1861
  const ret = arg1.name;
1658
1862
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1690,6 +1894,10 @@ function __wbg_get_imports() {
1690
1894
  const ret = new Object();
1691
1895
  return ret;
1692
1896
  },
1897
+ __wbg_new_83ca405eae412a62: function() { return handleError(function () {
1898
+ const ret = new Headers();
1899
+ return ret;
1900
+ }, arguments); },
1693
1901
  __wbg_new_ee2291f50781bf1d: function() {
1694
1902
  const ret = new Array();
1695
1903
  return ret;
@@ -1738,6 +1946,10 @@ function __wbg_get_imports() {
1738
1946
  const ret = Array.of(arg0);
1739
1947
  return ret;
1740
1948
  },
1949
+ __wbg_of_dde0b9d3265685ee: function(arg0, arg1, arg2) {
1950
+ const ret = Array.of(arg0, arg1, arg2);
1951
+ return ret;
1952
+ },
1741
1953
  __wbg_of_fea2613674ee0d0f: function(arg0, arg1, arg2, arg3, arg4) {
1742
1954
  const ret = Array.of(arg0, arg1, arg2, arg3, arg4);
1743
1955
  return ret;
@@ -1765,6 +1977,9 @@ function __wbg_get_imports() {
1765
1977
  __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
1766
1978
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1767
1979
  },
1980
+ __wbg_prototypesetcall_d49a4fab5ca427bc: function(arg0, arg1, arg2) {
1981
+ Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
1982
+ },
1768
1983
  __wbg_push_2baf45db356cf468: function(arg0, arg1) {
1769
1984
  const ret = arg0.push(arg1);
1770
1985
  return ret;
@@ -1809,6 +2024,9 @@ function __wbg_get_imports() {
1809
2024
  const ret = Reflect.set(arg0, arg1, arg2);
1810
2025
  return ret;
1811
2026
  }, arguments); },
2027
+ __wbg_set_af5932e3f78b5648: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2028
+ arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2029
+ }, arguments); },
1812
2030
  __wbg_set_alpha_6dea851a46253adf: function(arg0, arg1) {
1813
2031
  arg0.alpha = arg1 !== 0;
1814
2032
  },
@@ -1824,6 +2042,9 @@ function __wbg_get_imports() {
1824
2042
  __wbg_set_depth_8b49de49803d4e60: function(arg0, arg1) {
1825
2043
  arg0.depth = arg1 !== 0;
1826
2044
  },
2045
+ __wbg_set_headers_40ad33dcf016613f: function(arg0, arg1) {
2046
+ arg0.headers = arg1;
2047
+ },
1827
2048
  __wbg_set_power_preference_6ef22d4c8baf517f: function(arg0, arg1) {
1828
2049
  arg0.powerPreference = __wbindgen_enum_WebGlPowerPreference[arg1];
1829
2050
  },
@@ -1903,6 +2124,10 @@ function __wbg_get_imports() {
1903
2124
  __wbg_stencilOp_2697194654fee819: function(arg0, arg1, arg2, arg3) {
1904
2125
  arg0.stencilOp(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
1905
2126
  },
2127
+ __wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
2128
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
2129
+ return ret;
2130
+ },
1906
2131
  __wbg_texImage2D_1b3349107ad0faae: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1907
2132
  arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4 >>> 0, arg5 >>> 0, arg6);
1908
2133
  }, arguments); },
@@ -2100,7 +2325,7 @@ function __wbg_get_imports() {
2100
2325
  return ret;
2101
2326
  },
2102
2327
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
2103
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 149, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2328
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 190, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2104
2329
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
2105
2330
  return ret;
2106
2331
  },
@@ -68,6 +68,12 @@ export class Engine {
68
68
  * Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
69
69
  */
70
70
  addCircles(points: Float64Array, feature: Uint32Array, feature_count: number): number;
71
+ /**
72
+ * A layer drawn by the page: `render()` is called at its place in every frame (`customMatrix` gives the
73
+ * matrices of that frame meanwhile); `depth`: with the depth buffer of the 3D layers (`3d` mode), else over
74
+ * what is drawn before it
75
+ */
76
+ addCustomLayer(render: () => void, depth: boolean): number;
71
77
  /**
72
78
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
73
79
  */
@@ -114,6 +120,12 @@ export class Engine {
114
120
  bounds(): Float64Array;
115
121
  camera(): Camera;
116
122
  clearPreload(): void;
123
+ /**
124
+ * Model-view-projection matrix (16 numbers, column-major, for `uniformMatrix4fv`) of the local frame at a
125
+ * longitude, latitude (degrees) and altitude (metres): x east, y north, z up, in metres. Undefined outside the
126
+ * callback of a custom layer. Static: the engine is borrowed while it draws
127
+ */
128
+ static customMatrix(lon: number, lat: number, altitude: number): Float32Array | undefined;
117
129
  /**
118
130
  * Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
119
131
  */
@@ -273,6 +285,11 @@ export class Engine {
273
285
  */
274
286
  setGroundUniform(id: number, name: string, values: Float64Array): void;
275
287
  setGroundVisible(id: number, visible: boolean): void;
288
+ /**
289
+ * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
290
+ * and empty (`updateIconAtlas` fills it)
291
+ */
292
+ setIconAtlas(width: number, height: number): void;
276
293
  /**
277
294
  * How tiles load and show: `true`, immediately (everything visible loads, no fade, the default); `false`,
278
295
  * smoothly (levels skipped during flights, off-center tiles waiting while the camera moves, fade-in)
@@ -323,9 +340,9 @@ export class Engine {
323
340
  */
324
341
  setSymbolLayer(id: number, size: Float32Array, opacity: Float32Array, min_zoom: number, max_zoom: number, visible: boolean): void;
325
342
  /**
326
- * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), boxes (min x, min y, max x, max y,
327
- * CSS pixels from the anchor), styles (20 floats each, see `LABEL_FLOATS`) and glyph quads (10 floats each: label, x, y, width, height from the anchor, atlas u0, v0, u1, v1 in
328
- * texels, font scale)
343
+ * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
344
+ * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
345
+ * (11 floats each, see `QUAD_FLOATS`)
329
346
  */
330
347
  setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array): void;
331
348
  /**
@@ -356,6 +373,10 @@ export class Engine {
356
373
  * Replaces a region of a ground layer's texture (one layer of a 2D array)
357
374
  */
358
375
  updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
376
+ /**
377
+ * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
378
+ */
379
+ updateIconAtlas(x: number, y: number, width: number, height: number, data: Uint8Array): void;
359
380
  zoomAt(delta: number, x: number, y: number): void;
360
381
  }
361
382
 
@@ -365,6 +386,7 @@ export interface InitOutput {
365
386
  readonly memory: WebAssembly.Memory;
366
387
  readonly __wbg_engine_free: (a: number, b: number) => void;
367
388
  readonly engine_addCircles: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
389
+ readonly engine_addCustomLayer: (a: number, b: any, c: number) => number;
368
390
  readonly engine_addExtrusions: (a: number) => [number, number, number];
369
391
  readonly engine_addFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
370
392
  readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
@@ -375,6 +397,7 @@ export interface InitOutput {
375
397
  readonly engine_bounds: (a: number) => [number, number];
376
398
  readonly engine_camera: (a: number) => any;
377
399
  readonly engine_clearPreload: (a: number) => void;
400
+ readonly engine_customMatrix: (a: number, b: number, c: number) => [number, number];
378
401
  readonly engine_ground: (a: number, b: number, c: number) => any;
379
402
  readonly engine_linkExtrusionNetwork: (a: number, b: number, c: number, d: number) => void;
380
403
  readonly engine_moveLayer: (a: number, b: number, c: number) => void;
@@ -413,6 +436,7 @@ export interface InitOutput {
413
436
  readonly engine_setGroundTexture: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
414
437
  readonly engine_setGroundUniform: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
415
438
  readonly engine_setGroundVisible: (a: number, b: number, c: number) => void;
439
+ readonly engine_setIconAtlas: (a: number, b: number, c: number) => [number, number];
416
440
  readonly engine_setImmediateLoading: (a: number, b: number) => void;
417
441
  readonly engine_setLineDash: (a: number, b: number, c: number, d: number) => void;
418
442
  readonly engine_setLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
@@ -432,6 +456,7 @@ export interface InitOutput {
432
456
  readonly engine_updateGlyphAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
433
457
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
434
458
  readonly engine_updateGroundTexture: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
459
+ readonly engine_updateIconAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
435
460
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
436
461
  readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined___js_sys_b1e1c29ba6b0e6b3___Function_fn_wasm_bindgen_2e566c63402fe7fa___JsValue_____wasm_bindgen_2e566c63402fe7fa___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
437
462
  readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_: (a: number, b: number, c: any) => [number, number];
@@ -29,6 +29,18 @@ export class Engine {
29
29
  }
30
30
  return ret[0] >>> 0;
31
31
  }
32
+ /**
33
+ * A layer drawn by the page: `render()` is called at its place in every frame (`customMatrix` gives the
34
+ * matrices of that frame meanwhile); `depth`: with the depth buffer of the 3D layers (`3d` mode), else over
35
+ * what is drawn before it
36
+ * @param {() => void} render
37
+ * @param {boolean} depth
38
+ * @returns {number}
39
+ */
40
+ addCustomLayer(render, depth) {
41
+ const ret = wasm.engine_addCustomLayer(this.__wbg_ptr, render, depth);
42
+ return ret >>> 0;
43
+ }
32
44
  /**
33
45
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
34
46
  * @returns {number}
@@ -197,6 +209,24 @@ export class Engine {
197
209
  clearPreload() {
198
210
  wasm.engine_clearPreload(this.__wbg_ptr);
199
211
  }
212
+ /**
213
+ * Model-view-projection matrix (16 numbers, column-major, for `uniformMatrix4fv`) of the local frame at a
214
+ * longitude, latitude (degrees) and altitude (metres): x east, y north, z up, in metres. Undefined outside the
215
+ * callback of a custom layer. Static: the engine is borrowed while it draws
216
+ * @param {number} lon
217
+ * @param {number} lat
218
+ * @param {number} altitude
219
+ * @returns {Float32Array | undefined}
220
+ */
221
+ static customMatrix(lon, lat, altitude) {
222
+ const ret = wasm.engine_customMatrix(lon, lat, altitude);
223
+ let v1;
224
+ if (ret[0] !== 0) {
225
+ v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
226
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
227
+ }
228
+ return v1;
229
+ }
200
230
  /**
201
231
  * Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
202
232
  * @param {number} x
@@ -651,6 +681,18 @@ export class Engine {
651
681
  setGroundVisible(id, visible) {
652
682
  wasm.engine_setGroundVisible(this.__wbg_ptr, id, visible);
653
683
  }
684
+ /**
685
+ * The icon atlas shared by the symbol layers: `width` × `height` RGBA texels, premultiplied, allocated again
686
+ * and empty (`updateIconAtlas` fills it)
687
+ * @param {number} width
688
+ * @param {number} height
689
+ */
690
+ setIconAtlas(width, height) {
691
+ const ret = wasm.engine_setIconAtlas(this.__wbg_ptr, width, height);
692
+ if (ret[1]) {
693
+ throw takeFromExternrefTable0(ret[0]);
694
+ }
695
+ }
654
696
  /**
655
697
  * How tiles load and show: `true`, immediately (everything visible loads, no fade, the default); `false`,
656
698
  * smoothly (levels skipped during flights, off-center tiles waiting while the camera moves, fade-in)
@@ -779,9 +821,9 @@ export class Engine {
779
821
  wasm.engine_setSymbolLayer(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, min_zoom, max_zoom, visible);
780
822
  }
781
823
  /**
782
- * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), boxes (min x, min y, max x, max y,
783
- * CSS pixels from the anchor), styles (20 floats each, see `LABEL_FLOATS`) and glyph quads (10 floats each: label, x, y, width, height from the anchor, atlas u0, v0, u1, v1 in
784
- * texels, font scale)
824
+ * Labels of a symbol layer, shaped by the page: anchors (Mercator, interleaved), their texts' boxes (min x, min y,
825
+ * max x, max y, CSS pixels from the anchor), styles (36 floats each, see `LABEL_FLOATS`) and glyph and icon quads
826
+ * (11 floats each, see `QUAD_FLOATS`)
785
827
  * @param {number} id
786
828
  * @param {Float64Array} anchors
787
829
  * @param {Float32Array} boxes
@@ -888,6 +930,19 @@ export class Engine {
888
930
  throw takeFromExternrefTable0(ret[0]);
889
931
  }
890
932
  }
933
+ /**
934
+ * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
935
+ * @param {number} x
936
+ * @param {number} y
937
+ * @param {number} width
938
+ * @param {number} height
939
+ * @param {Uint8Array} data
940
+ */
941
+ updateIconAtlas(x, y, width, height, data) {
942
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
943
+ const len0 = WASM_VECTOR_LEN;
944
+ wasm.engine_updateIconAtlas(this.__wbg_ptr, x, y, width, height, ptr0, len0);
945
+ }
891
946
  /**
892
947
  * @param {number} delta
893
948
  * @param {number} x
@@ -998,6 +1053,12 @@ function __wbg_get_imports() {
998
1053
  __wbg_bindVertexArray_f58af0a346185ec5: function(arg0, arg1) {
999
1054
  arg0.bindVertexArray(arg1);
1000
1055
  },
1056
+ __wbg_blendEquation_5fb8aee6a55cf900: function(arg0, arg1) {
1057
+ arg0.blendEquation(arg1 >>> 0);
1058
+ },
1059
+ __wbg_blendEquation_d21914e937b14896: function(arg0, arg1) {
1060
+ arg0.blendEquation(arg1 >>> 0);
1061
+ },
1001
1062
  __wbg_blendFuncSeparate_28abe082febb1a26: function(arg0, arg1, arg2, arg3, arg4) {
1002
1063
  arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
1003
1064
  },
@@ -1135,6 +1196,12 @@ function __wbg_get_imports() {
1135
1196
  const ret = arg0.createVertexArray();
1136
1197
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1137
1198
  },
1199
+ __wbg_cullFace_12123c1c97f1ba2c: function(arg0, arg1) {
1200
+ arg0.cullFace(arg1 >>> 0);
1201
+ },
1202
+ __wbg_cullFace_1a01f0b6d5aeb687: function(arg0, arg1) {
1203
+ arg0.cullFace(arg1 >>> 0);
1204
+ },
1138
1205
  __wbg_deleteBuffer_070e58aaaf2a7a8b: function(arg0, arg1) {
1139
1206
  arg0.deleteBuffer(arg1);
1140
1207
  },
@@ -1192,6 +1259,12 @@ function __wbg_get_imports() {
1192
1259
  __wbg_depthMask_0d7c3dec3b8405ee: function(arg0, arg1) {
1193
1260
  arg0.depthMask(arg1 !== 0);
1194
1261
  },
1262
+ __wbg_depthRange_24c7969249461e8e: function(arg0, arg1, arg2) {
1263
+ arg0.depthRange(arg1, arg2);
1264
+ },
1265
+ __wbg_depthRange_6a4e169ccf314148: function(arg0, arg1, arg2) {
1266
+ arg0.depthRange(arg1, arg2);
1267
+ },
1195
1268
  __wbg_detachShader_1ed15fc2d289cf15: function(arg0, arg1, arg2) {
1196
1269
  arg0.detachShader(arg1, arg2);
1197
1270
  },
@@ -1862,7 +1935,7 @@ function __wbg_get_imports() {
1862
1935
  return ret;
1863
1936
  },
1864
1937
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1865
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 78, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1938
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 87, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1866
1939
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
1867
1940
  return ret;
1868
1941
  },