isard 1.16.0 → 2.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +4 -4
  3. package/dist/basemap/vectortiles/placed.js +7 -4
  4. package/dist/basemap/vectortiles/placed.js.map +1 -1
  5. package/dist/basemap/vectortiles/tiles.d.ts +1 -1
  6. package/dist/basemap/vectortiles/tiles.js.map +1 -1
  7. package/dist/basemap/workerpool.d.ts +1 -1
  8. package/dist/basemap/workerpool.js.map +1 -1
  9. package/dist/decoder.worker.js +4 -5
  10. package/dist/decoder.worker.js.map +6 -6
  11. package/dist/decoding/decoders.d.ts +1 -1
  12. package/dist/decoding/decoders.js.map +1 -1
  13. package/dist/decoding/loader.d.ts +6 -3
  14. package/dist/decoding/loader.js +7 -5
  15. package/dist/decoding/loader.js.map +1 -1
  16. package/dist/decoding/protocol.d.ts +3 -2
  17. package/dist/decoding/protocol.js.map +1 -1
  18. package/dist/engine-loader.d.ts +20 -18
  19. package/dist/engine-loader.js +45 -42
  20. package/dist/engine-loader.js.map +1 -1
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/isard_grid_bg.wasm +0 -0
  24. package/dist/isard_tess_bg.wasm +0 -0
  25. package/dist/isard_tiles3d_bg.wasm +0 -0
  26. package/dist/isard_webgl2_bg.wasm +0 -0
  27. package/dist/isard_webgpu_bg.wasm +0 -0
  28. package/dist/layers/custom.d.ts +35 -29
  29. package/dist/layers/custom.js +60 -46
  30. package/dist/layers/custom.js.map +1 -1
  31. package/dist/layers/extrusions.js.map +1 -1
  32. package/dist/layers/features.js.map +1 -1
  33. package/dist/layers/flow.js.map +1 -1
  34. package/dist/layers/glyphs.d.ts +1 -1
  35. package/dist/layers/glyphs.js.map +1 -1
  36. package/dist/layers/ground.d.ts +20 -13
  37. package/dist/layers/ground.js +29 -8
  38. package/dist/layers/ground.js.map +1 -1
  39. package/dist/layers/icons.d.ts +1 -1
  40. package/dist/layers/icons.js.map +1 -1
  41. package/dist/layers/layers.d.ts +1 -2
  42. package/dist/layers/layers.js +2 -11
  43. package/dist/layers/layers.js.map +1 -1
  44. package/dist/layers/models.js +0 -4
  45. package/dist/layers/models.js.map +1 -1
  46. package/dist/layers/network.d.ts +1 -1
  47. package/dist/layers/network.js.map +1 -1
  48. package/dist/layers/panoramas.d.ts +1 -0
  49. package/dist/layers/panoramas.js +3 -2
  50. package/dist/layers/panoramas.js.map +1 -1
  51. package/dist/layers/pointclouds.d.ts +1 -1
  52. package/dist/layers/pointclouds.js +0 -4
  53. package/dist/layers/pointclouds.js.map +1 -1
  54. package/dist/layers/raster.js.map +1 -1
  55. package/dist/layers/symbols.js.map +1 -1
  56. package/dist/layers/tiles3d.d.ts +1 -1
  57. package/dist/layers/tiles3d.js +0 -4
  58. package/dist/layers/tiles3d.js.map +1 -1
  59. package/dist/layers/vectors.d.ts +4 -5
  60. package/dist/layers/vectors.js +7 -15
  61. package/dist/layers/vectors.js.map +1 -1
  62. package/dist/map/engine-settings.d.ts +1 -1
  63. package/dist/map/engine-settings.js.map +1 -1
  64. package/dist/map/engines.d.ts +11 -26
  65. package/dist/map/engines.js +10 -48
  66. package/dist/map/engines.js.map +1 -1
  67. package/dist/map/frame-loop.d.ts +1 -3
  68. package/dist/map/frame-loop.js +3 -3
  69. package/dist/map/frame-loop.js.map +1 -1
  70. package/dist/map/hover-pick.d.ts +9 -3
  71. package/dist/map/hover-pick.js +29 -6
  72. package/dist/map/hover-pick.js.map +1 -1
  73. package/dist/map/layer-stack.d.ts +2 -2
  74. package/dist/map/layer-stack.js +1 -3
  75. package/dist/map/layer-stack.js.map +1 -1
  76. package/dist/map/symbol-atlases.d.ts +5 -4
  77. package/dist/map/symbol-atlases.js +8 -13
  78. package/dist/map/symbol-atlases.js.map +1 -1
  79. package/dist/map/viewshed.d.ts +1 -1
  80. package/dist/map/viewshed.js.map +1 -1
  81. package/dist/map.d.ts +26 -20
  82. package/dist/map.js +93 -78
  83. package/dist/map.js.map +1 -1
  84. package/dist/react/IsardMap.d.ts +1 -1
  85. package/dist/react/IsardMap.js.map +1 -1
  86. package/dist/react/index.d.ts +1 -1
  87. package/dist/react/index.js.map +1 -1
  88. package/dist/types.d.ts +29 -18
  89. package/dist/types.js.map +1 -1
  90. package/dist/ui/interaction.d.ts +1 -1
  91. package/dist/ui/interaction.js.map +1 -1
  92. package/dist/util/animation.d.ts +1 -1
  93. package/dist/util/animation.js.map +1 -1
  94. package/dist/wasm/isard_tiles3d.d.ts +181 -0
  95. package/dist/wasm/isard_tiles3d.js +387 -0
  96. package/dist/wasm/{isard_core.d.ts → isard_webgl2.d.ts} +373 -182
  97. package/dist/wasm/{isard_core.js → isard_webgl2.js} +2155 -413
  98. package/dist/wasm/{isard.d.ts → isard_webgpu.d.ts} +176 -353
  99. package/dist/wasm/{isard.js → isard_webgpu.js} +1361 -1104
  100. package/package.json +4 -3
  101. package/vite.js +5 -4
  102. package/dist/isard_bg.wasm +0 -0
  103. package/dist/isard_core_bg.wasm +0 -0
@@ -1,131 +1,21 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- /**
5
- * A primitive of a tile decoded by `decodeTile`: vertices x, y, z, u, v around the anchor; the image still encoded,
6
- * the same array for the primitives sharing it
7
- */
8
- export interface EncodedPrimitive {
9
- vertices: Float32Array<ArrayBuffer>;
10
- indices: Uint32Array<ArrayBuffer>;
11
- image?: Uint8Array<ArrayBuffer>;
12
- mime?: string;
13
- /** Base color factor of its material (RGBA 0-1), when not white */
14
- color?: Float32Array<ArrayBuffer>;
15
- /** The feature of each vertex (`EncodedTile.properties` index them), when the tile has features */
16
- features?: Float32Array<ArrayBuffer>;
17
- }
18
-
19
- /** A tile decoded by `decodeTile` */
20
- export interface EncodedTile {
21
- /** ECEF origin of the vertices (metres) */
22
- anchor: Float64Array<ArrayBuffer>;
23
- primitives: EncodedPrimitive[];
24
- /** Its points (`.pnts`, glTF points), 20 bytes a vertex: x, y, z (f32) around the anchor, RGB, a normal */
25
- points: Uint8Array<ArrayBuffer>[];
26
- /** The properties of its features, one object per feature */
27
- properties?: Record<string, unknown>[];
28
- }
29
-
30
- /** A texture transcoded for the GPU (KTX2 / Basis Universal): a WebGL internal format and its mip levels */
31
- export interface CompressedTexture {
32
- /** WebGL internal format (compressed, or RGBA8 when the GPU supports none of the targets) */
33
- format: number;
34
- levels: { width: number; height: number; data: Uint8Array<ArrayBuffer> }[];
35
- }
36
-
37
- /**
38
- * A primitive ready for the GPU: its image decoded (bitmap) or transcoded (texture); primitives given the same bitmap
39
- * or texture object share one GPU texture
40
- */
41
- export interface DecodedPrimitive {
42
- vertices: Float32Array<ArrayBuffer>;
43
- indices: Uint32Array<ArrayBuffer>;
44
- bitmap: ImageBitmap | null;
45
- texture?: CompressedTexture;
46
- /** Base color factor of its material (RGBA 0-1), when not white */
47
- color?: Float32Array<ArrayBuffer>;
48
- /** The feature of each vertex, when the tile has features */
49
- features?: Float32Array<ArrayBuffer>;
50
- }
51
-
52
- /**
53
- * A Draco-compressed primitive of a tile (`KHR_draco_mesh_compression`), or its points
54
- * (`3DTILES_draco_point_compression`), to decode with the Draco module
55
- */
56
- export interface DracoRequest {
57
- mesh: number;
58
- primitive: number;
59
- data: Uint8Array<ArrayBuffer>;
60
- /** Draco attribute ids */
61
- position: number;
62
- uv?: number;
63
- color?: number;
64
- normal?: number;
65
- /** A point cloud: no triangles */
66
- points?: boolean;
67
- }
68
-
69
- /** The Draco module's output for a request: positions, uv, colors and normals as stored, triangles (not for points) */
70
- export interface DracoGeometry {
71
- mesh: number;
72
- primitive: number;
73
- positions: Float32Array;
74
- uvs?: Float32Array;
75
- indices?: Uint32Array;
76
- colors?: Float32Array;
77
- normals?: Float32Array;
78
- }
79
-
80
- /** Compressed texture formats supported by the GPU */
81
- export interface TextureFormats {
82
- astc: boolean;
83
- bptc: boolean;
84
- etc: boolean;
85
- s3tc: boolean;
86
- }
87
-
88
- /** A tile ready for the GPU, as the decoding workers deliver it */
89
- export interface DecodedTile {
90
- anchor: Float64Array<ArrayBuffer>;
91
- primitives: DecodedPrimitive[];
92
- /** Its points' vertices (`EncodedTile.points`) */
93
- points?: Uint8Array<ArrayBuffer>[];
94
- /** The properties of its features (`EncodedTile.properties`) */
95
- properties?: Record<string, unknown>[];
4
+ /** A feature picked: its layer and its index there (the edge of a network, the feature of a layer) */
5
+ export interface PickHit {
6
+ layer: number;
7
+ index: number;
96
8
  }
97
9
 
98
- /** What the engine expects from a pool of decoding workers (`Engine.setTileLoader`) */
99
- export interface TileLoaderLike {
100
- /**
101
- * `reload`: bypass the HTTP cache (the tile failed before: the cache may hold the error); `priority`: the Fetch
102
- * Priority for the download (the first tiles in view of a frame are urgent)
103
- */
104
- load(
105
- id: number,
106
- url: string,
107
- transform: Float64Array,
108
- yUp: boolean,
109
- reload: boolean,
110
- priority?: 'high' | 'low',
111
- ): Promise<DecodedTile>;
112
- abort(id: number): void;
113
- /**
114
- * The points of a COPC node: its LAZ chunk (`size` bytes at `offset` of the file at `url`, a range request), the
115
- * data of the file's LAZ VLR, its layout (format, record length, scale, offset), the grid positioning its points
116
- * and its point count; resolves with its vertices (20 bytes each, see `EncodedTile.points`)
117
- */
118
- loadPoints?(
119
- id: number,
120
- url: string,
121
- offset: number,
122
- size: number,
123
- laz: Uint8Array,
124
- layout: Float64Array,
125
- grid: Float64Array,
126
- count: number,
127
- priority?: 'high' | 'low',
128
- ): Promise<Uint8Array<ArrayBuffer>>;
10
+ /** The answer to `requestPick`, from `pollPick` */
11
+ export interface PickResult {
12
+ /** The screen point asked about (CSS pixels) */
13
+ x: number;
14
+ y: number;
15
+ /** The feature there, if any */
16
+ hit?: PickHit;
17
+ /** The position there, on the relief; undefined above the horizon */
18
+ lonLat?: [lon: number, lat: number];
129
19
  }
130
20
 
131
21
 
@@ -140,14 +30,6 @@ export interface Camera {
140
30
  bearing: number;
141
31
  }
142
32
 
143
- /** The feature under a screen point */
144
- export interface PickHit {
145
- /** Id of the layer */
146
- layer: number;
147
- /** Index of the feature in the layer (the edge of a network) */
148
- index: number;
149
- }
150
-
151
33
  /** Tile counters of a raster layer */
152
34
  export interface RasterLayerStats {
153
35
  id: number;
@@ -253,47 +135,47 @@ export interface NetworkStats {
253
135
 
254
136
 
255
137
 
256
- /** The answer to `requestPick`, from `pollPick` */
257
- export interface PickResult {
258
- /** The screen point asked about (CSS pixels) */
259
- x: number;
260
- y: number;
261
- /** The feature there, if any */
262
- hit?: PickHit;
263
- /** The position there, on the relief; undefined above the horizon */
264
- lonLat?: [lon: number, lat: number];
138
+ /** What a custom layer draws into before the frame's pass: the engine's device, the layer's color (cleared, at the
139
+ * canvas's size; premultiplied alpha) and in the '3d' mode its depth (the solid scene's, to test against) */
140
+ export interface CustomTarget {
141
+ device: GPUDevice;
142
+ color: GPUTexture;
143
+ format: 'rgba8unorm';
144
+ depth?: GPUTexture;
145
+ depthFormat: 'depth32float';
146
+ width: number;
147
+ height: number;
265
148
  }
266
149
 
267
150
 
268
151
 
269
152
  /**
270
- * A map on one canvas: its WebGL2 context, camera, ground (raster layers over the relief) and the layers over it.
271
- * Draws only when `render` is called (the JavaScript side calls it after `redraw` asks for a frame)
153
+ * A map on one canvas: its device, its camera, what it draws. Draws only when `render` is called (the JavaScript
154
+ * side calls it after `redraw` asks for a frame)
272
155
  */
273
156
  export class Engine {
157
+ private constructor();
274
158
  free(): void;
275
159
  /**
276
160
  * Circle layer of `feature_count` features: points (Mercator [0, 1], interleaved) and the feature of each
277
161
  *
278
162
  * # Errors
279
163
  *
280
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
281
- * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
164
+ * Throws (to JavaScript) when `feature_count` features need a table past the GPU's largest texture
282
165
  */
283
166
  addCircles(points: Float64Array, feature: Uint32Array, feature_count: number): number;
284
167
  /**
285
- * A layer drawn by the page: `render()` is called at its place in every frame (`customMatrix` gives the
286
- * matrices of that frame meanwhile); `depth`: with the depth buffer of the 3D layers (`3d` mode), else over
287
- * what is drawn before it
168
+ * A layer drawn by the page: `render(target)` is called before every frame's pass with its targets (the device,
169
+ * the color, the depth in `'3d'`: `customMatrix` gives the matrices of that frame meanwhile), what it drew laid over
170
+ * the frame at the layer's place; `depth`: with the depth of the solid scene (`'3d'` mode)
288
171
  */
289
- addCustomLayer(render: () => void, depth: boolean): number;
172
+ addCustomLayer(render: (target: CustomTarget) => void, depth: boolean): number;
290
173
  /**
291
174
  * An empty extrusion layer: its blocks come in batches (`setExtrusionBatch`)
292
175
  *
293
176
  * # Errors
294
177
  *
295
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
296
- * info log)
178
+ * Never in practice: the layer starts empty
297
179
  */
298
180
  addExtrusions(): number;
299
181
  /**
@@ -303,8 +185,7 @@ export class Engine {
303
185
  *
304
186
  * # Errors
305
187
  *
306
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
307
- * info log), or when `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
188
+ * Throws (to JavaScript) when `feature_count` features need a table past the GPU's largest texture
308
189
  */
309
190
  addFills(points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number): number;
310
191
  /**
@@ -313,74 +194,61 @@ export class Engine {
313
194
  *
314
195
  * # Errors
315
196
  *
316
- * Throws (to JavaScript) when a WebGL object cannot be created, a shader fails to compile or the trails need a
317
- * table texture past the GPU's `MAX_TEXTURE_SIZE`
197
+ * Throws (to JavaScript) when the trails need a table past the GPU's largest texture
318
198
  */
319
199
  addFlow(particles: number, trail: number): number;
320
200
  /**
321
- * Ground layer running `code` (GLSL ES 3.0 defining `vec4 ground(vec2 offset)`, see `render::ground`) over the
322
- * ground; `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors
323
- * come back with the shader's info log (line numbers of `code`)
201
+ * Ground layer running `code` (WGSL defining `fn ground(offset: vec2f) -> vec4f`, see `render::ground`) over the
202
+ * ground; `names` and `types`: its uniforms (`f32`, `vec2f`, `vec4<u32>`, `mat4x4f`…), read as `u.<name>`;
203
+ * `anchor`: Mercator point the offsets are taken from; bounds: Mercator box it shows in. Compilation errors are
204
+ * reported in the console when the layer is first drawn
324
205
  *
325
206
  * # Errors
326
207
  *
327
- * Throws (to JavaScript) when `code` does not compile or link, with the shader's info log
208
+ * Throws (to JavaScript) on a uniform's name or type WGSL does not take
328
209
  */
329
- addGround(code: string, anchor_x: number, anchor_y: number, min_x: number, min_y: number, max_x: number, max_y: number): number;
210
+ addGround(code: string, names: string[], types: string[], anchor_x: number, anchor_y: number, min_x: number, min_y: number, max_x: number, max_y: number): number;
330
211
  /**
331
212
  * Line layer of `feature_count` features: polylines given by their points (Mercator [0, 1], interleaved), the
332
213
  * first point of each (`start`, one more entry than lines) and the feature each one belongs to
333
214
  *
334
215
  * # Errors
335
216
  *
336
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
337
- * info log), or when the features or the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
217
+ * Throws (to JavaScript) when the features or the lines need a table past the GPU's largest texture
338
218
  */
339
219
  addLines(points: Float64Array, start: Uint32Array, feature: Uint32Array, feature_count: number, heights?: Float64Array | null, sea?: boolean | null): number;
340
220
  /**
341
221
  * A glTF / GLB model (its URL, a `blob:` one for data of the page) drawn at each instance of `instances`
342
- * (`INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees, scale);
343
- * `ground`: altitudes above the relief, else above the ellipsoid
344
- *
345
- * # Errors
346
- *
347
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
348
- * info log). A model that fails to load or decode does not throw: the layer stays empty
222
+ * (`geo::models::INSTANCE_NUMBERS` numbers each: longitude, latitude, altitude, heading, pitch, roll in degrees,
223
+ * scale); `ground`: altitudes above the relief, else above the ellipsoid. A model that fails to load or decode
224
+ * leaves the layer empty
349
225
  */
350
226
  addModels(url: string, instances: Float64Array, ground: boolean): number;
351
227
  /**
352
228
  * Network of `mercator.length / 2` nodes (Mercator [0, 1], y towards the south, interleaved: converted by the
353
229
  * JavaScript side, where `Math.tan` and `Math.log` are much faster than in WebAssembly) and `edges.length / 2`
354
- * edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B, points
355
- * `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than two). `costs`: per edge, the
356
- * cost of travelling it from A to B then from B to A; without, values are interpolated along the edges.
230
+ * edges (node index pairs, interleaved). `line_start` and `line_points`: the line of each edge from A to B,
231
+ * points `line_start[e] .. line_start[e + 1]` of `line_points` (Mercator, interleaved; straight if fewer than
232
+ * two). `costs`: per edge, the cost of travelling it from A to B then from B to A; without, values are
233
+ * interpolated along the edges.
357
234
  *
358
235
  * # Errors
359
236
  *
360
- * Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past
361
- * those of `mercator`, the nodes or edges need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or when
362
- * a WebGL object cannot be created or a shader fails to compile (the error carries its info log)
237
+ * Throws (to JavaScript) when `style` is not 25 numbers, `edges` is not node pairs or names a node past those of
238
+ * `mercator`, or the nodes or edges need a table past the GPU's largest texture
363
239
  */
364
240
  addNetwork(mercator: Float64Array, edges: Uint32Array, line_start: Uint32Array | null | undefined, line_points: Float64Array | null | undefined, costs: Float32Array | null | undefined, style: Float32Array): number;
365
241
  /**
366
242
  * A COPC point cloud from its URL (HTTP range requests). `resolve(wkt)` gives the CRS of the file from its WKT
367
243
  * (undefined if it has none): its inverse projection, whether its altitudes are above the geoid, the metres of
368
244
  * a unit of z; it may throw (an unknown CRS), the layer then stays empty
369
- *
370
- * # Errors
371
- *
372
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
373
- * info log). The file itself is read later: a bad file, or a `resolve` that throws, leaves the layer empty
245
+ * The file is read later: a bad file, or a `resolve` that throws, leaves the layer empty
374
246
  */
375
247
  addPointCloud(url: string, resolve: (wkt: string | undefined) => PointCloudCrs): number;
376
248
  /**
377
249
  * Raster tiles in Web Mercator; `url` holds {z}, {x} and {y}. `size`: side of the tiles' textures (256 by
378
250
  * default); `loader`: draws each tile instead of fetching `url`, `(z, x, y, signal) => Promise<ImageBitmap |
379
251
  * null>`, an image of `size` × `size` (null: nothing there); `ground: false`: draped on 3D layers only
380
- *
381
- * # Errors
382
- *
383
- * Throws (to JavaScript) when the texture holding the layer's tiles cannot be created
384
252
  */
385
253
  addRaster(url: string, min_z: number, max_z: number, opacity: number, saturation: number, size: number | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<ImageBitmap | null>) | undefined, ground?: boolean | null): number;
386
254
  /**
@@ -388,8 +256,7 @@ export class Engine {
388
256
  *
389
257
  * # Errors
390
258
  *
391
- * Throws (to JavaScript) when a WebGL object cannot be created or a shader fails to compile (the error carries its
392
- * info log)
259
+ * Never in practice: its tables start empty
393
260
  */
394
261
  addSymbols(): number;
395
262
  /**
@@ -397,21 +264,22 @@ export class Engine {
397
264
  * screen-space error (CSS pixels) above which a tile is refined; 16 is the usual value, lower is finer.
398
265
  * `geoid`: its heights are altitudes (NGF-IGN69), each tile raised by the RAF20 geoid onto the relief.
399
266
  *
400
- * # Errors
401
- *
402
- * Throws (to JavaScript) when one of the layer's programs fails to compile or link (the error carries
403
- * its info log). The tileset itself is read later: a bad one leaves the layer empty, it does not throw
267
+ * The tileset is read later: a bad one leaves the layer empty
404
268
  */
405
269
  addTiles3d(url: string, max_error: number, geoid?: boolean | null): number;
406
270
  /**
407
271
  * An empty layer of vector tiles drawn as geometry: its style layers come with `setVectorSublayers`, its tiles
408
- * with `setVectorTile`
272
+ * with `setVectorTile` or `setVectorTileMesh`
409
273
  *
410
274
  * # Errors
411
275
  *
412
- * Throws (to JavaScript) when a shader fails to compile (the error carries its info log)
276
+ * Never in practice: the layer starts empty
413
277
  */
414
278
  addVectorTiles(): number;
279
+ /**
280
+ * The backend drawing: "browserwebgpu" or "gl"
281
+ */
282
+ backend(): string;
415
283
  /**
416
284
  * Longitudes and latitudes the view covers on the ground, `[west, south, east, north]` (degrees): the screen's
417
285
  * border cast on the ground, or on the far plane where it passes the horizon
@@ -438,7 +306,16 @@ export class Engine {
438
306
  */
439
307
  clearViewshed(): void;
440
308
  /**
441
- * Model-view-projection matrix (16 numbers, column-major, for `uniformMatrix4fv`) of the local frame at a
309
+ * The engine of `canvas`, `redraw` called when it needs a new frame; `antialias`: the 3D multisampled (default
310
+ * true). Asynchronous: the device is asked for
311
+ *
312
+ * # Errors
313
+ *
314
+ * Throws (to JavaScript) when the canvas gives no device ("WebGPU is not available" through WebGPU)
315
+ */
316
+ static create(canvas: HTMLCanvasElement, redraw: () => void, antialias?: boolean | null): Promise<Engine>;
317
+ /**
318
+ * Model-view-projection matrix (16 numbers, column-major, WebGPU's clip depth from 0 to 1) of the local frame at a
442
319
  * longitude, latitude (degrees) and altitude (metres): x east, y north, z up, in metres. Undefined outside the
443
320
  * callback of a custom layer. Static: the engine is borrowed while it draws
444
321
  */
@@ -454,23 +331,29 @@ export class Engine {
454
331
  */
455
332
  static geoidHeight(lon: number, lat: number): number;
456
333
  /**
457
- * Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself: from the copy of
458
- * its tiles kept on the CPU, the drawn ground read back from the GPU only where none is there (a read back waits
459
- * for the frame: called during a move, it stalls it)
334
+ * The `GPUDevice` the engine draws with, for the custom layers' objects; undefined on the WebGL2 fallback
335
+ */
336
+ gpuDevice(): GPUDevice | undefined;
337
+ /**
338
+ * Position under a screen point (CSS pixels), undefined above the horizon
460
339
  */
461
340
  ground(x: number, y: number): [lon: number, lat: number] | undefined;
462
341
  /**
463
- * Colors an extrusion layer by the node values of network layer `network` (undefined: by its own values):
464
- * each block takes min(value(A) + cost from A, value(B) + cost from B) from its anchors (`setExtrusionAnchors`),
342
+ * Colors an extrusion layer by the node values of network layer `network` (undefined: by its own values): each
343
+ * block takes min(value(A) + cost from A, value(B) + cost from B) from its anchors (`setExtrusionAnchors`),
465
344
  * through the layer's ramp, up to `max` (above: its own color)
466
345
  */
467
346
  linkExtrusionNetwork(id: number, network: number | null | undefined, max: number): void;
468
347
  /**
469
- * Model-view-projection matrix (16 numbers, column-major) of the local frame at a longitude, latitude (degrees)
470
- * and altitude (metres), x east, y north, z up, in metres, for the last frame drawn (else the camera): the 3D
471
- * overlays of the page (`Panel`) placed with it after each frame
348
+ * Model-view-projection matrix (16 numbers, column-major, WebGL's clip depth) of the local frame at a longitude,
349
+ * latitude (degrees) and altitude (metres), x east, y north, z up, in metres, for the last frame drawn (else the
350
+ * camera): the 3D overlays of the page (`Panel`) placed with it after each frame
472
351
  */
473
352
  localMatrix(lon: number, lat: number, altitude: number): Float32Array;
353
+ /**
354
+ * The largest texture the device takes (pixels a side): the symbol layers' atlases stay within it
355
+ */
356
+ maxTextureSize(): number;
474
357
  /**
475
358
  * Moves a layer to a drawing position (0 = bottom)
476
359
  */
@@ -479,35 +362,18 @@ export class Engine {
479
362
  * Pieces of a network in all and drawn in the last frame (only the squares in view are)
480
363
  */
481
364
  networkStats(id: number): NetworkStats | undefined;
482
- /**
483
- * `redraw` is called when the engine needs a new frame (a tile arrived); `antialias`: multisampled (default true)
484
- *
485
- * # Errors
486
- *
487
- * Throws (to JavaScript) when the canvas gives no WebGL2 context ("WebGL2 is not available"), or when a WebGL
488
- * object of the globe, the sky or the raster pass cannot be created or one of their shaders fails to compile
489
- */
490
- constructor(canvas: HTMLCanvasElement, redraw: () => void, antialias?: boolean | null);
491
365
  /**
492
366
  * Drags the ground from one screen point to another (CSS pixels); in relief, the ground point grabbed stays
493
367
  * under the cursor
494
368
  */
495
369
  pan(x0: number, y0: number, x1: number, y1: number): void;
496
- /**
497
- * Feature under a screen point (CSS pixels), or the nearest one within `radius` CSS pixels: its layer and its
498
- * index there (the edge of a network, the feature of a line, circle or fill layer), undefined if none. The
499
- * pickable layers are drawn with each feature colored by its number; then the fills are tested on the ground.
500
- * `only`: the ids of the layers to look in (all if undefined): the others are not drawn and hide nothing.
501
- * Reads the pixels back at once (the GPU finishes its work first): for clicks; `requestPick` for the hover
502
- */
503
- pick(x: number, y: number, radius?: number | null, only?: Uint32Array | null): PickHit | undefined;
504
370
  /**
505
371
  * What a point cloud says of itself, undefined before its head is read
506
372
  */
507
373
  pointCloudInfo(id: number): PointCloudInfo | undefined;
508
374
  /**
509
- * The point of a point cloud picked by `pick` or `pollPick` (its index there), read back from the GPU; undefined
510
- * once it is no longer drawn
375
+ * The point of a point cloud picked by `pollPick` (its index there): read back with the answer; undefined for
376
+ * another
511
377
  */
512
378
  pointCloudPoint(id: number, index: number): PointCloudPoint | undefined;
513
379
  /**
@@ -515,10 +381,10 @@ export class Engine {
515
381
  */
516
382
  pointCloudStats(id: number): PointCloudStats | undefined;
517
383
  /**
518
- * The answer to the last `requestPick` once the GPU has delivered it (then forgotten), undefined while it is not
519
- * there yet (or nothing was asked, or the context was lost)
384
+ * The answer to request `id` once the GPU has delivered it (then forgotten), undefined while it is not there yet
385
+ * (or for a request given up)
520
386
  */
521
- pollPick(): PickResult | undefined;
387
+ pollPick(id: number): PickResult | undefined;
522
388
  /**
523
389
  * Loads in advance the tiles of a camera flight's destination; `clearPreload` when the flight ends
524
390
  */
@@ -537,7 +403,7 @@ export class Engine {
537
403
  */
538
404
  removeExtrusionBatch(id: number, key: number): void;
539
405
  /**
540
- * Removes a layer and frees its GPU objects; the other layers forget it (a layer that referred to it)
406
+ * Removes a layer and frees its GPU objects (as it drops)
541
407
  */
542
408
  removeLayer(id: number): void;
543
409
  /**
@@ -545,16 +411,17 @@ export class Engine {
545
411
  */
546
412
  removeVectorTile(id: number, key: number): void;
547
413
  /**
548
- * Draws a frame: the backdrop, the ground and the layers over it bottom to top, then the panorama and the
549
- * viewshed; returns true while tiles are still loading (a new frame will be asked through `redraw`)
414
+ * Draws a frame: the backdrop, the ground; returns true while tiles are still loading (a new frame will be asked
415
+ * through `redraw`)
550
416
  */
551
417
  render(): boolean;
552
418
  /**
553
- * Asks what is under a screen point without waiting for the GPU (as `pick`, with the position there): the
554
- * picking pass is drawn now and read back into a buffer; `pollPick` gives the answer on a later frame. A new
555
- * request replaces the one in flight. Returns false if nothing could be asked (no WebGL2 fence)
419
+ * Asks what is under a screen point (CSS pixels), or nearest to it within `radius` CSS pixels, without waiting
420
+ * for the GPU: the picking pass is drawn now, its pixels read back later; `pollPick` gives the answer. `only`: the
421
+ * ids of the layers to look in (all if undefined): the others are not drawn and hide nothing. The request's
422
+ * number, never 0
556
423
  */
557
- requestPick(x: number, y: number, radius?: number | null, only?: Uint32Array | null): boolean;
424
+ requestPick(x: number, y: number, radius?: number | null, only?: Uint32Array | null): number;
558
425
  /**
559
426
  * Viewport in CSS pixels and device pixel ratio
560
427
  */
@@ -576,8 +443,7 @@ export class Engine {
576
443
  * The body the map is drawn on: its equatorial radius (metres) and flattening (0 for a sphere), the halo of its
577
444
  * atmosphere around the globe (RGB 0-1 and its strength, 4 numbers; `undefined` for an airless body), and the
578
445
  * lowest and highest altitudes of its ground (metres: what its relief may raise into view). WGS 84, the Earth's
579
- * blue halo and the range of its relief worldwide (-450 m to 8900 m) by default; set before the layers and the
580
- * relief, whose shaders may take its size (`ISARD_CIRCUMFERENCE` of the ground layers)
446
+ * blue halo and the range of its relief worldwide (-450 m to 8900 m) by default
581
447
  */
582
448
  setBody(radius: number, flattening: number, halo: Float32Array | null | undefined, lowest: number, highest: number): void;
583
449
  /**
@@ -598,8 +464,7 @@ export class Engine {
598
464
  *
599
465
  * # Errors
600
466
  *
601
- * Throws (to JavaScript) when the batch's features need an anchor texture past the GPU's
602
- * `MAX_TEXTURE_SIZE`, or when it cannot be created
467
+ * Throws (to JavaScript) when the batch's features need a table past the GPU's largest texture
603
468
  */
604
469
  setExtrusionAnchors(id: number, key: number, anchors: Float32Array): void;
605
470
  /**
@@ -608,8 +473,7 @@ export class Engine {
608
473
  *
609
474
  * # Errors
610
475
  *
611
- * Throws (to JavaScript) when a WebGL buffer or vertex array of the batch cannot be created, or when
612
- * `feature_count` features need a table texture past the GPU's `MAX_TEXTURE_SIZE`
476
+ * Throws (to JavaScript) when `feature_count` features need a table past the GPU's largest texture
613
477
  */
614
478
  setExtrusionBatch(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array, feature_count: number, roofs: Uint8Array, roof_heights: Float32Array, metres: number): void;
615
479
  /**
@@ -691,7 +555,7 @@ export class Engine {
691
555
  *
692
556
  * # Errors
693
557
  *
694
- * Throws (to JavaScript) as `setGlyphPages` does: a size that is not positive, or the texture not created
558
+ * Throws (to JavaScript) as `setGlyphPages` does
695
559
  */
696
560
  setGlyphAtlas(width: number, height: number, data?: Uint8Array | null): void;
697
561
  /**
@@ -701,8 +565,8 @@ export class Engine {
701
565
  *
702
566
  * # Errors
703
567
  *
704
- * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), `pages`
705
- * is not 1 to 256, or the atlas texture cannot be created
568
+ * Throws (to JavaScript) when `width` or `height` is not positive or past the GPU's largest texture, or `pages`
569
+ * is not 1 to 256
706
570
  */
707
571
  setGlyphPages(width: number, height: number, pages: number): void;
708
572
  /**
@@ -710,23 +574,22 @@ export class Engine {
710
574
  */
711
575
  setGroundBounds(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
712
576
  /**
713
- * Creates the texture of sampler `name` (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f, rgba8,
714
- * rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers; `linear` filtering for the
715
- * non-integer formats); `data`: its texels as bytes, or undefined for an empty texture
577
+ * Creates the texture `name` of a ground layer (`format`: r8, r8ui, r16ui, r16i, r32ui, r32f, rg16ui, rg32f,
578
+ * rgba8, rgba8ui, rgba16ui, rgba32f; `depth` 0 for 2D, else a 2D array of that many layers); `data`: its texels
579
+ * as bytes, or undefined for an empty texture
716
580
  *
717
581
  * # Errors
718
582
  *
719
- * Throws (to JavaScript) on an unknown `format`, a size not positive (or overflowing), `data` shorter
720
- * than the texels, more textures than the layer takes, or a texture WebGL cannot create
583
+ * Throws (to JavaScript) on an unknown `format`, a size of 0, `data` shorter than the texels, a name WGSL does not
584
+ * take, or more textures than the layer takes
721
585
  */
722
- setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, linear: boolean, data?: Uint8Array | null): void;
586
+ setGroundTexture(id: number, name: string, format: string, width: number, height: number, depth: number, data?: Uint8Array | null): void;
723
587
  /**
724
- * A uniform of a ground layer's code, as numbers
588
+ * A uniform of a ground layer's code, as numbers (column major for a matrix)
725
589
  *
726
590
  * # Errors
727
591
  *
728
- * Throws (to JavaScript) when the shader has no uniform `name` (one its code does not use is removed
729
- * by the compiler)
592
+ * Throws (to JavaScript) when no uniform `name` was declared, or for a count of numbers not its type's
730
593
  */
731
594
  setGroundUniform(id: number, name: string, values: Float64Array): void;
732
595
  /**
@@ -739,8 +602,7 @@ export class Engine {
739
602
  *
740
603
  * # Errors
741
604
  *
742
- * Throws (to JavaScript) when `width` or `height` is not positive (or their product overflows), or the
743
- * atlas texture cannot be created
605
+ * Throws (to JavaScript) when `width` or `height` is not positive or past the GPU's largest texture
744
606
  */
745
607
  setIconAtlas(width: number, height: number): void;
746
608
  /**
@@ -757,8 +619,8 @@ export class Engine {
757
619
  *
758
620
  * # Errors
759
621
  *
760
- * Throws (to JavaScript) when the lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
761
- * when it cannot be created; the layer then keeps its lines
622
+ * Throws (to JavaScript) when the lines need a table past the GPU's largest texture; the layer then keeps its
623
+ * lines
762
624
  */
763
625
  setLines(id: number, points: Float64Array, start: Uint32Array, feature: Uint32Array, heights?: Float64Array | null, sea?: boolean | null): void;
764
626
  /**
@@ -802,11 +664,8 @@ export class Engine {
802
664
  */
803
665
  setNetworkValues(id: number, values: Float32Array): void;
804
666
  /**
805
- * The image of camera `index` of the panorama (the images sharing the size of the first)
806
- *
807
- * # Errors
808
- *
809
- * Throws (to JavaScript) when WebGL refuses the upload of `image` into the panorama's texture
667
+ * The image of camera `index` of the panorama (the images sharing the size of the first), which the engine takes
668
+ * (closes once copied)
810
669
  */
811
670
  setPanoramaImage(index: number, image: ImageBitmap): void;
812
671
  /**
@@ -818,14 +677,12 @@ export class Engine {
818
677
  *
819
678
  * # Errors
820
679
  *
821
- * Throws (to JavaScript) when `rotation` holds fewer than 9 numbers, or when a WebGL object cannot be created or a
822
- * shader fails to compile (the error carries its info log)
680
+ * Throws (to JavaScript) when `rotation` holds fewer than 9 numbers
823
681
  */
824
682
  setPanorama(lon: number, lat: number, height: number, rotation: Float64Array, cameras: Float64Array, radius: number, opacity: number): void;
825
683
  /**
826
684
  * Sets the point the next turns and tilts go around (`rotate`): what is drawn under a screen point (CSS
827
- * pixels), a roof or a mesh as the relief. Read back from the last frame (a stall): once, where a drag starts.
828
- * Returns whether something was drawn there; over nothing, the turns go around the center
685
+ * pixels). Returns whether something was drawn there; over nothing, the turns go around the center
829
686
  */
830
687
  setPivot(x: number, y: number): boolean;
831
688
  /**
@@ -850,16 +707,11 @@ export class Engine {
850
707
  * The sun casting shadows and the night: its azimuth (degrees clockwise from north) and altitude (degrees above
851
708
  * the horizon), the shadows' opacity (0 to 1; none under the horizon or not a number), how dark the night is (0 to
852
709
  * 1: the frame tinted, the lights of the layers on). Neither shadows nor night: nothing drawn
853
- *
854
- * # Errors
855
- *
856
- * Throws (to JavaScript) when a WebGL object cannot be created or the pass fails to compile
857
710
  */
858
711
  setSun(azimuth: number, altitude: number, opacity: number, night: number): void;
859
712
  /**
860
- * Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
861
- * of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; `others` on the other side
862
- * only (two meshes of the same place, each on its side, never drawn over each other); a non-finite `x` stops
713
+ * Shows `layers` left of `x` (CSS pixels from the left of the canvas; right of it if `right`), `others` on the
714
+ * other side only; `x` not a number, or no layer: no swipe
863
715
  */
864
716
  setSwipe(x: number, right: boolean, layers: Uint32Array, others: Uint32Array): void;
865
717
  /**
@@ -875,23 +727,18 @@ export class Engine {
875
727
  *
876
728
  * # Errors
877
729
  *
878
- * Throws (to JavaScript) when the labels need a table texture past the GPU's `MAX_TEXTURE_SIZE`, or
879
- * when it cannot be created; the layer then keeps its labels
730
+ * Throws (to JavaScript) when the labels need a table past the GPU's largest texture; the layer then keeps its
731
+ * labels
880
732
  */
881
733
  setSymbols(id: number, anchors: Float64Array, boxes: Float32Array, styles: Float32Array, quads: Float32Array, paths: Float64Array): void;
882
734
  /**
883
735
  * Relief under the raster layers, from raw altitudes (`image/x-bil;bits=32`, 256 × 256, or the same followed by
884
736
  * the validity mask of an `ArcGIS` raw grid): `url` is a template with `{bbox}` (WMS `GetMap` in EPSG:3857, or in
885
737
  * the Mercator metres of another body) or `{z}/{x}/{y}`; `undefined` turns it off. `exaggeration` scales the
886
- * heights (1: true relief); `max_z`: finest level loaded (up to 15, from 6 on the Earth, coarser on bodies of a
887
- * larger relief for their size: `terrain_levels`); `geoid`: altitudes raised by the RAF20 geoid height (heights
888
- * above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the default);
889
- * `loader`: gives the
890
- * altitudes of each tile instead of fetching `url` (an encoding decoded by the page: Terrarium, Terrain-RGB)
891
- *
892
- * # Errors
893
- *
894
- * Throws (to JavaScript) when the texture holding the relief's tiles cannot be created
738
+ * heights (1: true relief); `max_z`: finest level loaded; `geoid`: altitudes raised by the RAF20 geoid height
739
+ * (heights above the ellipsoid, those of 3D Tiles; over France, on the Earth only), else left as served (the
740
+ * default); `loader`: gives the altitudes of each tile instead of fetching `url` (an encoding decoded by the
741
+ * page: Terrarium, Terrain-RGB)
895
742
  */
896
743
  setTerrain(url: string | null | undefined, exaggeration: number, max_z: number | null | undefined, geoid: boolean | null | undefined, loader: ((z: number, x: number, y: number, signal: AbortSignal) => Promise<Float32Array | null>) | undefined): void;
897
744
  /**
@@ -899,7 +746,7 @@ export class Engine {
899
746
  * `load(id, url, transform, yUp, reload, priority) → Promise<{ anchor, primitives }>` and `abort(id)`. Without
900
747
  * it, tiles are decoded on the main thread. Set it before adding 3D Tiles layers.
901
748
  */
902
- setTileLoader(loader: TileLoaderLike | null): void;
749
+ setTileLoader(loader: import('./isard_tiles3d.js').TileLoaderLike | null): void;
903
750
  /**
904
751
  * A raster layer draped on a 3D Tiles layer's roofs, or all its faces (`raster` undefined: none)
905
752
  */
@@ -919,30 +766,29 @@ export class Engine {
919
766
  setTiles3dStyle(id: number, max_error: number, opacity: number, point_size: number | null | undefined, color: Float32Array): void;
920
767
  /**
921
768
  * The style layers of a vector tile layer, in drawing order: per layer, its kind (0 fill, 1 line, 2 extrusion, 3
922
- * circle), its zoom range
923
- * (two numbers: shown from the first, included, to the second, excluded), whether it shows (0 or 1), its dashes
924
- * (four numbers: dash, gap, dash, gap, in line widths; 0: solid), its opacity as zoom stops (four zooms then four
925
- * values; missing: opaque), the caps of its lines' ends (0 butt, 1 round, 2 square; missing: round), whether its
926
- * lines glow at night (streets; 0 or 1), the joins of its lines (two numbers: 0 round, 1 miter, 2 bevel, then the
927
- * miter limit in line widths; missing: round), the translation of its fills or lines (three numbers: x and y in CSS
928
- * pixels, x right and y down, then 0 if it turns with the map, 1 if it stays on the screen; missing: none), whether its
929
- * fills have patterns (0 or 1)
769
+ * circle), its zoom range (two numbers: shown from the first, included, to the second, excluded), whether it shows
770
+ * (0 or 1), its dashes (four numbers: dash, gap, dash, gap, in line widths; 0: solid), its opacity as zoom stops
771
+ * (four zooms then four values; missing: opaque), the caps of its lines' ends (0 butt, 1 round, 2 square; missing:
772
+ * round), whether its lines glow at night (streets; 0 or 1), the joins of its lines (two numbers: 0 round, 1
773
+ * miter, 2 bevel, then the miter limit in line widths; missing: round), the translation of its fills or lines
774
+ * (three numbers: x and y in CSS pixels, x right and y down, then 0 if it turns with the map, 1 if it stays on the
775
+ * screen; missing: none), whether its fills have patterns (0 or 1)
930
776
  */
931
777
  setVectorSublayers(id: number, kinds: Uint8Array, zooms: Float64Array, visible: Uint8Array, dashes: Float32Array, opacities: Float32Array, caps: Uint8Array, lit: Uint8Array, joins: Float32Array, translates: Float32Array, patterned: Uint8Array): void;
932
778
  /**
933
779
  * Adds or replaces tile `key` of a vector tile layer ready for the GPU, as the basemap workers make it (the
934
- * tessellation module): its polygons as for `setVectorTile` (picked here; their prisms built here if drawn in
935
- * relief while `prism` is false), the vertices of its fills (`shapes::Vertex` as bytes, each with its feature),
936
- * their triangles, per sublayer its top cap and the rest of its prism (`fill_ranges`: four numbers, first and
937
- * end of each), its line pieces (`pieces::Piece` as bytes), the line table (feature and length of each line),
780
+ * tessellation module): its polygons as for `setVectorTile` (their prisms built here if drawn in relief while
781
+ * `prism` is false), the vertices of its fills (`shapes::Vertex` as bytes, each with its feature), their
782
+ * triangles, per sublayer its top cap and the rest of its prism (`fill_ranges`: four numbers, first and end of
783
+ * each), its line pieces (`vector_tiles::TilePiece` as bytes), the line table (feature and length of each line),
938
784
  * per sublayer its pieces (`line_ranges`: first, end), the blocks of its extrusion sublayers (`shapes::Block` as
939
785
  * bytes), their triangles, per sublayer its blocks' triangles (`block_ranges`: first, end), the extent of its
940
786
  * points (`bounds`: min x, min y, max x, max y), its features' sublayers (one each, as for `setVectorTile`)
941
787
  *
942
788
  * # Errors
943
789
  *
944
- * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, when a WebGL object of the tile cannot be
945
- * created, or when its features or lines need a table texture past the GPU's `MAX_TEXTURE_SIZE`
790
+ * Throws (to JavaScript) when the vertices, pieces or blocks are cut short, or when its features or lines need a
791
+ * table past the GPU's largest texture
946
792
  */
947
793
  setVectorTileMesh(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, vertices: Uint8Array, indices: Uint32Array, fill_ranges: Uint32Array, prism: boolean, pieces: Uint8Array, line_table: Float32Array, line_ranges: Uint32Array, blocks: Uint8Array, block_indices: Uint32Array, block_ranges: Uint32Array, bounds: Float64Array, feature_sublayer: Uint16Array): void;
948
794
  /**
@@ -955,19 +801,16 @@ export class Engine {
955
801
  * Adds or replaces tile `key` of a vector tile layer: its polygons as for `addFills` (`fill_start`: the first
956
802
  * polygon of each sublayer, and the end; those of an extrusion sublayer raised into blocks), its lines as for
957
803
  * `addLines` (`line_start`: the first line of each sublayer, and the end), its features' sublayers (one each, the
958
- * features of a sublayer after those of the one before), styled as an
959
- * extrusion layer's (`setFeatureStyle` with the key: a color, then a line's width or a block's height and base);
960
- * `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose edges no
961
- * wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's roof
962
- * (`shapes::Roofs`: 0 flat, 1 to 5 `RoofShape::number`, 255 generated from its outline; metres, not a number: as
963
- * its slopes make it; empty: flat), the whole outlines of the buildings the tile cuts (`roof_outlines`, interleaved
964
- * Mercator points, `roof_outline_start`: where each polygon's starts, and the end), `roof_metres` the metres per
965
- * Mercator unit at the tile
804
+ * features of a sublayer after those of the one before), styled as an extrusion layer's (`setFeatureStyle` with
805
+ * the key); `tile`: the corners of the tile they are cut to (west, north, east, south; empty: none), along whose
806
+ * edges no wall of a block rises; `roofs` and `roof_heights`: per polygon, the shape and height of its block's
807
+ * roof (`shapes::Roofs`), the whole outlines of the buildings the tile cuts (`roof_outlines`, interleaved Mercator
808
+ * points, `roof_outline_start`: where each polygon's starts, and the end), `roof_metres` the metres per Mercator
809
+ * unit at the tile
966
810
  *
967
811
  * # Errors
968
812
  *
969
- * Throws (to JavaScript) when a WebGL object of the tile cannot be created, or when its features or lines need a
970
- * table texture past the GPU's `MAX_TEXTURE_SIZE`
813
+ * Throws (to JavaScript) when its features or lines need a table past the GPU's largest texture
971
814
  */
972
815
  setVectorTile(id: number, key: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, polygon_feature: Uint32Array, fill_start: Uint32Array, line_points: Float64Array, line_first: Uint32Array, line_feature: Uint32Array, line_start: Uint32Array, feature_sublayer: Uint16Array, tile: Float64Array, roofs: Uint8Array, roof_heights: Float32Array, roof_outlines: Float64Array, roof_outline_start: Uint32Array, roof_metres: number): void;
973
816
  /**
@@ -976,11 +819,6 @@ export class Engine {
976
819
  * only heading, tilt, angles of view across and up (degrees), the heading NaN to look all around. What some
977
820
  * observer sees is tinted with `visible`, what is hidden from all those that reach it with `hidden` (RGB 0-1),
978
821
  * at `opacity`; `outline` (RGB 0-1, or empty) the color of the cones' edges drawn in 3D
979
- *
980
- * # Errors
981
- *
982
- * Throws (to JavaScript) when, on the first call, a WebGL object cannot be created or a shader fails to compile
983
- * (the error carries its info log)
984
822
  */
985
823
  setViewshed(observers: Float64Array, visible: Float32Array, hidden: Float32Array, opacity: number, outline: Float32Array): void;
986
824
  /**
@@ -998,20 +836,21 @@ export class Engine {
998
836
  stepFlow(id: number, seconds: number): boolean;
999
837
  /**
1000
838
  * The height above the relief (metres) of the top of what stands at a position (degrees): a roof, a mesh, 0 on
1001
- * the bare ground; undefined where nothing of the last frame is there. The scene is drawn from above into a single
1002
- * pixel and read back (a stall, cheap: one pixel to fill)
839
+ * the bare ground; undefined where nothing of the last frame is there, or until measured: the scene is drawn
840
+ * looking down at it after a frame and read back a frame or two later (a frame is asked for), the answer kept and
841
+ * measured again every 250 ms at most
1003
842
  */
1004
843
  surfaceAt(lon: number, lat: number): any;
1005
844
  /**
1006
845
  * What is drawn under a screen point (CSS pixels): longitude, latitude and its height above the relief (metres),
1007
- * on a roof, a wall or a mesh as on the ground; undefined where nothing was drawn. The scene is drawn again and
1008
- * read back (a stall): for clicks and drags
846
+ * on a roof, a wall or a mesh as on the ground; undefined where nothing was drawn. From the last copy of the
847
+ * scene's depth (a frame or two old, one pixel in 4 CSS pixels): at once, without waiting for the GPU
1009
848
  */
1010
849
  surface(x: number, y: number): [lon: number, lat: number, height: number] | undefined;
1011
850
  /**
1012
- * Compressed texture formats of the GPU (their WebGL extensions get enabled), for the KTX2 transcoding
851
+ * Compressed texture formats of the GPU, for the KTX2 transcoding
1013
852
  */
1014
- textureFormats(): TextureFormats;
853
+ textureFormats(): import('./isard_tiles3d.js').TextureFormats;
1015
854
  /**
1016
855
  * The feature of a picked handle (`pick`'s index on a 3D Tiles layer): `[properties, feature]`, its properties
1017
856
  * (undefined when its tile has none) and its index in its tile; undefined if the handle is not of the last picking
@@ -1035,24 +874,19 @@ export class Engine {
1035
874
  *
1036
875
  * # Errors
1037
876
  *
1038
- * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or
1039
- * `data` holds too few bytes
877
+ * Throws (to JavaScript) when there is no texture `name`, or when the region is out of its bounds or `data` holds
878
+ * too few bytes
1040
879
  */
1041
880
  updateGroundTexture(id: number, name: string, x: number, y: number, layer: number, width: number, height: number, data: Uint8Array): void;
1042
881
  /**
1043
882
  * A region of the icon atlas: `width` × `height` RGBA texels (premultiplied) at (`x`, `y`)
1044
883
  */
1045
884
  updateIconAtlas(x: number, y: number, width: number, height: number, data: Uint8Array): void;
1046
- /**
1047
- * Uploads a part more of the blocks of tile `key` of a vector tile layer (a large tile's, a part at a time over
1048
- * several frames); whether some are left. Its blocks are drawn once they are all there
1049
- */
1050
- uploadVectorTile(id: number, key: number): boolean;
1051
885
  /**
1052
886
  * Vector tiles (512 CSS pixels across at their level, as `MapLibre`'s) for the view of the last frame (else the
1053
887
  * camera's), levels `min_z` to `max_z`, three numbers per tile (z, x, y), the nearest to the eye first: what a
1054
- * vector tile layer draws (`addVectorTiles`), coarser far away in a tilted view as the raster layers, and no
1055
- * farther than `reach` times the screen center's distance (infinite: to the horizon)
888
+ * vector tile layer draws, coarser far away in a tilted view as the raster layers, and no farther than `reach`
889
+ * times the screen center's distance (infinite: to the horizon)
1056
890
  */
1057
891
  vectorTilesInView(min_z: number, max_z: number, reach: number): Uint32Array;
1058
892
  /**
@@ -1066,62 +900,48 @@ export class Engine {
1066
900
  zoomAt(delta: number, x: number, y: number): void;
1067
901
  }
1068
902
 
1069
- /**
1070
- * Decodes a `.b3dm` / `.pnts` / `.glb` tile: `{ anchor: Float64Array(3), primitives: [{ vertices: Float32Array (x,
1071
- * y, z, u, v per vertex, relative to the anchor), indices: Uint32Array, image?: Uint8Array, mime?: string, color?:
1072
- * Float32Array (the material's base color, when not white) }], points: [Uint8Array] (the points' vertices) }`.
1073
- * `transform`: the tile's world transform (16 numbers, column-major).
1074
- * `draco`: the decoded geometries of its Draco primitives (`dracoRequests`), if any.
1075
- */
1076
- export function decodeTile(bytes: Uint8Array, transform: Float64Array, y_up: boolean, draco: DracoGeometry[] | undefined): EncodedTile;
1077
-
1078
- /**
1079
- * The Draco-compressed primitives of a tile, to decode before `decodeTile`
1080
- */
1081
- export function dracoRequests(bytes: Uint8Array): DracoRequest[];
1082
-
1083
903
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1084
904
 
1085
905
  export interface InitOutput {
1086
906
  readonly memory: WebAssembly.Memory;
1087
907
  readonly __wbg_engine_free: (a: number, b: number) => void;
1088
- readonly decodeTile: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
1089
- readonly dracoRequests: (a: number, b: number) => [number, number, number];
1090
908
  readonly engine_addCircles: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
1091
909
  readonly engine_addCustomLayer: (a: number, b: any, c: number) => number;
1092
910
  readonly engine_addExtrusions: (a: number) => [number, number, number];
1093
911
  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];
1094
912
  readonly engine_addFlow: (a: number, b: number, c: number) => [number, number, number];
1095
- readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
913
+ readonly engine_addGround: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
1096
914
  readonly engine_addLines: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
1097
- readonly engine_addModels: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
915
+ readonly engine_addModels: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
1098
916
  readonly engine_addNetwork: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
1099
- readonly engine_addPointCloud: (a: number, b: number, c: number, d: any) => [number, number, number];
1100
- readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
917
+ readonly engine_addPointCloud: (a: number, b: number, c: number, d: any) => number;
918
+ readonly engine_addRaster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
1101
919
  readonly engine_addSymbols: (a: number) => [number, number, number];
1102
- readonly engine_addTiles3d: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
920
+ readonly engine_addTiles3d: (a: number, b: number, c: number, d: number, e: number) => number;
1103
921
  readonly engine_addVectorTiles: (a: number) => [number, number, number];
922
+ readonly engine_backend: (a: number) => [number, number];
1104
923
  readonly engine_bounds: (a: number) => [number, number];
1105
924
  readonly engine_camera: (a: number) => any;
1106
925
  readonly engine_clearPanorama: (a: number) => void;
1107
926
  readonly engine_clearPivot: (a: number) => void;
1108
927
  readonly engine_clearPreload: (a: number) => void;
1109
928
  readonly engine_clearViewshed: (a: number) => void;
929
+ readonly engine_create: (a: any, b: any, c: number) => any;
1110
930
  readonly engine_customMatrix: (a: number, b: number, c: number) => [number, number];
1111
931
  readonly engine_elevationAt: (a: number, b: number, c: number) => [number, number];
1112
932
  readonly engine_geoidHeight: (a: number, b: number) => number;
933
+ readonly engine_gpuDevice: (a: number) => any;
1113
934
  readonly engine_ground: (a: number, b: number, c: number) => any;
1114
935
  readonly engine_linkExtrusionNetwork: (a: number, b: number, c: number, d: number) => void;
1115
936
  readonly engine_localMatrix: (a: number, b: number, c: number, d: number) => [number, number];
937
+ readonly engine_maxTextureSize: (a: number) => number;
1116
938
  readonly engine_moveLayer: (a: number, b: number, c: number) => void;
1117
939
  readonly engine_networkStats: (a: number, b: number) => any;
1118
- readonly engine_new: (a: any, b: any, c: number) => [number, number, number];
1119
940
  readonly engine_pan: (a: number, b: number, c: number, d: number, e: number) => void;
1120
- readonly engine_pick: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
1121
941
  readonly engine_pointCloudInfo: (a: number, b: number) => any;
1122
942
  readonly engine_pointCloudPoint: (a: number, b: number, c: number) => any;
1123
943
  readonly engine_pointCloudStats: (a: number, b: number) => any;
1124
- readonly engine_pollPick: (a: number) => any;
944
+ readonly engine_pollPick: (a: number, b: number) => any;
1125
945
  readonly engine_preload: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1126
946
  readonly engine_project: (a: number, b: number, c: number, d: number, e: number) => any;
1127
947
  readonly engine_promoteFlowNext: (a: number, b: number) => void;
@@ -1158,7 +978,7 @@ export interface InitOutput {
1158
978
  readonly engine_setGlyphAtlas: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1159
979
  readonly engine_setGlyphPages: (a: number, b: number, c: number, d: number) => [number, number];
1160
980
  readonly engine_setGroundBounds: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1161
- 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];
981
+ 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) => [number, number];
1162
982
  readonly engine_setGroundUniform: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1163
983
  readonly engine_setGroundVisible: (a: number, b: number, c: number) => void;
1164
984
  readonly engine_setIconAtlas: (a: number, b: number, c: number) => [number, number];
@@ -1175,17 +995,17 @@ export interface InitOutput {
1175
995
  readonly engine_setNetworkStyle: (a: number, b: number, c: number, d: number) => void;
1176
996
  readonly engine_setNetworkValues: (a: number, b: number, c: number, d: number) => void;
1177
997
  readonly engine_setPanorama: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1178
- readonly engine_setPanoramaImage: (a: number, b: number, c: any) => [number, number];
998
+ readonly engine_setPanoramaImage: (a: number, b: number, c: any) => void;
1179
999
  readonly engine_setPivot: (a: number, b: number, c: number) => number;
1180
1000
  readonly engine_setPointCloudStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1181
1001
  readonly engine_setRasterStyle: (a: number, b: number, c: number, d: number) => void;
1182
1002
  readonly engine_setRequestHeaders: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1183
1003
  readonly engine_setSky: (a: number, b: number) => void;
1184
- readonly engine_setSun: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1004
+ readonly engine_setSun: (a: number, b: number, c: number, d: number, e: number) => void;
1185
1005
  readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1186
1006
  readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1187
1007
  readonly engine_setSymbols: (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];
1188
- readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1008
+ readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1189
1009
  readonly engine_setTileLoader: (a: number, b: any) => void;
1190
1010
  readonly engine_setTiles3dDrape: (a: number, b: number, c: number, d: number, e: number) => void;
1191
1011
  readonly engine_setTiles3dFacades: (a: number, b: number, c: number) => void;
@@ -1195,7 +1015,7 @@ export interface InitOutput {
1195
1015
  readonly engine_setVectorTile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number) => [number, number];
1196
1016
  readonly engine_setVectorTileMesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => [number, number];
1197
1017
  readonly engine_setVectorTilePoints: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1198
- readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1018
+ readonly engine_setViewshed: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1199
1019
  readonly engine_setZoomRange: (a: number, b: number, c: number) => void;
1200
1020
  readonly engine_stats: (a: number) => any;
1201
1021
  readonly engine_stepFlow: (a: number, b: number, c: number) => number;
@@ -1208,12 +1028,15 @@ export interface InitOutput {
1208
1028
  readonly engine_updateGlyphPage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1209
1029
  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];
1210
1030
  readonly engine_updateIconAtlas: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1211
- readonly engine_uploadVectorTile: (a: number, b: number, c: number) => number;
1212
1031
  readonly engine_vectorTilesInView: (a: number, b: number, c: number, d: number) => [number, number];
1213
1032
  readonly engine_wantedTiles: (a: number, b: number) => [number, number];
1214
1033
  readonly engine_zoomAt: (a: number, b: number, c: number, d: number) => void;
1215
1034
  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;
1216
1035
  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];
1036
+ readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_: (a: number, b: number, c: any) => [number, number];
1037
+ readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true__130: (a: number, b: number, c: any) => [number, number];
1038
+ readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___sys__JsNullable_wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuError__GpuError___core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true__131: (a: number, b: number, c: any) => [number, number];
1039
+ readonly wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wgpu_79b597b3111bcbe9___backend__webgpu__webgpu_sys__gen_GpuDeviceLostInfo__GpuDeviceLostInfo______true_: (a: number, b: number, c: any) => void;
1217
1040
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1218
1041
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1219
1042
  readonly __wbindgen_exn_store: (a: number) => void;