isard 0.3.0 → 0.4.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.
@@ -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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isard",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A WebGL2 map engine for large, interactive data layers, labels and 3D Tiles over raster or vector basemaps (Rust core in WebAssembly)",
5
5
  "license": "MIT",
6
6
  "author": "Kevin Graff",