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.
- package/CHANGELOG.md +48 -0
- package/README.md +4 -4
- package/dist/basemap/vectortiles/placed.js +7 -4
- package/dist/basemap/vectortiles/placed.js.map +1 -1
- package/dist/basemap/vectortiles/tiles.d.ts +1 -1
- package/dist/basemap/vectortiles/tiles.js.map +1 -1
- package/dist/basemap/workerpool.d.ts +1 -1
- package/dist/basemap/workerpool.js.map +1 -1
- package/dist/decoder.worker.js +4 -5
- package/dist/decoder.worker.js.map +6 -6
- package/dist/decoding/decoders.d.ts +1 -1
- package/dist/decoding/decoders.js.map +1 -1
- package/dist/decoding/loader.d.ts +6 -3
- package/dist/decoding/loader.js +7 -5
- package/dist/decoding/loader.js.map +1 -1
- package/dist/decoding/protocol.d.ts +3 -2
- package/dist/decoding/protocol.js.map +1 -1
- package/dist/engine-loader.d.ts +20 -18
- package/dist/engine-loader.js +45 -42
- package/dist/engine-loader.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/isard_tiles3d_bg.wasm +0 -0
- package/dist/isard_webgl2_bg.wasm +0 -0
- package/dist/isard_webgpu_bg.wasm +0 -0
- package/dist/layers/custom.d.ts +35 -29
- package/dist/layers/custom.js +60 -46
- package/dist/layers/custom.js.map +1 -1
- package/dist/layers/extrusions.js.map +1 -1
- package/dist/layers/features.js.map +1 -1
- package/dist/layers/flow.js.map +1 -1
- package/dist/layers/glyphs.d.ts +1 -1
- package/dist/layers/glyphs.js.map +1 -1
- package/dist/layers/ground.d.ts +20 -13
- package/dist/layers/ground.js +29 -8
- package/dist/layers/ground.js.map +1 -1
- package/dist/layers/icons.d.ts +1 -1
- package/dist/layers/icons.js.map +1 -1
- package/dist/layers/layers.d.ts +1 -2
- package/dist/layers/layers.js +2 -11
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/models.js +0 -4
- package/dist/layers/models.js.map +1 -1
- package/dist/layers/network.d.ts +1 -1
- package/dist/layers/network.js.map +1 -1
- package/dist/layers/panoramas.d.ts +1 -0
- package/dist/layers/panoramas.js +3 -2
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/pointclouds.d.ts +1 -1
- package/dist/layers/pointclouds.js +0 -4
- package/dist/layers/pointclouds.js.map +1 -1
- package/dist/layers/raster.js.map +1 -1
- package/dist/layers/symbols.js.map +1 -1
- package/dist/layers/tiles3d.d.ts +1 -1
- package/dist/layers/tiles3d.js +0 -4
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/layers/vectors.d.ts +4 -5
- package/dist/layers/vectors.js +7 -15
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/engine-settings.d.ts +1 -1
- package/dist/map/engine-settings.js.map +1 -1
- package/dist/map/engines.d.ts +11 -26
- package/dist/map/engines.js +10 -48
- package/dist/map/engines.js.map +1 -1
- package/dist/map/frame-loop.d.ts +1 -3
- package/dist/map/frame-loop.js +3 -3
- package/dist/map/frame-loop.js.map +1 -1
- package/dist/map/hover-pick.d.ts +9 -3
- package/dist/map/hover-pick.js +29 -6
- package/dist/map/hover-pick.js.map +1 -1
- package/dist/map/layer-stack.d.ts +2 -2
- package/dist/map/layer-stack.js +1 -3
- package/dist/map/layer-stack.js.map +1 -1
- package/dist/map/symbol-atlases.d.ts +5 -4
- package/dist/map/symbol-atlases.js +8 -13
- package/dist/map/symbol-atlases.js.map +1 -1
- package/dist/map/viewshed.d.ts +1 -1
- package/dist/map/viewshed.js.map +1 -1
- package/dist/map.d.ts +26 -20
- package/dist/map.js +93 -78
- package/dist/map.js.map +1 -1
- package/dist/react/IsardMap.d.ts +1 -1
- package/dist/react/IsardMap.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/types.d.ts +29 -18
- package/dist/types.js.map +1 -1
- package/dist/ui/interaction.d.ts +1 -1
- package/dist/ui/interaction.js.map +1 -1
- package/dist/util/animation.d.ts +1 -1
- package/dist/util/animation.js.map +1 -1
- package/dist/wasm/isard_tiles3d.d.ts +181 -0
- package/dist/wasm/isard_tiles3d.js +387 -0
- package/dist/wasm/{isard_core.d.ts → isard_webgl2.d.ts} +373 -182
- package/dist/wasm/{isard_core.js → isard_webgl2.js} +2155 -413
- package/dist/wasm/{isard.d.ts → isard_webgpu.d.ts} +176 -353
- package/dist/wasm/{isard.js → isard_webgpu.js} +1361 -1104
- package/package.json +4 -3
- package/vite.js +5 -4
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,54 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [2.0.0] - 2026-10-30
|
|
9
|
+
|
|
10
|
+
With `isard-react-native` and `isard-map` (Python) 2.0.0: the three now share their version.
|
|
11
|
+
|
|
12
|
+
The engine on WebGPU (#146), with breaking changes. From 1.x:
|
|
13
|
+
|
|
14
|
+
- `await` the answers of `map.pick` and `map.pickFeature` (a Promise now).
|
|
15
|
+
- Remove the options `tiles3d`, `wasmUrl` and `coreWasmUrl`; give the engine's files, if you serve them yourself, with
|
|
16
|
+
`webgpuWasmUrl` and `webgl2WasmUrl`.
|
|
17
|
+
- Serve the new files (`isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, `isard_tiles3d_bg.wasm`) in place of
|
|
18
|
+
`isard_bg.wasm` and `isard_core_bg.wasm` (`isard/vite` copies them).
|
|
19
|
+
- Rewrite custom layers for WebGPU: `onAdd(device, map)`, `render(device, frame)`, `onRemove(device, map)`, drawing
|
|
20
|
+
into `frame.color` (and `frame.depth`); see the guide's Custom layers page.
|
|
21
|
+
- `map.surfaceAt` may answer undefined at first: the height is measured a frame or two later.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Profiling: `bun run profile` plays camera moves on a page (an example, or any page using isard) and gives per move the
|
|
26
|
+
frames, the draw calls and state changes a frame, the engine's CPU time and its GPU time, in all and by layer.
|
|
27
|
+
`map.setGpuTiming(true)` and `map.gpuTimings()` time a frame's parts on the GPU with an engine built to profile
|
|
28
|
+
(`PROFILE=1 bun run build`: timer queries, the functions' names kept); the engines published are unchanged.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- The engine on wgpu (#146): the map draws through WebGPU, or through wgpu's WebGL2 fallback where a browser has no
|
|
33
|
+
WebGPU (`isard_webgpu_bg.wasm`, `isard_webgl2_bg.wasm`, the 3D Tiles module `isard_tiles3d_bg.wasm` for the workers),
|
|
34
|
+
in place of the WebGL2 engine (`isard_bg.wasm`, `isard_core_bg.wasm` gone, from the package's files and exports and
|
|
35
|
+
from `isard/vite` too). Its shaders in WGSL; the same layers, passes and picking. Measured on a Mac: as fast or
|
|
36
|
+
faster on every example (a region's network zooming out at 59 fps where the WebGL2 engine did 36).
|
|
37
|
+
- `map.pick` and `map.pickFeature` answer with a Promise, a frame or two later: the picking pass's pixels are read back
|
|
38
|
+
once the GPU is done (WebGPU reads nothing back at once), the main thread no longer waiting for it (#146).
|
|
39
|
+
- One engine, 3D Tiles, models, point clouds and panoramas included from the start, through WebGPU or its WebGL2
|
|
40
|
+
fallback (#146): the map no longer moves onto an engine with 3D Tiles for its first 3D layer. The options
|
|
41
|
+
`tiles3d`, `wasmUrl` and `coreWasmUrl` are gone (`webgpuWasmUrl` and `webgl2WasmUrl` for the engine's files).
|
|
42
|
+
- Custom layers draw with WebGPU (#146): `onAdd(device, map)`, `render(device, frame)` and `onRemove(device, map)` get the
|
|
43
|
+
map's `GPUDevice`; `render` draws into the layer's targets (`frame.color`, and `frame.depth` in the '3d' mode, the
|
|
44
|
+
scene's depth to test against), laid over the frame at the layer's place; `frame.matrixAt` is in WebGPU's clip depth.
|
|
45
|
+
On the WebGL2 fallback, custom layers are not drawn. The three.js example on three's WebGPU renderer.
|
|
46
|
+
- `map.surfaceAt` answers undefined until the position is measured: the scene is drawn looking down at it after a
|
|
47
|
+
frame and read back a frame or two later, the answer kept and measured again every 250 ms at most (#146).
|
|
48
|
+
`map.pickSurface` answers at once from the last copy of the scene's depth, a frame or two old, without waiting for the
|
|
49
|
+
GPU.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- The trees and street furniture placed over a vector basemap are the same whether the relief under the view's center
|
|
54
|
+
came before or after them (chosen from the camera's scale, not the ground's).
|
|
55
|
+
|
|
8
56
|
## [1.16.0] - 2026-10-29
|
|
9
57
|
|
|
10
58
|
With `isard-react-native` 0.5.0 and `isard-map` 0.5.0 (Python).
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**Maps that recolor at every mouse move.**
|
|
8
8
|
|
|
9
|
-
A
|
|
9
|
+
A WebGPU map engine (WebGL2 where a browser has no WebGPU) for large, interactive data layers, labels and 3D Tiles.<br />
|
|
10
10
|
Rust core in WebAssembly, a small TypeScript API.
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/isard)
|
|
@@ -51,7 +51,7 @@ General-purpose map libraries spend their time on things these maps do not need.
|
|
|
51
51
|
models in 3D Tiles (Draco, meshopt, KTX2).
|
|
52
52
|
- ☁️ **Point clouds.** LiDAR in COPC read by range requests (the IGN's LiDAR HD, reprojected from Lambert-93 onto the
|
|
53
53
|
relief), 3D Tiles points; colored by RGB, class, altitude or intensity, Eye-Dome Lighting, a point budget, picked.
|
|
54
|
-
- 🧊 **Your own 3D.** glTF models at positions, instanced and picked; custom layers for your
|
|
54
|
+
- 🧊 **Your own 3D.** glTF models at positions, instanced and picked; custom layers for your WebGPU code or a three.js
|
|
55
55
|
scene, in the map's frame and depth, with camera-relative matrices exact at any zoom.
|
|
56
56
|
- 🦀 **Small and exact.** 278 KB of WebAssembly gzipped (452 KB once a 3D Tiles layer, a model or a point cloud is added), f64 on the CPU and f32 relative to the camera on the GPU
|
|
57
57
|
(centimetres at any zoom), frames on demand only, strict TypeScript types end to end.
|
|
@@ -126,7 +126,7 @@ Live in the [documentation](https://ideal-adventure-zqn6y6p.pages.github.io/exam
|
|
|
126
126
|
| [glTF models](https://ideal-adventure-zqn6y6p.pages.github.io/layers/models) | `addModels` | a glTF model at many positions, instanced, on the relief, picked |
|
|
127
127
|
| [Point clouds](https://ideal-adventure-zqn6y6p.pages.github.io/layers/pointclouds) | `addPointCloud` | COPC (LiDAR HD) by range requests, pnts and glTF points; by class, altitude, intensity, EDL |
|
|
128
128
|
| [Flows](https://ideal-adventure-zqn6y6p.pages.github.io/layers/flows) | `addFlow`, `readGrids` | particles carried by a wind or a current, a model's hours along a clock, its GRIB2 and NetCDF files read in workers, the wind through a city's streets (`streetWind`) |
|
|
129
|
-
| [Custom layers](https://ideal-adventure-zqn6y6p.pages.github.io/layers/custom) | `addCustomLayer` | your
|
|
129
|
+
| [Custom layers](https://ideal-adventure-zqn6y6p.pages.github.io/layers/custom) | `addCustomLayer` | your WebGPU code or a three.js scene in the map's frame, tested against its depth |
|
|
130
130
|
|
|
131
131
|
Plus markers, popups, controls, picking within a radius, `easeTo`, `flyTo`, a sky and fog for tilted views. All in
|
|
132
132
|
the [API reference](https://ideal-adventure-zqn6y6p.pages.github.io/api).
|
|
@@ -167,7 +167,7 @@ drives both. Each crate has its README; [crates/README.md](crates/README.md) gui
|
|
|
167
167
|
crates/geo/ camera, projections, geodesy and geoid, tile selection, label placement, polygons tested natively
|
|
168
168
|
crates/tiles3d/ 3D Tiles tree, traversal and decoding tested natively
|
|
169
169
|
crates/pointcloud/ COPC point clouds: header, octree hierarchy, traversal, LAZ chunks tested natively
|
|
170
|
-
crates/engine/
|
|
170
|
+
crates/engine-wgpu/ the WebAssembly engine on wgpu (WebGPU, or its WebGL2 fallback): the ground, the layers, picking
|
|
171
171
|
crates/tess/ the tessellation module: vector tiles made ready for the GPU in the basemap workers
|
|
172
172
|
crates/grid/ the grid module: GRIB2 and NetCDF files read into grids, the wind through the streets tested natively
|
|
173
173
|
packages/isard/ the npm package isard: GeoMap, layer handles, overlays, workers
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* each kind one instanced model layer: all of them near the ground under the camera, fewer and fewer past it (a
|
|
4
4
|
* simplified model there when the kind has one), the tiles following the view.
|
|
5
5
|
*/
|
|
6
|
-
import { METRES_PER_DEGREE, RAD } from "../../util/geo.js";
|
|
6
|
+
import { EARTH_METRES, METRES_PER_DEGREE, RAD } from "../../util/geo.js";
|
|
7
7
|
import { PLACED_KIND, PLACED_NUMBERS, PLACED_RANK } from "../placed.js";
|
|
8
8
|
import { TileRequests } from "./requests.js";
|
|
9
9
|
import { nearPriority, tileKey, tilesAround } from "./tiles.js";
|
|
@@ -13,10 +13,13 @@ const FOV = 0.6435011087932844;
|
|
|
13
13
|
* zoomed as much): going through the tiles' things at every frame of a drag would hold the main thread */
|
|
14
14
|
const RESEND_SHARE = 0.05;
|
|
15
15
|
/** The ground under the camera: east and north metres from the view's center, and its distance from it (the camera
|
|
16
|
-
* stands behind the center of a tilted view, `FOV` its field of view)
|
|
16
|
+
* stands behind the center of a tilted view, `FOV` its field of view). The camera's own scale at the center (512
|
|
17
|
+
* pixels a tile), not the ground's under it (`metersPerPixel`): the things chosen the same before and after the relief
|
|
18
|
+
* there has come */
|
|
17
19
|
const groundUnderCamera = (map) => {
|
|
18
|
-
const { pitch, bearing } = map.getCamera();
|
|
19
|
-
const
|
|
20
|
+
const { center, zoom, pitch, bearing } = map.getCamera();
|
|
21
|
+
const metresPerPixel = (EARTH_METRES * Math.cos(center[1] * RAD)) / (512 * 2 ** zoom);
|
|
22
|
+
const back = ((0.5 * map.getCanvas().clientHeight) / Math.tan(FOV / 2)) * Math.sin(pitch * RAD) * metresPerPixel;
|
|
20
23
|
return [-back * Math.sin(bearing * RAD), -back * Math.cos(bearing * RAD), back];
|
|
21
24
|
};
|
|
22
25
|
/** What follows the camera as it moves: `send` called again once it has gone `RESEND_SHARE` of `radius` metres (or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placed.js","sourceRoot":"","sources":["../../../src/basemap/vectortiles/placed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhE,qHAAqH;AACrH,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B;0GAC0G;AAC1G,MAAM,YAAY,GAAG,IAAI,CAAC;AAyB1B;yEACyE;AACzE,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAmD,EAAE;IACzF,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC;IAC3C,MAAM,IAAI,GACR,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnH,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAClF,CAAC,CAAC;AAEF;6DAC6D;AAC7D,MAAM,eAAe,GAAG,CAAC,GAAW,E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,CAAC,CAAC;IAEF,+GAA+G;IAC/G,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\n * Things placed by the workers in a vector basemap's tiles around the view (trees, street lamps, street furniture),\n * each kind one instanced model layer: all of them near the ground under the camera, fewer and fewer past it (a\n * simplified model there when the kind has one), the tiles following the view.\n */\n\nimport type { Layer } from '../../layers/layers.ts';\nimport type { ModelLayer, ModelOptions } from '../../layers/models.ts';\nimport type { GeoMap } from '../../map.ts';\nimport { METRES_PER_DEGREE, RAD } from '../../util/geo.ts';\nimport type { BasemapResponse, BasemapWork, Priority } from '../../workers/basemap/protocol.ts';\nimport { PLACED_KIND, PLACED_NUMBERS, PLACED_RANK } from '../placed.ts';\nimport type { StyleLayer } from '../vectorstyle.ts';\nimport type { VectorTilesContext } from './context.ts';\nimport { TileRequests } from './requests.ts';\nimport { nearPriority, tileKey, tilesAround } from './tiles.ts';\n\n/** The engine's vertical field of view (radians, `camera::FOV`): where the camera stands behind the view's center */\nconst FOV = 0.6435011087932844;\n\n/** While the camera moves, the things chosen again once it has gone this share of the near radius (or turned or\n * zoomed as much): going through the tiles' things at every frame of a drag would hold the main thread */\nconst RESEND_SHARE = 0.05;\n\n/** A model: a glTF binary's URL or bytes */\ntype Model = Pick<ModelOptions, 'url' | 'data'>;\n\ninterface PlacedOptions {\n /** A model per kind (`PLACED_KIND`); a kind past them drawn with the first */\n models: [Model, ...Model[]];\n /** Past `near`, the kinds' simplified models (as many), drawn `density` times as densely as the full ones would\n * be, at most `instances` times `maxInstances` */\n far?: { models: Model[]; density: number; instances: number };\n /** The style layers the renderer sends the workers (the tiles' source and its levels) */\n layers: (layer: StyleLayer) => boolean;\n /** The work asked of the worker of a tile (`layers`: the renderer's), and the things in its answer */\n work: (key: string, z: number, x: number, y: number, priority: Priority, layers: StyleLayer[]) => BasemapWork;\n read: (response: BasemapResponse) => Float64Array | undefined;\n /** Metres around the ground under the camera where every one is drawn at a zoom (twice as far a zoom level out) */\n near: [metres: number, zoom: number];\n minZoom: number;\n maxTiles: number;\n /** Things drawn at most, all kinds together (and `far.instances` times as many simplified) */\n maxInstances: number;\n before?: Layer;\n}\n\n/** The ground under the camera: east and north metres from the view's center, and its distance from it (the camera\n * stands behind the center of a tilted view, `FOV` its field of view) */\nconst groundUnderCamera = (map: GeoMap): [east: number, north: number, distance: number] => {\n const { pitch, bearing } = map.getCamera();\n const back =\n ((0.5 * map.getCanvas().clientHeight) / Math.tan(FOV / 2)) * Math.sin(pitch * RAD) * (map.metersPerPixel() ?? 0);\n\n return [-back * Math.sin(bearing * RAD), -back * Math.cos(bearing * RAD), back];\n};\n\n/** What follows the camera as it moves: `send` called again once it has gone `RESEND_SHARE` of `radius` metres (or\n * turned or zoomed as much), not at every frame of a drag */\nconst followWhenMoved = (map: GeoMap, radius: (zoom: number) => number, send: () => void): (() => void) => {\n /** The view of the last call: center (metres), zoom, bearing, pitch */\n let sent: [number, number, number, number, number] | undefined;\n\n return () => {\n const { center, zoom, bearing, pitch } = map.getCamera();\n const [x, y] = [center[0] * METRES_PER_DEGREE * Math.cos(center[1] * RAD), center[1] * METRES_PER_DEGREE];\n\n if (\n sent &&\n Math.hypot(x - sent[0], y - sent[1]) < RESEND_SHARE * radius(zoom) &&\n Math.abs(zoom - sent[2]) < RESEND_SHARE &&\n Math.abs(bearing - sent[3]) < 45 * RESEND_SHARE &&\n Math.abs(pitch - sent[4]) < 45 * RESEND_SHARE\n )\n return;\n sent = [x, y, zoom, bearing, pitch];\n send();\n };\n};\n\n/** The layers of the things placed: one per kind, then one per kind's simplified model; the first holds the others\n * (`Layer.companions`) */\nexport const placed = (context: VectorTilesContext, options: PlacedOptions): [ModelLayer, ...ModelLayer[]] => {\n const { map } = context;\n const { models, far, minZoom, maxTiles, maxInstances } = options;\n const add = (model: Model) =>\n map.addModels({ ...model, instances: [], ...(options.before ? { before: options.before } : {}) });\n const [model, ...more] = models;\n const layers: [ModelLayer, ...ModelLayer[]] = [add(model), ...more.map(add), ...(far?.models ?? []).map(add)];\n const renderer = context.renderer(options.layers, []);\n const radius = (zoom: number) => options.near[0] * 2 ** (options.near[1] - zoom);\n\n renderer.catch(() => undefined);\n layers[0].companions.push(...layers.slice(1));\n context.layers.push(...layers);\n\n const requests = new TileRequests();\n const found = new Map<string, Float64Array>();\n /** The things drawn: all of them near the ground under the camera; past it those of a rank under `density` (near /\n * distance)², simplified; at most `maxInstances` near, `far.instances` times as many past (beyond, the rank kept\n * lowered in proportion: no sort) */\n const send = () => {\n const { center, zoom } = map.getCamera();\n const cos = Math.cos(center[1] * RAD);\n const [ex, ey, back] = groundUnderCamera(map);\n const near = radius(zoom) + back;\n const density = far?.density ?? 1;\n /** Each thing that may be drawn: in full (near, or every one without simplified models) or simplified, with its\n * score (the lowest kept first) */\n const visit = (each: (t: Float64Array, at: number, full: boolean, score: number) => void) => {\n found.forEach((t) => {\n for (let at = 0; at < t.length; at += PLACED_NUMBERS) {\n const dx = ((t[at] ?? 0) - center[0]) * METRES_PER_DEGREE * cos - ex;\n const dy = ((t[at + 1] ?? 0) - center[1]) * METRES_PER_DEGREE - ey;\n const distance = (dx * dx + dy * dy) / (near * near);\n const rank = t[at + PLACED_RANK] ?? 0;\n\n if (distance <= 1) each(t, at, true, rank);\n else if (rank * (distance / density) < 1) each(t, at, !far, rank * (distance / density));\n }\n });\n };\n let [fullCount, farCount] = [0, 0];\n\n visit((_, __, full) => {\n if (full) fullCount += 1;\n else farCount += 1;\n });\n\n const limits = [\n Math.min(1, maxInstances / Math.max(fullCount, 1)),\n Math.min(1, (maxInstances * (far?.instances ?? 1)) / Math.max(farCount, 1)),\n ];\n // The engine's numbers: longitude, latitude, altitude, heading, pitch, roll, scale\n const out: number[][] = layers.map(() => []);\n\n visit((t, at, full, score) => {\n if (score >= (limits[full ? 0 : 1] ?? 1)) return;\n\n const kind = t[at + PLACED_KIND] ?? 0;\n const k = (full ? 0 : models.length) + (kind < models.length ? kind : 0);\n\n out[k]?.push(t[at] ?? 0, t[at + 1] ?? 0, 0, t[at + 3] ?? 0, 0, 0, t[at + 2] ?? 1);\n });\n layers.forEach((layer, k) => {\n layer.setInstanceNumbers(Float64Array.from(out[k] ?? []));\n });\n };\n const update = async () => {\n if (context.destroyed()) return;\n\n const { key, maxzoom: z, layers: list } = await renderer;\n const camera = map.getCamera();\n const wanted = camera.zoom < minZoom ? [] : tilesAround(map, camera, z, maxTiles);\n const keys = new Set(wanted.map(([x, y]) => tileKey(z, x, y)));\n\n // Out of view: dropped, or no longer asked for\n requests\n .keys()\n .filter((k) => !keys.has(k))\n .forEach((k) => {\n requests.drop(k);\n found.delete(k);\n });\n // Dense around the new center\n send();\n wanted.forEach(([x, y], index) => {\n const k = tileKey(z, x, y);\n\n if (requests.has(k)) return;\n requests.ask(\n k,\n (signal) => context.request(z, x, y, options.work(key, z, x, y, nearPriority(index), list), signal),\n (r) => {\n const things = options.read(r);\n\n if (!things) return;\n found.set(k, things);\n send();\n },\n );\n });\n };\n\n // While the camera moves, the things drawn follow it (dense near it), chosen again once it has gone far enough\n context.followView(layers[0], update, requests, followWhenMoved(map, radius, send));\n\n return layers;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"placed.js","sourceRoot":"","sources":["../../../src/basemap/vectortiles/placed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhE,qHAAqH;AAC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,CAAC,CAAC,CAAC,CAAC;YACjB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACL,8BAA8B;QAC9B,IAAI,EAAE,CAAC;QACP,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YAC/B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAE3B,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,OAAO;YAC5B,QAAQ,CAAC,GAAG,CACV,CAAC,EACD,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,EACnG,CAAC,CAAC,EAAE,EAAE;gBACJ,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAE/B,IAAI,CAAC,MAAM;oBAAE,OAAO;gBACpB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gBACrB,IAAI,EAAE,CAAC;YACT,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,+GAA+G;IAC/G,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\n * Things placed by the workers in a vector basemap's tiles around the view (trees, street lamps, street furniture),\n * each kind one instanced model layer: all of them near the ground under the camera, fewer and fewer past it (a\n * simplified model there when the kind has one), the tiles following the view.\n */\n\nimport type { Layer } from '../../layers/layers.ts';\nimport type { ModelLayer, ModelOptions } from '../../layers/models.ts';\nimport type { GeoMap } from '../../map.ts';\nimport { EARTH_METRES, METRES_PER_DEGREE, RAD } from '../../util/geo.ts';\nimport type { BasemapResponse, BasemapWork, Priority } from '../../workers/basemap/protocol.ts';\nimport { PLACED_KIND, PLACED_NUMBERS, PLACED_RANK } from '../placed.ts';\nimport type { StyleLayer } from '../vectorstyle.ts';\nimport type { VectorTilesContext } from './context.ts';\nimport { TileRequests } from './requests.ts';\nimport { nearPriority, tileKey, tilesAround } from './tiles.ts';\n\n/** The engine's vertical field of view (radians, `camera::FOV`): where the camera stands behind the view's center */\nconst FOV = 0.6435011087932844;\n\n/** While the camera moves, the things chosen again once it has gone this share of the near radius (or turned or\n * zoomed as much): going through the tiles' things at every frame of a drag would hold the main thread */\nconst RESEND_SHARE = 0.05;\n\n/** A model: a glTF binary's URL or bytes */\ntype Model = Pick<ModelOptions, 'url' | 'data'>;\n\ninterface PlacedOptions {\n /** A model per kind (`PLACED_KIND`); a kind past them drawn with the first */\n models: [Model, ...Model[]];\n /** Past `near`, the kinds' simplified models (as many), drawn `density` times as densely as the full ones would\n * be, at most `instances` times `maxInstances` */\n far?: { models: Model[]; density: number; instances: number };\n /** The style layers the renderer sends the workers (the tiles' source and its levels) */\n layers: (layer: StyleLayer) => boolean;\n /** The work asked of the worker of a tile (`layers`: the renderer's), and the things in its answer */\n work: (key: string, z: number, x: number, y: number, priority: Priority, layers: StyleLayer[]) => BasemapWork;\n read: (response: BasemapResponse) => Float64Array | undefined;\n /** Metres around the ground under the camera where every one is drawn at a zoom (twice as far a zoom level out) */\n near: [metres: number, zoom: number];\n minZoom: number;\n maxTiles: number;\n /** Things drawn at most, all kinds together (and `far.instances` times as many simplified) */\n maxInstances: number;\n before?: Layer;\n}\n\n/** The ground under the camera: east and north metres from the view's center, and its distance from it (the camera\n * stands behind the center of a tilted view, `FOV` its field of view). The camera's own scale at the center (512\n * pixels a tile), not the ground's under it (`metersPerPixel`): the things chosen the same before and after the relief\n * there has come */\nconst groundUnderCamera = (map: GeoMap): [east: number, north: number, distance: number] => {\n const { center, zoom, pitch, bearing } = map.getCamera();\n const metresPerPixel = (EARTH_METRES * Math.cos(center[1] * RAD)) / (512 * 2 ** zoom);\n const back = ((0.5 * map.getCanvas().clientHeight) / Math.tan(FOV / 2)) * Math.sin(pitch * RAD) * metresPerPixel;\n\n return [-back * Math.sin(bearing * RAD), -back * Math.cos(bearing * RAD), back];\n};\n\n/** What follows the camera as it moves: `send` called again once it has gone `RESEND_SHARE` of `radius` metres (or\n * turned or zoomed as much), not at every frame of a drag */\nconst followWhenMoved = (map: GeoMap, radius: (zoom: number) => number, send: () => void): (() => void) => {\n /** The view of the last call: center (metres), zoom, bearing, pitch */\n let sent: [number, number, number, number, number] | undefined;\n\n return () => {\n const { center, zoom, bearing, pitch } = map.getCamera();\n const [x, y] = [center[0] * METRES_PER_DEGREE * Math.cos(center[1] * RAD), center[1] * METRES_PER_DEGREE];\n\n if (\n sent &&\n Math.hypot(x - sent[0], y - sent[1]) < RESEND_SHARE * radius(zoom) &&\n Math.abs(zoom - sent[2]) < RESEND_SHARE &&\n Math.abs(bearing - sent[3]) < 45 * RESEND_SHARE &&\n Math.abs(pitch - sent[4]) < 45 * RESEND_SHARE\n )\n return;\n sent = [x, y, zoom, bearing, pitch];\n send();\n };\n};\n\n/** The layers of the things placed: one per kind, then one per kind's simplified model; the first holds the others\n * (`Layer.companions`) */\nexport const placed = (context: VectorTilesContext, options: PlacedOptions): [ModelLayer, ...ModelLayer[]] => {\n const { map } = context;\n const { models, far, minZoom, maxTiles, maxInstances } = options;\n const add = (model: Model) =>\n map.addModels({ ...model, instances: [], ...(options.before ? { before: options.before } : {}) });\n const [model, ...more] = models;\n const layers: [ModelLayer, ...ModelLayer[]] = [add(model), ...more.map(add), ...(far?.models ?? []).map(add)];\n const renderer = context.renderer(options.layers, []);\n const radius = (zoom: number) => options.near[0] * 2 ** (options.near[1] - zoom);\n\n renderer.catch(() => undefined);\n layers[0].companions.push(...layers.slice(1));\n context.layers.push(...layers);\n\n const requests = new TileRequests();\n const found = new Map<string, Float64Array>();\n /** The things drawn: all of them near the ground under the camera; past it those of a rank under `density` (near /\n * distance)², simplified; at most `maxInstances` near, `far.instances` times as many past (beyond, the rank kept\n * lowered in proportion: no sort) */\n const send = () => {\n const { center, zoom } = map.getCamera();\n const cos = Math.cos(center[1] * RAD);\n const [ex, ey, back] = groundUnderCamera(map);\n const near = radius(zoom) + back;\n const density = far?.density ?? 1;\n /** Each thing that may be drawn: in full (near, or every one without simplified models) or simplified, with its\n * score (the lowest kept first) */\n const visit = (each: (t: Float64Array, at: number, full: boolean, score: number) => void) => {\n found.forEach((t) => {\n for (let at = 0; at < t.length; at += PLACED_NUMBERS) {\n const dx = ((t[at] ?? 0) - center[0]) * METRES_PER_DEGREE * cos - ex;\n const dy = ((t[at + 1] ?? 0) - center[1]) * METRES_PER_DEGREE - ey;\n const distance = (dx * dx + dy * dy) / (near * near);\n const rank = t[at + PLACED_RANK] ?? 0;\n\n if (distance <= 1) each(t, at, true, rank);\n else if (rank * (distance / density) < 1) each(t, at, !far, rank * (distance / density));\n }\n });\n };\n let [fullCount, farCount] = [0, 0];\n\n visit((_, __, full) => {\n if (full) fullCount += 1;\n else farCount += 1;\n });\n\n const limits = [\n Math.min(1, maxInstances / Math.max(fullCount, 1)),\n Math.min(1, (maxInstances * (far?.instances ?? 1)) / Math.max(farCount, 1)),\n ];\n // The engine's numbers: longitude, latitude, altitude, heading, pitch, roll, scale\n const out: number[][] = layers.map(() => []);\n\n visit((t, at, full, score) => {\n if (score >= (limits[full ? 0 : 1] ?? 1)) return;\n\n const kind = t[at + PLACED_KIND] ?? 0;\n const k = (full ? 0 : models.length) + (kind < models.length ? kind : 0);\n\n out[k]?.push(t[at] ?? 0, t[at + 1] ?? 0, 0, t[at + 3] ?? 0, 0, 0, t[at + 2] ?? 1);\n });\n layers.forEach((layer, k) => {\n layer.setInstanceNumbers(Float64Array.from(out[k] ?? []));\n });\n };\n const update = async () => {\n if (context.destroyed()) return;\n\n const { key, maxzoom: z, layers: list } = await renderer;\n const camera = map.getCamera();\n const wanted = camera.zoom < minZoom ? [] : tilesAround(map, camera, z, maxTiles);\n const keys = new Set(wanted.map(([x, y]) => tileKey(z, x, y)));\n\n // Out of view: dropped, or no longer asked for\n requests\n .keys()\n .filter((k) => !keys.has(k))\n .forEach((k) => {\n requests.drop(k);\n found.delete(k);\n });\n // Dense around the new center\n send();\n wanted.forEach(([x, y], index) => {\n const k = tileKey(z, x, y);\n\n if (requests.has(k)) return;\n requests.ask(\n k,\n (signal) => context.request(z, x, y, options.work(key, z, x, y, nearPriority(index), list), signal),\n (r) => {\n const things = options.read(r);\n\n if (!things) return;\n found.set(k, things);\n send();\n },\n );\n });\n };\n\n // While the camera moves, the things drawn follow it (dense near it), chosen again once it has gone far enough\n context.followView(layers[0], update, requests, followWhenMoved(map, radius, send));\n\n return layers;\n};\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* for in, and the defaults the layers share.
|
|
4
4
|
*/
|
|
5
5
|
import type { GeoMap } from '../../map.ts';
|
|
6
|
-
import type { Camera } from '../../wasm/
|
|
6
|
+
import type { Camera } from '../../wasm/isard_webgpu.js';
|
|
7
7
|
import type { Priority } from '../../workers/basemap/protocol.ts';
|
|
8
8
|
/** A tile: its level and its column and row at that level */
|
|
9
9
|
export type TileTriple = [z: number, x: number, y: number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiles.js","sourceRoot":"","sources":["../../../src/basemap/vectortiles/tiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOzD,iGAAiG;AACjG,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,wFAAwF;AACxF,MAAM,CAAC,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C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;IAEnH,2EAA2E;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACxD,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QACjB,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAEtB,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEZ,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,CAAC","sourcesContent":["/**\n * The tiles of the vector layers (`VectorTiles`): the tiles around the view, their keys, the order they are asked\n * for in, and the defaults the layers share.\n */\n\nimport type { GeoMap } from '../../map.ts';\nimport { mercatorX, mercatorY } from '../../util/geo.ts';\nimport type { Camera } from '../../wasm/
|
|
1
|
+
{"version":3,"file":"tiles.js","sourceRoot":"","sources":["../../../src/basemap/vectortiles/tiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE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AAC,CAAC,EAAE,CAAC,EAAoB,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAC1F,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;IAEnH,2EAA2E;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACxD,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QACjB,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAEtB,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEZ,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxB,CAAC,CAAC","sourcesContent":["/**\n * The tiles of the vector layers (`VectorTiles`): the tiles around the view, their keys, the order they are asked\n * for in, and the defaults the layers share.\n */\n\nimport type { GeoMap } from '../../map.ts';\nimport { mercatorX, mercatorY } from '../../util/geo.ts';\nimport type { Camera } from '../../wasm/isard_webgpu.js';\nimport type { Priority } from '../../workers/basemap/protocol.ts';\n\n/** A tile: its level and its column and row at that level */\nexport type TileTriple = [z: number, x: number, y: number];\n\n/** Street level: the zoom the extrusions, the streets' wind and the trees start at by default */\nexport const STREET_ZOOM = 15;\n\n/** Tiles of a layer that follows the view, by default (the extrusions', the labels') */\nexport const MAX_TILES = 36;\n\n/** Tiles nearest to the center asked for first: the others wait (for the raster tiles, for instance) */\nconst NEAR_TILES = 4;\n\n/** Milliseconds between two updates of the tiles of a layer while the camera moves */\nexport const VECTOR_MOVE_REFRESH_MS = 250;\n\n/** A tile's key, `z/x/y` */\nexport const tileKey = (z: number, x: number, y: number): string => `${z}/${x}/${y}`;\n\n/** The tile of a key `z/x/y` (zeros for the numbers it lacks) */\nexport const parseTileKey = (key: string): TileTriple => {\n const [z = 0, x = 0, y = 0] = key.split('/').map(Number);\n\n return [z, x, y];\n};\n\n/** The tiles of the engine's flat list of z, x, y triples */\nexport const tileTriples = (list: Uint32Array): TileTriple[] =>\n Array.from(\n { length: Math.floor(list.length / 3) },\n (_, i): TileTriple => [list[i * 3] ?? 0, list[i * 3 + 1] ?? 0, list[i * 3 + 2] ?? 0],\n );\n\n/** The priority of the `index`th tile asked for, the nearest first: `near` for the first `NEAR_TILES`, `far` after */\nexport const nearPriority = (index: number, near: Priority = 'auto', far: Priority = 'low'): Priority =>\n index < NEAR_TILES ? near : far;\n\n/** A tile's column at level `z` brought back into the world (the columns past the antimeridian are those of its other\n * side) */\nexport const wrapColumn = (x: number, z: number): number => {\n const n = 2 ** z;\n\n return ((x % n) + n) % n;\n};\n\n/**\n * The tiles of level `z` in view, within a window around the center (a tilted view's bounds reach far), the\n * `maxTiles` nearest to the center first. Across the antimeridian, the window's columns go on round the world (the\n * view's bounds, which stop at ±180°, no longer limit them)\n */\nexport const tilesAround = (map: GeoMap, camera: Camera, z: number, maxTiles: number): [x: number, y: number][] => {\n const n = 2 ** z;\n const [west, south, east, north] = map.getBounds();\n const tx = (lon: number) => Math.floor(mercatorX(lon) * n);\n const ty = (lat: number) => Math.floor(mercatorY(lat) * n);\n const [cx, cy] = [mercatorX(camera.center[0]) * n, mercatorY(camera.center[1]) * n];\n const reach = Math.ceil(Math.sqrt(maxTiles)) + 2;\n const [left, right] = [Math.floor(cx) - reach, Math.floor(cx) + reach];\n const across = left < 0 || right > n - 1;\n const [x0, x1] = across ? [left, right] : [Math.max(left, tx(west)), Math.min(right, tx(east))];\n const [y0, y1] = [Math.max(0, ty(north), Math.floor(cy) - reach), Math.min(n - 1, ty(south), Math.floor(cy) + reach)];\n const wanted = Array.from({ length: Math.max(0, y1 - y0 + 1) }, (_, j) => y0 + j).flatMap((y) =>\n Array.from({ length: Math.max(0, x1 - x0 + 1) }, (_, i): [number, number] => [x0 + i, y]),\n );\n\n wanted.sort((a, b) => Math.hypot(a[0] + 0.5 - cx, a[1] + 0.5 - cy) - Math.hypot(b[0] + 0.5 - cx, b[1] + 0.5 - cy));\n\n // Each tile once (at a low level, the window can go round the whole world)\n const seen = new Set<string>();\n\n return wanted\n .map(([x, y]): [number, number] => [wrapColumn(x, z), y])\n .filter(([x, y]) => {\n const k = `${x}/${y}`;\n\n if (seen.has(k)) return false;\n seen.add(k);\n\n return true;\n })\n .slice(0, maxTiles);\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The pool of basemap workers the vector tiles share: a vector tile always goes to the same worker (its decoded copy
|
|
2
2
|
* kept there), the requests of an owner cancelled together, the renderers broadcast to every worker */
|
|
3
|
-
import type { Camera } from '../wasm/
|
|
3
|
+
import type { Camera } from '../wasm/isard_webgpu.js';
|
|
4
4
|
import type { Priority } from '../workers/basemap/protocol.ts';
|
|
5
5
|
/** Default size of a basemap worker pool: cores - 1, 1 to `most` (4 by default, fewer at a lower quality) */
|
|
6
6
|
export declare const defaultWorkerCount: (most?: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerpool.js","sourceRoot":"","sources":["../../src/basemap/workerpool.ts"],"names":[],"mappings":"A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L,CAAC;CACF","sourcesContent":["/** The pool of basemap workers the vector tiles share: a vector tile always goes to the same worker (its decoded copy\n * kept there), the requests of an owner cancelled together, the renderers broadcast to every worker */\n\nimport { assetUrl } from '../engine-loader.ts';\nimport type { GridDescription } from '../grid-module.ts';\nimport { mercatorX, mercatorY } from '../util/geo.ts';\nimport { headerRules, onHeaderRules } from '../util/requests.ts';\nimport type { Camera } from '../wasm/isard.js';\nimport type { BasemapRequest, BasemapResponse, BasemapWork, Priority } from '../workers/basemap/protocol.ts';\nimport { type Job, SOURCE_CACHE } from './resample.ts';\nimport type { PngEncoding } from './terrain.ts';\n\n/** Default size of a basemap worker pool: cores - 1, 1 to `most` (4 by default, fewer at a lower quality) */\nexport const defaultWorkerCount = (most = 4): number => {\n return Math.min(most, Math.max(1, (typeof navigator !== 'undefined' ? navigator.hardwareConcurrency || 2 : 2) - 1));\n};\n\n/** Default URL of the basemap worker: in the page's assets folder (`isard/vite`), else next to the module */\nexport const defaultWorkerUrl = (assetsUrl?: string | URL): string | URL => {\n return assetUrl('basemap.worker.js', undefined, assetsUrl);\n};\n\n/** Fetch priority of a raster tile drawn by the workers: 'high' near the center of the view, at the current zoom or\n * coarser; 'low' far from it or finer (prefetch); 'auto' between */\nexport const tilePriority = (z: number, x: number, y: number, camera: Pick<Camera, 'center' | 'zoom'>): Priority => {\n // A raster tile of level z covers the map at zoom z - 1\n if (z - 1 > camera.zoom + 1) return 'low';\n\n const n = 2 ** z;\n const [lon, lat] = camera.center;\n const cx = mercatorX(lon) * n;\n const cy = mercatorY(lat) * n;\n // Across the antimeridian, the short way\n const along = Math.abs(x + 0.5 - cx) % n;\n const dx = Math.min(along, n - along);\n const d = Math.hypot(dx, y + 0.5 - cy);\n\n if (d <= 1.5) return 'high';\n\n return d >= 4 ? 'low' : 'auto';\n};\n\n/** The worker of a vector tile among `count`: always the same one */\nexport const workerIndex = (vz: number, vx: number, vy: number, count: number): number => {\n // Unsigned: every worker gets its share\n return ((Math.imul(vx, 73856093) ^ Math.imul(vy, 19349663) ^ vz) >>> 0) % Math.max(1, count);\n};\n\n/** The worker-side key of a renderer: unique across the `VectorTiles` sharing a pool */\nexport const rendererKey = (namespace: string, n: number): string => {\n return `${namespace}:r${n}`;\n};\n\n/** What the pool needs of a worker (a `Worker`, or a stand-in in tests) */\nexport type PoolWorker = Pick<Worker, 'postMessage' | 'terminate' | 'onmessage' | 'onerror' | 'onmessageerror'>;\n\n/**\n * @internal Workers drawing vector tiles, shared by the `VectorTiles` of a map: each vector tile always goes to the\n * same worker, which keeps it decoded for every style drawn from it. Requests are tracked one by one, with their\n * owner, so that one `VectorTiles` going away cancels its own requests only.\n */\nexport class BasemapWorkers {\n private readonly workers: [PoolWorker, ...PoolWorker[]];\n private readonly pending = new Map<\n number,\n { resolve: (r: BasemapResponse) => void; reject: (e: Error) => void; worker: PoolWorker; owner: object }\n >();\n private next = 1;\n /** The workers that answered once (they loaded), and those that failed before: dead, their error given at once to\n * any request still sent their way */\n private readonly answered = new WeakSet<PoolWorker>();\n private readonly dead = new Map<PoolWorker, Error>();\n /** The worker the next file of grids goes to, in turn */\n private turn = 0;\n private namespaces = 0;\n private terminated = false;\n /** Stops following the page's request headers */\n private readonly unfollow: () => void;\n\n constructor(\n readonly count: number,\n readonly url: string | URL,\n create: (url: string | URL) => PoolWorker = (u) => new Worker(u, { type: 'module' }),\n ) {\n const start = (): PoolWorker => {\n const worker = create(url);\n\n worker.onmessage = ({ data }: MessageEvent<BasemapResponse>) => {\n this.answered.add(worker);\n\n const p = this.pending.get(data.id);\n\n if (!p) return;\n this.pending.delete(data.id);\n if ('error' in data) p.reject(new Error(data.error));\n else p.resolve(data);\n };\n // A worker that fails to load (a bundler serving it from elsewhere) or to read a message fails its requests; one\n // that never answered is dead: its tiles go to the others, and with none left every request fails at once\n worker.onerror = (event) => {\n event.preventDefault();\n\n const error = this.fail(\n worker,\n `the vector basemap worker ${url} failed${event.message ? `: ${event.message}` : ''}`,\n );\n\n if (!this.answered.has(worker)) this.dead.set(worker, error);\n };\n worker.onmessageerror = () => this.fail(worker, `the vector basemap worker ${url} sent an unreadable message`);\n\n const rules = headerRules();\n\n if (rules.length > 0) worker.postMessage({ type: 'headers', rules } satisfies BasemapRequest);\n\n return worker;\n };\n\n this.workers = [start(), ...Array.from({ length: Math.max(1, count) - 1 }, start)];\n this.unfollow = onHeaderRules((rules) => {\n this.workers.forEach((w) => {\n w.postMessage({ type: 'headers', rules } satisfies BasemapRequest);\n });\n });\n }\n\n /** A prefix for the renderer keys of one `VectorTiles` */\n namespace(): string {\n return `v${this.namespaces++}`;\n }\n\n /** Requests in progress */\n get size(): number {\n return this.pending.size;\n }\n\n /** Rejects the requests of a failed worker, with the error returned */\n private fail(worker: PoolWorker, message: string): Error {\n const error = new Error(\n `isard: ${message}. If a bundler moves the worker, give its URL in the \\`basemapWorkerUrl\\` option (see \"With a bundler\" in the guide)`,\n );\n\n this.pending.forEach((p, id) => {\n if (p.worker !== worker) return;\n this.pending.delete(id);\n p.reject(error);\n });\n\n return error;\n }\n\n /** The worker of a vector tile: always the same one, or the next living one if it died */\n worker(vz: number, vx: number, vy: number): PoolWorker {\n return this.living(workerIndex(vz, vx, vy, this.workers.length));\n }\n\n /** The worker at `index`, or the next one that has not died (the first one when all have) */\n private living(index: number): PoolWorker {\n const { workers } = this;\n const at = (k: number) => workers[(index + k) % workers.length] ?? workers[0];\n const k = workers.findIndex((_, k) => !this.dead.has(at(k)));\n\n return at(Math.max(0, k));\n }\n\n /** Sends a message to every worker (a renderer, or its removal, or where the tessellation module is) */\n broadcast(message: Extract<BasemapRequest, { type: 'init' } | { type: 'drop' } | { type: 'tess' }>): void {\n if (this.terminated) return;\n\n // A renderer tells the workers how many they are: they share the decoded tiles' budget\n const sent = message.type === 'init' ? { ...message, workers: this.workers.length } : message;\n\n // A sprite image is copied to each worker (structured clone)\n this.workers.forEach((w) => {\n w.postMessage(sent);\n });\n }\n\n /** Asks a worker for a tile's image or labels, on behalf of `owner` */\n request(worker: PoolWorker, work: BasemapWork, owner: object, signal?: AbortSignal): Promise<BasemapResponse> {\n return new Promise<BasemapResponse>((resolve, reject) => {\n if (this.terminated) return reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n if (signal?.aborted) return reject(new DOMException('isard: aborted', 'AbortError'));\n\n const dead = this.dead.get(worker);\n\n if (dead) return reject(dead);\n\n const id = this.next++;\n const abort = () => {\n if (!this.pending.delete(id)) return;\n worker.postMessage({ type: 'abort', id } satisfies BasemapRequest);\n reject(new DOMException('isard: aborted', 'AbortError'));\n };\n // The listener goes once the request is settled\n const settle = () => signal?.removeEventListener('abort', abort);\n\n this.pending.set(id, {\n resolve: (r) => {\n settle();\n resolve(r);\n },\n reject: (e) => {\n settle();\n reject(e);\n },\n worker,\n owner,\n });\n signal?.addEventListener('abort', abort, { once: true });\n worker.postMessage({ ...work, id } satisfies BasemapRequest);\n });\n }\n\n /** The altitudes of a PNG relief tile `z`/`x`/`y` at `url`, decoded by a worker (see `fetchHeights`) */\n heights(\n url: string,\n encoding: PngEncoding,\n floor: number | undefined,\n [z, x, y]: [number, number, number],\n signal: AbortSignal,\n owner: object,\n ): Promise<Float32Array | null> {\n const work: BasemapWork = { type: 'heights', url, encoding, ...(floor === undefined ? {} : { floor }) };\n\n return this.request(this.worker(z, x, y), work, owner, signal).then((r) => ('heights' in r ? r.heights : null));\n }\n\n /** Mercator tile `z`/`x`/`y` reprojected by a worker from the source images of its plan (see `resampler`) */\n reproject(\n job: Job,\n [z, x, y]: [number, number, number],\n signal: AbortSignal,\n owner: object,\n ): Promise<ImageBitmap | null> {\n // Blocks of 4 × 4 Mercator tiles go to the same worker: neighbours share source tiles, each worker keeps its share\n const worker = this.worker(Math.max(0, z - 2), x >> 2, y >> 2);\n const cached = Math.max(16, Math.ceil(SOURCE_CACHE / this.workers.length));\n const work: BasemapWork = { type: 'reproject', job, cached };\n\n return this.request(worker, work, owner, signal).then((r) => ('image' in r ? r.image : null));\n }\n\n /** A GRIB2 or NetCDF file (its URL, fetched by the worker, or its bytes, transferred) read into grids by the grid\n * module (`module`), in the next worker */\n grids(\n source: { url: string } | { bytes: ArrayBuffer },\n module: string,\n signal: AbortSignal | undefined,\n owner: object,\n ): Promise<{ grids: GridDescription[]; values: Float32Array[] }> {\n const work: BasemapWork = { type: 'grids', module, ...source };\n\n this.turn = (this.turn + 1) % this.workers.length;\n\n return this.request(this.living(this.turn), work, owner, signal).then((r) =>\n 'grids' in r ? { grids: r.grids, values: r.values } : { grids: [], values: [] },\n );\n }\n\n /** Cancels the requests of an owner (the workers stop them) */\n cancel(owner: object): void {\n this.pending.forEach((p, id) => {\n if (p.owner !== owner) return;\n this.pending.delete(id);\n p.worker.postMessage({ type: 'abort', id } satisfies BasemapRequest);\n p.reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n });\n }\n\n /** Stops the workers; their requests fail */\n terminate(): void {\n if (this.terminated) return;\n this.terminated = true;\n this.unfollow();\n this.workers.forEach((w) => {\n w.terminate();\n });\n\n const pending = [...this.pending.values()];\n\n this.pending.clear();\n pending.forEach((p) => {\n p.reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workerpool.js","sourceRoot":"","sources":["../../src/basemap/workerpool.ts"],"names":[],"mappings":"AAAA;uGACuG;AAEvG,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAY,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,6GAA6G;AAC7G,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAI,GAAG,CAAC,EAAU,EAAE;IACrD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,SAA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AC;YACxB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAA2B,CAAC,CAAC;YACrE,CAAC,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,+BAA+B,EAAE,YAAY,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,6CAA6C;IAC7C,SAAS;QACP,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACzB,CAAC,CAAC,SAAS,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAE3C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACpB,CAAC,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,+BAA+B,EAAE,YAAY,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/** The pool of basemap workers the vector tiles share: a vector tile always goes to the same worker (its decoded copy\n * kept there), the requests of an owner cancelled together, the renderers broadcast to every worker */\n\nimport { assetUrl } from '../engine-loader.ts';\nimport type { GridDescription } from '../grid-module.ts';\nimport { mercatorX, mercatorY } from '../util/geo.ts';\nimport { headerRules, onHeaderRules } from '../util/requests.ts';\nimport type { Camera } from '../wasm/isard_webgpu.js';\nimport type { BasemapRequest, BasemapResponse, BasemapWork, Priority } from '../workers/basemap/protocol.ts';\nimport { type Job, SOURCE_CACHE } from './resample.ts';\nimport type { PngEncoding } from './terrain.ts';\n\n/** Default size of a basemap worker pool: cores - 1, 1 to `most` (4 by default, fewer at a lower quality) */\nexport const defaultWorkerCount = (most = 4): number => {\n return Math.min(most, Math.max(1, (typeof navigator !== 'undefined' ? navigator.hardwareConcurrency || 2 : 2) - 1));\n};\n\n/** Default URL of the basemap worker: in the page's assets folder (`isard/vite`), else next to the module */\nexport const defaultWorkerUrl = (assetsUrl?: string | URL): string | URL => {\n return assetUrl('basemap.worker.js', undefined, assetsUrl);\n};\n\n/** Fetch priority of a raster tile drawn by the workers: 'high' near the center of the view, at the current zoom or\n * coarser; 'low' far from it or finer (prefetch); 'auto' between */\nexport const tilePriority = (z: number, x: number, y: number, camera: Pick<Camera, 'center' | 'zoom'>): Priority => {\n // A raster tile of level z covers the map at zoom z - 1\n if (z - 1 > camera.zoom + 1) return 'low';\n\n const n = 2 ** z;\n const [lon, lat] = camera.center;\n const cx = mercatorX(lon) * n;\n const cy = mercatorY(lat) * n;\n // Across the antimeridian, the short way\n const along = Math.abs(x + 0.5 - cx) % n;\n const dx = Math.min(along, n - along);\n const d = Math.hypot(dx, y + 0.5 - cy);\n\n if (d <= 1.5) return 'high';\n\n return d >= 4 ? 'low' : 'auto';\n};\n\n/** The worker of a vector tile among `count`: always the same one */\nexport const workerIndex = (vz: number, vx: number, vy: number, count: number): number => {\n // Unsigned: every worker gets its share\n return ((Math.imul(vx, 73856093) ^ Math.imul(vy, 19349663) ^ vz) >>> 0) % Math.max(1, count);\n};\n\n/** The worker-side key of a renderer: unique across the `VectorTiles` sharing a pool */\nexport const rendererKey = (namespace: string, n: number): string => {\n return `${namespace}:r${n}`;\n};\n\n/** What the pool needs of a worker (a `Worker`, or a stand-in in tests) */\nexport type PoolWorker = Pick<Worker, 'postMessage' | 'terminate' | 'onmessage' | 'onerror' | 'onmessageerror'>;\n\n/**\n * @internal Workers drawing vector tiles, shared by the `VectorTiles` of a map: each vector tile always goes to the\n * same worker, which keeps it decoded for every style drawn from it. Requests are tracked one by one, with their\n * owner, so that one `VectorTiles` going away cancels its own requests only.\n */\nexport class BasemapWorkers {\n private readonly workers: [PoolWorker, ...PoolWorker[]];\n private readonly pending = new Map<\n number,\n { resolve: (r: BasemapResponse) => void; reject: (e: Error) => void; worker: PoolWorker; owner: object }\n >();\n private next = 1;\n /** The workers that answered once (they loaded), and those that failed before: dead, their error given at once to\n * any request still sent their way */\n private readonly answered = new WeakSet<PoolWorker>();\n private readonly dead = new Map<PoolWorker, Error>();\n /** The worker the next file of grids goes to, in turn */\n private turn = 0;\n private namespaces = 0;\n private terminated = false;\n /** Stops following the page's request headers */\n private readonly unfollow: () => void;\n\n constructor(\n readonly count: number,\n readonly url: string | URL,\n create: (url: string | URL) => PoolWorker = (u) => new Worker(u, { type: 'module' }),\n ) {\n const start = (): PoolWorker => {\n const worker = create(url);\n\n worker.onmessage = ({ data }: MessageEvent<BasemapResponse>) => {\n this.answered.add(worker);\n\n const p = this.pending.get(data.id);\n\n if (!p) return;\n this.pending.delete(data.id);\n if ('error' in data) p.reject(new Error(data.error));\n else p.resolve(data);\n };\n // A worker that fails to load (a bundler serving it from elsewhere) or to read a message fails its requests; one\n // that never answered is dead: its tiles go to the others, and with none left every request fails at once\n worker.onerror = (event) => {\n event.preventDefault();\n\n const error = this.fail(\n worker,\n `the vector basemap worker ${url} failed${event.message ? `: ${event.message}` : ''}`,\n );\n\n if (!this.answered.has(worker)) this.dead.set(worker, error);\n };\n worker.onmessageerror = () => this.fail(worker, `the vector basemap worker ${url} sent an unreadable message`);\n\n const rules = headerRules();\n\n if (rules.length > 0) worker.postMessage({ type: 'headers', rules } satisfies BasemapRequest);\n\n return worker;\n };\n\n this.workers = [start(), ...Array.from({ length: Math.max(1, count) - 1 }, start)];\n this.unfollow = onHeaderRules((rules) => {\n this.workers.forEach((w) => {\n w.postMessage({ type: 'headers', rules } satisfies BasemapRequest);\n });\n });\n }\n\n /** A prefix for the renderer keys of one `VectorTiles` */\n namespace(): string {\n return `v${this.namespaces++}`;\n }\n\n /** Requests in progress */\n get size(): number {\n return this.pending.size;\n }\n\n /** Rejects the requests of a failed worker, with the error returned */\n private fail(worker: PoolWorker, message: string): Error {\n const error = new Error(\n `isard: ${message}. If a bundler moves the worker, give its URL in the \\`basemapWorkerUrl\\` option (see \"With a bundler\" in the guide)`,\n );\n\n this.pending.forEach((p, id) => {\n if (p.worker !== worker) return;\n this.pending.delete(id);\n p.reject(error);\n });\n\n return error;\n }\n\n /** The worker of a vector tile: always the same one, or the next living one if it died */\n worker(vz: number, vx: number, vy: number): PoolWorker {\n return this.living(workerIndex(vz, vx, vy, this.workers.length));\n }\n\n /** The worker at `index`, or the next one that has not died (the first one when all have) */\n private living(index: number): PoolWorker {\n const { workers } = this;\n const at = (k: number) => workers[(index + k) % workers.length] ?? workers[0];\n const k = workers.findIndex((_, k) => !this.dead.has(at(k)));\n\n return at(Math.max(0, k));\n }\n\n /** Sends a message to every worker (a renderer, or its removal, or where the tessellation module is) */\n broadcast(message: Extract<BasemapRequest, { type: 'init' } | { type: 'drop' } | { type: 'tess' }>): void {\n if (this.terminated) return;\n\n // A renderer tells the workers how many they are: they share the decoded tiles' budget\n const sent = message.type === 'init' ? { ...message, workers: this.workers.length } : message;\n\n // A sprite image is copied to each worker (structured clone)\n this.workers.forEach((w) => {\n w.postMessage(sent);\n });\n }\n\n /** Asks a worker for a tile's image or labels, on behalf of `owner` */\n request(worker: PoolWorker, work: BasemapWork, owner: object, signal?: AbortSignal): Promise<BasemapResponse> {\n return new Promise<BasemapResponse>((resolve, reject) => {\n if (this.terminated) return reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n if (signal?.aborted) return reject(new DOMException('isard: aborted', 'AbortError'));\n\n const dead = this.dead.get(worker);\n\n if (dead) return reject(dead);\n\n const id = this.next++;\n const abort = () => {\n if (!this.pending.delete(id)) return;\n worker.postMessage({ type: 'abort', id } satisfies BasemapRequest);\n reject(new DOMException('isard: aborted', 'AbortError'));\n };\n // The listener goes once the request is settled\n const settle = () => signal?.removeEventListener('abort', abort);\n\n this.pending.set(id, {\n resolve: (r) => {\n settle();\n resolve(r);\n },\n reject: (e) => {\n settle();\n reject(e);\n },\n worker,\n owner,\n });\n signal?.addEventListener('abort', abort, { once: true });\n worker.postMessage({ ...work, id } satisfies BasemapRequest);\n });\n }\n\n /** The altitudes of a PNG relief tile `z`/`x`/`y` at `url`, decoded by a worker (see `fetchHeights`) */\n heights(\n url: string,\n encoding: PngEncoding,\n floor: number | undefined,\n [z, x, y]: [number, number, number],\n signal: AbortSignal,\n owner: object,\n ): Promise<Float32Array | null> {\n const work: BasemapWork = { type: 'heights', url, encoding, ...(floor === undefined ? {} : { floor }) };\n\n return this.request(this.worker(z, x, y), work, owner, signal).then((r) => ('heights' in r ? r.heights : null));\n }\n\n /** Mercator tile `z`/`x`/`y` reprojected by a worker from the source images of its plan (see `resampler`) */\n reproject(\n job: Job,\n [z, x, y]: [number, number, number],\n signal: AbortSignal,\n owner: object,\n ): Promise<ImageBitmap | null> {\n // Blocks of 4 × 4 Mercator tiles go to the same worker: neighbours share source tiles, each worker keeps its share\n const worker = this.worker(Math.max(0, z - 2), x >> 2, y >> 2);\n const cached = Math.max(16, Math.ceil(SOURCE_CACHE / this.workers.length));\n const work: BasemapWork = { type: 'reproject', job, cached };\n\n return this.request(worker, work, owner, signal).then((r) => ('image' in r ? r.image : null));\n }\n\n /** A GRIB2 or NetCDF file (its URL, fetched by the worker, or its bytes, transferred) read into grids by the grid\n * module (`module`), in the next worker */\n grids(\n source: { url: string } | { bytes: ArrayBuffer },\n module: string,\n signal: AbortSignal | undefined,\n owner: object,\n ): Promise<{ grids: GridDescription[]; values: Float32Array[] }> {\n const work: BasemapWork = { type: 'grids', module, ...source };\n\n this.turn = (this.turn + 1) % this.workers.length;\n\n return this.request(this.living(this.turn), work, owner, signal).then((r) =>\n 'grids' in r ? { grids: r.grids, values: r.values } : { grids: [], values: [] },\n );\n }\n\n /** Cancels the requests of an owner (the workers stop them) */\n cancel(owner: object): void {\n this.pending.forEach((p, id) => {\n if (p.owner !== owner) return;\n this.pending.delete(id);\n p.worker.postMessage({ type: 'abort', id } satisfies BasemapRequest);\n p.reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n });\n }\n\n /** Stops the workers; their requests fail */\n terminate(): void {\n if (this.terminated) return;\n this.terminated = true;\n this.unfollow();\n this.workers.forEach((w) => {\n w.terminate();\n });\n\n const pending = [...this.pending.values()];\n\n this.pending.clear();\n pending.forEach((p) => {\n p.reject(new DOMException('isard: vector tiles destroyed', 'AbortError'));\n });\n }\n}\n"]}
|
package/dist/decoder.worker.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
export default ${e};`],{type:"text/javascript"}));try{let
|
|
3
|
-
return ${e};`)()},Re=async(r,e,t,n)=>{let[_,c]=await Promise.all([At(`${r}${e}`,n),fetch(`${r}${t}`).then((i)=>i.arrayBuffer())]);return _({wasmBinary:c})},$e,ze,qe,Je=async(r,e)=>{let t=e.some((c)=>!c.points);if(t)$e??=Re(r.draco,"draco_wasm_wrapper_gltf.js","draco_decoder_gltf.wasm","DracoDecoderModule");if(e.some((c)=>c.points))ze??=Re(r.draco,"draco_wasm_wrapper.js","draco_decoder.wasm","DracoDecoderModule");let[n,_]=await Promise.all([t?$e:void 0,ze]);return e.map((c)=>{let i=c.points?_:n;if(!i)throw Error("isard: the Draco decoder is not loaded");let s=new i.Decoder,f=c.points?new i.PointCloud:new i.Mesh;try{let b=new Int8Array(c.data.buffer,c.data.byteOffset,c.data.byteLength),l=c.points?s.DecodeArrayToPointCloud(b,b.byteLength,f):s.DecodeArrayToMesh(b,b.byteLength,f);if(!l.ok())throw Error(`Draco: ${l.error_msg()}`);let d=(S)=>{let T=s.GetAttributeByUniqueId(f,S),I=f.num_points()*T.num_components(),M=i._malloc(I*4);try{return s.GetAttributeDataArrayForAllPoints(f,T,i.DT_FLOAT32,I*4,M),i.HEAPF32.slice(M/4,M/4+I)}finally{i._free(M)}};if(c.points){let S={mesh:c.mesh,primitive:c.primitive,positions:d(c.position)};if(c.color!==void 0)S.colors=d(c.color);if(c.normal!==void 0)S.normals=d(c.normal);return S}let m=(()=>{let S=f.num_faces()*3,T=i._malloc(S*4);try{return s.GetTrianglesUInt32Array(f,S*4,T),i.HEAPU32.slice(T/4,T/4+S)}finally{i._free(T)}})(),F={mesh:c.mesh,primitive:c.primitive,positions:d(c.position),indices:m};if(c.uv!==void 0)F.uvs=d(c.uv);return F}finally{i.destroy(f),i.destroy(s)}})},xt=(r,e)=>{if(r.astc)return{basis:10,gl:37808};if(r.bptc)return{basis:6,gl:36492};if(r.etc)return e?{basis:1,gl:37496}:{basis:0,gl:37492};if(r.s3tc)return e?{basis:3,gl:33779}:{basis:2,gl:33776};return{basis:13,gl:32856}},Ke=async(r,e,t)=>{qe??=Re(r.basis,"basis_transcoder.js","basis_transcoder.wasm","BASIS").then((c)=>(c.initializeBasis(),c));let _=new(await qe).KTX2File(t);try{if(!_.isValid()||!_.startTranscoding())throw Error("KTX2: invalid file");let{basis:c,gl:i}=xt(e,_.getHasAlpha()),s=Array.from({length:_.getLevels()},(f,b)=>{let{origWidth:l,origHeight:d}=_.getImageLevelInfo(b,0,0),g=new Uint8Array(_.getImageTranscodedSizeInBytes(b,0,0,c));if(!_.transcodeImage(g,b,0,0,c,0,-1,-1))throw Error("KTX2: transcoding failed");return{width:l,height:d,data:g}});return{format:i,levels:s}}finally{_.close(),_.delete()}};var Ee=(r,e)=>Error(`isard: ${String(r)}: HTTP ${e}`),Ye=async(r,e)=>{let t=await fetch(r,e);if(!t.ok)throw Ee(r,t.status);return t};var Ze=async(r,e)=>{let t=r.body?.getReader();if(!t)return new Uint8Array(await r.arrayBuffer());let n=[],_=0;for(;;){let{done:i,value:s}=await t.read();if(i)break;if(_+=s.length,_>e){await t.cancel();return}n.push(s)}let c=new Uint8Array(_);return n.reduce((i,s)=>(c.set(s,i),i+s.length),0),c};var Qe=[];var et=(r)=>{Qe=r};var Le=(r,e={})=>{let t=String(r),n=Qe.filter(([c])=>t.startsWith(c));if(n.length===0)return e;let _=new Headers(e.headers);return n.forEach(([,c])=>{Object.entries(c).forEach(([i,s])=>{_.set(i,s)})}),{...e,headers:_}};class Be{__destroy_into_raw(){let r=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),r}free(){let r=this.__destroy_into_raw();o.__wbg_engine_free(r,0)}addCircles(r,e,t){let n=x(r,o.__wbindgen_malloc),_=a,c=w(e,o.__wbindgen_malloc),i=a,s=o.engine_addCircles(this.__wbg_ptr,n,_,c,i,t);if(s[2])throw h(s[1]);return s[0]>>>0}addCustomLayer(r,e){return o.engine_addCustomLayer(this.__wbg_ptr,r,e)>>>0}addExtrusions(){let r=o.engine_addExtrusions(this.__wbg_ptr);if(r[2])throw h(r[1]);return r[0]>>>0}addFills(r,e,t,n,_){let c=x(r,o.__wbindgen_malloc),i=a,s=w(e,o.__wbindgen_malloc),f=a,b=w(t,o.__wbindgen_malloc),l=a,d=w(n,o.__wbindgen_malloc),g=a,m=o.engine_addFills(this.__wbg_ptr,c,i,s,f,b,l,d,g,_);if(m[2])throw h(m[1]);return m[0]>>>0}addFlow(r,e){let t=o.engine_addFlow(this.__wbg_ptr,r,e);if(t[2])throw h(t[1]);return t[0]>>>0}addGround(r,e,t,n,_,c,i){let s=R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),f=a,b=o.engine_addGround(this.__wbg_ptr,s,f,e,t,n,_,c,i);if(b[2])throw h(b[1]);return b[0]>>>0}addLines(r,e,t,n,_,c){let i=x(r,o.__wbindgen_malloc),s=a,f=w(e,o.__wbindgen_malloc),b=a,l=w(t,o.__wbindgen_malloc),d=a;var g=u(_)?0:x(_,o.__wbindgen_malloc),m=a;let F=o.engine_addLines(this.__wbg_ptr,i,s,f,b,l,d,n,g,m,u(c)?16777215:c?1:0);if(F[2])throw h(F[1]);return F[0]>>>0}addModels(r,e,t){let n=R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=x(e,o.__wbindgen_malloc),i=a,s=o.engine_addModels(this.__wbg_ptr,n,_,c,i,t);if(s[2])throw h(s[1]);return s[0]>>>0}addNetwork(r,e,t,n,_,c){let i=x(r,o.__wbindgen_malloc),s=a,f=w(e,o.__wbindgen_malloc),b=a;var l=u(t)?0:w(t,o.__wbindgen_malloc),d=a,g=u(n)?0:x(n,o.__wbindgen_malloc),m=a,F=u(_)?0:y(_,o.__wbindgen_malloc),S=a;let T=y(c,o.__wbindgen_malloc),I=a,M=o.engine_addNetwork(this.__wbg_ptr,i,s,f,b,l,d,g,m,F,S,T,I);if(M[2])throw h(M[1]);return M[0]>>>0}addPointCloud(r,e){let t=R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=o.engine_addPointCloud(this.__wbg_ptr,t,n,e);if(_[2])throw h(_[1]);return _[0]>>>0}addRaster(r,e,t,n,_,c,i,s){let f=R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),b=a,l=o.engine_addRaster(this.__wbg_ptr,f,b,e,t,n,_,u(c)?Number.MAX_SAFE_INTEGER:c>>0,u(i)?0:A(i),u(s)?16777215:s?1:0);if(l[2])throw h(l[1]);return l[0]>>>0}addSymbols(){let r=o.engine_addSymbols(this.__wbg_ptr);if(r[2])throw h(r[1]);return r[0]>>>0}addTiles3d(r,e,t){let n=R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.engine_addTiles3d(this.__wbg_ptr,n,_,e,u(t)?16777215:t?1:0);if(c[2])throw h(c[1]);return c[0]>>>0}addVectorTiles(){let r=o.engine_addVectorTiles(this.__wbg_ptr);if(r[2])throw h(r[1]);return r[0]>>>0}bounds(){let r=o.engine_bounds(this.__wbg_ptr);var e=Oe(r[0],r[1]).slice();return o.__wbindgen_free(r[0],r[1]*8,8),e}camera(){return o.engine_camera(this.__wbg_ptr)}clearPanorama(){o.engine_clearPanorama(this.__wbg_ptr)}clearPivot(){o.engine_clearPivot(this.__wbg_ptr)}clearPreload(){o.engine_clearPreload(this.__wbg_ptr)}clearViewshed(){o.engine_clearViewshed(this.__wbg_ptr)}static customMatrix(r,e,t){let n=o.engine_customMatrix(r,e,t),_;if(n[0]!==0)_=E(n[0],n[1]).slice(),o.__wbindgen_free(n[0],n[1]*4,4);return _}elevationAt(r,e){let t=o.engine_elevationAt(this.__wbg_ptr,r,e);return t[0]===0?void 0:t[1]}static geoidHeight(r,e){return o.engine_geoidHeight(r,e)}ground(r,e){return o.engine_ground(this.__wbg_ptr,r,e)}linkExtrusionNetwork(r,e,t){o.engine_linkExtrusionNetwork(this.__wbg_ptr,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0,t)}localMatrix(r,e,t){let n=o.engine_localMatrix(this.__wbg_ptr,r,e,t);var _=E(n[0],n[1]).slice();return o.__wbindgen_free(n[0],n[1]*4,4),_}moveLayer(r,e){o.engine_moveLayer(this.__wbg_ptr,r,e)}networkStats(r){return o.engine_networkStats(this.__wbg_ptr,r)}constructor(r,e,t){let n=o.engine_new(r,e,u(t)?16777215:t?1:0);if(n[2])throw h(n[1]);return this.__wbg_ptr=n[0],tt.register(this,this.__wbg_ptr,this),this}pan(r,e,t,n){o.engine_pan(this.__wbg_ptr,r,e,t,n)}pick(r,e,t,n){var _=u(n)?0:w(n,o.__wbindgen_malloc),c=a;return o.engine_pick(this.__wbg_ptr,r,e,!u(t),u(t)?0:t,_,c)}pointCloudInfo(r){return o.engine_pointCloudInfo(this.__wbg_ptr,r)}pointCloudPoint(r,e){return o.engine_pointCloudPoint(this.__wbg_ptr,r,e)}pointCloudStats(r){return o.engine_pointCloudStats(this.__wbg_ptr,r)}pollPick(){return o.engine_pollPick(this.__wbg_ptr)}preload(r,e,t,n,_){o.engine_preload(this.__wbg_ptr,r,e,t,n,_)}project(r,e,t){return o.engine_project(this.__wbg_ptr,r,e,!u(t),u(t)?0:t)}promoteFlowNext(r){o.engine_promoteFlowNext(this.__wbg_ptr,r)}removeExtrusionBatch(r,e){o.engine_removeExtrusionBatch(this.__wbg_ptr,r,e)}removeLayer(r){o.engine_removeLayer(this.__wbg_ptr,r)}removeVectorTile(r,e){o.engine_removeVectorTile(this.__wbg_ptr,r,e)}render(){return o.engine_render(this.__wbg_ptr)!==0}requestPick(r,e,t,n){var _=u(n)?0:w(n,o.__wbindgen_malloc),c=a;return o.engine_requestPick(this.__wbg_ptr,r,e,!u(t),u(t)?0:t,_,c)!==0}resize(r,e,t){o.engine_resize(this.__wbg_ptr,r,e,t)}rotate(r,e){o.engine_rotate(this.__wbg_ptr,r,e)}setAtmosphere(r){var e=u(r)?0:y(r,o.__wbindgen_malloc),t=a;o.engine_setAtmosphere(this.__wbg_ptr,e,t)}setBackground(r,e,t){o.engine_setBackground(this.__wbg_ptr,r,e,t)}setBody(r,e,t,n,_){var c=u(t)?0:y(t,o.__wbindgen_malloc),i=a;o.engine_setBody(this.__wbg_ptr,r,e,c,i,n,_)}setCamera(r,e,t,n,_){o.engine_setCamera(this.__wbg_ptr,r,e,t,n,_)}setCircleAlignment(r,e){o.engine_setCircleAlignment(this.__wbg_ptr,r,e)}setCircles(r,e,t){let n=x(e,o.__wbindgen_malloc),_=a,c=w(t,o.__wbindgen_malloc),i=a;o.engine_setCircles(this.__wbg_ptr,r,n,_,c,i)}setExtrusionAnchors(r,e,t){let n=y(t,o.__wbindgen_malloc),_=a,c=o.engine_setExtrusionAnchors(this.__wbg_ptr,r,e,n,_);if(c[1])throw h(c[0])}setExtrusionBatch(r,e,t,n,_,c,i,s,f,b){let l=x(t,o.__wbindgen_malloc),d=a,g=w(n,o.__wbindgen_malloc),m=a,F=w(_,o.__wbindgen_malloc),S=a,T=w(c,o.__wbindgen_malloc),I=a,M=P(s,o.__wbindgen_malloc),v=a,k=y(f,o.__wbindgen_malloc),U=a,B=o.engine_setExtrusionBatch(this.__wbg_ptr,r,e,l,d,g,m,F,S,T,I,i,M,v,k,U,b);if(B[1])throw h(B[0])}setFacades(r,e){o.engine_setFacades(this.__wbg_ptr,r,e)}setFeatureLayer(r,e,t,n,_){let c=y(e,o.__wbindgen_malloc),i=a;o.engine_setFeatureLayer(this.__wbg_ptr,r,c,i,t,n,_)}setFeatureMask(r,e,t){let n=P(e,o.__wbindgen_malloc),_=a;o.engine_setFeatureMask(this.__wbg_ptr,r,n,_,u(t)?Number.MAX_SAFE_INTEGER:t>>>0)}setFeatureRamp(r,e,t,n){var _=u(e)?0:P(e,o.__wbindgen_malloc),c=a;o.engine_setFeatureRamp(this.__wbg_ptr,r,_,c,t,n)}setFeatureStyle(r,e,t){let n=y(e,o.__wbindgen_malloc),_=a;o.engine_setFeatureStyle(this.__wbg_ptr,r,n,_,u(t)?Number.MAX_SAFE_INTEGER:t>>>0)}setFeatureValues(r,e,t){let n=y(e,o.__wbindgen_malloc),_=a;o.engine_setFeatureValues(this.__wbg_ptr,r,n,_,u(t)?Number.MAX_SAFE_INTEGER:t>>>0)}setFills(r,e,t,n,_){let c=x(e,o.__wbindgen_malloc),i=a,s=w(t,o.__wbindgen_malloc),f=a,b=w(n,o.__wbindgen_malloc),l=a,d=w(_,o.__wbindgen_malloc),g=a;o.engine_setFills(this.__wbg_ptr,r,c,i,s,f,b,l,d,g)}setFirstPerson(r,e,t,n,_,c){o.engine_setFirstPerson(this.__wbg_ptr,r,e,t,n,_,c)}setFlowBlend(r,e){o.engine_setFlowBlend(this.__wbg_ptr,r,e)}setFlowField(r,e,t,n,_,c){let i=y(n,o.__wbindgen_malloc),s=a,f=y(_,o.__wbindgen_malloc),b=a,l=x(c,o.__wbindgen_malloc),d=a;o.engine_setFlowField(this.__wbg_ptr,r,e,t,i,s,f,b,l,d)}setFlowNext(r,e,t){let n=y(e,o.__wbindgen_malloc),_=a,c=y(t,o.__wbindgen_malloc),i=a;o.engine_setFlowNext(this.__wbg_ptr,r,n,_,c,i)}setFlowStyle(r,e,t,n,_,c,i,s){let f=y(e,o.__wbindgen_malloc),b=a,l=y(t,o.__wbindgen_malloc),d=a;o.engine_setFlowStyle(this.__wbg_ptr,r,f,b,l,d,n,_,c,i,s)}setFlowWeights(r,e,t){o.engine_setFlowWeights(this.__wbg_ptr,r,e,t)}setGlobeColor(r,e,t){o.engine_setGlobeColor(this.__wbg_ptr,r,e,t)}setGlobe(r){o.engine_setGlobe(this.__wbg_ptr,r)}setGlyphAtlas(r,e,t){var n=u(t)?0:P(t,o.__wbindgen_malloc),_=a;let c=o.engine_setGlyphAtlas(this.__wbg_ptr,r,e,n,_);if(c[1])throw h(c[0])}setGlyphPages(r,e,t){let n=o.engine_setGlyphPages(this.__wbg_ptr,r,e,t);if(n[1])throw h(n[0])}setGroundBounds(r,e,t,n,_){o.engine_setGroundBounds(this.__wbg_ptr,r,e,t,n,_)}setGroundTexture(r,e,t,n,_,c,i,s){let f=R(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=a,l=R(t,o.__wbindgen_malloc,o.__wbindgen_realloc),d=a;var g=u(s)?0:P(s,o.__wbindgen_malloc),m=a;let F=o.engine_setGroundTexture(this.__wbg_ptr,r,f,b,l,d,n,_,c,i,g,m);if(F[1])throw h(F[0])}setGroundUniform(r,e,t){let n=R(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=x(t,o.__wbindgen_malloc),i=a,s=o.engine_setGroundUniform(this.__wbg_ptr,r,n,_,c,i);if(s[1])throw h(s[0])}setGroundVisible(r,e){o.engine_setGroundVisible(this.__wbg_ptr,r,e)}setIconAtlas(r,e){let t=o.engine_setIconAtlas(this.__wbg_ptr,r,e);if(t[1])throw h(t[0])}setImmediateLoading(r){o.engine_setImmediateLoading(this.__wbg_ptr,r)}setLineDash(r,e,t){o.engine_setLineDash(this.__wbg_ptr,r,e,t)}setLines(r,e,t,n,_,c){let i=x(e,o.__wbindgen_malloc),s=a,f=w(t,o.__wbindgen_malloc),b=a,l=w(n,o.__wbindgen_malloc),d=a;var g=u(_)?0:x(_,o.__wbindgen_malloc),m=a;let F=o.engine_setLines(this.__wbg_ptr,r,i,s,f,b,l,d,g,m,u(c)?16777215:c?1:0);if(F[1])throw h(F[0])}setMaxPitch(r){o.engine_setMaxPitch(this.__wbg_ptr,r)}setModelGlow(r,e,t,n,_){o.engine_setModelGlow(this.__wbg_ptr,r,e,t,n,_)}setModelHighlight(r,e,t,n,_){o.engine_setModelHighlight(this.__wbg_ptr,r,e,t,n,_)}setModelInstances(r,e,t){let n=x(e,o.__wbindgen_malloc),_=a;o.engine_setModelInstances(this.__wbg_ptr,r,n,_,t)}setNetworkCosts(r,e){var t=u(e)?0:y(e,o.__wbindgen_malloc),n=a;o.engine_setNetworkCosts(this.__wbg_ptr,r,t,n)}setNetworkRamp(r,e){var t=u(e)?0:P(e,o.__wbindgen_malloc),n=a;o.engine_setNetworkRamp(this.__wbg_ptr,r,t,n)}setNetworkScales(r,e){var t=u(e)?0:y(e,o.__wbindgen_malloc),n=a;o.engine_setNetworkScales(this.__wbg_ptr,r,t,n)}setNetworkStyle(r,e){let t=y(e,o.__wbindgen_malloc),n=a;o.engine_setNetworkStyle(this.__wbg_ptr,r,t,n)}setNetworkValues(r,e){let t=y(e,o.__wbindgen_malloc),n=a;o.engine_setNetworkValues(this.__wbg_ptr,r,t,n)}setPanoramaImage(r,e){let t=o.engine_setPanoramaImage(this.__wbg_ptr,r,e);if(t[1])throw h(t[0])}setPanorama(r,e,t,n,_,c,i){let s=x(n,o.__wbindgen_malloc),f=a,b=x(_,o.__wbindgen_malloc),l=a,d=o.engine_setPanorama(this.__wbg_ptr,r,e,t,s,f,b,l,c,i);if(d[1])throw h(d[0])}setPivot(r,e){return o.engine_setPivot(this.__wbg_ptr,r,e)!==0}setPointCloudStyle(r,e,t,n){let _=x(e,o.__wbindgen_malloc),c=a,i=P(t,o.__wbindgen_malloc),s=a,f=P(n,o.__wbindgen_malloc),b=a;o.engine_setPointCloudStyle(this.__wbg_ptr,r,_,c,i,s,f,b)}setRasterStyle(r,e,t){o.engine_setRasterStyle(this.__wbg_ptr,r,e,t)}setRequestHeaders(r,e,t){let n=_t(r,o.__wbindgen_malloc),_=a,c=w(e,o.__wbindgen_malloc),i=a,s=_t(t,o.__wbindgen_malloc),f=a;o.engine_setRequestHeaders(this.__wbg_ptr,n,_,c,i,s,f)}setSky(r){o.engine_setSky(this.__wbg_ptr,r)}setSun(r,e,t,n){let _=o.engine_setSun(this.__wbg_ptr,r,e,t,n);if(_[1])throw h(_[0])}setSwipe(r,e,t,n){let _=w(t,o.__wbindgen_malloc),c=a,i=w(n,o.__wbindgen_malloc),s=a;o.engine_setSwipe(this.__wbg_ptr,r,e,_,c,i,s)}setSymbolLayer(r,e,t,n,_,c,i){let s=y(e,o.__wbindgen_malloc),f=a,b=y(t,o.__wbindgen_malloc),l=a;o.engine_setSymbolLayer(this.__wbg_ptr,r,s,f,b,l,n,_,c,i)}setSymbols(r,e,t,n,_,c){let i=x(e,o.__wbindgen_malloc),s=a,f=y(t,o.__wbindgen_malloc),b=a,l=y(n,o.__wbindgen_malloc),d=a,g=y(_,o.__wbindgen_malloc),m=a,F=x(c,o.__wbindgen_malloc),S=a,T=o.engine_setSymbols(this.__wbg_ptr,r,i,s,f,b,l,d,g,m,F,S);if(T[1])throw h(T[0])}setTerrain(r,e,t,n,_){var c=u(r)?0:R(r,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;let s=o.engine_setTerrain(this.__wbg_ptr,c,i,e,u(t)?16777215:t,u(n)?16777215:n?1:0,u(_)?0:A(_));if(s[1])throw h(s[0])}setTileLoader(r){o.engine_setTileLoader(this.__wbg_ptr,r)}setTiles3dDrape(r,e,t,n){o.engine_setTiles3dDrape(this.__wbg_ptr,r,u(e)?Number.MAX_SAFE_INTEGER:e>>>0,t,n)}setTiles3dFacades(r,e){o.engine_setTiles3dFacades(this.__wbg_ptr,r,e)}setTiles3dFeatureColors(r,e){o.engine_setTiles3dFeatureColors(this.__wbg_ptr,r,e)}setTiles3dStyle(r,e,t,n,_){let c=y(_,o.__wbindgen_malloc),i=a;o.engine_setTiles3dStyle(this.__wbg_ptr,r,e,t,!u(n),u(n)?0:n,c,i)}setVectorSublayers(r,e,t,n,_,c,i,s,f,b,l){let d=P(e,o.__wbindgen_malloc),g=a,m=x(t,o.__wbindgen_malloc),F=a,S=P(n,o.__wbindgen_malloc),T=a,I=y(_,o.__wbindgen_malloc),M=a,v=y(c,o.__wbindgen_malloc),k=a,U=P(i,o.__wbindgen_malloc),B=a,O=P(s,o.__wbindgen_malloc),G=a,z=y(f,o.__wbindgen_malloc),q=a,X=y(b,o.__wbindgen_malloc),J=a,K=P(l,o.__wbindgen_malloc),Y=a;o.engine_setVectorSublayers(this.__wbg_ptr,r,d,g,m,F,S,T,I,M,v,k,U,B,O,G,z,q,X,J,K,Y)}setVectorTileMesh(r,e,t,n,_,c,i,s,f,b,l,d,g,m,F,S,T,I,M){let v=x(t,o.__wbindgen_malloc),k=a,U=w(n,o.__wbindgen_malloc),B=a,O=w(_,o.__wbindgen_malloc),G=a,z=w(c,o.__wbindgen_malloc),q=a,X=w(i,o.__wbindgen_malloc),J=a,K=P(s,o.__wbindgen_malloc),Y=a,de=w(f,o.__wbindgen_malloc),ge=a,we=w(b,o.__wbindgen_malloc),me=a,pe=P(d,o.__wbindgen_malloc),he=a,ye=y(g,o.__wbindgen_malloc),Ae=a,xe=w(m,o.__wbindgen_malloc),Fe=a,ve=P(F,o.__wbindgen_malloc),Se=a,Te=w(S,o.__wbindgen_malloc),Pe=a,Ie=w(T,o.__wbindgen_malloc),De=a,Me=x(I,o.__wbindgen_malloc),fe=a,ht=rt(M,o.__wbindgen_malloc),yt=a,je=o.engine_setVectorTileMesh(this.__wbg_ptr,r,e,v,k,U,B,O,G,z,q,X,J,K,Y,de,ge,we,me,l,pe,he,ye,Ae,xe,Fe,ve,Se,Te,Pe,Ie,De,Me,fe,ht,yt);if(je[1])throw h(je[0])}setVectorTilePoints(r,e,t,n,_){let c=x(t,o.__wbindgen_malloc),i=a,s=w(n,o.__wbindgen_malloc),f=a,b=w(_,o.__wbindgen_malloc),l=a;o.engine_setVectorTilePoints(this.__wbg_ptr,r,e,c,i,s,f,b,l)}setVectorTile(r,e,t,n,_,c,i,s,f,b,l,d,g,m,F,S,T,I){let M=x(t,o.__wbindgen_malloc),v=a,k=w(n,o.__wbindgen_malloc),U=a,B=w(_,o.__wbindgen_malloc),O=a,G=w(c,o.__wbindgen_malloc),z=a,q=w(i,o.__wbindgen_malloc),X=a,J=x(s,o.__wbindgen_malloc),K=a,Y=w(f,o.__wbindgen_malloc),de=a,ge=w(b,o.__wbindgen_malloc),we=a,me=w(l,o.__wbindgen_malloc),pe=a,he=rt(d,o.__wbindgen_malloc),ye=a,Ae=x(g,o.__wbindgen_malloc),xe=a,Fe=P(m,o.__wbindgen_malloc),ve=a,Se=y(F,o.__wbindgen_malloc),Te=a,Pe=x(S,o.__wbindgen_malloc),Ie=a,De=w(T,o.__wbindgen_malloc),Me=a,fe=o.engine_setVectorTile(this.__wbg_ptr,r,e,M,v,k,U,B,O,G,z,q,X,J,K,Y,de,ge,we,me,pe,he,ye,Ae,xe,Fe,ve,Se,Te,Pe,Ie,De,Me,I);if(fe[1])throw h(fe[0])}setViewshed(r,e,t,n,_){let c=x(r,o.__wbindgen_malloc),i=a,s=y(e,o.__wbindgen_malloc),f=a,b=y(t,o.__wbindgen_malloc),l=a,d=y(_,o.__wbindgen_malloc),g=a,m=o.engine_setViewshed(this.__wbg_ptr,c,i,s,f,b,l,n,d,g);if(m[1])throw h(m[0])}setZoomRange(r,e){o.engine_setZoomRange(this.__wbg_ptr,r,e)}stats(){return o.engine_stats(this.__wbg_ptr)}stepFlow(r,e){return o.engine_stepFlow(this.__wbg_ptr,r,e)!==0}surfaceAt(r,e){return o.engine_surfaceAt(this.__wbg_ptr,r,e)}surface(r,e){return o.engine_surface(this.__wbg_ptr,r,e)}textureFormats(){return o.engine_textureFormats(this.__wbg_ptr)}tiles3dFeature(r,e){return o.engine_tiles3dFeature(this.__wbg_ptr,r,e)}tiles3dStats(r){return o.engine_tiles3dStats(this.__wbg_ptr,r)}updateGlyphAtlas(r,e,t,n,_){let c=P(_,o.__wbindgen_malloc),i=a;o.engine_updateGlyphAtlas(this.__wbg_ptr,r,e,t,n,c,i)}updateGlyphPage(r,e,t,n,_,c){let i=P(c,o.__wbindgen_malloc),s=a;o.engine_updateGlyphPage(this.__wbg_ptr,r,e,t,n,_,i,s)}updateGroundTexture(r,e,t,n,_,c,i,s){let f=R(e,o.__wbindgen_malloc,o.__wbindgen_realloc),b=a,l=P(s,o.__wbindgen_malloc),d=a,g=o.engine_updateGroundTexture(this.__wbg_ptr,r,f,b,t,n,_,c,i,l,d);if(g[1])throw h(g[0])}updateIconAtlas(r,e,t,n,_){let c=P(_,o.__wbindgen_malloc),i=a;o.engine_updateIconAtlas(this.__wbg_ptr,r,e,t,n,c,i)}uploadVectorTile(r,e){return o.engine_uploadVectorTile(this.__wbg_ptr,r,e)!==0}vectorTilesInView(r,e,t){let n=o.engine_vectorTilesInView(this.__wbg_ptr,r,e,t);var _=V(n[0],n[1]).slice();return o.__wbindgen_free(n[0],n[1]*4,4),_}wantedTiles(r){let e=o.engine_wantedTiles(this.__wbg_ptr,r);var t=V(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}zoomAt(r,e,t){o.engine_zoomAt(this.__wbg_ptr,r,e,t)}}if(Symbol.dispose)Be.prototype[Symbol.dispose]=Be.prototype.free;function ot(r,e,t,n){let _=P(r,o.__wbindgen_malloc),c=a,i=x(e,o.__wbindgen_malloc),s=a,f=o.decodeTile(_,c,i,s,t,n);if(f[2])throw h(f[1]);return h(f[0])}function ct(r){let e=P(r,o.__wbindgen_malloc),t=a,n=o.dracoRequests(e,t);if(n[2])throw h(n[1]);return h(n[0])}function Ft(){return{__proto__:null,"./isard_bg.js":{__proto__:null,__wbg___wbindgen_boolean_get_5b446f51afd21013:function(e){let t=e,n=typeof t==="boolean"?t:void 0;return u(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_4687d8d8c2017d52:function(e,t){let n=Ce(t),_=R(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;D().setInt32(e+4,c,!0),D().setInt32(e+0,_,!0)},__wbg___wbindgen_is_falsy_16bd49b68658263e:function(e){return!e},__wbg___wbindgen_is_function_1f9d30630b8b1d3d:function(e){return typeof e==="function"},__wbg___wbindgen_is_null_e343b7d08827ba72:function(e){return e===null},__wbg___wbindgen_is_object_3c45d4f2dde4e749:function(e){let t=e;return typeof t==="object"&&t!==null},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_number_get_2e0e7dee9f701a71:function(e,t){let n=t,_=typeof n==="number"?n:void 0;D().setFloat64(e+8,u(_)?0:_,!0),D().setInt32(e+0,!u(_),!0)},__wbg___wbindgen_string_get_0380ccaa2f57f0d9:function(e,t){let n=t,_=typeof n==="string"?n:void 0;var c=u(_)?0:R(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;D().setInt32(e+4,i,!0),D().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,t){throw Error(C(e,t))},__wbg__wbg_cb_unref_dcc1a90847f04c41:function(e){e._wbg_cb_unref()},__wbg_abort_f78b99d80248bacb:function(e){e.abort()},__wbg_aborted_5b2b5f06b5e59fde:function(e){return e.aborted},__wbg_activeTexture_11079673eac5c921:function(e,t){e.activeTexture(t>>>0)},__wbg_activeTexture_2fad46c01cafe6b1:function(e,t){e.activeTexture(t>>>0)},__wbg_apply_a910804df6e1e433:function(){return p(function(e,t,n){return e.apply(t,n)},arguments)},__wbg_arrayBuffer_f07be74819944ea2:function(){return p(function(e){return e.arrayBuffer()},arguments)},__wbg_attachShader_8920a5beea54aba7:function(e,t,n){e.attachShader(t,n)},__wbg_attachShader_9567ae57af6746d5:function(e,t,n){e.attachShader(t,n)},__wbg_bindBuffer_0324f62b876c4403:function(e,t,n){e.bindBuffer(t>>>0,n)},__wbg_bindBuffer_2195e89b585ce0c3:function(e,t,n){e.bindBuffer(t>>>0,n)},__wbg_bindFramebuffer_22e4b8e6e6d8d0e8:function(e,t,n){e.bindFramebuffer(t>>>0,n)},__wbg_bindFramebuffer_378eb18ef219d37a:function(e,t,n){e.bindFramebuffer(t>>>0,n)},__wbg_bindRenderbuffer_db090531fb28de34:function(e,t,n){e.bindRenderbuffer(t>>>0,n)},__wbg_bindRenderbuffer_e0c5aeef245a913a:function(e,t,n){e.bindRenderbuffer(t>>>0,n)},__wbg_bindTexture_3cf008f256f3ed99:function(e,t,n){e.bindTexture(t>>>0,n)},__wbg_bindTexture_613a47b8917a0ccd:function(e,t,n){e.bindTexture(t>>>0,n)},__wbg_bindVertexArrayOES_3141815cb8234a6e:function(e,t){e.bindVertexArrayOES(t)},__wbg_bindVertexArray_f58af0a346185ec5:function(e,t){e.bindVertexArray(t)},__wbg_blendEquation_5fb8aee6a55cf900:function(e,t){e.blendEquation(t>>>0)},__wbg_blendEquation_d21914e937b14896:function(e,t){e.blendEquation(t>>>0)},__wbg_blendFuncSeparate_28abe082febb1a26:function(e,t,n,_,c){e.blendFuncSeparate(t>>>0,n>>>0,_>>>0,c>>>0)},__wbg_blendFuncSeparate_2af9d47f7efc0452:function(e,t,n,_,c){e.blendFuncSeparate(t>>>0,n>>>0,_>>>0,c>>>0)},__wbg_blendFunc_491ee1105079ce76:function(e,t,n){e.blendFunc(t>>>0,n>>>0)},__wbg_blendFunc_589e4252bb396484:function(e,t,n){e.blendFunc(t>>>0,n>>>0)},__wbg_blob_232135c7e297b861:function(){return p(function(e){return e.blob()},arguments)},__wbg_bufferData_50f5eb06469330e4:function(e,t,n,_){e.bufferData(t>>>0,n,_>>>0)},__wbg_bufferData_53e0f7a06b58fe81:function(e,t,n,_){e.bufferData(t>>>0,n,_>>>0)},__wbg_bufferData_5fa44d94fe7a3878:function(e,t,n,_){e.bufferData(t>>>0,n,_>>>0)},__wbg_bufferData_bad7ce562b6a9eac:function(e,t,n,_){e.bufferData(t>>>0,n,_>>>0)},__wbg_bufferSubData_22c4c420e0f67cda:function(e,t,n,_){e.bufferSubData(t>>>0,n,_)},__wbg_bufferSubData_8609cd8a2c013181:function(e,t,n,_){e.bufferSubData(t>>>0,n,_)},__wbg_byteLength_141bda7c7c28aa72:function(e){return e.byteLength},__wbg_byteLength_18a1704c0bf397bb:function(e){return e.byteLength},__wbg_byteLength_27689b065d089962:function(e){return e.byteLength},__wbg_byteLength_9f985b8373f1f3fe:function(e){return e.byteLength},__wbg_call_01721c8c75200a10:function(){return p(function(e,t,n,_,c,i){return e.call(t,n,_,c,i)},arguments)},__wbg_call_1875a20c43a36133:function(){return p(function(e,t,n,_){return e.call(t,n,_)},arguments)},__wbg_call_187d372bd5fdd4aa:function(){return p(function(e,t,n){return e.call(t,n)},arguments)},__wbg_call_6137034ef55c9d0f:function(){return p(function(e,t){return e.call(t)},arguments)},__wbg_clearColor_3f6aa096dc12e8b7:function(e,t,n,_,c){e.clearColor(t,n,_,c)},__wbg_clearColor_796427e8ac60fe14:function(e,t,n,_,c){e.clearColor(t,n,_,c)},__wbg_clearDepth_4840a5497ae51286:function(e,t){e.clearDepth(t)},__wbg_clearDepth_5a119c24c5d193bc:function(e,t){e.clearDepth(t)},__wbg_clearStencil_1b8b8c727f598eec:function(e,t){e.clearStencil(t)},__wbg_clearStencil_e4383e4a543e7997:function(e,t){e.clearStencil(t)},__wbg_clear_175cf3cb6d98d72b:function(e,t){e.clear(t>>>0)},__wbg_clear_cb96796cc568b7c8:function(e,t){e.clear(t>>>0)},__wbg_close_355afba6ea5ad1ae:function(e){e.close()},__wbg_colorMask_4d6afbbbc3022fbe:function(e,t,n,_,c){e.colorMask(t!==0,n!==0,_!==0,c!==0)},__wbg_colorMask_8c903995f6f873be:function(e,t,n,_,c){e.colorMask(t!==0,n!==0,_!==0,c!==0)},__wbg_compileShader_073a75409aaf96d2:function(e,t){e.compileShader(t)},__wbg_compileShader_c2b53ff3a8851f60:function(e,t){e.compileShader(t)},__wbg_compressedTexImage2D_93d2b30687f2cfad:function(e,t,n,_,c,i,s,f){e.compressedTexImage2D(t>>>0,n,_>>>0,c,i,s,f)},__wbg_createBuffer_d1dd23bf8704564c:function(e){let t=e.createBuffer();return u(t)?0:A(t)},__wbg_createBuffer_ffe613371d42cfd3:function(e){let t=e.createBuffer();return u(t)?0:A(t)},__wbg_createFramebuffer_2c6b5b0f49c88e5d:function(e){let t=e.createFramebuffer();return u(t)?0:A(t)},__wbg_createFramebuffer_d0969af4e9886297:function(e){let t=e.createFramebuffer();return u(t)?0:A(t)},__wbg_createImageBitmap_1b985e01e4c81baa:function(){return p(function(e,t,n){return e.createImageBitmap(t,n)},arguments)},__wbg_createImageBitmap_69996a36c51d409f:function(){return p(function(e,t,n){return e.createImageBitmap(t,n)},arguments)},__wbg_createProgram_cbf448e6f18a9402:function(e){let t=e.createProgram();return u(t)?0:A(t)},__wbg_createProgram_e0c81b0d2b8d0fd0:function(e){let t=e.createProgram();return u(t)?0:A(t)},__wbg_createRenderbuffer_2b17e9fe2e6fb4be:function(e){let t=e.createRenderbuffer();return u(t)?0:A(t)},__wbg_createRenderbuffer_c864095d6ebd60d0:function(e){let t=e.createRenderbuffer();return u(t)?0:A(t)},__wbg_createShader_6c1a2295587878a5:function(e,t){let n=e.createShader(t>>>0);return u(n)?0:A(n)},__wbg_createShader_7c9d99a21ecb08c0:function(e,t){let n=e.createShader(t>>>0);return u(n)?0:A(n)},__wbg_createTexture_01e8e591b64237de:function(e){let t=e.createTexture();return u(t)?0:A(t)},__wbg_createTexture_5f2583508ebe379b:function(e){let t=e.createTexture();return u(t)?0:A(t)},__wbg_createVertexArrayOES_a8dc8498b56df937:function(e){let t=e.createVertexArrayOES();return u(t)?0:A(t)},__wbg_createVertexArray_b223ea69dd08fcab:function(e){let t=e.createVertexArray();return u(t)?0:A(t)},__wbg_cullFace_12123c1c97f1ba2c:function(e,t){e.cullFace(t>>>0)},__wbg_cullFace_1a01f0b6d5aeb687:function(e,t){e.cullFace(t>>>0)},__wbg_deleteBuffer_070e58aaaf2a7a8b:function(e,t){e.deleteBuffer(t)},__wbg_deleteBuffer_7775ee9e248c8468:function(e,t){e.deleteBuffer(t)},__wbg_deleteFramebuffer_3f8ab330098bf8e6:function(e,t){e.deleteFramebuffer(t)},__wbg_deleteFramebuffer_570d3b214a509fa2:function(e,t){e.deleteFramebuffer(t)},__wbg_deleteProgram_822906f0368175d0:function(e,t){e.deleteProgram(t)},__wbg_deleteProgram_b524b30ad176cdb4:function(e,t){e.deleteProgram(t)},__wbg_deleteRenderbuffer_826c9b43b7ea68f5:function(e,t){e.deleteRenderbuffer(t)},__wbg_deleteRenderbuffer_f4e121a3ab21c605:function(e,t){e.deleteRenderbuffer(t)},__wbg_deleteShader_a70f6cc1918d67eb:function(e,t){e.deleteShader(t)},__wbg_deleteShader_da18a294158c2d15:function(e,t){e.deleteShader(t)},__wbg_deleteSync_4f0be28b03f50495:function(e,t){e.deleteSync(t)},__wbg_deleteTexture_78c170241204a466:function(e,t){e.deleteTexture(t)},__wbg_deleteTexture_9f42750adb092e4f:function(e,t){e.deleteTexture(t)},__wbg_deleteVertexArrayOES_e01f31634d466176:function(e,t){e.deleteVertexArrayOES(t)},__wbg_deleteVertexArray_ca9768805d051d49:function(e,t){e.deleteVertexArray(t)},__wbg_depthFunc_92e96d8f46a23300:function(e,t){e.depthFunc(t>>>0)},__wbg_depthFunc_a41fb5adacb22e09:function(e,t){e.depthFunc(t>>>0)},__wbg_depthMask_06ecff4d4514c38f:function(e,t){e.depthMask(t!==0)},__wbg_depthMask_0d7c3dec3b8405ee:function(e,t){e.depthMask(t!==0)},__wbg_depthRange_24c7969249461e8e:function(e,t,n){e.depthRange(t,n)},__wbg_depthRange_6a4e169ccf314148:function(e,t,n){e.depthRange(t,n)},__wbg_detachShader_1ed15fc2d289cf15:function(e,t,n){e.detachShader(t,n)},__wbg_detachShader_67dabaaad80a795e:function(e,t,n){e.detachShader(t,n)},__wbg_disableVertexAttribArray_11c9f11bee30c9d8:function(e,t){e.disableVertexAttribArray(t>>>0)},__wbg_disableVertexAttribArray_c4c8af1f9e4120d4:function(e,t){e.disableVertexAttribArray(t>>>0)},__wbg_disable_19fe787eccdf0272:function(e,t){e.disable(t>>>0)},__wbg_disable_81b2cb5f8cea15ae:function(e,t){e.disable(t>>>0)},__wbg_drawArraysInstancedANGLE_b76512b5abba6668:function(e,t,n,_,c){e.drawArraysInstancedANGLE(t>>>0,n,_,c)},__wbg_drawArraysInstanced_9b44aa78a087154d:function(e,t,n,_,c){e.drawArraysInstanced(t>>>0,n,_,c)},__wbg_drawArrays_08872e02fb57b847:function(e,t,n,_){e.drawArrays(t>>>0,n,_)},__wbg_drawArrays_741af5c3f8db636f:function(e,t,n,_){e.drawArrays(t>>>0,n,_)},__wbg_drawElementsInstancedANGLE_c3fc0cfa9e29a1bc:function(e,t,n,_,c,i){e.drawElementsInstancedANGLE(t>>>0,n,_>>>0,c,i)},__wbg_drawElementsInstanced_d7c396aa034159b6:function(e,t,n,_,c,i){e.drawElementsInstanced(t>>>0,n,_>>>0,c,i)},__wbg_drawElements_c8988ba71de1101a:function(e,t,n,_,c){e.drawElements(t>>>0,n,_>>>0,c)},__wbg_drawElements_cc1e6c631e89eddf:function(e,t,n,_,c){e.drawElements(t>>>0,n,_>>>0,c)},__wbg_enableVertexAttribArray_1496b78a8dbab9fd:function(e,t){e.enableVertexAttribArray(t>>>0)},__wbg_enableVertexAttribArray_d52693866bc8b8dd:function(e,t){e.enableVertexAttribArray(t>>>0)},__wbg_enable_6eeb9c0e9b483cee:function(e,t){e.enable(t>>>0)},__wbg_enable_cb4fc19b51148c37:function(e,t){e.enable(t>>>0)},__wbg_error_c9cf3fc2064683a9:function(e){console.error(e)},__wbg_fenceSync_330293024adb66bc:function(e,t,n){let _=e.fenceSync(t>>>0,n>>>0);return u(_)?0:A(_)},__wbg_fetch_b322877f1ed6457d:function(e,t,n,_){return e.fetch(C(t,n),_)},__wbg_flush_13b162660ad850d2:function(e){e.flush()},__wbg_flush_a5ad38200881ac35:function(e){e.flush()},__wbg_framebufferRenderbuffer_1c6337e0030411f3:function(e,t,n,_,c){e.framebufferRenderbuffer(t>>>0,n>>>0,_>>>0,c)},__wbg_framebufferRenderbuffer_f019e9231b142c0d:function(e,t,n,_,c){e.framebufferRenderbuffer(t>>>0,n>>>0,_>>>0,c)},__wbg_framebufferTexture2D_73c52f23ec33aa22:function(e,t,n,_,c,i){e.framebufferTexture2D(t>>>0,n>>>0,_>>>0,c,i)},__wbg_framebufferTexture2D_caddefa1f767646e:function(e,t,n,_,c,i){e.framebufferTexture2D(t>>>0,n>>>0,_>>>0,c,i)},__wbg_from_296ca31f8d0f1c52:function(e){return Array.from(e)},__wbg_frontFace_6751b4b97f997aeb:function(e,t){e.frontFace(t>>>0)},__wbg_frontFace_b064adb15b6f3772:function(e,t){e.frontFace(t>>>0)},__wbg_generateMipmap_c63604006bfa52d5:function(e,t){e.generateMipmap(t>>>0)},__wbg_generateMipmap_cd49f6eec9558721:function(e,t){e.generateMipmap(t>>>0)},__wbg_getActiveUniform_239de631a40c387a:function(e,t,n){let _=e.getActiveUniform(t,n>>>0);return u(_)?0:A(_)},__wbg_getActiveUniform_f2052b3c57679fe2:function(e,t,n){let _=e.getActiveUniform(t,n>>>0);return u(_)?0:A(_)},__wbg_getBufferSubData_dd23246099b166d1:function(e,t,n,_){e.getBufferSubData(t>>>0,n,_)},__wbg_getContext_051324720aa5b7e8:function(){return p(function(e,t,n,_){let c=e.getContext(C(t,n),_);return u(c)?0:A(c)},arguments)},__wbg_getExtension_abfda2c5db286b07:function(){return p(function(e,t,n){let _=e.getExtension(C(t,n));return u(_)?0:A(_)},arguments)},__wbg_getParameter_974595a6624c6c10:function(){return p(function(e,t){return e.getParameter(t>>>0)},arguments)},__wbg_getParameter_a97f491753b05668:function(){return p(function(e,t){return e.getParameter(t>>>0)},arguments)},__wbg_getProgramInfoLog_208fb1ff31006495:function(e,t,n){let _=t.getProgramInfoLog(n);var c=u(_)?0:R(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;D().setInt32(e+4,i,!0),D().setInt32(e+0,c,!0)},__wbg_getProgramInfoLog_3276b294d6d42fe2:function(e,t,n){let _=t.getProgramInfoLog(n);var c=u(_)?0:R(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;D().setInt32(e+4,i,!0),D().setInt32(e+0,c,!0)},__wbg_getProgramParameter_50bafab01cf88652:function(e,t,n){return e.getProgramParameter(t,n>>>0)},__wbg_getProgramParameter_fc7124bb9fb7c675:function(e,t,n){return e.getProgramParameter(t,n>>>0)},__wbg_getShaderInfoLog_7e0cbba353ca95da:function(e,t,n){let _=t.getShaderInfoLog(n);var c=u(_)?0:R(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;D().setInt32(e+4,i,!0),D().setInt32(e+0,c,!0)},__wbg_getShaderInfoLog_bb64c5a52df0b7a3:function(e,t,n){let _=t.getShaderInfoLog(n);var c=u(_)?0:R(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;D().setInt32(e+4,i,!0),D().setInt32(e+0,c,!0)},__wbg_getShaderParameter_745acf10b8e45e31:function(e,t,n){return e.getShaderParameter(t,n>>>0)},__wbg_getShaderParameter_e55ea9c456df5484:function(e,t,n){return e.getShaderParameter(t,n>>>0)},__wbg_getSupportedExtensions_1459bad37860c0c3:function(e){let t=e.getSupportedExtensions();return u(t)?0:A(t)},__wbg_getSyncParameter_bb4be47b67bfa2f8:function(e,t,n){return e.getSyncParameter(t,n>>>0)},__wbg_getUniformLocation_50ba45dade572703:function(e,t,n,_){let c=e.getUniformLocation(t,C(n,_));return u(c)?0:A(c)},__wbg_getUniformLocation_cb4e3e121235f91a:function(e,t,n,_){let c=e.getUniformLocation(t,C(n,_));return u(c)?0:A(c)},__wbg_get_31af05bd4842a84f:function(){return p(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_806853698d9fc227:function(){return p(function(e,t){return Reflect.get(e,t>>>0)},arguments)},__wbg_get_f75619e20cb68514:function(){return p(function(e,t,n,_){let c=t.get(C(n,_));var i=u(c)?0:R(c,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;D().setInt32(e+4,s,!0),D().setInt32(e+0,i,!0)},arguments)},__wbg_get_index_f4750150bb3083b3:function(e,t){return e[t>>>0]},__wbg_get_unchecked_288889d017702237:function(e,t){return e[t>>>0]},__wbg_headers_eba93595f8944c2f:function(e){return e.headers},__wbg_height_9dca4d43c3e4b84b:function(e){return e.height},__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8:function(e){let t;try{t=e instanceof ArrayBuffer}catch(_){t=!1}return t},__wbg_instanceof_Blob_7c6191a4cd5834d3:function(e){let t;try{t=e instanceof Blob}catch(_){t=!1}return t},__wbg_instanceof_Error_80a725f81f2e102d:function(e){let t;try{t=e instanceof Error}catch(_){t=!1}return t},__wbg_instanceof_Float32Array_595afb0f28b828c9:function(e){let t;try{t=e instanceof Float32Array}catch(_){t=!1}return t},__wbg_instanceof_Float64Array_8a59377f9eec1b8b:function(e){let t;try{t=e instanceof Float64Array}catch(_){t=!1}return t},__wbg_instanceof_ImageBitmap_74bea45ee48d3d7a:function(e){let t;try{t=e instanceof ImageBitmap}catch(_){t=!1}return t},__wbg_instanceof_Promise_e1dc6893aa1ece28:function(e){let t;try{t=e instanceof Promise}catch(_){t=!1}return t},__wbg_instanceof_Response_b8758567269c30b2:function(e){let t;try{t=e instanceof Response}catch(_){t=!1}return t},__wbg_instanceof_Uint32Array_53a4facaf04b8a8b:function(e){let t;try{t=e instanceof Uint32Array}catch(_){t=!1}return t},__wbg_instanceof_Uint8Array_828cef2aaacafc31:function(e){let t;try{t=e instanceof Uint8Array}catch(_){t=!1}return t},__wbg_instanceof_WebGl2RenderingContext_64c994c14c0790fb:function(e){let t;try{t=e instanceof WebGL2RenderingContext}catch(_){t=!1}return t},__wbg_instanceof_Window_82d71df4eddf88bc:function(e){let t;try{t=e instanceof Window}catch(_){t=!1}return t},__wbg_isArray_e15a2ff68ffdbef2:function(e){return Array.isArray(e)},__wbg_isContextLost_fbbab8b921e614b7:function(e){return e.isContextLost()},__wbg_isEnabled_a3522bc4076e6296:function(e,t){return e.isEnabled(t>>>0)},__wbg_isEnabled_acb9d89bd88c16bd:function(e,t){return e.isEnabled(t>>>0)},__wbg_is_4b278c0bd3caba97:function(e,t){return Object.is(e,t)},__wbg_length_511b1f84719d3462:function(e){return e.length},__wbg_length_58572db4c38f3c3e:function(e){return e.length},__wbg_length_7f3c00c40364105e:function(e){return e.length},__wbg_length_b5f0008bbf60cf59:function(e){return e.length},__wbg_length_d4bdea10311bd9cf:function(e){return e.length},__wbg_linkProgram_571a9ea00d38ff83:function(e,t){e.linkProgram(t)},__wbg_linkProgram_acdc299c43d734a0:function(e,t){e.linkProgram(t)},__wbg_message_5f8387f0c32b90a7:function(e){return e.message},__wbg_name_91a697e9ff1634bf:function(e,t){let n=t.name,_=R(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;D().setInt32(e+4,c,!0),D().setInt32(e+0,_,!0)},__wbg_new_1dbf7428bba60a42:function(e){return new Uint8Array(e)},__wbg_new_2e41357094e99294:function(){return p(function(){return new AbortController},arguments)},__wbg_new_5502aad30c185fc8:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{let f=n.a;n.a=0;try{return St(f,n.b,i,s)}finally{n.a=f}};return new Promise(_)}finally{n.a=0}},__wbg_new_617a8cdb8bb1130e:function(){return{}},__wbg_new_83ca405eae412a62:function(){return p(function(){return new Headers},arguments)},__wbg_new_ee2291f50781bf1d:function(){return[]},__wbg_new_from_slice_37a3c3a194266cb8:function(e,t){return new Uint32Array(V(e,t))},__wbg_new_from_slice_9a868026ffa4208a:function(e,t){return new Uint8Array(ke(e,t))},__wbg_new_from_slice_ca6ad97db1f4779a:function(e,t){return new Float32Array(E(e,t))},__wbg_new_from_slice_f545fd22ddc142b8:function(e,t){return new Float64Array(Oe(e,t))},__wbg_new_with_byte_offset_70ba6193352e027b:function(e,t){return new Uint8Array(e,t>>>0)},__wbg_new_with_byte_offset_and_length_40c170286adc9005:function(e,t,n){return new Float32Array(e,t>>>0,n>>>0)},__wbg_new_with_u8_array_sequence_and_options_fccc08fe93f4b8fd:function(){return p(function(e,t){return new Blob(e,t)},arguments)},__wbg_now_aa4ccb83129e9e55:function(){return Date.now()},__wbg_now_d0b7f4bea9f38490:function(e){return e.now()},__wbg_of_20798cb14708764f:function(e,t){return Array.of(e,t)},__wbg_of_d5dbecdc59e02e34:function(e){return Array.of(e)},__wbg_of_dde0b9d3265685ee:function(e,t,n){return Array.of(e,t,n)},__wbg_of_fea2613674ee0d0f:function(e,t,n,_,c){return Array.of(e,t,n,_,c)},__wbg_ok_125878a7db256ecb:function(e){return e.ok},__wbg_performance_d0d7b03fc649b694:function(e){let t=e.performance;return u(t)?0:A(t)},__wbg_pixelStorei_af18e636b3e7b725:function(e,t,n){e.pixelStorei(t>>>0,n)},__wbg_pixelStorei_cb4e43466f5b8703:function(e,t,n){e.pixelStorei(t>>>0,n)},__wbg_polygonOffset_81dc8ca84e29572b:function(e,t,n){e.polygonOffset(t,n)},__wbg_polygonOffset_8f922d9173d8849d:function(e,t,n){e.polygonOffset(t,n)},__wbg_prototypesetcall_06eb15da165dee8f:function(e,t,n){Uint32Array.prototype.set.call(V(e,t),n)},__wbg_prototypesetcall_8b03c01e2c0f8066:function(e,t,n){Float32Array.prototype.set.call(E(e,t),n)},__wbg_prototypesetcall_bc27214492979395:function(e,t,n){Uint8Array.prototype.set.call(ke(e,t),n)},__wbg_prototypesetcall_d49a4fab5ca427bc:function(e,t,n){Float64Array.prototype.set.call(Oe(e,t),n)},__wbg_push_2baf45db356cf468:function(e,t){return e.push(t)},__wbg_queueMicrotask_9833f9a49df95a49:function(e){return e.queueMicrotask},__wbg_queueMicrotask_a72f977e97f23c5f:function(e){queueMicrotask(e)},__wbg_readPixels_31e44e70558ac590:function(){return p(function(e,t,n,_,c,i,s,f){e.readPixels(t,n,_,c,i>>>0,s>>>0,f)},arguments)},__wbg_readPixels_3321086a7818a739:function(){return p(function(e,t,n,_,c,i,s,f){e.readPixels(t,n,_,c,i>>>0,s>>>0,f)},arguments)},__wbg_readPixels_eb030cd9976eeca5:function(){return p(function(e,t,n,_,c,i,s,f){e.readPixels(t,n,_,c,i>>>0,s>>>0,f)},arguments)},__wbg_renderbufferStorage_52b131bbf3112b3a:function(e,t,n,_,c){e.renderbufferStorage(t>>>0,n>>>0,_,c)},__wbg_renderbufferStorage_bca487b0dea425b8:function(e,t,n,_,c){e.renderbufferStorage(t>>>0,n>>>0,_,c)},__wbg_resolve_0076e10020304ede:function(e){return Promise.resolve(e)},__wbg_scissor_12ddc324094acd50:function(e,t,n,_,c){e.scissor(t,n,_,c)},__wbg_scissor_a9468482697c2bdb:function(e,t,n,_,c){e.scissor(t,n,_,c)},__wbg_setTimeout_db7bbc18a17e152a:function(){return p(function(e,t,n){return e.setTimeout(t,n)},arguments)},__wbg_set_145a351398b48c65:function(){return p(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_af5932e3f78b5648:function(){return p(function(e,t,n,_,c){e.set(C(t,n),C(_,c))},arguments)},__wbg_set_alpha_6dea851a46253adf:function(e,t){e.alpha=t!==0},__wbg_set_antialias_1f699e96763e8a35:function(e,t){e.antialias=t!==0},__wbg_set_cache_7507c4cc5938ccc7:function(e,t){e.cache=It[t]},__wbg_set_color_space_conversion_f27e9d866a683b4b:function(e,t){e.colorSpaceConversion=Tt[t]},__wbg_set_depth_8b49de49803d4e60:function(e,t){e.depth=t!==0},__wbg_set_headers_40ad33dcf016613f:function(e,t){e.headers=t},__wbg_set_power_preference_6ef22d4c8baf517f:function(e,t){e.powerPreference=Dt[t]},__wbg_set_premultiply_alpha_45a4cf9a1e87bfbf:function(e,t){e.premultiplyAlpha=Pt[t]},__wbg_set_resize_height_274433c2f249624d:function(e,t){e.resizeHeight=t>>>0},__wbg_set_resize_width_6f06543b29d1ca48:function(e,t){e.resizeWidth=t>>>0},__wbg_set_signal_2dbd377604627f26:function(e,t){e.signal=t},__wbg_set_stencil_edc32d9477c7c107:function(e,t){e.stencil=t!==0},__wbg_set_type_dcf75b2afa60c694:function(e,t,n){e.type=C(t,n)},__wbg_shaderSource_06379dac249994dd:function(e,t,n,_){e.shaderSource(t,C(n,_))},__wbg_shaderSource_c8812639b47d87b9:function(e,t,n,_){e.shaderSource(t,C(n,_))},__wbg_signal_e5a49a2d9c65b7f6:function(e){return e.signal},__wbg_size_74c48d7329291685:function(e){return e.size},__wbg_static_accessor_GLOBAL_266715b9d96ba635:function(){let e=typeof global>"u"?null:global;return u(e)?0:A(e)},__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179:function(){let e=typeof globalThis>"u"?null:globalThis;return u(e)?0:A(e)},__wbg_static_accessor_SELF_0b583911f537483a:function(){let e=typeof self>"u"?null:self;return u(e)?0:A(e)},__wbg_static_accessor_WINDOW_d7f903d1508cbdc4:function(){let e=typeof window>"u"?null:window;return u(e)?0:A(e)},__wbg_status_ce0a98d3c57125f3:function(e){return e.status},__wbg_stencilFunc_aa3cd8856be514c4:function(e,t,n,_){e.stencilFunc(t>>>0,n,_>>>0)},__wbg_stencilFunc_bab7e0b7c443f093:function(e,t,n,_){e.stencilFunc(t>>>0,n,_>>>0)},__wbg_stencilMask_9e18cc018897c747:function(e,t){e.stencilMask(t>>>0)},__wbg_stencilMask_a22be64c66abd825:function(e,t){e.stencilMask(t>>>0)},__wbg_stencilOpSeparate_7d01185cbdb89d99:function(e,t,n,_,c){e.stencilOpSeparate(t>>>0,n>>>0,_>>>0,c>>>0)},__wbg_stencilOpSeparate_c5af5f5dbd237bea:function(e,t,n,_,c){e.stencilOpSeparate(t>>>0,n>>>0,_>>>0,c>>>0)},__wbg_stencilOp_12274af665ab8a00:function(e,t,n,_){e.stencilOp(t>>>0,n>>>0,_>>>0)},__wbg_stencilOp_2697194654fee819:function(e,t,n,_){e.stencilOp(t>>>0,n>>>0,_>>>0)},__wbg_subarray_002b94d5e13d1411:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_texImage2D_1b3349107ad0faae:function(){return p(function(e,t,n,_,c,i,s){e.texImage2D(t>>>0,n,_,c>>>0,i>>>0,s)},arguments)},__wbg_texImage2D_82bf2b4c8aa9a1db:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texImage2D_8fc2f2fcca249b59:function(){return p(function(e,t,n,_,c,i,s){e.texImage2D(t>>>0,n,_,c>>>0,i>>>0,s)},arguments)},__wbg_texImage2D_a856af552acdc9d9:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texImage2D_ca3d0fe24620ec85:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texParameteri_647fdb1426809cb5:function(e,t,n,_){e.texParameteri(t>>>0,n>>>0,_)},__wbg_texParameteri_7864076abcdb03e0:function(e,t,n,_){e.texParameteri(t>>>0,n>>>0,_)},__wbg_texStorage2D_cf2bd991072d9efb:function(e,t,n,_,c,i){e.texStorage2D(t>>>0,n,_>>>0,c,i)},__wbg_texStorage3D_74b701c2b176380c:function(e,t,n,_,c,i,s){e.texStorage3D(t>>>0,n,_>>>0,c,i,s)},__wbg_texSubImage2D_31a0c2797aa04f32:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texSubImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texSubImage2D_5e90c7a719d40256:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texSubImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texSubImage2D_bb322aae90f7657f:function(){return p(function(e,t,n,_,c,i,s,f,b,l){e.texSubImage2D(t>>>0,n,_,c,i,s,f>>>0,b>>>0,l)},arguments)},__wbg_texSubImage3D_5143d5af7e182ddc:function(){return p(function(e,t,n,_,c,i,s,f,b,l,d,g){e.texSubImage3D(t>>>0,n,_,c,i,s,f,b,l>>>0,d>>>0,g)},arguments)},__wbg_texSubImage3D_5d773fc7a8cd4d08:function(){return p(function(e,t,n,_,c,i,s,f,b,l,d,g){e.texSubImage3D(t>>>0,n,_,c,i,s,f,b,l>>>0,d>>>0,g)},arguments)},__wbg_texSubImage3D_e0d113b7047a5130:function(){return p(function(e,t,n,_,c,i,s,f,b,l,d,g){e.texSubImage3D(t>>>0,n,_,c,i,s,f,b,l>>>0,d>>>0,g)},arguments)},__wbg_then_c949d5a25a4e78f8:function(e,t,n){return e.then(t,n)},__wbg_then_e71170d78fcf8954:function(e,t){return e.then(t)},__wbg_type_ff6f7b321fe8478b:function(e){return e.type},__wbg_uniform1f_9cfecfaeb8cf43c1:function(e,t,n){e.uniform1f(t,n)},__wbg_uniform1f_b5856e35a43b65a1:function(e,t,n){e.uniform1f(t,n)},__wbg_uniform1fv_1bf537fc926ef8b9:function(e,t,n,_){e.uniform1fv(t,E(n,_))},__wbg_uniform1fv_1cc1d09bc13b03bf:function(e,t,n,_){e.uniform1fv(t,E(n,_))},__wbg_uniform1i_531b98c4a7177366:function(e,t,n){e.uniform1i(t,n)},__wbg_uniform1i_fc2dc8cadc49d8ec:function(e,t,n){e.uniform1i(t,n)},__wbg_uniform1iv_4b8cbceccddfaa62:function(e,t,n,_){e.uniform1iv(t,W(n,_))},__wbg_uniform1iv_8fc880ae80c77c74:function(e,t,n,_){e.uniform1iv(t,W(n,_))},__wbg_uniform1ui_353c67ec681b540c:function(e,t,n){e.uniform1ui(t,n>>>0)},__wbg_uniform1uiv_ad5e946730aacbec:function(e,t,n,_){e.uniform1uiv(t,V(n,_))},__wbg_uniform2f_131da2d4bf17e4b9:function(e,t,n,_){e.uniform2f(t,n,_)},__wbg_uniform2f_a92b5bb95dc5b4d9:function(e,t,n,_){e.uniform2f(t,n,_)},__wbg_uniform2fv_319c49f0ce340f26:function(e,t,n,_){e.uniform2fv(t,E(n,_))},__wbg_uniform2fv_a7d3c1830d18c1b2:function(e,t,n,_){e.uniform2fv(t,E(n,_))},__wbg_uniform2iv_65f36fc9777697d7:function(e,t,n,_){e.uniform2iv(t,W(n,_))},__wbg_uniform2iv_ca9cb507409b9ad1:function(e,t,n,_){e.uniform2iv(t,W(n,_))},__wbg_uniform2uiv_c95af5fb653ccb86:function(e,t,n,_){e.uniform2uiv(t,V(n,_))},__wbg_uniform3f_1211579ff87ccfad:function(e,t,n,_,c){e.uniform3f(t,n,_,c)},__wbg_uniform3f_ee105161897ee48a:function(e,t,n,_,c){e.uniform3f(t,n,_,c)},__wbg_uniform3fv_055ea5ac38af4fce:function(e,t,n,_){e.uniform3fv(t,E(n,_))},__wbg_uniform3fv_58520ffe22a6e27c:function(e,t,n,_){e.uniform3fv(t,E(n,_))},__wbg_uniform3iv_0590e8b7eff2a791:function(e,t,n,_){e.uniform3iv(t,W(n,_))},__wbg_uniform3iv_e91b1410dc299f50:function(e,t,n,_){e.uniform3iv(t,W(n,_))},__wbg_uniform3uiv_9992491000463a52:function(e,t,n,_){e.uniform3uiv(t,V(n,_))},__wbg_uniform4f_22bfec882308eec2:function(e,t,n,_,c,i){e.uniform4f(t,n,_,c,i)},__wbg_uniform4f_8dd8f311e656ca0d:function(e,t,n,_,c,i){e.uniform4f(t,n,_,c,i)},__wbg_uniform4fv_3ef2f5121fcb78ae:function(e,t,n,_){e.uniform4fv(t,E(n,_))},__wbg_uniform4fv_cf8ff646c36232c8:function(e,t,n,_){e.uniform4fv(t,E(n,_))},__wbg_uniform4iv_6fc5436b4f876039:function(e,t,n,_){e.uniform4iv(t,W(n,_))},__wbg_uniform4iv_99c2b07787d362d6:function(e,t,n,_){e.uniform4iv(t,W(n,_))},__wbg_uniform4uiv_a6fb3237d9df7ed4:function(e,t,n,_){e.uniform4uiv(t,V(n,_))},__wbg_uniformMatrix3fv_472e7824735acce1:function(e,t,n,_,c){e.uniformMatrix3fv(t,n!==0,E(_,c))},__wbg_uniformMatrix3fv_83fdc9c3c0d43204:function(e,t,n,_,c){e.uniformMatrix3fv(t,n!==0,E(_,c))},__wbg_uniformMatrix4fv_dff9738d995fd0b1:function(e,t,n,_,c){e.uniformMatrix4fv(t,n!==0,E(_,c))},__wbg_uniformMatrix4fv_e691d7f14d3609f7:function(e,t,n,_,c){e.uniformMatrix4fv(t,n!==0,E(_,c))},__wbg_useProgram_5bdae58fd9f9826f:function(e,t){e.useProgram(t)},__wbg_useProgram_e075c2902e420761:function(e,t){e.useProgram(t)},__wbg_vertexAttrib1f_37ce0547e8fa5f36:function(e,t,n){e.vertexAttrib1f(t>>>0,n)},__wbg_vertexAttrib1f_470b2556c148483a:function(e,t,n){e.vertexAttrib1f(t>>>0,n)},__wbg_vertexAttribDivisorANGLE_659fb027198a47c3:function(e,t,n){e.vertexAttribDivisorANGLE(t>>>0,n>>>0)},__wbg_vertexAttribDivisor_7575d382215322f7:function(e,t,n){e.vertexAttribDivisor(t>>>0,n>>>0)},__wbg_vertexAttribIPointer_fc8057c62cfcc63c:function(e,t,n,_,c,i){e.vertexAttribIPointer(t>>>0,n,_>>>0,c,i)},__wbg_vertexAttribPointer_24b495e18df325dc:function(e,t,n,_,c,i,s){e.vertexAttribPointer(t>>>0,n,_>>>0,c!==0,i,s)},__wbg_vertexAttribPointer_54d56b18f71a946d:function(e,t,n,_,c,i,s){e.vertexAttribPointer(t>>>0,n,_>>>0,c!==0,i,s)},__wbg_viewport_16936692526e2ce6:function(e,t,n,_,c){e.viewport(t,n,_,c)},__wbg_viewport_e35d16c542d2ce70:function(e,t,n,_,c){e.viewport(t,n,_,c)},__wbg_warn_13abc63e0d4b3527:function(e){console.warn(e)},__wbg_width_8a9cc26363f10d5f:function(e){return e.width},__wbindgen_generic_0000000000000001:function(e,t){return Bt(e,t,vt)},__wbindgen_generic_0000000000000002:function(e){return e},__wbindgen_generic_0000000000000003:function(e,t){return E(e,t)},__wbindgen_generic_0000000000000004:function(e,t){return Mt(e,t)},__wbindgen_generic_0000000000000005:function(e,t){return W(e,t)},__wbindgen_generic_0000000000000006:function(e,t){return Rt(e,t)},__wbindgen_generic_0000000000000007:function(e,t){return Et(e,t)},__wbindgen_generic_0000000000000008:function(e,t){return V(e,t)},__wbindgen_generic_0000000000000009:function(e,t){return ke(e,t)},__wbindgen_generic_000000000000000a:function(e,t){return C(e,t)},__wbindgen_init_externref_table:function(){let e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function vt(r,e,t){let n=o.wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_(r,e,t);if(n[1])throw h(n[0])}function St(r,e,t,n){o.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_(r,e,t,n)}var Tt=["none","default"],Pt=["none","premultiply","default"],It=["default","no-store","reload","no-cache","force-cache","only-if-cached"],Dt=["default","low-power","high-performance"],tt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((r)=>o.__wbg_engine_free(r,1));function A(r){let e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}var nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((r)=>o.__wbindgen_destroy_closure(r.a,r.b));function Ce(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let _=r.description;if(_==null)return"Symbol";else return`Symbol(${_})`}if(e=="function"){let _=r.name;if(typeof _=="string"&&_.length>0)return`Function(${_})`;else return"Function"}if(Array.isArray(r)){let _=r.length,c="[";if(_>0)c+=Ce(r[0]);for(let i=1;i<_;i++)c+=", "+Ce(r[i]);return c+="]",c}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(_){return"Object"}if(r instanceof Error)return`${r.name}: ${r.message}
|
|
4
|
-
${r.stack}`;return n}function E(r,e){return r=r>>>0,it().subarray(r/4,r/4+e)}function Oe(r,e){return r=r>>>0,at().subarray(r/8,r/8+e)}function Mt(r,e){return r=r>>>0,Lt().subarray(r/2,r/2+e)}function W(r,e){return r=r>>>0,kt().subarray(r/4,r/4+e)}function Rt(r,e){return r=r>>>0,Ut().subarray(r/1,r/1+e)}function Et(r,e){return r=r>>>0,st().subarray(r/2,r/2+e)}function V(r,e){return r=r>>>0,ft().subarray(r/4,r/4+e)}function ke(r,e){return r=r>>>0,j().subarray(r/1,r/1+e)}var N=null;function D(){if(N===null||N.buffer.detached===!0||N.buffer.detached===void 0&&N.buffer!==o.memory.buffer)N=new DataView(o.memory.buffer);return N}var Z=null;function it(){if(Z===null||Z.byteLength===0)Z=new Float32Array(o.memory.buffer);return Z}var Q=null;function at(){if(Q===null||Q.byteLength===0)Q=new Float64Array(o.memory.buffer);return Q}var ee=null;function Lt(){if(ee===null||ee.byteLength===0)ee=new Int16Array(o.memory.buffer);return ee}var te=null;function kt(){if(te===null||te.byteLength===0)te=new Int32Array(o.memory.buffer);return te}var ne=null;function Ut(){if(ne===null||ne.byteLength===0)ne=new Int8Array(o.memory.buffer);return ne}function C(r,e){return Ot(r>>>0,e)}var re=null;function st(){if(re===null||re.byteLength===0)re=new Uint16Array(o.memory.buffer);return re}var _e=null;function ft(){if(_e===null||_e.byteLength===0)_e=new Uint32Array(o.memory.buffer);return _e}var oe=null;function j(){if(oe===null||oe.byteLength===0)oe=new Uint8Array(o.memory.buffer);return oe}function p(r,e){try{return r.apply(this,e)}catch(t){let n=A(t);o.__wbindgen_exn_store(n)}}function u(r){return r===void 0||r===null}function Bt(r,e,t){let n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;let i=n.a;n.a=0;try{return t(i,n.b,...c)}finally{n.a=i,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{if(--n.cnt===0)o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,nt.unregister(n)},nt.register(_,n,n),_}function rt(r,e){let t=e(r.length*2,2)>>>0;return st().set(r,t/2),a=r.length,t}function w(r,e){let t=e(r.length*4,4)>>>0;return ft().set(r,t/4),a=r.length,t}function P(r,e){let t=e(r.length*1,1)>>>0;return j().set(r,t/1),a=r.length,t}function y(r,e){let t=e(r.length*4,4)>>>0;return it().set(r,t/4),a=r.length,t}function x(r,e){let t=e(r.length*8,8)>>>0;return at().set(r,t/8),a=r.length,t}function _t(r,e){let t=e(r.length*4,4)>>>0;for(let n=0;n<r.length;n++){let _=A(r[n]);D().setUint32(t+4*n,_,!0)}return a=r.length,t}function R(r,e,t){if(t===void 0){let s=ce.encode(r),f=e(s.length,1)>>>0;return j().subarray(f,f+s.length).set(s),a=s.length,f}let n=r.length,_=e(n,1)>>>0,c=j(),i=0;for(;i<n;i++){let s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){if(i!==0)r=r.slice(i);_=t(_,n,n=i+r.length*3,1)>>>0;let s=j().subarray(_+i,_+n),f=ce.encodeInto(r,s);i+=f.written,_=t(_,n,i,1)>>>0}return a=i,_}function h(r){let e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}var be=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});be.decode();var Ct=2146435072,Ue=0;function Ot(r,e){if(Ue+=e,Ue>=Ct)be=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),be.decode(),Ue=e;return be.decode(j().subarray(r,r+e))}var ce=new TextEncoder;if(!("encodeInto"in ce))ce.encodeInto=function(r,e){let t=ce.encode(r);return e.set(t),{read:r.length,written:t.length}};var a=0,Wt,Vt,o;function Gt(r,e){return Vt=r,o=r.exports,Wt=e,N=null,Z=null,Q=null,ee=null,te=null,ne=null,re=null,_e=null,oe=null,o.__wbindgen_start(),o}async function Nt(r,e){if(typeof Response==="function"&&r instanceof Response){if(!r.ok)throw Error(`failed to fetch Wasm: ${r.status} ${r.statusText} fetching '${r.url}'`);if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}let n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(r,e);if(n instanceof WebAssembly.Instance)return{instance:n,module:r};else return n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function bt(r){if(o!==void 0)return o;if(r!==void 0)if(Object.getPrototypeOf(r)===Object.prototype)({module_or_path:r}=r);else console.warn("using deprecated parameters for the initialization function; pass a single object instead");if(r===void 0)r=new URL("isard_bg.wasm",import.meta.url);let e=Ft();if(typeof r==="string"||typeof Request==="function"&&r instanceof Request||typeof URL==="function"&&r instanceof URL)r=fetch(r);let{instance:t,module:n}=await Nt(await r,e);return Gt(t,n)}function dt(r,e,t,n,_){let c=ut(r,L.__wbindgen_malloc),i=H,s=ut(e,L.__wbindgen_malloc),f=H,b=lt(t,L.__wbindgen_malloc),l=H,d=lt(n,L.__wbindgen_malloc),g=H,m=L.decodeCopc(c,i,s,f,b,l,d,g,_);if(m[3])throw qt(m[2]);var F=Ht(m[0],m[1]).slice();return L.__wbindgen_free(m[0],m[1]*1,1),F}function jt(){return{__proto__:null,"./isard_points_bg.js":{__proto__:null,__wbindgen_generic_0000000000000001:function(e,t){return zt(e,t)},__wbindgen_init_externref_table:function(){let e=L.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function Ht(r,e){return r=r>>>0,Ve().subarray(r/1,r/1+e)}var ie=null;function $t(){if(ie===null||ie.byteLength===0)ie=new Float64Array(L.memory.buffer);return ie}function zt(r,e){return Jt(r>>>0,e)}var ae=null;function Ve(){if(ae===null||ae.byteLength===0)ae=new Uint8Array(L.memory.buffer);return ae}function ut(r,e){let t=e(r.length*1,1)>>>0;return Ve().set(r,t/1),H=r.length,t}function lt(r,e){let t=e(r.length*8,8)>>>0;return $t().set(r,t/8),H=r.length,t}function qt(r){let e=L.__wbindgen_externrefs.get(r);return L.__externref_table_dealloc(r),e}var ue=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ue.decode();var Xt=2146435072,We=0;function Jt(r,e){if(We+=e,We>=Xt)ue=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),ue.decode(),We=e;return ue.decode(Ve().subarray(r,r+e))}var H=0,Kt,Yt,L;function Zt(r,e){return Yt=r,L=r.exports,Kt=e,ie=null,ae=null,L.__wbindgen_start(),L}async function Qt(r,e){if(typeof Response==="function"&&r instanceof Response){if(!r.ok)throw Error(`failed to fetch Wasm: ${r.status} ${r.statusText} fetching '${r.url}'`);if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}let n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(r,e);if(n instanceof WebAssembly.Instance)return{instance:n,module:r};else return n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function gt(r){if(L!==void 0)return L;if(r!==void 0)if(Object.getPrototypeOf(r)===Object.prototype)({module_or_path:r}=r);else console.warn("using deprecated parameters for the initialization function; pass a single object instead");if(r===void 0)r=new URL("isard_points_bg.wasm",import.meta.url);let e=jt();if(typeof r==="string"||typeof Request==="function"&&r instanceof Request||typeof URL==="function"&&r instanceof URL)r=fetch(r);let{instance:t,module:n}=await Qt(await r,e);return Zt(t,n)}var wt,Ne=Xe,mt={astc:!1,bptc:!1,etc:!1,s3tc:!1},pt="",Ge,se=new Map,le=(r,e=[])=>postMessage(r,e);addEventListener("message",(r)=>{let e=r.data;switch(e.type){case"headers":et(e.rules);break;case"init":wt=bt({module_or_path:e.module}),Ne=e.decoders,mt=e.formats,pt=e.points;break;case"points":on(e);break;case"abort":se.get(e.id)?.abort();break;case"load":en(e.id,e.url,e.transform,e.yUp,e.reload,e.priority);break}});var en=async(r,e,t,n,_,c)=>{let i=new AbortController;se.set(r,i);try{await wt;let s={signal:i.signal,cache:_?"reload":"default",...c?{priority:c}:{}},f=await Ye(e,Le(e,s)),b=new Uint8Array(await f.arrayBuffer()),l=ct(b),d=l.length>0?await Je(Ne,l):void 0,g=ot(b,t,n,d),m=new Map,F=(v,k)=>{let U=m.get(v);if(U)return U;let B=k==="image/ktx2"?Ke(Ne,mt,v).then((O)=>({bitmap:null,texture:O})):createImageBitmap(new Blob([v],{type:k??""}),{premultiplyAlpha:"none"}).then((O)=>({bitmap:O}));return m.set(v,B),B},S=g.points??[],T=await Promise.all(g.primitives.map(async({vertices:v,indices:k,image:U,mime:B,color:O,features:G})=>({vertices:v,indices:k,...O?{color:O}:{},...G?{features:G}:{},...U?await F(U,B):{bitmap:null}}))),I=new Set;T.forEach((v)=>{if(I.add(v.vertices.buffer),I.add(v.indices.buffer),v.color)I.add(v.color.buffer);if(v.features)I.add(v.features.buffer);if(v.bitmap)I.add(v.bitmap);v.texture?.levels.forEach((k)=>{I.add(k.data.buffer)})}),S.forEach((v)=>{I.add(v.buffer)});let M={anchor:g.anchor,primitives:T,...S.length>0?{points:S}:{},...g.properties?{properties:g.properties}:{}};le({type:"tile",id:r,tile:M},[...I])}catch(s){le({type:"error",id:r,error:String(s),aborted:i.signal.aborted})}finally{se.delete(r)}},tn=4,nn=1000,rn=(r,e)=>new Promise((t,n)=>{let _=setTimeout(t,r);e.addEventListener("abort",()=>{clearTimeout(_),n(new DOMException("aborted","AbortError"))})}),_n=async(r,e,t,n,_)=>{for(let c=1;;c+=1){let i={signal:n,headers:{Range:`bytes=${e}-${e+Math.max(t,1)-1}`},..._?{priority:_}:{}},s=await fetch(r,Le(r,i));if(s.status===429&&c<tn){let f=Number(s.headers.get("Retry-After"));await rn(f>0?f*1000:nn*2**(c-1),n);continue}if(!s.ok)throw Ee(r,s.status);if(s.status!==206){let f=s.headers.get("Content-Length"),b=f!==null&&!(Number(f)<=t),l=b?void 0:await Ze(s,t);if(!l){if(b)await s.body?.cancel();throw Error("the server ignores range requests (HTTP 206 expected)")}return l.subarray(e,e+t)}return new Uint8Array(await s.arrayBuffer())}},on=async(r)=>{let{id:e,url:t,offset:n,size:_,laz:c,layout:i,grid:s,count:f,priority:b}=r,l=new AbortController;se.set(e,l);try{Ge??=gt({module_or_path:pt}).catch((m)=>{throw Ge=void 0,m});let[d]=await Promise.all([_n(t,n,_,l.signal,b),Ge]),g=dt(d,c,i,s,f);le({type:"points",id:e,vertices:g},[g.buffer])}catch(d){le({type:"error",id:e,error:String(d),aborted:l.signal.aborted})}finally{se.delete(e)}};
|
|
1
|
+
var J=(t)=>typeof t==="object"&&t!==null&&!Array.isArray(t);var te={draco:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/",basis:"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/libs/basis/"},Ue=async(t,e)=>{let n=await(await fetch(t)).text(),r=URL.createObjectURL(new Blob([`${n}
|
|
2
|
+
export default ${e};`],{type:"text/javascript"}));try{let s=await import(r);if(J(s)&&typeof s.default==="function")return s.default}catch{}finally{URL.revokeObjectURL(r)}return Function(`${n}
|
|
3
|
+
return ${e};`)()},H=async(t,e,n,r)=>{let[s,o]=await Promise.all([Ue(`${t}${e}`,r),fetch(`${t}${n}`).then((a)=>a.arrayBuffer())]);return s({wasmBinary:o})},Q,Z,ee,ne=async(t,e)=>{let n=e.some((o)=>!o.points);if(n)Q??=H(t.draco,"draco_wasm_wrapper_gltf.js","draco_decoder_gltf.wasm","DracoDecoderModule");if(e.some((o)=>o.points))Z??=H(t.draco,"draco_wasm_wrapper.js","draco_decoder.wasm","DracoDecoderModule");let[r,s]=await Promise.all([n?Q:void 0,Z]);return e.map((o)=>{let a=o.points?s:r;if(!a)throw Error("isard: the Draco decoder is not loaded");let i=new a.Decoder,c=o.points?new a.PointCloud:new a.Mesh;try{let f=new Int8Array(o.data.buffer,o.data.byteOffset,o.data.byteLength),d=o.points?i.DecodeArrayToPointCloud(f,f.byteLength,c):i.DecodeArrayToMesh(f,f.byteLength,c);if(!d.ok())throw Error(`Draco: ${d.error_msg()}`);let y=(g)=>{let p=i.GetAttributeByUniqueId(c,g),w=c.num_points()*p.num_components(),T=a._malloc(w*4);try{return i.GetAttributeDataArrayForAllPoints(c,p,a.DT_FLOAT32,w*4,T),a.HEAPF32.slice(T/4,T/4+w)}finally{a._free(T)}};if(o.points){let g={mesh:o.mesh,primitive:o.primitive,positions:y(o.position)};if(o.color!==void 0)g.colors=y(o.color);if(o.normal!==void 0)g.normals=y(o.normal);return g}let _=(()=>{let g=c.num_faces()*3,p=a._malloc(g*4);try{return i.GetTrianglesUInt32Array(c,g*4,p),a.HEAPU32.slice(p/4,p/4+g)}finally{a._free(p)}})(),A={mesh:o.mesh,primitive:o.primitive,positions:y(o.position),indices:_};if(o.uv!==void 0)A.uvs=y(o.uv);return A}finally{a.destroy(c),a.destroy(i)}})},ve=(t,e)=>{if(t.astc)return{basis:10,gl:37808};if(t.bptc)return{basis:6,gl:36492};if(t.etc)return e?{basis:1,gl:37496}:{basis:0,gl:37492};if(t.s3tc)return e?{basis:3,gl:33779}:{basis:2,gl:33776};return{basis:13,gl:32856}},re=async(t,e,n)=>{ee??=H(t.basis,"basis_transcoder.js","basis_transcoder.wasm","BASIS").then((o)=>(o.initializeBasis(),o));let s=new(await ee).KTX2File(n);try{if(!s.isValid()||!s.startTranscoding())throw Error("KTX2: invalid file");let{basis:o,gl:a}=ve(e,s.getHasAlpha()),i=Array.from({length:s.getLevels()},(c,f)=>{let{origWidth:d,origHeight:y}=s.getImageLevelInfo(f,0,0),m=new Uint8Array(s.getImageTranscodedSizeInBytes(f,0,0,o));if(!s.transcodeImage(m,f,0,0,o,0,-1,-1))throw Error("KTX2: transcoding failed");return{width:d,height:y,data:m}});return{format:a,levels:i}}finally{s.close(),s.delete()}};var C=(t,e)=>Error(`isard: ${String(t)}: HTTP ${e}`),oe=async(t,e)=>{let n=await fetch(t,e);if(!n.ok)throw C(t,n.status);return n};var se=async(t,e)=>{let n=t.body?.getReader();if(!n)return new Uint8Array(await t.arrayBuffer());let r=[],s=0;for(;;){let{done:a,value:i}=await n.read();if(a)break;if(s+=i.length,s>e){await n.cancel();return}r.push(i)}let o=new Uint8Array(s);return r.reduce((a,i)=>(o.set(i,a),a+i.length),0),o};var ae=[];var ie=(t)=>{ae=t};var G=(t,e={})=>{let n=String(t),r=ae.filter(([o])=>n.startsWith(o));if(r.length===0)return e;let s=new Headers(e.headers);return r.forEach(([,o])=>{Object.entries(o).forEach(([a,i])=>{s.set(a,i)})}),{...e,headers:s}};function fe(t,e,n,r,s){let o=ce(t,b.__wbindgen_malloc),a=R,i=ce(e,b.__wbindgen_malloc),c=R,f=le(n,b.__wbindgen_malloc),d=R,y=le(r,b.__wbindgen_malloc),m=R,_=b.decodeCopc(o,a,i,c,f,d,y,m,s);if(_[3])throw Se(_[2]);var A=Ee(_[0],_[1]).slice();return b.__wbindgen_free(_[0],_[1]*1,1),A}function Fe(){return{__proto__:null,"./isard_points_bg.js":{__proto__:null,__wbindgen_generic_0000000000000001:function(e,n){return We(e,n)},__wbindgen_init_externref_table:function(){let e=b.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)}}}}function Ee(t,e){return t=t>>>0,K().subarray(t/1,t/1+e)}var U=null;function Pe(){if(U===null||U.byteLength===0)U=new Float64Array(b.memory.buffer);return U}function We(t,e){return ke(t>>>0,e)}var v=null;function K(){if(v===null||v.byteLength===0)v=new Uint8Array(b.memory.buffer);return v}function ce(t,e){let n=e(t.length*1,1)>>>0;return K().set(t,n/1),R=t.length,n}function le(t,e){let n=e(t.length*8,8)>>>0;return Pe().set(t,n/8),R=t.length,n}function Se(t){let e=b.__wbindgen_externrefs.get(t);return b.__externref_table_dealloc(t),e}var L=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});L.decode();var Ie=2146435072,z=0;function ke(t,e){if(z+=e,z>=Ie)L=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),L.decode(),z=e;return L.decode(K().subarray(t,t+e))}var R=0,Le,Oe,b;function Be(t,e){return Oe=t,b=t.exports,Le=e,U=null,v=null,b.__wbindgen_start(),b}async function je(t,e){if(typeof Response==="function"&&t instanceof Response){if(!t.ok)throw Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(n(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);if(r instanceof WebAssembly.Instance)return{instance:r,module:t};else return r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function ue(t){if(b!==void 0)return b;if(t!==void 0)if(Object.getPrototypeOf(t)===Object.prototype)({module_or_path:t}=t);else console.warn("using deprecated parameters for the initialization function; pass a single object instead");if(t===void 0)t=new URL("isard_points_bg.wasm",import.meta.url);let e=Fe();if(typeof t==="string"||typeof Request==="function"&&t instanceof Request||typeof URL==="function"&&t instanceof URL)t=fetch(t);let{instance:n,module:r}=await je(await t,e);return Be(n,r)}function we(t,e,n,r){let s=Ae(t,l.__wbindgen_malloc),o=S,a=Ne(e,l.__wbindgen_malloc),i=S,c=l.decodeTile(s,o,a,i,n,r);if(c[2])throw B(c[1]);return B(c[0])}function pe(t){let e=Ae(t,l.__wbindgen_malloc),n=S,r=l.dracoRequests(e,n);if(r[2])throw B(r[1]);return B(r[0])}function He(){return{__proto__:null,"./isard_tiles3d_bg.js":{__proto__:null,__wbg___wbindgen_is_null_e343b7d08827ba72:function(e){return e===null},__wbg___wbindgen_is_undefined_8865fb403f8fe9d8:function(e){return e===void 0},__wbg___wbindgen_number_get_2e0e7dee9f701a71:function(e,n){let r=n,s=typeof r==="number"?r:void 0;ye().setFloat64(e+8,ge(s)?0:s,!0),ye().setInt32(e+0,!ge(s),!0)},__wbg___wbindgen_throw_41e9ee4f547fc59a:function(e,n){throw Error(me(e,n))},__wbg_from_296ca31f8d0f1c52:function(e){return Array.from(e)},__wbg_get_31af05bd4842a84f:function(){return _e(function(e,n){return Reflect.get(e,n)},arguments)},__wbg_get_unchecked_288889d017702237:function(e,n){return e[n>>>0]},__wbg_instanceof_Float32Array_595afb0f28b828c9:function(e){let n;try{n=e instanceof Float32Array}catch(s){n=!1}return n},__wbg_instanceof_Uint32Array_53a4facaf04b8a8b:function(e){let n;try{n=e instanceof Uint32Array}catch(s){n=!1}return n},__wbg_length_511b1f84719d3462:function(e){return e.length},__wbg_length_58572db4c38f3c3e:function(e){return e.length},__wbg_length_d4bdea10311bd9cf:function(e){return e.length},__wbg_new_617a8cdb8bb1130e:function(){return{}},__wbg_new_ee2291f50781bf1d:function(){return[]},__wbg_new_from_slice_37a3c3a194266cb8:function(e,n){return new Uint32Array(be(e,n))},__wbg_new_from_slice_9a868026ffa4208a:function(e,n){return new Uint8Array(Ge(e,n))},__wbg_new_from_slice_ca6ad97db1f4779a:function(e,n){return new Float32Array(de(e,n))},__wbg_new_from_slice_f545fd22ddc142b8:function(e,n){return new Float64Array($e(e,n))},__wbg_prototypesetcall_06eb15da165dee8f:function(e,n,r){Uint32Array.prototype.set.call(be(e,n),r)},__wbg_prototypesetcall_8b03c01e2c0f8066:function(e,n,r){Float32Array.prototype.set.call(de(e,n),r)},__wbg_push_2baf45db356cf468:function(e,n){return e.push(n)},__wbg_set_145a351398b48c65:function(){return _e(function(e,n,r){return Reflect.set(e,n,r)},arguments)},__wbindgen_generic_0000000000000001:function(e){return e},__wbindgen_generic_0000000000000002:function(e,n){return me(e,n)},__wbindgen_init_externref_table:function(){let e=l.__wbindgen_externrefs,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)}}}}function Ce(t){let e=l.__externref_table_alloc();return l.__wbindgen_externrefs.set(e,t),e}function de(t,e){return t=t>>>0,ze().subarray(t/4,t/4+e)}function $e(t,e){return t=t>>>0,he().subarray(t/8,t/8+e)}function be(t,e){return t=t>>>0,Ke().subarray(t/4,t/4+e)}function Ge(t,e){return t=t>>>0,X().subarray(t/1,t/1+e)}var h=null;function ye(){if(h===null||h.buffer.detached===!0||h.buffer.detached===void 0&&h.buffer!==l.memory.buffer)h=new DataView(l.memory.buffer);return h}var F=null;function ze(){if(F===null||F.byteLength===0)F=new Float32Array(l.memory.buffer);return F}var E=null;function he(){if(E===null||E.byteLength===0)E=new Float64Array(l.memory.buffer);return E}function me(t,e){return Ve(t>>>0,e)}var P=null;function Ke(){if(P===null||P.byteLength===0)P=new Uint32Array(l.memory.buffer);return P}var W=null;function X(){if(W===null||W.byteLength===0)W=new Uint8Array(l.memory.buffer);return W}function _e(t,e){try{return t.apply(this,e)}catch(n){let r=Ce(n);l.__wbindgen_exn_store(r)}}function ge(t){return t===void 0||t===null}function Ae(t,e){let n=e(t.length*1,1)>>>0;return X().set(t,n/1),S=t.length,n}function Ne(t,e){let n=e(t.length*8,8)>>>0;return he().set(t,n/8),S=t.length,n}function B(t){let e=l.__wbindgen_externrefs.get(t);return l.__externref_table_dealloc(t),e}var O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();var Xe=2146435072,N=0;function Ve(t,e){if(N+=e,N>=Xe)O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),N=e;return O.decode(X().subarray(t,t+e))}var S=0,Ye,qe,l;function Je(t,e){return qe=t,l=t.exports,Ye=e,h=null,F=null,E=null,P=null,W=null,l.__wbindgen_start(),l}async function Qe(t,e){if(typeof Response==="function"&&t instanceof Response){if(!t.ok)throw Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(s){if(n(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);if(r instanceof WebAssembly.Instance)return{instance:r,module:t};else return r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function Te(t){if(l!==void 0)return l;if(t!==void 0)if(Object.getPrototypeOf(t)===Object.prototype)({module_or_path:t}=t);else console.warn("using deprecated parameters for the initialization function; pass a single object instead");if(t===void 0)t=new URL("isard_tiles3d_bg.wasm",import.meta.url);let e=He();if(typeof t==="string"||typeof Request==="function"&&t instanceof Request||typeof URL==="function"&&t instanceof URL)t=fetch(t);let{instance:n,module:r}=await Qe(await t,e);return Je(n,r)}var xe="",De,Y=te,Re={astc:!1,bptc:!1,etc:!1,s3tc:!1},Me="",V,I=new Map,j=(t,e=[])=>postMessage(t,e);addEventListener("message",(t)=>{let e=t.data;switch(e.type){case"headers":ie(e.rules);break;case"init":xe=e.tiles3d,Y=e.decoders,Re=e.formats,Me=e.points;break;case"points":ot(e);break;case"abort":I.get(e.id)?.abort();break;case"load":Ze(e.id,e.url,e.transform,e.yUp,e.reload,e.priority);break}});var Ze=async(t,e,n,r,s,o)=>{let a=new AbortController;I.set(t,a);try{De??=Te({module_or_path:xe}),await De;let i={signal:a.signal,cache:s?"reload":"default",...o?{priority:o}:{}},c=await oe(e,G(e,i)),f=new Uint8Array(await c.arrayBuffer()),d=pe(f),y=d.length>0?await ne(Y,d):void 0,m=we(f,n,r,y),_=new Map,A=(u,D)=>{let M=_.get(u);if(M)return M;let k=D==="image/ktx2"?re(Y,Re,u).then((x)=>({bitmap:null,texture:x})):createImageBitmap(new Blob([u],{type:D??""}),{premultiplyAlpha:"none"}).then((x)=>({bitmap:x}));return _.set(u,k),k},g=m.points??[],p=await Promise.all(m.primitives.map(async({vertices:u,indices:D,image:M,mime:k,color:x,features:q})=>({vertices:u,indices:D,...x?{color:x}:{},...q?{features:q}:{},...M?await A(M,k):{bitmap:null}}))),w=new Set;p.forEach((u)=>{if(w.add(u.vertices.buffer),w.add(u.indices.buffer),u.color)w.add(u.color.buffer);if(u.features)w.add(u.features.buffer);if(u.bitmap)w.add(u.bitmap);u.texture?.levels.forEach((D)=>{w.add(D.data.buffer)})}),g.forEach((u)=>{w.add(u.buffer)});let T={anchor:m.anchor,primitives:p,...g.length>0?{points:g}:{},...m.properties?{properties:m.properties}:{}};j({type:"tile",id:t,tile:T},[...w])}catch(i){j({type:"error",id:t,error:String(i),aborted:a.signal.aborted})}finally{I.delete(t)}},et=4,tt=1000,nt=(t,e)=>new Promise((n,r)=>{let s=setTimeout(n,t);e.addEventListener("abort",()=>{clearTimeout(s),r(new DOMException("aborted","AbortError"))})}),rt=async(t,e,n,r,s)=>{for(let o=1;;o+=1){let a={signal:r,headers:{Range:`bytes=${e}-${e+Math.max(n,1)-1}`},...s?{priority:s}:{}},i=await fetch(t,G(t,a));if(i.status===429&&o<et){let c=Number(i.headers.get("Retry-After"));await nt(c>0?c*1000:tt*2**(o-1),r);continue}if(!i.ok)throw C(t,i.status);if(i.status!==206){let c=i.headers.get("Content-Length"),f=c!==null&&!(Number(c)<=n),d=f?void 0:await se(i,n);if(!d){if(f)await i.body?.cancel();throw Error("the server ignores range requests (HTTP 206 expected)")}return d.subarray(e,e+n)}return new Uint8Array(await i.arrayBuffer())}},ot=async(t)=>{let{id:e,url:n,offset:r,size:s,laz:o,layout:a,grid:i,count:c,priority:f}=t,d=new AbortController;I.set(e,d);try{V??=ue({module_or_path:Me}).catch((_)=>{throw V=void 0,_});let[y]=await Promise.all([rt(n,r,s,d.signal,f),V]),m=fe(y,o,a,i,c);j({type:"points",id:e,vertices:m},[m.buffer])}catch(y){j({type:"error",id:e,error:String(y),aborted:d.signal.aborted})}finally{I.delete(e)}};
|
|
5
4
|
|
|
6
|
-
//# debugId=
|
|
5
|
+
//# debugId=FBA3818EFA235FBB64756E2164756E21
|
|
7
6
|
//# sourceMappingURL=decoder.worker.js.map
|