@deck.gl/aggregation-layers 9.4.0-alpha.1 → 9.4.0-alpha.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 (78) hide show
  1. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -1
  2. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +1 -3
  3. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -1
  4. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +0 -1
  5. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -1
  6. package/dist/dist.dev.js +499 -25
  7. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -1
  8. package/dist/grid-layer/grid-cell-layer.js +2 -1
  9. package/dist/grid-layer/grid-cell-layer.js.map +1 -1
  10. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +2 -0
  11. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -1
  12. package/dist/heatmap-layer/heatmap-layer-uniforms.js +19 -0
  13. package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -1
  14. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  15. package/dist/heatmap-layer/heatmap-layer.js +59 -12
  16. package/dist/heatmap-layer/heatmap-layer.js.map +1 -1
  17. package/dist/heatmap-layer/max.wgsl.d.ts +3 -0
  18. package/dist/heatmap-layer/max.wgsl.d.ts.map +1 -0
  19. package/dist/heatmap-layer/max.wgsl.js +48 -0
  20. package/dist/heatmap-layer/max.wgsl.js.map +1 -0
  21. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +1 -0
  22. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -1
  23. package/dist/heatmap-layer/triangle-layer-uniforms.js +16 -0
  24. package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -1
  25. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  26. package/dist/heatmap-layer/triangle-layer.js +3 -2
  27. package/dist/heatmap-layer/triangle-layer.js.map +1 -1
  28. package/dist/heatmap-layer/triangle-layer.wgsl.d.ts +3 -0
  29. package/dist/heatmap-layer/triangle-layer.wgsl.d.ts.map +1 -0
  30. package/dist/heatmap-layer/triangle-layer.wgsl.js +65 -0
  31. package/dist/heatmap-layer/triangle-layer.wgsl.js.map +1 -0
  32. package/dist/heatmap-layer/weights.wgsl.d.ts +3 -0
  33. package/dist/heatmap-layer/weights.wgsl.d.ts.map +1 -0
  34. package/dist/heatmap-layer/weights.wgsl.js +64 -0
  35. package/dist/heatmap-layer/weights.wgsl.js.map +1 -0
  36. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -1
  37. package/dist/hexagon-layer/hexagon-cell-layer.js +2 -1
  38. package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -1
  39. package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts +3 -0
  40. package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts.map +1 -0
  41. package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js +120 -0
  42. package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js.map +1 -0
  43. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +1 -0
  44. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -1
  45. package/dist/hexagon-layer/hexagon-layer-uniforms.js +13 -0
  46. package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -1
  47. package/dist/index.cjs +499 -25
  48. package/dist/index.cjs.map +4 -4
  49. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -6
  50. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  51. package/dist/screen-grid-layer/screen-grid-cell-layer.js +3 -2
  52. package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  53. package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts +3 -0
  54. package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts.map +1 -0
  55. package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js +76 -0
  56. package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js.map +1 -0
  57. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +1 -0
  58. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -1
  59. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +12 -0
  60. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -1
  61. package/dist.min.js +426 -35
  62. package/package.json +9 -5
  63. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +1 -3
  64. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +0 -1
  65. package/src/grid-layer/grid-cell-layer.ts +2 -1
  66. package/src/heatmap-layer/heatmap-layer-uniforms.ts +20 -0
  67. package/src/heatmap-layer/heatmap-layer.ts +67 -13
  68. package/src/heatmap-layer/max.wgsl.ts +48 -0
  69. package/src/heatmap-layer/triangle-layer-uniforms.ts +17 -0
  70. package/src/heatmap-layer/triangle-layer.ts +3 -2
  71. package/src/heatmap-layer/triangle-layer.wgsl.ts +65 -0
  72. package/src/heatmap-layer/weights.wgsl.ts +64 -0
  73. package/src/hexagon-layer/hexagon-cell-layer.ts +2 -1
  74. package/src/hexagon-layer/hexagon-cell-layer.wgsl.ts +120 -0
  75. package/src/hexagon-layer/hexagon-layer-uniforms.ts +14 -0
  76. package/src/screen-grid-layer/screen-grid-cell-layer.ts +4 -4
  77. package/src/screen-grid-layer/screen-grid-cell-layer.wgsl.ts +76 -0
  78. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +13 -0
@@ -4,12 +4,12 @@
4
4
 
5
5
  import {Texture} from '@luma.gl/core';
6
6
  import {Model, Geometry} from '@luma.gl/engine';
7
- import {Layer, picking, UpdateParameters, Color} from '@deck.gl/core';
7
+ import {Layer, color, picking, UpdateParameters, Color} from '@deck.gl/core';
8
8
  import {createColorRangeTexture, updateColorRangeTexture} from '../common/utils/color-utils';
9
+ import source from './screen-grid-cell-layer.wgsl';
9
10
  import vs from './screen-grid-layer-vertex.glsl';
10
11
  import fs from './screen-grid-layer-fragment.glsl';
11
12
  import {ScreenGridProps, screenGridUniforms} from './screen-grid-layer-uniforms';
12
- import {ShaderModule} from '@luma.gl/shadertools';
13
13
  import type {ScaleType} from '../common/types';
14
14
 
15
15
  /** Proprties added by ScreenGridCellLayer. */
@@ -31,8 +31,8 @@ export default class ScreenGridCellLayer<ExtraPropsT extends {} = {}> extends La
31
31
  colorTexture: Texture;
32
32
  };
33
33
 
34
- getShaders(): {vs: string; fs: string; modules: ShaderModule[]} {
35
- return super.getShaders({vs, fs, modules: [picking, screenGridUniforms]});
34
+ getShaders() {
35
+ return super.getShaders({source, vs, fs, modules: [color, picking, screenGridUniforms]});
36
36
  }
37
37
 
38
38
  initializeState() {
@@ -0,0 +1,76 @@
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export default /* wgsl */ `
6
+ struct Attributes {
7
+ @builtin(instance_index) instanceIndex: u32,
8
+ @location(0) positions: vec2<f32>,
9
+ @location(1) instancePositions: vec2<f32>,
10
+ @location(2) instanceWeights: f32,
11
+ };
12
+
13
+ struct Varyings {
14
+ @builtin(position) position: vec4<f32>,
15
+ @location(0) color: vec4<f32>,
16
+ @location(1) pickingColor: vec3<f32>,
17
+ };
18
+
19
+ fn sampleColorRange(value: f32, domain: vec2<f32>) -> vec4<f32> {
20
+ let ratio = (value - domain.x) / (domain.y - domain.x);
21
+ return textureSampleLevel(colorRange, colorRangeSampler, vec2<f32>(ratio, 0.5), 0.0);
22
+ }
23
+
24
+ @vertex
25
+ fn vertexMain(attributes: Attributes) -> Varyings {
26
+ var output: Varyings;
27
+ output.pickingColor = picking_getPickingColorFromIndex(attributes.instanceIndex);
28
+
29
+ if (attributes.instanceWeights != attributes.instanceWeights) {
30
+ output.position = vec4<f32>(0.0);
31
+ output.color = vec4<f32>(0.0);
32
+ return output;
33
+ }
34
+
35
+ var position =
36
+ attributes.instancePositions * screenGrid.gridSizeClipspace +
37
+ attributes.positions * screenGrid.cellSizeClipspace;
38
+ position.x -= 1.0;
39
+ position.y = 1.0 - position.y;
40
+
41
+ output.position = vec4<f32>(position, 0.0, 1.0);
42
+ let colorValue = sampleColorRange(attributes.instanceWeights, screenGrid.colorDomain);
43
+ output.color = vec4<f32>(colorValue.rgb, colorValue.a * layer.opacity);
44
+ return output;
45
+ }
46
+
47
+ @fragment
48
+ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
49
+ if (picking.isActive > 0.5) {
50
+ if (!picking_isColorValid(varyings.pickingColor)) {
51
+ discard;
52
+ }
53
+ return vec4<f32>(varyings.pickingColor, 1.0);
54
+ }
55
+
56
+ var color = varyings.color;
57
+ if (picking.isHighlightActive > 0.5) {
58
+ let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
59
+ if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
60
+ let highLightAlpha = picking.highlightColor.a;
61
+ let blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
62
+ if (blendedAlpha > 0.0) {
63
+ let highLightRatio = highLightAlpha / blendedAlpha;
64
+ color = vec4<f32>(
65
+ mix(color.rgb, picking.highlightColor.rgb, highLightRatio),
66
+ blendedAlpha
67
+ );
68
+ } else {
69
+ color = vec4<f32>(color.rgb, 0.0);
70
+ }
71
+ }
72
+ }
73
+
74
+ return deckgl_premultiplied_alpha(color);
75
+ }
76
+ `;
@@ -5,6 +5,18 @@
5
5
  import {Texture} from '@luma.gl/core';
6
6
  import type {ShaderModule} from '@luma.gl/shadertools';
7
7
 
8
+ const uniformBlockWGSL = /* wgsl */ `
9
+ struct ScreenGridUniforms {
10
+ cellSizeClipspace: vec2<f32>,
11
+ gridSizeClipspace: vec2<f32>,
12
+ colorDomain: vec2<f32>,
13
+ };
14
+
15
+ @group(0) @binding(auto) var<uniform> screenGrid: ScreenGridUniforms;
16
+ @group(0) @binding(auto) var colorRange: texture_2d<f32>;
17
+ @group(0) @binding(auto) var colorRangeSampler: sampler;
18
+ `;
19
+
8
20
  const uniformBlock = /* glsl */ `\
9
21
  layout(std140) uniform screenGridUniforms {
10
22
  vec2 cellSizeClipspace;
@@ -22,6 +34,7 @@ export type ScreenGridProps = {
22
34
 
23
35
  export const screenGridUniforms = {
24
36
  name: 'screenGrid',
37
+ source: uniformBlockWGSL,
25
38
  vs: uniformBlock,
26
39
  uniformTypes: {
27
40
  cellSizeClipspace: 'vec2<f32>',