@deck.gl-community/infovis-layers 9.1.0-beta.8 → 9.2.0-beta.2

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 (70) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.cjs +815 -0
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/index.d.ts +12 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +10 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts +23 -0
  9. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts.map +1 -0
  10. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js +33 -0
  11. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js.map +1 -0
  12. package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts +38 -0
  13. package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts.map +1 -0
  14. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts +3 -0
  15. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts.map +1 -0
  16. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js +53 -0
  17. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js.map +1 -0
  18. package/dist/layers/horizon-graph-layer/horizon-graph-layer.js +138 -0
  19. package/dist/layers/horizon-graph-layer/horizon-graph-layer.js.map +1 -0
  20. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts +3 -0
  21. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts.map +1 -0
  22. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js +24 -0
  23. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js.map +1 -0
  24. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts +23 -0
  25. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts.map +1 -0
  26. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js +100 -0
  27. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js.map +1 -0
  28. package/dist/layers/time-axis-layer.d.ts +56 -0
  29. package/dist/layers/time-axis-layer.d.ts.map +1 -0
  30. package/dist/layers/time-axis-layer.js +78 -0
  31. package/dist/layers/time-axis-layer.js.map +1 -0
  32. package/dist/layers/time-delta-layer.d.ts +74 -0
  33. package/dist/layers/time-delta-layer.d.ts.map +1 -0
  34. package/dist/layers/time-delta-layer.js +136 -0
  35. package/dist/layers/time-delta-layer.js.map +1 -0
  36. package/dist/layers/vertical-grid-layer.d.ts +41 -0
  37. package/dist/layers/vertical-grid-layer.d.ts.map +1 -0
  38. package/dist/layers/vertical-grid-layer.js +43 -0
  39. package/dist/layers/vertical-grid-layer.js.map +1 -0
  40. package/dist/synchronized-views/synchronized-views.d.ts +39 -0
  41. package/dist/synchronized-views/synchronized-views.d.ts.map +1 -0
  42. package/dist/synchronized-views/synchronized-views.js +85 -0
  43. package/dist/synchronized-views/synchronized-views.js.map +1 -0
  44. package/dist/utils/format-utils.d.ts +7 -0
  45. package/dist/utils/format-utils.d.ts.map +1 -0
  46. package/dist/utils/format-utils.js +75 -0
  47. package/dist/utils/format-utils.js.map +1 -0
  48. package/dist/utils/tick-utils.d.ts +10 -0
  49. package/dist/utils/tick-utils.d.ts.map +1 -0
  50. package/dist/utils/tick-utils.js +32 -0
  51. package/dist/utils/tick-utils.js.map +1 -0
  52. package/dist/views/layer-filter.d.ts +8 -0
  53. package/dist/views/layer-filter.d.ts.map +1 -0
  54. package/dist/views/layer-filter.js +40 -0
  55. package/dist/views/layer-filter.js.map +1 -0
  56. package/dist/views/orthographic-utils.d.ts +11 -0
  57. package/dist/views/orthographic-utils.d.ts.map +1 -0
  58. package/dist/views/orthographic-utils.js +41 -0
  59. package/dist/views/orthographic-utils.js.map +1 -0
  60. package/dist/views/view-state-utils.d.ts +8 -0
  61. package/dist/views/view-state-utils.d.ts.map +1 -0
  62. package/dist/views/view-state-utils.js +41 -0
  63. package/dist/views/view-state-utils.js.map +1 -0
  64. package/package.json +11 -18
  65. package/src/index.ts +4 -0
  66. package/src/layers/horizon-graph-layer/horizon-graph-layer-uniforms.ts +47 -0
  67. package/src/layers/horizon-graph-layer/horizon-graph-layer.fs.ts +53 -0
  68. package/src/layers/horizon-graph-layer/horizon-graph-layer.ts +202 -0
  69. package/src/layers/horizon-graph-layer/horizon-graph-layer.vs.ts +24 -0
  70. package/src/layers/horizon-graph-layer/multi-horizon-graph-layer.ts +164 -0
@@ -0,0 +1,85 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import { OrthographicController, OrthographicView } from '@deck.gl/core';
5
+ import { fitBoundsOrthographic } from "../views/orthographic-utils.js";
6
+ import { mergeViewStates } from "../views/view-state-utils.js";
7
+ export const HEADER_VIEW_HEIGHT = 50;
8
+ export const LEGEND_VIEW_WIDTH = 150;
9
+ export const SYNCHRONIZED_VIEWS = [
10
+ new OrthographicView({
11
+ id: 'main',
12
+ flipY: false,
13
+ clear: true, // [1, 1, 1, 1],
14
+ x: LEGEND_VIEW_WIDTH,
15
+ width: `calc(100% - ${LEGEND_VIEW_WIDTH}px`,
16
+ y: HEADER_VIEW_HEIGHT,
17
+ height: `calc(100% - ${HEADER_VIEW_HEIGHT}px)`,
18
+ controller: {
19
+ type: OrthographicController,
20
+ // @ts-expect-error Specific to OrthographicController
21
+ zoomAxis: 'X',
22
+ inertia: false,
23
+ scrollZoom: true
24
+ }
25
+ }),
26
+ new OrthographicView({
27
+ id: 'header',
28
+ flipY: false,
29
+ clear: true, // [1, 1, 1, 1],
30
+ x: LEGEND_VIEW_WIDTH,
31
+ width: `calc(100% - ${LEGEND_VIEW_WIDTH}px)`,
32
+ height: 50,
33
+ controller: false
34
+ }),
35
+ new OrthographicView({
36
+ id: 'legend',
37
+ flipY: false,
38
+ clear: true, // [1, 1, 1, 1],
39
+ x: 0,
40
+ width: LEGEND_VIEW_WIDTH,
41
+ y: HEADER_VIEW_HEIGHT,
42
+ height: `calc(100% - ${HEADER_VIEW_HEIGHT}px)`,
43
+ controller: false
44
+ })
45
+ ];
46
+ export const SYNCHRONIZED_VIEW_STATE_CONSTRAINTS = {
47
+ header: { target: [undefined, 20], zoom: [undefined, 0] },
48
+ legend: { target: [-30, undefined], zoom: [1, undefined] }
49
+ };
50
+ export function getSynchronizedViewStates(viewState) {
51
+ return {
52
+ header: mergeViewStates(viewState, SYNCHRONIZED_VIEW_STATE_CONSTRAINTS.header),
53
+ legend: mergeViewStates(viewState, SYNCHRONIZED_VIEW_STATE_CONSTRAINTS.legend),
54
+ main: viewState
55
+ };
56
+ }
57
+ export function fitSynchronizedViewStatesToBounds(props) {
58
+ const { viewState, initialize } = props;
59
+ const { headerHeight = HEADER_VIEW_HEIGHT, legendWidth = LEGEND_VIEW_WIDTH } = props;
60
+ // Handle cases where the window size is too small for the header and/or legend
61
+ const width = Math.max(props.width - legendWidth, 1);
62
+ const height = Math.max(props.height - headerHeight, 1);
63
+ const { target, zoom } = fitBoundsOrthographic(width, height, props.bounds, 'per-axis');
64
+ target[1] = target[1] - 1.5; // ADD SOME TIME SPACE
65
+ let mainViewState;
66
+ // Avoid messing with y axis if we have already fitted the view state
67
+ if (initialize) {
68
+ mainViewState = { ...viewState.main, target, zoom };
69
+ }
70
+ else {
71
+ mainViewState = {
72
+ ...viewState.main,
73
+ target: [viewState.main.target[0], target[1]],
74
+ zoom: [viewState.main.zoom[0], zoom[1]]
75
+ };
76
+ }
77
+ const newViewState = {
78
+ ...viewState,
79
+ main: mainViewState,
80
+ header: mergeViewStates(mainViewState, SYNCHRONIZED_VIEW_STATE_CONSTRAINTS.header),
81
+ legend: mergeViewStates(mainViewState, SYNCHRONIZED_VIEW_STATE_CONSTRAINTS.legend)
82
+ };
83
+ return newViewState;
84
+ }
85
+ //# sourceMappingURL=synchronized-views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synchronized-views.js","sourceRoot":"","sources":["../../src/synchronized-views/synchronized-views.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,sBAAsB,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAC,qBAAqB,EAAC,uCAAoC;AAClE,OAAO,EAAC,eAAe,EAAC,qCAAkC;AAK1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,gBAAgB,CAAC;QACnB,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,IAAI,EAAE,gBAAgB;QAC7B,CAAC,EAAE,iBAAiB;QACpB,KAAK,EAAE,eAAe,iBAAiB,IAAI;QAC3C,CAAC,EAAE,kBAAkB;QACrB,MAAM,EAAE,eAAe,kBAAkB,KAAK;QAC9C,UAAU,EAAE;YACV,IAAI,EAAE,sBAAsB;YAC5B,sDAAsD;YACtD,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;IACF,IAAI,gBAAgB,CAAC;QACnB,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,IAAI,EAAE,gBAAgB;QAC7B,CAAC,EAAE,iBAAiB;QACpB,KAAK,EAAE,eAAe,iBAAiB,KAAK;QAC5C,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,KAAK;KAClB,CAAC;IACF,IAAI,gBAAgB,CAAC;QACnB,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,IAAI,EAAE,gBAAgB;QAC7B,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,iBAAiB;QACxB,C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C,CAAC,GAAG,GAAG,CAAC,CAAC,sBAAsB;IAEnD,IAAI,aAAoC,CAAC;IACzC,qEAAqE;IACrE,IAAI,UAAU,EAAE,CAAC;QACf,aAAa,GAAG,EAAC,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,aAAa,GAAG;YACd,GAAG,SAAS,CAAC,IAAI;YACjB,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAC7C,IAAI,EAAE,CAAE,SAAS,CAAC,IAAI,CAAC,IAAyB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;SAC9D,CAAC;IACJ,CAAC;IACD,MAAM,YAAY,GAAG;QACnB,GAAG,SAAS;QACZ,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,eAAe,CAAC,aAAa,EAAE,mCAAmC,CAAC,MAAM,CAAC;QAClF,MAAM,EAAE,eAAe,CAAC,aAAa,EAAE,mCAAmC,CAAC,MAAM,CAAC;KACnF,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Convert a time in microseconds to a human-readable string
3
+ * @param us Time in microseconds
4
+ */
5
+ export declare function formatTimeMs(timeMs: number, space?: boolean): string;
6
+ export declare function formatTimeRangeMs(startMs: number, endMs: number): string;
7
+ //# sourceMappingURL=format-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-utils.d.ts","sourceRoot":"","sources":["../../src/utils/format-utils.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,OAAc,GAAG,MAAM,CA2B1E;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAExE"}
@@ -0,0 +1,75 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Convert a time in microseconds to a human-readable string
6
+ * @param us Time in microseconds
7
+ */
8
+ export function formatTimeMs(timeMs, space = true) {
9
+ const sep = space ? ' ' : '';
10
+ const us = timeMs * 1000;
11
+ if (us === 0) {
12
+ return '0s';
13
+ }
14
+ if (Math.abs(us) < 1000) {
15
+ return `${floatToStr(us)}${sep}µs`;
16
+ }
17
+ const ms = us / 1000;
18
+ if (Math.abs(ms) < 1000) {
19
+ return `${floatToStr(ms)}${sep} ms`;
20
+ }
21
+ const s = ms / 1000;
22
+ if (Math.abs(s) < 60) {
23
+ return `${floatToStr(s)}${sep} s`;
24
+ }
25
+ const m = s / 60;
26
+ if (Math.abs(m) < 60) {
27
+ return `${floatToStr(m)}${sep} min`;
28
+ }
29
+ const h = m / 60;
30
+ if (Math.abs(h) < 24) {
31
+ return `${floatToStr(h)}${sep} hrs`;
32
+ }
33
+ const d = h / 24;
34
+ return `${floatToStr(d)}${sep} days`;
35
+ }
36
+ export function formatTimeRangeMs(startMs, endMs) {
37
+ return `${formatTimeMs(startMs)} - ${formatTimeMs(endMs)}`;
38
+ }
39
+ /**
40
+ * Convert a float to a string
41
+ */
42
+ function floatToStr(f, roundDigits = 5) {
43
+ if (Number.isInteger(f)) {
44
+ return f.toString();
45
+ }
46
+ for (let i = 1; i < roundDigits - 1; i++) {
47
+ const rounded = parseFloat(f.toPrecision(i));
48
+ if (rounded === f) {
49
+ return rounded.toPrecision(i);
50
+ }
51
+ }
52
+ return f.toPrecision(roundDigits);
53
+ }
54
+ // export function formatTimesUs(ticks: number[]): string {
55
+ // // Try from 0 up to a reasonable max (e.g. 20)
56
+ // for (let d = 0; d <= 20; d++) {
57
+ // const seen = new Set<string>();
58
+ // let allDistinct = true;
59
+ // for (const t of ticks) {
60
+ // // Format each tick with d decimals
61
+ // const str = t.toFixed(d);
62
+ // if (seen.has(str)) {
63
+ // allDistinct = false;
64
+ // break;
65
+ // }
66
+ // seen.add(str);
67
+ // }
68
+ // if (allDistinct) {
69
+ // return d;
70
+ // }
71
+ // }
72
+ // // Fallback if somehow not distinct even at 20 decimals
73
+ // return 20;
74
+ // }
75
+ //# sourceMappingURL=format-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../src/utils/format-utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,QAAiB,IAAI;IAChE,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,UAAU,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC;IACrC,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,UAAU,CAAC,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC;IACtC,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IACpB,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QACrB,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;IACpC,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACjB,IAAI,IAAI,CAA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;AAC/B,4CAA4C;AAC5C,kCAAkC;AAClC,6BAA6B;AAC7B,+BAA+B;AAC/B,iBAAiB;AACjB,UAAU;AACV,uBAAuB;AACvB,QAAQ;AACR,yBAAyB;AACzB,kBAAkB;AAClB,QAAQ;AACR,MAAM;AACN,4DAA4D;AAC5D,eAAe;AACf,IAAI"}
@@ -0,0 +1,10 @@
1
+ export declare function getZoomedRange(startTime: number, endTime: number, bounds: [number, number, number, number]): number[];
2
+ /**
3
+ * Get nicely rounded tick close to the natural spacing
4
+ * @param startTime
5
+ * @param endTime
6
+ * @param tickCount
7
+ * @returns
8
+ */
9
+ export declare function getPrettyTicks(startTime: number, endTime: number, tickCount?: number): any[];
10
+ //# sourceMappingURL=tick-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tick-utils.d.ts","sourceRoot":"","sources":["../../src/utils/tick-utils.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,YAKzC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,SAmBvF"}
@@ -0,0 +1,32 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export function getZoomedRange(startTime, endTime, bounds) {
5
+ const [startTimeZoomed, , endTimeZoomed] = bounds;
6
+ // console.log(`startTimeZoomed: ${startTimeZoomed}, endTimeZoomed: ${endTimeZoomed}, tickInterval: ${tickInterval} tickCountZoomed: ${tickCountZoomed}`);
7
+ return [Math.max(startTime, startTimeZoomed), Math.min(endTime, endTimeZoomed)];
8
+ }
9
+ /**
10
+ * Get nicely rounded tick close to the natural spacing
11
+ * @param startTime
12
+ * @param endTime
13
+ * @param tickCount
14
+ * @returns
15
+ */
16
+ export function getPrettyTicks(startTime, endTime, tickCount = 5) {
17
+ const range = endTime - startTime;
18
+ const roughStep = range / (tickCount - 1);
19
+ const exponent = Math.floor(Math.log10(roughStep));
20
+ const base = Math.pow(10, exponent);
21
+ const multiples = [1, 2, 5, 10];
22
+ // Find the smallest multiple that is greater than or equal to roughStep
23
+ const niceStep = multiples.find((m) => base * m >= roughStep) * base;
24
+ const niceStart = Math.ceil(startTime / niceStep) * niceStep;
25
+ const niceEnd = Math.floor(endTime / niceStep) * niceStep;
26
+ const ticks = [];
27
+ for (let t = niceStart; t <= niceEnd; t += niceStep) {
28
+ ticks.push(t);
29
+ }
30
+ return ticks;
31
+ }
32
+ //# sourceMappingURL=tick-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tick-utils.js","sourceRoot":"","sources":["../../src/utils/tick-utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,MAAM,UAAU,cAAc,CAC5B,SAAiB,EACjB,OAAe,EACf,MAAwC;IAExC,MAAM,CAAC,eAAe,EAAE,AAAD,EAAG,aAAa,CAAC,GAAG,MAAM,CAAC;IAClD,0JAA0J;IAC1J,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,OAAe,EAAE,YAAoB,CAAC;IACtF,MAAM,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;IAClC,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhC,wEAAwE;IACxE,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,IAAI,CAAC;IAErE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAE1D,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type FilterContext } from '@deck.gl/core';
2
+ export type DeclarativeLayerFilter = Record<string, {
3
+ include: string[];
4
+ } | {
5
+ exclude: string[];
6
+ }>;
7
+ export declare function makeLayerFilter(filters: DeclarativeLayerFilter): (context: FilterContext) => boolean;
8
+ //# sourceMappingURL=layer-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-filter.d.ts","sourceRoot":"","sources":["../../src/views/layer-filter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC,MAAM,EACJ;IACE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GACD;IACE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CACJ,CAAC;AAYF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAmCrC"}
@@ -0,0 +1,40 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export function makeLayerFilter(filters) {
5
+ // Pre-compile the regexps for performance
6
+ const regexpFilters = {};
7
+ for (const [key, value] of Object.entries(filters)) {
8
+ if ('include' in value) {
9
+ regexpFilters[key] = {
10
+ include: value.include.map((v) => new RegExp(v))
11
+ };
12
+ }
13
+ else {
14
+ regexpFilters[key] = {
15
+ exclude: value.exclude.map((v) => new RegExp(v))
16
+ };
17
+ }
18
+ }
19
+ // Return a function that checks if a layer matches the filter
20
+ return ({ viewport, layer }) => {
21
+ let visible = true;
22
+ const viewFilters = regexpFilters[viewport.id] || {};
23
+ // Check if the layer matches the filters for this viewport
24
+ if ('include' in viewFilters) {
25
+ if (!viewFilters.include.some((regexp) => regexp.test(layer.id))) {
26
+ visible = false;
27
+ }
28
+ }
29
+ if ('exclude' in viewFilters) {
30
+ if (viewFilters.exclude.some((regexp) => regexp.test(layer.id))) {
31
+ visible = false;
32
+ }
33
+ }
34
+ // if (!visible) {
35
+ // console.log(`Viewport ${viewport.id}: filtering out layer ${layer.id}`);
36
+ // }
37
+ return visible;
38
+ };
39
+ }
40
+ //# sourceMappingURL=layer-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-filter.js","sourceRoot":"","sources":["../../src/views/layer-filter.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAwBpC,MAAM,UAAU,eAAe,CAC7B,OAA+B;IAE/B,0CAA0C;IAC1C,MAAM,aAAa,GAAsB,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,SAAS,IAAI,KAAK,E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number, number]];
2
+ export declare function fitBoundsOrthographic(width: number, height: number, bounds: Readonly<Bounds>, zoomMode: 'single'): {
3
+ target: [number, number];
4
+ zoom: number;
5
+ };
6
+ export declare function fitBoundsOrthographic(width: number, height: number, bounds: Readonly<Bounds>, zoomMode: 'per-axis'): {
7
+ target: [number, number];
8
+ zoom: [number, number];
9
+ };
10
+ export {};
11
+ //# sourceMappingURL=orthographic-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orthographic-utils.d.ts","sourceRoot":"","sources":["../../src/views/orthographic-utils.ts"],"names":[],"mappings":"AAIA,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,QAAQ,GACjB;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAE5C,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,UAAU,GACnB;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Compute center & zoom for an OrthographicViewport so that `bounds` fills the viewport.
6
+ * @param width viewport width in px
7
+ * @param height viewport height in px
8
+ * @param bounds [[minX,minY],[maxX,maxY]] in the same world units you’re rendering
9
+ * @returns { target: [number, number], zoom: number }
10
+ * target: center of the viewport in world units
11
+ * zoom: deck.gl orthographic zoom level (log2(scale))
12
+ * (deck.gl orthographic zoom is the log2 of the scale factor)
13
+ */
14
+ export function fitBoundsOrthographic(width, height, bounds, zoomMode = 'per-axis') {
15
+ const [[minX, minY], [maxX, maxY]] = bounds;
16
+ // center of the box
17
+ const centerX = (minX + maxX) / 2;
18
+ const centerY = (minY + maxY) / 2;
19
+ // size of the box
20
+ const boxW = maxX - minX;
21
+ const boxH = maxY - minY;
22
+ // scale (world units → screen pixels)
23
+ const scaleX = width / boxW;
24
+ const scaleY = height / boxH;
25
+ // pick the smaller scale so the whole box fits
26
+ const scale = Math.min(scaleX, scaleY);
27
+ // deck.gl orthographic zoom is log2(scale)
28
+ const zoom = Math.log2(scale);
29
+ // 3) axis‐specific zooms (deck.gl’s orthographic zoom = log2(scale))
30
+ const zoomX = Math.log2(scaleX);
31
+ const zoomY = Math.log2(scaleY);
32
+ if (Number.isNaN(zoom) || Number.isNaN(zoomX) || Number.isNaN(zoom)) {
33
+ // eslint-disable-next-line no-console
34
+ console.warn('Invalid zoom values:', { zoom, zoomX, zoomY });
35
+ }
36
+ return {
37
+ target: [centerX, centerY],
38
+ zoom: zoomMode === 'single' ? zoom : [zoomX, zoomY]
39
+ };
40
+ }
41
+ //# sourceMappingURL=orthographic-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orthographic-utils.js","sourceRoot":"","sources":["../../src/views/orthographic-utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAkBpC;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,MAAc,EACd,MAAwB,EACxB,WAAkC,UAAU;IAE5C,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAE5C,oBAAoB;IACpB,MAAM,OAAO,GAAG,CAAC,IAAI,GAAG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ined ? [number | undefined, number | undefined] | undefined : T[K] extends [number, number, number] | undefined ? [number | undefined, number | undefined, number | undefined] | undefined : T[K] extends [number, number] | number | undefined ? [number | undefined, number | undefined] | undefined : T[K] extends [number, number, number] | [number, number] | undefined ? [number | undefined, number | undefined, number | undefined] | [number | undefined, number | undefined] | undefined : T[K];
4
+ };
5
+ export type OptionalViewState = OptionalizedViewState<OrthographicViewState>;
6
+ export declare function mergeViewStates(viewState1: OrthographicViewState, viewState2: OptionalViewState): OrthographicViewState;
7
+ export declare function validateViewState(viewState: OrthographicViewState): viewState is OrthographicViewState;
8
+ //# sourceMappingURL=view-state-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-state-utils.d.ts","sourceRoot":"","sources":["../../src/views/view-state-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAEzD,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI;KACpC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACrD,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,GACpD,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAC/C,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,GACxE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,GAChD,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,GACpD,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAE9D,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GAC5D,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,GACxC,SAAS,GACb,CAAC,CAAC,CAAC,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;AAE7E,wBAAgB,eAAe,CAC7B,UAAU,EAAE,qBAAqB,EACjC,UAAU,EAAE,iBAAiB,GAC5B,qBAAqB,CAkBvB;AAGD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,qBAAqB,GAC/B,SAAS,IAAI,qBAAqB,CAoBpC"}
@@ -0,0 +1,41 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export function mergeViewStates(viewState1, viewState2) {
5
+ const target1 = viewState1.target ?? [0, 0];
6
+ const zoom1 = viewState1.zoom ?? [1, 1];
7
+ const mergedViewState = {
8
+ ...viewState1,
9
+ ...viewState2,
10
+ target: [viewState2.target?.[0] ?? target1[0], viewState2.target?.[1] ?? target1[1]],
11
+ zoom: [
12
+ // ts-expect-error view state typing is awfully optional
13
+ viewState2.zoom?.[0] ?? zoom1[0],
14
+ // ts-expect-error view state typing is awfully optional
15
+ viewState2.zoom?.[1] ?? zoom1[1]
16
+ ]
17
+ };
18
+ // @ts-expect-error view state typing is awfully optional
19
+ validateViewState(mergedViewState);
20
+ // @ts-expect-error view state typing is awfully optional
21
+ return mergedViewState;
22
+ }
23
+ // eslint-disable-next-line complexity
24
+ export function validateViewState(viewState) {
25
+ const isTargetValid = Array.isArray(viewState.target) &&
26
+ viewState.target[0] !== undefined &&
27
+ !Number.isNaN(viewState.target[0]) &&
28
+ viewState.target[1] !== undefined &&
29
+ !Number.isNaN(viewState.target[1]);
30
+ const isZoomValid = Array.isArray(viewState.zoom) &&
31
+ viewState.zoom[0] !== undefined &&
32
+ !Number.isNaN(viewState.zoom[0]) &&
33
+ viewState.zoom[1] !== undefined &&
34
+ !Number.isNaN(viewState.zoom[1]);
35
+ if (!isTargetValid || !isZoomValid) {
36
+ // eslint-disable-next-line no-console
37
+ console.warn('Invalid viewState:', viewState);
38
+ }
39
+ return isTargetValid && isZoomValid;
40
+ }
41
+ //# sourceMappingURL=view-state-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-state-utils.js","sourceRoot":"","sources":["../../src/views/view-state-utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAqBpC,MAAM,UAAU,eAAe,CAC7B,UAAiC,EACjC,UAA6B;IAE7B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG;QACtB,GAAG,UAAU;QACb,GAAG,UAAU;QACb,MAAM,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QACpF,IAAI,EAAE;YACJ,wDAAwD;YACxD,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;YAChC,wDAAwD;YACxD,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;SACjC;KACF,CAAC;IACF,yDAAyD;IACzD,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACnC,yDAAyD;IACzD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,iBAAiB,CAC/B,SAAgC;IAEhC,MAAM,aAAa,GACjB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/B,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS;QACjC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAClC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS;QACjC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;QAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;QAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnC,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,EAAE,CAAC;QACnC,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,aAAa,IAAI,WAAW,CAAC;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deck.gl-community/infovis-layers",
3
- "version": "9.1.0-beta.8",
3
+ "version": "9.2.0-beta.2",
4
4
  "description": "Infovis layers (non-geospatial) for deck.gl",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -30,23 +30,16 @@
30
30
  "test-watch": "vitest"
31
31
  },
32
32
  "dependencies": {
33
- "@deck.gl/core": "^9.1.12",
34
- "@deck.gl/extensions": "^9.1.0",
35
- "@deck.gl/layers": "^9.1.0",
36
- "@deck.gl/mesh-layers": "^9.1.0",
37
- "@deck.gl/react": "^9.1.0",
38
- "@loaders.gl/core": "^4.2.0",
39
- "@loaders.gl/loader-utils": "^4.2.0",
40
- "@loaders.gl/schema": "^4.2.0",
41
- "@luma.gl/constants": "^9.1.9",
42
- "@luma.gl/core": "^9.1.9",
43
- "@luma.gl/engine": "^9.1.9",
44
- "@math.gl/core": "^4.0.0",
45
- "a5-js": "^0.1.4",
46
- "h3-js": "^4.2.1"
33
+ "@deck.gl/core": "~9.2.1",
34
+ "@deck.gl/layers": "~9.2.1",
35
+ "@luma.gl/core": "~9.2.0",
36
+ "@luma.gl/engine": "~9.2.0",
37
+ "@luma.gl/shadertools": "~9.2.0"
47
38
  },
48
39
  "devDependencies": {
49
- "@deck.gl/test-utils": "^9.1.12",
50
- "@luma.gl/webgpu": "^9.1.9"
51
- }
40
+ "@deck.gl/test-utils": "~9.2.1",
41
+ "@luma.gl/webgpu": "~9.2.0",
42
+ "@probe.gl/test-utils": "^4.0.4"
43
+ },
44
+ "gitHead": "b434bcba10800f27e95a7c9e6c4c7edd0b915773"
52
45
  }
package/src/index.ts CHANGED
@@ -5,6 +5,10 @@
5
5
  export {TimeAxisLayer, type TimeAxisLayerProps} from './layers/time-axis-layer';
6
6
  export {VerticalGridLayer, type VerticalGridLayerProps} from './layers/vertical-grid-layer';
7
7
  export {TimeDeltaLayer, type TimeDeltaLayerProps} from './layers/time-delta-layer';
8
+ export type {HorizonGraphLayerProps} from './layers/horizon-graph-layer/horizon-graph-layer';
9
+ export {HorizonGraphLayer} from './layers/horizon-graph-layer/horizon-graph-layer';
10
+ export type {MultiHorizonGraphLayerProps} from './layers/horizon-graph-layer/multi-horizon-graph-layer';
11
+ export {MultiHorizonGraphLayer} from './layers/horizon-graph-layer/multi-horizon-graph-layer';
8
12
 
9
13
  export {fitBoundsOrthographic} from './views/orthographic-utils';
10
14
  export {formatTimeMs, formatTimeRangeMs} from './utils/format-utils';
@@ -0,0 +1,47 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {ShaderModule} from '@luma.gl/shadertools';
6
+ import {Texture} from '@luma.gl/core';
7
+
8
+ const uniformBlock = `\
9
+ layout(std140) uniform horizonLayerUniforms {
10
+ float dataTextureSize; // width = height of the POT texture
11
+ float dataTextureSizeInv;
12
+ float dataTextureCount; // actual number of data points
13
+
14
+ float bands;
15
+ float bandsInv;
16
+ float yAxisScaleInv;
17
+
18
+ vec3 positiveColor;
19
+ vec3 negativeColor;
20
+ } horizonLayer;
21
+ `;
22
+
23
+ type HorizonLayerBindingProps = {
24
+ dataTexture: Texture;
25
+ };
26
+
27
+ type HorizonLayerUniformProps = {};
28
+
29
+ export type HorizonLayerProps = HorizonLayerBindingProps & HorizonLayerUniformProps;
30
+
31
+ export const horizonLayerUniforms = {
32
+ name: 'horizonLayer',
33
+ vs: uniformBlock,
34
+ fs: uniformBlock,
35
+ uniformTypes: {
36
+ dataTextureSize: 'f32',
37
+ dataTextureSizeInv: 'f32',
38
+ dataTextureCount: 'f32',
39
+
40
+ bands: 'f32',
41
+ bandsInv: 'f32',
42
+ yAxisScaleInv: 'f32',
43
+
44
+ positiveColor: 'vec3<f32>',
45
+ negativeColor: 'vec3<f32>'
46
+ }
47
+ } as const satisfies ShaderModule<HorizonLayerProps>;
@@ -0,0 +1,53 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export default `#version 300 es
6
+ #define SHADER_NAME horizon-graph-layer-fragment-shader
7
+
8
+ precision highp float;
9
+ precision highp int;
10
+
11
+ /******* UNIFORM *******/
12
+
13
+ uniform sampler2D dataTexture;
14
+
15
+ /******* IN *******/
16
+
17
+ in vec2 v_uv;
18
+
19
+ /******* OUT *******/
20
+
21
+ out vec4 fragColor;
22
+
23
+
24
+ /******* MAIN *******/
25
+
26
+ void main(void) {
27
+ // horizontal position to sample index
28
+ float idx = v_uv.x * horizonLayer.dataTextureCount;
29
+ // idx = clamp(idx, 0.0, horizonLayer.dataTextureCount - 1.0); // NEEDED???
30
+
31
+ // fetch single data point & normalize (-1,+1)
32
+ float fy = floor(idx * horizonLayer.dataTextureSizeInv);
33
+ float fx = idx - fy * horizonLayer.dataTextureSize;
34
+ float val = texelFetch(dataTexture, ivec2(int(fx), int(fy)), 0).r;
35
+ val *= horizonLayer.yAxisScaleInv;
36
+
37
+ // band layering
38
+ float fband = abs(val) * horizonLayer.bands;
39
+ float bandIdx = clamp(floor(fband), 0.0, horizonLayer.bands - 1.0);
40
+ float bandFrac = fract(fband);
41
+
42
+ // calc our position value and find out color (using mix+step instead of if...else)
43
+ float positive = step(0.0, val); // 1 if pos, else 0
44
+ vec3 baseCol = mix(horizonLayer.negativeColor, horizonLayer.positiveColor, positive);
45
+ float curPos = mix(v_uv.y, 1.0 - v_uv.y, positive);
46
+ float addOne = step(curPos, bandFrac);
47
+
48
+ float band = bandIdx + addOne;
49
+ float whiten = 1.0 - band * horizonLayer.bandsInv;
50
+
51
+ fragColor = vec4(mix(baseCol, vec3(1.0), whiten), 1.0);
52
+ }
53
+ `;