@developmentseed/deck.gl-raster 0.5.0-beta.1 → 0.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/gpu-modules/colormap-names.d.ts +128 -0
  2. package/dist/gpu-modules/colormap-names.d.ts.map +1 -0
  3. package/dist/gpu-modules/colormap-names.js +127 -0
  4. package/dist/gpu-modules/colormap-names.js.map +1 -0
  5. package/dist/gpu-modules/colormap.d.ts +28 -4
  6. package/dist/gpu-modules/colormap.d.ts.map +1 -1
  7. package/dist/gpu-modules/colormap.js +22 -5
  8. package/dist/gpu-modules/colormap.js.map +1 -1
  9. package/dist/gpu-modules/colormaps.png +0 -0
  10. package/dist/gpu-modules/composite-bands.d.ts +85 -0
  11. package/dist/gpu-modules/composite-bands.d.ts.map +1 -0
  12. package/dist/gpu-modules/composite-bands.js +141 -0
  13. package/dist/gpu-modules/composite-bands.js.map +1 -0
  14. package/dist/gpu-modules/create-colormap-texture.d.ts +16 -0
  15. package/dist/gpu-modules/create-colormap-texture.d.ts.map +1 -0
  16. package/dist/gpu-modules/create-colormap-texture.js +41 -0
  17. package/dist/gpu-modules/create-colormap-texture.js.map +1 -0
  18. package/dist/gpu-modules/cutline-bbox.d.ts +70 -0
  19. package/dist/gpu-modules/cutline-bbox.d.ts.map +1 -0
  20. package/dist/gpu-modules/cutline-bbox.js +100 -0
  21. package/dist/gpu-modules/cutline-bbox.js.map +1 -0
  22. package/dist/gpu-modules/decode-colormap-sprite.d.ts +25 -0
  23. package/dist/gpu-modules/decode-colormap-sprite.d.ts.map +1 -0
  24. package/dist/gpu-modules/decode-colormap-sprite.js +51 -0
  25. package/dist/gpu-modules/decode-colormap-sprite.js.map +1 -0
  26. package/dist/gpu-modules/index.d.ts +12 -1
  27. package/dist/gpu-modules/index.d.ts.map +1 -1
  28. package/dist/gpu-modules/index.js +7 -1
  29. package/dist/gpu-modules/index.js.map +1 -1
  30. package/dist/gpu-modules/linear-rescale.d.ts +39 -0
  31. package/dist/gpu-modules/linear-rescale.d.ts.map +1 -0
  32. package/dist/gpu-modules/linear-rescale.js +40 -0
  33. package/dist/gpu-modules/linear-rescale.js.map +1 -0
  34. package/dist/gpu-modules/types.d.ts +10 -1
  35. package/dist/gpu-modules/types.d.ts.map +1 -1
  36. package/dist/index.d.ts +5 -9
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +4 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/layer-utils.d.ts +28 -0
  41. package/dist/layer-utils.d.ts.map +1 -0
  42. package/dist/layer-utils.js +56 -0
  43. package/dist/layer-utils.js.map +1 -0
  44. package/dist/mesh-layer/mesh-layer.d.ts.map +1 -1
  45. package/dist/mesh-layer/mesh-layer.js +10 -1
  46. package/dist/mesh-layer/mesh-layer.js.map +1 -1
  47. package/dist/multi-raster-tileset/index.d.ts +5 -0
  48. package/dist/multi-raster-tileset/index.d.ts.map +1 -0
  49. package/dist/multi-raster-tileset/index.js +3 -0
  50. package/dist/multi-raster-tileset/index.js.map +1 -0
  51. package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts +75 -0
  52. package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts.map +1 -0
  53. package/dist/multi-raster-tileset/multi-tileset-descriptor.js +97 -0
  54. package/dist/multi-raster-tileset/multi-tileset-descriptor.js.map +1 -0
  55. package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts +129 -0
  56. package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts.map +1 -0
  57. package/dist/multi-raster-tileset/secondary-tile-resolver.js +88 -0
  58. package/dist/multi-raster-tileset/secondary-tile-resolver.js.map +1 -0
  59. package/dist/raster-tileset/index.d.ts +4 -1
  60. package/dist/raster-tileset/index.d.ts.map +1 -1
  61. package/dist/raster-tileset/index.js +2 -1
  62. package/dist/raster-tileset/index.js.map +1 -1
  63. package/dist/raster-tileset/raster-tile-traversal.d.ts +29 -51
  64. package/dist/raster-tileset/raster-tile-traversal.d.ts.map +1 -1
  65. package/dist/raster-tileset/raster-tile-traversal.js +113 -171
  66. package/dist/raster-tileset/raster-tile-traversal.js.map +1 -1
  67. package/dist/raster-tileset/raster-tileset-2d.d.ts +8 -22
  68. package/dist/raster-tileset/raster-tileset-2d.d.ts.map +1 -1
  69. package/dist/raster-tileset/raster-tileset-2d.js +30 -81
  70. package/dist/raster-tileset/raster-tileset-2d.js.map +1 -1
  71. package/dist/raster-tileset/tile-matrix-set.d.ts +20 -0
  72. package/dist/raster-tileset/tile-matrix-set.d.ts.map +1 -0
  73. package/dist/raster-tileset/tile-matrix-set.js +121 -0
  74. package/dist/raster-tileset/tile-matrix-set.js.map +1 -0
  75. package/dist/raster-tileset/tileset-interface.d.ts +78 -0
  76. package/dist/raster-tileset/tileset-interface.d.ts.map +1 -0
  77. package/dist/raster-tileset/tileset-interface.js +2 -0
  78. package/dist/raster-tileset/tileset-interface.js.map +1 -0
  79. package/dist/raster-tileset/types.d.ts +10 -18
  80. package/dist/raster-tileset/types.d.ts.map +1 -1
  81. package/package.json +17 -16
@@ -0,0 +1,70 @@
1
+ export type CutlineBboxProps = {
2
+ /**
3
+ * Axis-aligned bbox in **EPSG:3857 meters**, packed as
4
+ * `[minX, minY, maxX, maxY]`. This must be in the same coordinate space
5
+ * as the layer's mesh `positions` attribute — for `COGLayer` /
6
+ * `RasterLayer`'s Web Mercator rendering path, that is raw 3857 meters.
7
+ *
8
+ * Use {@link lngLatBboxToMercator} to project a WGS84 lng/lat bbox once
9
+ * at bbox definition time.
10
+ */
11
+ bbox: [number, number, number, number];
12
+ };
13
+ /**
14
+ * A shader module that discards fragments whose position falls outside a
15
+ * Web Mercator (EPSG:3857) axis-aligned bbox.
16
+ *
17
+ * Intended for rendering rasters with a "map collar" (e.g. USGS historical
18
+ * topographic maps) where the valid data area is described as a bbox but
19
+ * the raw pixels include surrounding metadata.
20
+ *
21
+ * Only supports rendering in a `WebMercatorViewport`. The caller is
22
+ * responsible for enforcing this in application code; the module itself
23
+ * does not have viewport access.
24
+ *
25
+ * This module assumes the layer's mesh `positions` attribute is in EPSG:3857
26
+ * meters — the convention used by `COGLayer` / `RasterLayer` in Web Mercator
27
+ * rendering mode. It injects a vertex shader varying that passes each
28
+ * vertex's 3857 meters through to the fragment shader, and compares against
29
+ * a uniform bbox also in 3857 meters. This avoids deck.gl's common space and
30
+ * its viewport-anchored precision translation, which would otherwise cause
31
+ * the test to drift at higher zoom levels.
32
+ */
33
+ export declare const CutlineBbox: {
34
+ readonly name: "cutlineBbox";
35
+ readonly fs: "uniform cutlineBboxUniforms {\n vec4 bbox;\n} cutlineBbox;\n";
36
+ readonly inject: {
37
+ readonly "vs:#decl": "out vec2 v_cutlineBboxMercator;";
38
+ readonly "vs:#main-start": "\n v_cutlineBboxMercator = positions.xy;\n ";
39
+ readonly "fs:#decl": "in vec2 v_cutlineBboxMercator;";
40
+ readonly "fs:#main-start": "\n {\n if (v_cutlineBboxMercator.x < cutlineBbox.bbox.x ||\n v_cutlineBboxMercator.x > cutlineBbox.bbox.z ||\n v_cutlineBboxMercator.y < cutlineBbox.bbox.y ||\n v_cutlineBboxMercator.y > cutlineBbox.bbox.w) {\n discard;\n }\n }\n ";
41
+ };
42
+ readonly uniformTypes: {
43
+ readonly bbox: "vec4<f32>";
44
+ };
45
+ readonly getUniforms: (props: Partial<CutlineBboxProps>) => {
46
+ bbox: [number, number, number, number];
47
+ } | {
48
+ bbox?: undefined;
49
+ };
50
+ };
51
+ /**
52
+ * Project a single WGS84 lng/lat point (degrees) to EPSG:3857 meters.
53
+ *
54
+ * Throws if the latitude falls outside the Web Mercator projection's valid
55
+ * range (±85.051129°).
56
+ *
57
+ * This is intended to be used with the {@link CutlineBbox} module, which
58
+ * expects a bbox in 3857 meters. The conversion from WGS84 to 3857 is a
59
+ * one-time cost that can be done at bbox definition time, rather than per frame
60
+ * in the shader.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const [west, south] = lngLatToMercator(-120.75, 39.25);
65
+ * const [east, north] = lngLatToMercator(-120.5, 39.5);
66
+ * const bbox = [west, south, east, north];
67
+ * ```
68
+ */
69
+ export declare function lngLatToMercator(lng: number, lat: number): [number, number];
70
+ //# sourceMappingURL=cutline-bbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cutline-bbox.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/cutline-bbox.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;OAQG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAUF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;kCAyCD,OAAO,CAAC,gBAAgB,CAAC;;;;;CAEG,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAU3E"}
@@ -0,0 +1,100 @@
1
+ /** Earth equatorial radius used by Web Mercator (WGS84 / EPSG:3857). */
2
+ const EARTH_RADIUS = 6378137.0;
3
+ /** Web Mercator latitude limit in degrees. */
4
+ const MERCATOR_LAT_LIMIT = 85.051129;
5
+ const MODULE_NAME = "cutlineBbox";
6
+ const uniformBlock = `\
7
+ uniform ${MODULE_NAME}Uniforms {
8
+ vec4 bbox;
9
+ } ${MODULE_NAME};
10
+ `;
11
+ /**
12
+ * A shader module that discards fragments whose position falls outside a
13
+ * Web Mercator (EPSG:3857) axis-aligned bbox.
14
+ *
15
+ * Intended for rendering rasters with a "map collar" (e.g. USGS historical
16
+ * topographic maps) where the valid data area is described as a bbox but
17
+ * the raw pixels include surrounding metadata.
18
+ *
19
+ * Only supports rendering in a `WebMercatorViewport`. The caller is
20
+ * responsible for enforcing this in application code; the module itself
21
+ * does not have viewport access.
22
+ *
23
+ * This module assumes the layer's mesh `positions` attribute is in EPSG:3857
24
+ * meters — the convention used by `COGLayer` / `RasterLayer` in Web Mercator
25
+ * rendering mode. It injects a vertex shader varying that passes each
26
+ * vertex's 3857 meters through to the fragment shader, and compares against
27
+ * a uniform bbox also in 3857 meters. This avoids deck.gl's common space and
28
+ * its viewport-anchored precision translation, which would otherwise cause
29
+ * the test to drift at higher zoom levels.
30
+ */
31
+ export const CutlineBbox = {
32
+ name: MODULE_NAME,
33
+ fs: uniformBlock,
34
+ inject: {
35
+ // Declare the mercator-meters varying on both sides of the pipeline.
36
+ "vs:#decl": `out vec2 v_cutlineBboxMercator;`,
37
+ // `positions` is the per-vertex attribute the SimpleMeshLayer vertex
38
+ // shader reads (see @deck.gl/mesh-layers simple-mesh-layer-vertex.glsl).
39
+ // In COGLayer's CARTESIAN + web-mercator path this attribute is already
40
+ // in EPSG:3857 meters. We capture it before any projection is applied.
41
+ "vs:#main-start": /* glsl */ `
42
+ v_cutlineBboxMercator = positions.xy;
43
+ `,
44
+ "fs:#decl": `in vec2 v_cutlineBboxMercator;`,
45
+ // Injects at fs:#main-start (not fs:DECKGL_FILTER_COLOR). The
46
+ // DECKGL_FILTER_COLOR hook is a generated function whose body is assembled
47
+ // before the main FS source; top-level FS varyings declared in the main
48
+ // source are out of scope there. Injecting at #main-start puts this test
49
+ // inside main() where the varying is visible and discard still works.
50
+ //
51
+ // Globe support: when rendering in a GlobeView, the mesh positions are in
52
+ // 4326 lng/lat rather than 3857 meters, so this exact varying is no
53
+ // longer meaningful. A future globe code path would need a different
54
+ // varying (e.g. lng/lat pair) and matching uniform layout.
55
+ "fs:#main-start": /* glsl */ `
56
+ {
57
+ if (v_cutlineBboxMercator.x < ${MODULE_NAME}.bbox.x ||
58
+ v_cutlineBboxMercator.x > ${MODULE_NAME}.bbox.z ||
59
+ v_cutlineBboxMercator.y < ${MODULE_NAME}.bbox.y ||
60
+ v_cutlineBboxMercator.y > ${MODULE_NAME}.bbox.w) {
61
+ discard;
62
+ }
63
+ }
64
+ `,
65
+ },
66
+ uniformTypes: {
67
+ bbox: "vec4<f32>",
68
+ },
69
+ // Pass-through: the bbox is expected to already be in 3857 meters. The
70
+ // conversion from WGS84 is done by `lngLatBboxToMercator` at bbox
71
+ // definition time so it does not run in the per-frame render loop.
72
+ getUniforms: (props) => props.bbox ? { bbox: props.bbox } : {},
73
+ };
74
+ /**
75
+ * Project a single WGS84 lng/lat point (degrees) to EPSG:3857 meters.
76
+ *
77
+ * Throws if the latitude falls outside the Web Mercator projection's valid
78
+ * range (±85.051129°).
79
+ *
80
+ * This is intended to be used with the {@link CutlineBbox} module, which
81
+ * expects a bbox in 3857 meters. The conversion from WGS84 to 3857 is a
82
+ * one-time cost that can be done at bbox definition time, rather than per frame
83
+ * in the shader.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const [west, south] = lngLatToMercator(-120.75, 39.25);
88
+ * const [east, north] = lngLatToMercator(-120.5, 39.5);
89
+ * const bbox = [west, south, east, north];
90
+ * ```
91
+ */
92
+ export function lngLatToMercator(lng, lat) {
93
+ if (lat < -MERCATOR_LAT_LIMIT || lat > MERCATOR_LAT_LIMIT) {
94
+ throw new Error(`lngLatToMercator: latitude must be within Web Mercator limits (±${MERCATOR_LAT_LIMIT}°); got lat=${lat}`);
95
+ }
96
+ const x = (EARTH_RADIUS * lng * Math.PI) / 180;
97
+ const y = EARTH_RADIUS * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));
98
+ return [x, y];
99
+ }
100
+ //# sourceMappingURL=cutline-bbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cutline-bbox.js","sourceRoot":"","sources":["../../src/gpu-modules/cutline-bbox.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAerC,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,YAAY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C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /** Any source that {@link decodeColormapSprite} can normalize into an `ImageData`. */
2
+ export type ColormapSpriteSource = ArrayBuffer | Uint8Array | ImageBitmap;
3
+ /**
4
+ * Decode a colormap sprite image into `ImageData`. Does not require a GPU
5
+ * `Device`, so it can run during app startup in parallel with the
6
+ * device-creation path; pair with `createColormapTexture` once the device
7
+ * is available.
8
+ *
9
+ * Supported source forms:
10
+ * - `ArrayBuffer` / `Uint8Array`: wrapped in a `Blob` and decoded via
11
+ * `createImageBitmap`.
12
+ * - `ImageBitmap`: drawn into an `OffscreenCanvas` to extract pixels.
13
+ *
14
+ * To decode from a URL, fetch the bytes first:
15
+ *
16
+ * ```ts
17
+ * const bytes = await (await fetch(colormapsUrl)).arrayBuffer();
18
+ * const imageData = await decodeColormapSprite(bytes);
19
+ * ```
20
+ *
21
+ * Avoiding a `string` overload here keeps the helper from having to
22
+ * disambiguate URL / base64 / data-URL inputs.
23
+ */
24
+ export declare function decodeColormapSprite(source: ColormapSpriteSource): Promise<ImageData>;
25
+ //# sourceMappingURL=decode-colormap-sprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-colormap-sprite.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/decode-colormap-sprite.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,SAAS,CAAC,CAOpB"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Decode a colormap sprite image into `ImageData`. Does not require a GPU
3
+ * `Device`, so it can run during app startup in parallel with the
4
+ * device-creation path; pair with `createColormapTexture` once the device
5
+ * is available.
6
+ *
7
+ * Supported source forms:
8
+ * - `ArrayBuffer` / `Uint8Array`: wrapped in a `Blob` and decoded via
9
+ * `createImageBitmap`.
10
+ * - `ImageBitmap`: drawn into an `OffscreenCanvas` to extract pixels.
11
+ *
12
+ * To decode from a URL, fetch the bytes first:
13
+ *
14
+ * ```ts
15
+ * const bytes = await (await fetch(colormapsUrl)).arrayBuffer();
16
+ * const imageData = await decodeColormapSprite(bytes);
17
+ * ```
18
+ *
19
+ * Avoiding a `string` overload here keeps the helper from having to
20
+ * disambiguate URL / base64 / data-URL inputs.
21
+ */
22
+ export async function decodeColormapSprite(source) {
23
+ const bitmap = await sourceToImageBitmap(source);
24
+ try {
25
+ return bitmapToImageData(bitmap);
26
+ }
27
+ finally {
28
+ bitmap.close();
29
+ }
30
+ }
31
+ async function sourceToImageBitmap(source) {
32
+ if (source instanceof ImageBitmap) {
33
+ return source;
34
+ }
35
+ // `BlobPart` is strict about `Uint8Array<ArrayBufferLike>` vs
36
+ // `Uint8Array<ArrayBuffer>` in TS 5+. At runtime both an `ArrayBuffer`
37
+ // and any `Uint8Array` are valid blob inputs; the cast sidesteps the
38
+ // overly-narrow typing.
39
+ const blob = new Blob([source]);
40
+ return createImageBitmap(blob);
41
+ }
42
+ function bitmapToImageData(bitmap) {
43
+ const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
44
+ const ctx = canvas.getContext("2d");
45
+ if (!ctx) {
46
+ throw new Error("Failed to obtain 2D context for decoding the colormap sprite.");
47
+ }
48
+ ctx.drawImage(bitmap, 0, 0);
49
+ return ctx.getImageData(0, 0, bitmap.width, bitmap.height);
50
+ }
51
+ //# sourceMappingURL=decode-colormap-sprite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-colormap-sprite.js","sourceRoot":"","sources":["../../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{ Colormap } from "./colormap";
2
+ export type { ColormapProps } from "./colormap.js";
3
+ export { Colormap } from "./colormap.js";
4
+ export { COLORMAP_INDEX, type ColormapName, } from "./colormap-names.js";
5
+ export type { CompositeBandsProps } from "./composite-bands.js";
6
+ export { buildCompositeBandsProps, CompositeBands, } from "./composite-bands.js";
7
+ export { createColormapTexture } from "./create-colormap-texture.js";
3
8
  export { CreateTexture } from "./create-texture";
9
+ export type { CutlineBboxProps } from "./cutline-bbox.js";
10
+ export { CutlineBbox, lngLatToMercator } from "./cutline-bbox.js";
11
+ export type { ColormapSpriteSource } from "./decode-colormap-sprite.js";
12
+ export { decodeColormapSprite } from "./decode-colormap-sprite.js";
4
13
  export { FilterNoDataVal } from "./filter-nodata";
14
+ export type { LinearRescaleProps } from "./linear-rescale.js";
15
+ export { LinearRescale } from "./linear-rescale.js";
5
16
  export { MaskTexture } from "./mask-texture";
6
17
  export type { RasterModule } from "./types";
7
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -1,6 +1,12 @@
1
1
  export { BlackIsZero, CMYKToRGB, cieLabToRGB, WhiteIsZero, YCbCrToRGB, } from "./color";
2
- export { Colormap } from "./colormap";
2
+ export { Colormap } from "./colormap.js";
3
+ export { COLORMAP_INDEX, } from "./colormap-names.js";
4
+ export { buildCompositeBandsProps, CompositeBands, } from "./composite-bands.js";
5
+ export { createColormapTexture } from "./create-colormap-texture.js";
3
6
  export { CreateTexture } from "./create-texture";
7
+ export { CutlineBbox, lngLatToMercator } from "./cutline-bbox.js";
8
+ export { decodeColormapSprite } from "./decode-colormap-sprite.js";
4
9
  export { FilterNoDataVal } from "./filter-nodata";
10
+ export { LinearRescale } from "./linear-rescale.js";
5
11
  export { MaskTexture } from "./mask-texture";
6
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,cAAc,GAEf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Props for the {@link LinearRescale} shader module.
3
+ */
4
+ export type LinearRescaleProps = {
5
+ /** Minimum input value (maps to 0.0 in output). */
6
+ rescaleMin: number;
7
+ /** Maximum input value (maps to 1.0 in output). */
8
+ rescaleMax: number;
9
+ };
10
+ /**
11
+ * A shader module that linearly rescales RGB color values from
12
+ * `[min, max]` to `[0, 1]`, clamping values outside the range.
13
+ *
14
+ * Useful for normalizing data like Sentinel-2 reflectance (0-10000 stored
15
+ * as uint16) into a visible range after `r16unorm` normalization maps
16
+ * them to approximately 0.0-0.15.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Sentinel-2 L2A: reflectance 0-10000 → r16unorm 0.0-0.153
21
+ * { module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 0.15 } }
22
+ * ```
23
+ */
24
+ export declare const LinearRescale: {
25
+ readonly name: "linearRescale";
26
+ readonly fs: "uniform linearRescaleUniforms {\n float rescaleMin;\n float rescaleMax;\n} linearRescale;\n";
27
+ readonly inject: {
28
+ readonly "fs:DECKGL_FILTER_COLOR": "\n color.rgb = clamp((color.rgb - linearRescale.rescaleMin) / (linearRescale.rescaleMax - linearRescale.rescaleMin), 0.0, 1.0);\n";
29
+ };
30
+ readonly uniformTypes: {
31
+ readonly rescaleMin: "f32";
32
+ readonly rescaleMax: "f32";
33
+ };
34
+ readonly getUniforms: (props: Partial<LinearRescaleProps>) => {
35
+ rescaleMin: number;
36
+ rescaleMax: number;
37
+ };
38
+ };
39
+ //# sourceMappingURL=linear-rescale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-rescale.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/linear-rescale.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;kCAiBH,OAAO,CAAC,kBAAkB,CAAC;;;;CAMG,CAAC"}
@@ -0,0 +1,40 @@
1
+ const MODULE_NAME = "linearRescale";
2
+ /**
3
+ * A shader module that linearly rescales RGB color values from
4
+ * `[min, max]` to `[0, 1]`, clamping values outside the range.
5
+ *
6
+ * Useful for normalizing data like Sentinel-2 reflectance (0-10000 stored
7
+ * as uint16) into a visible range after `r16unorm` normalization maps
8
+ * them to approximately 0.0-0.15.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // Sentinel-2 L2A: reflectance 0-10000 → r16unorm 0.0-0.153
13
+ * { module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 0.15 } }
14
+ * ```
15
+ */
16
+ export const LinearRescale = {
17
+ name: MODULE_NAME,
18
+ fs: `\
19
+ uniform ${MODULE_NAME}Uniforms {
20
+ float rescaleMin;
21
+ float rescaleMax;
22
+ } ${MODULE_NAME};
23
+ `,
24
+ inject: {
25
+ "fs:DECKGL_FILTER_COLOR": /* glsl */ `
26
+ color.rgb = clamp((color.rgb - ${MODULE_NAME}.rescaleMin) / (${MODULE_NAME}.rescaleMax - ${MODULE_NAME}.rescaleMin), 0.0, 1.0);
27
+ `,
28
+ },
29
+ uniformTypes: {
30
+ rescaleMin: "f32",
31
+ rescaleMax: "f32",
32
+ },
33
+ getUniforms: (props) => {
34
+ return {
35
+ rescaleMin: props.rescaleMin ?? 0.0,
36
+ rescaleMax: props.rescaleMax ?? 1.0,
37
+ };
38
+ },
39
+ };
40
+ //# sourceMappingURL=linear-rescale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-rescale.js","sourceRoot":"","sources":["../../src/gpu-modules/linear-rescale.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE;UACI,WAAW;;;IAGjB,WAAW;CACd;IACC,MAAM,EAAE;QACN,wBAAwB,EAAE,UAAU,CAAC;mCACN,WAAW,mBAAmB,WAAW,iBAAiB,WAAW;CACvG;KACE;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;KAClB;IACD,WAAW,EAAE,CAAC,KAAkC,EAAE,EAAE;QAClD,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG;YACnC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG;SACpC,CAAC;IACJ,CAAC;CACkD,CAAC"}
@@ -1,7 +1,16 @@
1
1
  import type { Texture } from "@luma.gl/core";
2
2
  import type { ShaderModule } from "@luma.gl/shadertools";
3
- export type RasterModule<PropsT extends Record<string, number | Texture> = Record<string, number | Texture>> = {
3
+ /**
4
+ * Allowed prop value types for shader modules: scalars, typed tuples
5
+ * (matching luma.gl's internal `UniformValue`), or texture bindings.
6
+ */
7
+ type RasterModulePropValue = number | boolean | readonly number[] | Texture;
8
+ /**
9
+ * A shader module paired with its props, forming one step in a render pipeline.
10
+ */
11
+ export type RasterModule<PropsT extends Record<string, RasterModulePropValue> = Record<string, RasterModulePropValue>> = {
4
12
  module: ShaderModule<PropsT>;
5
13
  props?: Partial<PropsT>;
6
14
  };
15
+ export {};
7
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,MAAM,YAAY,CACtB,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CACtD,MAAM,EACN,MAAM,GAAG,OAAO,CACjB,IACC;IACF,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;GAGG;AACH,KAAK,qBAAqB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,YAAY,CACtB,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,MAAM,CAC3D,MAAM,EACN,qBAAqB,CACtB,IACC;IACF,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,13 +1,9 @@
1
1
  export type { RasterModule } from "./gpu-modules/types.js";
2
+ export { renderDebugTileOutline as _renderDebugTileOutline } from "./layer-utils.js";
3
+ export type { MultiTilesetDescriptor, SecondaryTileIndex, SecondaryTileResolution, UvTransform, } from "./multi-raster-tileset/index.js";
4
+ export { createMultiTilesetDescriptor, resolveSecondaryTiles, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-raster-tileset/index.js";
2
5
  export type { RasterLayerProps, RenderTileResult } from "./raster-layer.js";
3
6
  export { RasterLayer } from "./raster-layer.js";
4
- export type { TileMetadata } from "./raster-tileset/index.js";
5
- export { TileMatrixSetTileset } from "./raster-tileset/index.js";
6
- export declare const __TEST_EXPORTS: {
7
- computeProjectedTileBounds: (tileMatrix: import("@developmentseed/morecantile").TileMatrix, { x, y, }: {
8
- x: number;
9
- y: number;
10
- }) => [number, number, number, number];
11
- RasterTileNode: typeof import("./raster-tileset/raster-tile-traversal.js").RasterTileNode;
12
- };
7
+ export type { Bounds, CornerBounds, Corners, ProjectionFunction, TileMetadata, TilesetDescriptor, TilesetLevel, } from "./raster-tileset/index.js";
8
+ export { RasterTileset2D, TileMatrixSetAdaptor, } from "./raster-tileset/index.js";
13
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,eAAO,MAAM,cAAc;;;;;;CAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACrF,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,GACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,MAAM,EACN,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ // Not a public API; exported for use in COGLayer and ZarrLayer
2
+ export { renderDebugTileOutline as _renderDebugTileOutline } from "./layer-utils.js";
3
+ export { createMultiTilesetDescriptor, resolveSecondaryTiles, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-raster-tileset/index.js";
1
4
  export { RasterLayer } from "./raster-layer.js";
2
- export { TileMatrixSetTileset } from "./raster-tileset/index.js";
3
- import { __TEST_EXPORTS as traversalTestExports } from "./raster-tileset/raster-tile-traversal.js";
4
- export const __TEST_EXPORTS = { ...traversalTestExports };
5
+ export { RasterTileset2D, TileMatrixSetAdaptor, } from "./raster-tileset/index.js";
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEnG,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,+DAA+D;AAC/D,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAOrF,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,OAAO,EACL,eAAe,EACf,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { _Tile2DHeader as Tile2DHeader } from "@deck.gl/geo-layers";
2
+ import { PathLayer, TextLayer } from "@deck.gl/layers";
3
+ import type { ReprojectionFns } from "@developmentseed/raster-reproject";
4
+ import type { TileMetadata } from "./raster-tileset";
5
+ export declare function renderDebugTileOutline(id: string, tile: Tile2DHeader & TileMetadata, forwardTo4326: ReprojectionFns["forwardReproject"]): (TextLayer<any, {
6
+ id: `${string}-label`;
7
+ data: {
8
+ position: number[];
9
+ text: string;
10
+ }[];
11
+ getColor: [number, number, number, number];
12
+ getSize: 24;
13
+ sizeUnits: "pixels";
14
+ outlineWidth: 3;
15
+ outlineColor: [number, number, number, number];
16
+ fontSettings: {
17
+ sdf: true;
18
+ };
19
+ }> | PathLayer<any, {
20
+ id: string;
21
+ data: [number, number][][];
22
+ getPath: (d: any) => any;
23
+ getColor: [number, number, number, number];
24
+ getWidth: 2;
25
+ widthUnits: "pixels";
26
+ pickable: false;
27
+ }>)[];
28
+ //# sourceMappingURL=layer-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-utils.d.ts","sourceRoot":"","sources":["../src/layer-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,YAAY,GAAG,YAAY,EACjC,aAAa,EAAE,eAAe,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;MA2DnD"}
@@ -0,0 +1,56 @@
1
+ import { PathLayer, TextLayer } from "@deck.gl/layers";
2
+ export function renderDebugTileOutline(id, tile, forwardTo4326) {
3
+ const { projectedCorners } = tile;
4
+ // Create a closed path in WGS84 projection around the tile bounds
5
+ //
6
+ // The tile has a `bbox` field which is already the bounding box in WGS84,
7
+ // but that uses `transformBounds` and densifies edges. So the corners of
8
+ // the bounding boxes don't line up with each other.
9
+ //
10
+ // In this case in the debug mode, it looks better if we ignore the actual
11
+ // non-linearities of the edges and just draw a box connecting the
12
+ // reprojected corners. In any case, the _image itself_ will be densified
13
+ // on the edges as a feature of the mesh generation.
14
+ const { topLeft, topRight, bottomRight, bottomLeft } = projectedCorners;
15
+ const topLeftWgs84 = forwardTo4326(topLeft[0], topLeft[1]);
16
+ const topRightWgs84 = forwardTo4326(topRight[0], topRight[1]);
17
+ const bottomRightWgs84 = forwardTo4326(bottomRight[0], bottomRight[1]);
18
+ const bottomLeftWgs84 = forwardTo4326(bottomLeft[0], bottomLeft[1]);
19
+ const path = [
20
+ topLeftWgs84,
21
+ topRightWgs84,
22
+ bottomRightWgs84,
23
+ bottomLeftWgs84,
24
+ topLeftWgs84,
25
+ ];
26
+ const center = [
27
+ (topLeftWgs84[0] + bottomRightWgs84[0]) / 2,
28
+ (topLeftWgs84[1] + bottomRightWgs84[1]) / 2,
29
+ ];
30
+ const labelLayer = new TextLayer({
31
+ id: `${id}-label`,
32
+ data: [
33
+ {
34
+ position: center,
35
+ text: `x=${tile.index.x} y=${tile.index.y} z=${tile.index.z}`,
36
+ },
37
+ ],
38
+ getColor: [255, 255, 255, 255],
39
+ getSize: 24,
40
+ sizeUnits: "pixels",
41
+ outlineWidth: 3,
42
+ outlineColor: [0, 0, 0, 255],
43
+ fontSettings: { sdf: true },
44
+ });
45
+ const outlineLayer = new PathLayer({
46
+ id,
47
+ data: [path],
48
+ getPath: (d) => d,
49
+ getColor: [255, 0, 0, 255], // Red
50
+ getWidth: 2,
51
+ widthUnits: "pixels",
52
+ pickable: false,
53
+ });
54
+ return [outlineLayer, labelLayer];
55
+ }
56
+ //# sourceMappingURL=layer-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-utils.js","sourceRoot":"","sources":["../src/layer-utils.ts"],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AAE,YAAY,CAC9B,oBAAoB,GAAG;IACrB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,YAAY,EAAE,CAAC;CAChC,CAcF,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,eAAe,CACnD,IAAI,EACJ,qBAAqB,CACtB;IACC,OAAgB,SAAS,SAAwB;IACjD,OAAgB,YAAY,EAAE,OAAO,YAAY,CAAgB;IAEjE,sBAAsB,IAAI,YAAY,EAAE;IAQ/B,UAAU;IAiBV,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;CAa/B"}
@@ -3,8 +3,17 @@ import { CreateTexture } from "../gpu-modules/create-texture.js";
3
3
  import fs from "./mesh-layer-fragment.glsl.js";
4
4
  const defaultProps = {
5
5
  ...SimpleMeshLayer.defaultProps,
6
- image: { type: "image", value: null, async: true },
6
+ // Note: putting `image` in defaultProps causes Maplibre to fail to render
7
+ // labels in interleaved mode 🤷‍♂️
8
+ // image: { type: "image", value: null, async: true },
7
9
  renderPipeline: { type: "array", value: [], compare: true },
10
+ // Disable lighting by default (avoids darkening raster)
11
+ material: {
12
+ ambient: 1.0,
13
+ diffuse: 0.0,
14
+ shininess: 0,
15
+ specularColor: [0, 0, 0],
16
+ },
8
17
  };
9
18
  /**
10
19
  * A small subclass of the SimpleMeshLayer to allow dynamic shader injections.
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-layer.js","sourceRoot":"","sources":["../../src/mesh-layer/mesh-layer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAS/C,MAAM,YAAY,GAKd;IACF,GAAG,eAAe,CAAC,YAAY;IAC/B,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,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AAG,WAAW,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAEQ,UAAU;QACjB,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QAE3C,MAAM,OAAO,GAAmB,eAAe,CAAC,OAAO,CAAC;QACxD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAED,OAAO;YACL,GAAG,eAAe;YAClB,kEAAkE;YAClE,mBAAmB;YACnB,EAAE;YACF,OAAO;SACR,CAAC;IACJ,CAAC;IAEQ,IAAI,CAAC,IAAS;QACrB,MAAM,WAAW,GAAsD,EAAE,CAAC;QAC1E,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;YAC9C,uCAAuC;YACvC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,CAAC;QAED,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;YAClC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { MultiTilesetDescriptor, SecondaryLevelStrategy, } from "./multi-tileset-descriptor.js";
2
+ export { createMultiTilesetDescriptor, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-tileset-descriptor.js";
3
+ export type { SecondaryTileIndex, SecondaryTileResolution, UvTransform, } from "./secondary-tile-resolver.js";
4
+ export { resolveSecondaryTiles } from "./secondary-tile-resolver.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/multi-raster-tileset/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createMultiTilesetDescriptor, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-tileset-descriptor.js";
2
+ export { resolveSecondaryTiles } from "./secondary-tile-resolver.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/multi-raster-tileset/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}