@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,128 @@
1
+ /**
2
+ * Mapping from matplotlib / rio-tiler colormap name to its layer index in
3
+ * the shipped `colormaps.png` sprite. Pass values from this object as the
4
+ * `colormapIndex` prop of the {@link Colormap} shader module:
5
+ *
6
+ * ```ts
7
+ * { module: Colormap, props: {
8
+ * colormapTexture,
9
+ * colormapIndex: COLORMAP_INDEX.viridis,
10
+ * } }
11
+ * ```
12
+ *
13
+ * Names are sorted alphabetically. Reversed variants (`_r` suffix) are not
14
+ * listed separately — use the module's `reversed` uniform to flip a
15
+ * colormap at render time instead of binding a distinct layer.
16
+ */
17
+ export declare const COLORMAP_INDEX: {
18
+ readonly accent: 0;
19
+ readonly afmhot: 1;
20
+ readonly algae: 2;
21
+ readonly amp: 3;
22
+ readonly autumn: 4;
23
+ readonly balance: 5;
24
+ readonly binary: 6;
25
+ readonly blues: 7;
26
+ readonly bone: 8;
27
+ readonly brbg: 9;
28
+ readonly brg: 10;
29
+ readonly bugn: 11;
30
+ readonly bupu: 12;
31
+ readonly bwr: 13;
32
+ readonly cfastie: 14;
33
+ readonly cividis: 15;
34
+ readonly cmrmap: 16;
35
+ readonly cool: 17;
36
+ readonly coolwarm: 18;
37
+ readonly copper: 19;
38
+ readonly cubehelix: 20;
39
+ readonly curl: 21;
40
+ readonly dark2: 22;
41
+ readonly deep: 23;
42
+ readonly delta: 24;
43
+ readonly dense: 25;
44
+ readonly diff: 26;
45
+ readonly flag: 27;
46
+ readonly gist_earth: 28;
47
+ readonly gist_gray: 29;
48
+ readonly gist_heat: 30;
49
+ readonly gist_ncar: 31;
50
+ readonly gist_rainbow: 32;
51
+ readonly gist_stern: 33;
52
+ readonly gist_yarg: 34;
53
+ readonly gnbu: 35;
54
+ readonly gnuplot: 36;
55
+ readonly gnuplot2: 37;
56
+ readonly gray: 38;
57
+ readonly greens: 39;
58
+ readonly greys: 40;
59
+ readonly haline: 41;
60
+ readonly hot: 42;
61
+ readonly hsv: 43;
62
+ readonly ice: 44;
63
+ readonly inferno: 45;
64
+ readonly jet: 46;
65
+ readonly magma: 47;
66
+ readonly matter: 48;
67
+ readonly nipy_spectral: 49;
68
+ readonly ocean: 50;
69
+ readonly oranges: 51;
70
+ readonly orrd: 52;
71
+ readonly oxy: 53;
72
+ readonly paired: 54;
73
+ readonly pastel1: 55;
74
+ readonly pastel2: 56;
75
+ readonly phase: 57;
76
+ readonly pink: 58;
77
+ readonly piyg: 59;
78
+ readonly plasma: 60;
79
+ readonly prgn: 61;
80
+ readonly prism: 62;
81
+ readonly pubu: 63;
82
+ readonly pubugn: 64;
83
+ readonly puor: 65;
84
+ readonly purd: 66;
85
+ readonly purples: 67;
86
+ readonly rain: 68;
87
+ readonly rainbow: 69;
88
+ readonly rdbu: 70;
89
+ readonly rdgy: 71;
90
+ readonly rdpu: 72;
91
+ readonly rdylbu: 73;
92
+ readonly rdylgn: 74;
93
+ readonly reds: 75;
94
+ readonly rplumbo: 76;
95
+ readonly schwarzwald: 77;
96
+ readonly seismic: 78;
97
+ readonly set1: 79;
98
+ readonly set2: 80;
99
+ readonly set3: 81;
100
+ readonly solar: 82;
101
+ readonly spectral: 83;
102
+ readonly speed: 84;
103
+ readonly spring: 85;
104
+ readonly summer: 86;
105
+ readonly tab10: 87;
106
+ readonly tab20: 88;
107
+ readonly tab20b: 89;
108
+ readonly tab20c: 90;
109
+ readonly tarn: 91;
110
+ readonly tempo: 92;
111
+ readonly terrain: 93;
112
+ readonly thermal: 94;
113
+ readonly topo: 95;
114
+ readonly turbid: 96;
115
+ readonly turbo: 97;
116
+ readonly twilight: 98;
117
+ readonly twilight_shifted: 99;
118
+ readonly viridis: 100;
119
+ readonly winter: 101;
120
+ readonly wistia: 102;
121
+ readonly ylgn: 103;
122
+ readonly ylgnbu: 104;
123
+ readonly ylorbr: 105;
124
+ readonly ylorrd: 106;
125
+ };
126
+ /** Name of any colormap in the shipped sprite; a key of {@link COLORMAP_INDEX}. */
127
+ export type ColormapName = keyof typeof COLORMAP_INDEX;
128
+ //# sourceMappingURL=colormap-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colormap-names.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/colormap-names.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GjB,CAAC;AAEX,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAC"}
@@ -0,0 +1,127 @@
1
+ // Generated by scripts/generate_colormaps.py. Do not edit by hand.
2
+ /**
3
+ * Mapping from matplotlib / rio-tiler colormap name to its layer index in
4
+ * the shipped `colormaps.png` sprite. Pass values from this object as the
5
+ * `colormapIndex` prop of the {@link Colormap} shader module:
6
+ *
7
+ * ```ts
8
+ * { module: Colormap, props: {
9
+ * colormapTexture,
10
+ * colormapIndex: COLORMAP_INDEX.viridis,
11
+ * } }
12
+ * ```
13
+ *
14
+ * Names are sorted alphabetically. Reversed variants (`_r` suffix) are not
15
+ * listed separately — use the module's `reversed` uniform to flip a
16
+ * colormap at render time instead of binding a distinct layer.
17
+ */
18
+ export const COLORMAP_INDEX = {
19
+ accent: 0,
20
+ afmhot: 1,
21
+ algae: 2,
22
+ amp: 3,
23
+ autumn: 4,
24
+ balance: 5,
25
+ binary: 6,
26
+ blues: 7,
27
+ bone: 8,
28
+ brbg: 9,
29
+ brg: 10,
30
+ bugn: 11,
31
+ bupu: 12,
32
+ bwr: 13,
33
+ cfastie: 14,
34
+ cividis: 15,
35
+ cmrmap: 16,
36
+ cool: 17,
37
+ coolwarm: 18,
38
+ copper: 19,
39
+ cubehelix: 20,
40
+ curl: 21,
41
+ dark2: 22,
42
+ deep: 23,
43
+ delta: 24,
44
+ dense: 25,
45
+ diff: 26,
46
+ flag: 27,
47
+ gist_earth: 28,
48
+ gist_gray: 29,
49
+ gist_heat: 30,
50
+ gist_ncar: 31,
51
+ gist_rainbow: 32,
52
+ gist_stern: 33,
53
+ gist_yarg: 34,
54
+ gnbu: 35,
55
+ gnuplot: 36,
56
+ gnuplot2: 37,
57
+ gray: 38,
58
+ greens: 39,
59
+ greys: 40,
60
+ haline: 41,
61
+ hot: 42,
62
+ hsv: 43,
63
+ ice: 44,
64
+ inferno: 45,
65
+ jet: 46,
66
+ magma: 47,
67
+ matter: 48,
68
+ nipy_spectral: 49,
69
+ ocean: 50,
70
+ oranges: 51,
71
+ orrd: 52,
72
+ oxy: 53,
73
+ paired: 54,
74
+ pastel1: 55,
75
+ pastel2: 56,
76
+ phase: 57,
77
+ pink: 58,
78
+ piyg: 59,
79
+ plasma: 60,
80
+ prgn: 61,
81
+ prism: 62,
82
+ pubu: 63,
83
+ pubugn: 64,
84
+ puor: 65,
85
+ purd: 66,
86
+ purples: 67,
87
+ rain: 68,
88
+ rainbow: 69,
89
+ rdbu: 70,
90
+ rdgy: 71,
91
+ rdpu: 72,
92
+ rdylbu: 73,
93
+ rdylgn: 74,
94
+ reds: 75,
95
+ rplumbo: 76,
96
+ schwarzwald: 77,
97
+ seismic: 78,
98
+ set1: 79,
99
+ set2: 80,
100
+ set3: 81,
101
+ solar: 82,
102
+ spectral: 83,
103
+ speed: 84,
104
+ spring: 85,
105
+ summer: 86,
106
+ tab10: 87,
107
+ tab20: 88,
108
+ tab20b: 89,
109
+ tab20c: 90,
110
+ tarn: 91,
111
+ tempo: 92,
112
+ terrain: 93,
113
+ thermal: 94,
114
+ topo: 95,
115
+ turbid: 96,
116
+ turbo: 97,
117
+ twilight: 98,
118
+ twilight_shifted: 99,
119
+ viridis: 100,
120
+ winter: 101,
121
+ wistia: 102,
122
+ ylgn: 103,
123
+ ylgnbu: 104,
124
+ ylorbr: 105,
125
+ ylorrd: 106,
126
+ };
127
+ //# sourceMappingURL=colormap-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colormap-names.js","sourceRoot":"","sources":["../../src/gpu-modules/colormap-names.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR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EAAE;IACR,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,gBAAgB,EAAE,EAAE;IACpB,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;CACH,CAAC"}
@@ -1,19 +1,43 @@
1
1
  import type { Texture } from "@luma.gl/core";
2
+ /** Props for the {@link Colormap} shader module. */
2
3
  export type ColormapProps = {
4
+ /**
5
+ * The colormap sprite as a 2D array texture. Each layer of the array is
6
+ * one 256×1 RGBA8 colormap. Build from the shipped `colormaps.png` with
7
+ * `decodeColormapSprite` + `createColormapTexture`, or bring your own.
8
+ */
3
9
  colormapTexture: Texture;
10
+ /**
11
+ * Which layer of `colormapTexture` to sample. Pass values from the
12
+ * generated `COLORMAP_INDEX` for the shipped sprite, or any valid layer
13
+ * index for a custom sprite. Defaults to `0`.
14
+ */
15
+ colormapIndex?: number;
16
+ /**
17
+ * When true, samples the colormap in reverse — equivalent to matplotlib's
18
+ * `_r` suffix (e.g. `viridis_r`). Defaults to false.
19
+ */
20
+ reversed?: boolean;
4
21
  };
5
22
  /**
6
- * A shader module that injects a unorm texture and uses a sampler2D to assign
7
- * to a color.
23
+ * A shader module that injects a 2D-array colormap texture and samples one
24
+ * layer per fragment, indexed by `colormapIndex`.
8
25
  */
9
26
  export declare const Colormap: {
10
27
  readonly name: "colormap";
28
+ readonly fs: "uniform colormapUniforms {\n int colormapIndex;\n float reversed;\n} colormap;\n";
11
29
  readonly inject: {
12
- readonly "fs:#decl": "uniform sampler2D colormapTexture;";
13
- readonly "fs:DECKGL_FILTER_COLOR": "\n color = texture(colormapTexture, vec2(color.r, 0.));\n ";
30
+ readonly "fs:#decl": "uniform sampler2DArray colormapTexture;";
31
+ readonly "fs:DECKGL_FILTER_COLOR": "\n float idx = mix(color.r, 1.0 - color.r, colormap.reversed);\n color = texture(\n colormapTexture,\n vec3(idx, 0.5, float(colormap.colormapIndex))\n );\n ";
32
+ };
33
+ readonly uniformTypes: {
34
+ readonly colormapIndex: "i32";
35
+ readonly reversed: "f32";
14
36
  };
15
37
  readonly getUniforms: (props: Partial<ColormapProps>) => {
16
38
  colormapTexture: Texture | undefined;
39
+ colormapIndex: number;
40
+ reversed: boolean;
17
41
  };
18
42
  };
19
43
  //# sourceMappingURL=colormap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"colormap.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/colormap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;kCAQE,OAAO,CAAC,aAAa,CAAC;;;CAKG,CAAC"}
1
+ {"version":3,"file":"colormap.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/colormap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,oDAAoD;AACpD,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;kCAsBE,OAAO,CAAC,aAAa,CAAC;;;;;CAOG,CAAC"}
@@ -1,18 +1,35 @@
1
+ const MODULE_NAME = "colormap";
1
2
  /**
2
- * A shader module that injects a unorm texture and uses a sampler2D to assign
3
- * to a color.
3
+ * A shader module that injects a 2D-array colormap texture and samples one
4
+ * layer per fragment, indexed by `colormapIndex`.
4
5
  */
5
6
  export const Colormap = {
6
- name: "colormap",
7
+ name: MODULE_NAME,
8
+ fs: `\
9
+ uniform ${MODULE_NAME}Uniforms {
10
+ int colormapIndex;
11
+ float reversed;
12
+ } ${MODULE_NAME};
13
+ `,
7
14
  inject: {
8
- "fs:#decl": `uniform sampler2D colormapTexture;`,
15
+ "fs:#decl": `uniform sampler2DArray colormapTexture;`,
9
16
  "fs:DECKGL_FILTER_COLOR": /* glsl */ `
10
- color = texture(colormapTexture, vec2(color.r, 0.));
17
+ float idx = mix(color.r, 1.0 - color.r, ${MODULE_NAME}.reversed);
18
+ color = texture(
19
+ colormapTexture,
20
+ vec3(idx, 0.5, float(${MODULE_NAME}.colormapIndex))
21
+ );
11
22
  `,
12
23
  },
24
+ uniformTypes: {
25
+ colormapIndex: "i32",
26
+ reversed: "f32",
27
+ },
13
28
  getUniforms: (props) => {
14
29
  return {
15
30
  colormapTexture: props.colormapTexture,
31
+ colormapIndex: props.colormapIndex ?? 0,
32
+ reversed: props.reversed ?? false,
16
33
  };
17
34
  },
18
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"colormap.js","sourceRoot":"","sources":["../../src/gpu-modules/colormap.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE;QACN,UAAU,EAAE,oCAAoC;QAChD,wBAAwB,EAAE,UAAU,CAAC;;KAEpC;KACF;IACD,WAAW,EAAE,CAAC,KAA6B,EAAE,EAAE;QAC7C,OAAO;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;SACvC,CAAC;IACJ,CAAC;CAC6C,CAAC"}
1
+ {"version":3,"file":"colormap.js","sourceRoot":"","sources":["../../src/gpu-modules/colormap.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE;UACI,WAAW;;;IAGjB,WAAW;CACd;IACC,MAAM,EAAE;QACN,UAAU,EAAE,yCAAyC;QACrD,wBAAwB,EAAE,UAAU,CAAC;gDACO,WAAW;;;+BAG5B,WAAW;;KAErC;KACF;IACD,YAAY,EAAE;QACZ,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,KAAK;KAChB;IACD,WAAW,EAAE,CAAC,KAA6B,EAAE,EAAE;QAC7C,OAAO;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC;YACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK;SAClC,CAAC;IACJ,CAAC;CAC6C,CAAC"}
Binary file
@@ -0,0 +1,85 @@
1
+ import type { Texture } from "@luma.gl/core";
2
+ import type { UvTransform } from "../multi-raster-tileset/index.js";
3
+ /**
4
+ * Maximum number of band texture slots supported by {@link CompositeBands}.
5
+ */
6
+ export declare const MAX_BAND_SLOTS = 4;
7
+ /**
8
+ * Props for the {@link CompositeBands} shader module.
9
+ *
10
+ * Textures (`band0`–`band3`) are bound via `getUniforms`. Scalar uniforms
11
+ * (`uvTransform0`–`uvTransform3`, `channelMap`) go through a uniform block.
12
+ */
13
+ export type CompositeBandsProps = {
14
+ band0: Texture;
15
+ band1: Texture;
16
+ band2: Texture;
17
+ band3: Texture;
18
+ uvTransform0: UvTransform;
19
+ uvTransform1: UvTransform;
20
+ uvTransform2: UvTransform;
21
+ uvTransform3: UvTransform;
22
+ channelMap: [number, number, number, number];
23
+ };
24
+ /**
25
+ * A shader module that samples up to 4 band textures with per-band UV
26
+ * transforms and composites them into a `vec4` color.
27
+ *
28
+ * Uses fixed uniform slots (`band0`–`band3`) for textures (bound via
29
+ * `getUniforms`) and a uniform block for scalar values (`uvTransform0`–
30
+ * `uvTransform3`, `channelMap`).
31
+ *
32
+ * @see {@link CompositeBandsProps}
33
+ * @see {@link buildCompositeBandsProps} for a helper that maps named bands
34
+ * to slot indices.
35
+ */
36
+ export declare const CompositeBands: {
37
+ readonly name: "compositeBands";
38
+ readonly inject: {
39
+ readonly "fs:#decl": "\nuniform sampler2D band0;\nuniform sampler2D band1;\nuniform sampler2D band2;\nuniform sampler2D band3;\n\nvec2 compositeBands_applyUv(vec2 uv, vec4 transform) {\n return uv * transform.zw + transform.xy;\n}\n\nfloat compositeBands_sampleSlot(int slot, vec2 uv) {\n if (slot == 0) return texture(band0, compositeBands_applyUv(uv, compositeBands.uvTransform0)).r;\n if (slot == 1) return texture(band1, compositeBands_applyUv(uv, compositeBands.uvTransform1)).r;\n if (slot == 2) return texture(band2, compositeBands_applyUv(uv, compositeBands.uvTransform2)).r;\n if (slot == 3) return texture(band3, compositeBands_applyUv(uv, compositeBands.uvTransform3)).r;\n return 0.0;\n}\n";
40
+ readonly "fs:DECKGL_FILTER_COLOR": "\n float r = compositeBands.channelMap.r >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.r, geometry.uv) : 0.0;\n float g = compositeBands.channelMap.g >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.g, geometry.uv) : 0.0;\n float b = compositeBands.channelMap.b >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.b, geometry.uv) : 0.0;\n float a = compositeBands.channelMap.a >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.a, geometry.uv) : 1.0;\n color = vec4(r, g, b, a);\n";
41
+ };
42
+ readonly fs: "uniform compositeBandsUniforms {\n vec4 uvTransform0;\n vec4 uvTransform1;\n vec4 uvTransform2;\n vec4 uvTransform3;\n ivec4 channelMap;\n} compositeBands;\n";
43
+ readonly uniformTypes: {
44
+ readonly uvTransform0: "vec4<f32>";
45
+ readonly uvTransform1: "vec4<f32>";
46
+ readonly uvTransform2: "vec4<f32>";
47
+ readonly uvTransform3: "vec4<f32>";
48
+ readonly channelMap: "vec4<i32>";
49
+ };
50
+ readonly getUniforms: (props: Partial<CompositeBandsProps>) => {
51
+ band0: Texture | undefined;
52
+ band1: Texture | undefined;
53
+ band2: Texture | undefined;
54
+ band3: Texture | undefined;
55
+ uvTransform0: UvTransform;
56
+ uvTransform1: UvTransform;
57
+ uvTransform2: UvTransform;
58
+ uvTransform3: UvTransform;
59
+ channelMap: [number, number, number, number];
60
+ };
61
+ };
62
+ /**
63
+ * Maps named bands and their UV transforms to {@link CompositeBandsProps}
64
+ * slot indices.
65
+ *
66
+ * Assigns each unique band name to a fixed slot (0–3), builds the
67
+ * `channelMap` that maps RGBA output channels to slots, and fills unused
68
+ * slots with a placeholder texture to satisfy WebGL binding requirements.
69
+ *
70
+ * @param mapping - Which named band goes to which RGBA channel.
71
+ * @param bands - Map of band name to texture + UV transform.
72
+ * @returns Props ready to pass to `{ module: CompositeBands, props: ... }`.
73
+ *
74
+ * @see {@link CompositeBands}
75
+ */
76
+ export declare function buildCompositeBandsProps(mapping: {
77
+ r: string;
78
+ g?: string;
79
+ b?: string;
80
+ a?: string;
81
+ }, bands: Map<string, {
82
+ texture: Texture;
83
+ uvTransform: UvTransform;
84
+ }>): Partial<CompositeBandsProps>;
85
+ //# sourceMappingURL=composite-bands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-bands.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/composite-bands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;kCA+CJ,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;CAeG,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1D,KAAK,EAAE,GAAG,CACR,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B,CACF,GACA,OAAO,CAAC,mBAAmB,CAAC,CAsD9B"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Maximum number of band texture slots supported by {@link CompositeBands}.
3
+ */
4
+ export const MAX_BAND_SLOTS = 4;
5
+ const MODULE_NAME = "compositeBands";
6
+ /**
7
+ * A shader module that samples up to 4 band textures with per-band UV
8
+ * transforms and composites them into a `vec4` color.
9
+ *
10
+ * Uses fixed uniform slots (`band0`–`band3`) for textures (bound via
11
+ * `getUniforms`) and a uniform block for scalar values (`uvTransform0`–
12
+ * `uvTransform3`, `channelMap`).
13
+ *
14
+ * @see {@link CompositeBandsProps}
15
+ * @see {@link buildCompositeBandsProps} for a helper that maps named bands
16
+ * to slot indices.
17
+ */
18
+ export const CompositeBands = {
19
+ name: MODULE_NAME,
20
+ // Texture samplers — declared via inject, bound via getUniforms
21
+ inject: {
22
+ "fs:#decl": /* glsl */ `
23
+ uniform sampler2D band0;
24
+ uniform sampler2D band1;
25
+ uniform sampler2D band2;
26
+ uniform sampler2D band3;
27
+
28
+ vec2 compositeBands_applyUv(vec2 uv, vec4 transform) {
29
+ return uv * transform.zw + transform.xy;
30
+ }
31
+
32
+ float compositeBands_sampleSlot(int slot, vec2 uv) {
33
+ if (slot == 0) return texture(band0, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform0)).r;
34
+ if (slot == 1) return texture(band1, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform1)).r;
35
+ if (slot == 2) return texture(band2, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform2)).r;
36
+ if (slot == 3) return texture(band3, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform3)).r;
37
+ return 0.0;
38
+ }
39
+ `,
40
+ "fs:DECKGL_FILTER_COLOR": /* glsl */ `
41
+ float r = ${MODULE_NAME}.channelMap.r >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.r, geometry.uv) : 0.0;
42
+ float g = ${MODULE_NAME}.channelMap.g >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.g, geometry.uv) : 0.0;
43
+ float b = ${MODULE_NAME}.channelMap.b >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.b, geometry.uv) : 0.0;
44
+ float a = ${MODULE_NAME}.channelMap.a >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.a, geometry.uv) : 1.0;
45
+ color = vec4(r, g, b, a);
46
+ `,
47
+ },
48
+ // Scalar uniforms — declared via fs uniform block + uniformTypes
49
+ fs: `\
50
+ uniform ${MODULE_NAME}Uniforms {
51
+ vec4 uvTransform0;
52
+ vec4 uvTransform1;
53
+ vec4 uvTransform2;
54
+ vec4 uvTransform3;
55
+ ivec4 channelMap;
56
+ } ${MODULE_NAME};
57
+ `,
58
+ uniformTypes: {
59
+ uvTransform0: "vec4<f32>",
60
+ uvTransform1: "vec4<f32>",
61
+ uvTransform2: "vec4<f32>",
62
+ uvTransform3: "vec4<f32>",
63
+ channelMap: "vec4<i32>",
64
+ },
65
+ getUniforms: (props) => {
66
+ return {
67
+ // Texture bindings
68
+ band0: props.band0,
69
+ band1: props.band1,
70
+ band2: props.band2,
71
+ band3: props.band3,
72
+ // Scalar uniforms (uniform block)
73
+ uvTransform0: props.uvTransform0 ?? [0, 0, 1, 1],
74
+ uvTransform1: props.uvTransform1 ?? [0, 0, 1, 1],
75
+ uvTransform2: props.uvTransform2 ?? [0, 0, 1, 1],
76
+ uvTransform3: props.uvTransform3 ?? [0, 0, 1, 1],
77
+ channelMap: props.channelMap ?? [0, 1, 2, -1],
78
+ };
79
+ },
80
+ };
81
+ /**
82
+ * Maps named bands and their UV transforms to {@link CompositeBandsProps}
83
+ * slot indices.
84
+ *
85
+ * Assigns each unique band name to a fixed slot (0–3), builds the
86
+ * `channelMap` that maps RGBA output channels to slots, and fills unused
87
+ * slots with a placeholder texture to satisfy WebGL binding requirements.
88
+ *
89
+ * @param mapping - Which named band goes to which RGBA channel.
90
+ * @param bands - Map of band name to texture + UV transform.
91
+ * @returns Props ready to pass to `{ module: CompositeBands, props: ... }`.
92
+ *
93
+ * @see {@link CompositeBands}
94
+ */
95
+ export function buildCompositeBandsProps(mapping, bands) {
96
+ // Collect unique band names in mapping order and assign slot indices
97
+ const slotNames = [];
98
+ const slotIndex = new Map();
99
+ for (const name of [mapping.r, mapping.g, mapping.b, mapping.a]) {
100
+ if (name && !slotIndex.has(name)) {
101
+ if (slotNames.length >= MAX_BAND_SLOTS) {
102
+ throw new Error(`CompositeBands supports at most ${MAX_BAND_SLOTS} band slots`);
103
+ }
104
+ slotIndex.set(name, slotNames.length);
105
+ slotNames.push(name);
106
+ }
107
+ }
108
+ function slotFor(name) {
109
+ return name ? (slotIndex.get(name) ?? -1) : -1;
110
+ }
111
+ const props = {
112
+ channelMap: [
113
+ slotFor(mapping.r),
114
+ slotFor(mapping.g),
115
+ slotFor(mapping.b),
116
+ slotFor(mapping.a),
117
+ ],
118
+ };
119
+ // Get the first texture to use as a placeholder for unused slots.
120
+ // WebGL requires all declared samplers to have a valid texture bound,
121
+ // even if the channelMap never references them.
122
+ const firstBandName = slotNames[0];
123
+ if (!firstBandName) {
124
+ throw new Error("At least one band is required");
125
+ }
126
+ const firstTexture = bands.get(firstBandName).texture;
127
+ for (const [name, slot] of slotIndex) {
128
+ const band = bands.get(name);
129
+ if (!band) {
130
+ throw new Error(`Band "${name}" not found in fetched bands`);
131
+ }
132
+ props[`band${slot}`] = band.texture;
133
+ props[`uvTransform${slot}`] = band.uvTransform;
134
+ }
135
+ // Fill unused slots with the first texture as a placeholder
136
+ for (let i = slotNames.length; i < MAX_BAND_SLOTS; i++) {
137
+ props[`band${i}`] = firstTexture;
138
+ }
139
+ return props;
140
+ }
141
+ //# sourceMappingURL=composite-bands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-bands.js","sourceRoot":"","sources":["../../src/gpu-modules/composite-bands.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAoBhC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,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,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,aAAa,CAAE,CAAC,OAAO,CAAC;IAEvD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,8BAA8B,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACpC,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IACjD,CAAC;IAED,4DAA4D;IAC5D,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;QACvD,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,OAAO,KAAqC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Device, Texture } from "@luma.gl/core";
2
+ /**
3
+ * Upload a decoded colormap sprite to the GPU as a 2D array texture.
4
+ *
5
+ * The image must be exactly 256 pixels wide; each row becomes one layer
6
+ * of the returned `Texture` (`dimension: "2d-array"`, `format:
7
+ * "rgba8unorm"`). Use the result as the `colormapTexture` prop of the
8
+ * `Colormap` shader module.
9
+ *
10
+ * Synchronous — pair with `decodeColormapSprite` when you have a URL or
11
+ * raw bytes rather than an already-decoded `ImageData`.
12
+ *
13
+ * @throws when `imageData.width` is not 256.
14
+ */
15
+ export declare function createColormapTexture(device: Device, imageData: ImageData): Texture;
16
+ //# sourceMappingURL=create-colormap-texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-colormap-texture.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/create-colormap-texture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACnB,OAAO,CAgCT"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Upload a decoded colormap sprite to the GPU as a 2D array texture.
3
+ *
4
+ * The image must be exactly 256 pixels wide; each row becomes one layer
5
+ * of the returned `Texture` (`dimension: "2d-array"`, `format:
6
+ * "rgba8unorm"`). Use the result as the `colormapTexture` prop of the
7
+ * `Colormap` shader module.
8
+ *
9
+ * Synchronous — pair with `decodeColormapSprite` when you have a URL or
10
+ * raw bytes rather than an already-decoded `ImageData`.
11
+ *
12
+ * @throws when `imageData.width` is not 256.
13
+ */
14
+ export function createColormapTexture(device, imageData) {
15
+ if (imageData.width !== 256) {
16
+ throw new Error(`Expected a 256-pixel-wide colormap sprite, got width ${imageData.width}.`);
17
+ }
18
+ // ImageData row-major layout (RGBA row 0, RGBA row 1, …) matches luma.gl's
19
+ // 2D-array upload layout (layer-major). Each layer is one image row and
20
+ // exactly one texel tall, so no re-packing is needed.
21
+ const bytes = new Uint8Array(imageData.data.buffer, imageData.data.byteOffset, imageData.data.byteLength);
22
+ return device.createTexture({
23
+ dimension: "2d-array",
24
+ format: "rgba8unorm",
25
+ width: 256,
26
+ height: 1,
27
+ depth: imageData.height,
28
+ data: bytes,
29
+ mipLevels: 1,
30
+ sampler: {
31
+ minFilter: "linear",
32
+ magFilter: "linear",
33
+ // Clamp in every axis so an out-of-range colormapIndex yields an
34
+ // edge color rather than wrapping to an unrelated colormap.
35
+ addressModeU: "clamp-to-edge",
36
+ addressModeV: "clamp-to-edge",
37
+ addressModeW: "clamp-to-edge",
38
+ },
39
+ });
40
+ }
41
+ //# sourceMappingURL=create-colormap-texture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-colormap-texture.js","sourceRoot":"","sources":["../../src/gpu-modules/create-colormap-texture.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,SAAoB;IAEpB,IAAI,SAAS,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,wDAAwD,SAAS,CAAC,KAAK,GAAG,CAC3E,CAAC;IACJ,CAAC;IACD,2EAA2E;IAC3E,wEAAwE;IACxE,sDAAsD;IACtD,MAAM,KAAK,GAAG,IAAI,UAAU,CAC1B,SAAS,CAAC,IAAI,CAAC,MAAM,EACrB,SAAS,CAAC,IAAI,CAAC,UAAU,EACzB,SAAS,CAAC,IAAI,CAAC,UAAU,CAC1B,CAAC;IACF,OAAO,MAAM,CAAC,aAAa,CAAC;QAC1B,SAAS,EAAE,UAAU;QACrB,MAAM,EAAE,YAAY;QACpB,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,QAAQ;YACnB,iEAAiE;YACjE,4DAA4D;YAC5D,YAAY,EAAE,eAAe;YAC7B,YAAY,EAAE,eAAe;YAC7B,YAAY,EAAE,eAAe;SAC9B;KACF,CAAC,CAAC;AACL,CAAC"}