@deck.gl/aggregation-layers 9.0.34 → 9.1.0-beta.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.
- package/dist/common/aggregation-layer.d.ts +30 -0
- package/dist/common/aggregation-layer.d.ts.map +1 -0
- package/dist/common/aggregation-layer.js +69 -0
- package/dist/common/aggregator/aggregator.d.ts +76 -0
- package/dist/common/aggregator/aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/aggregator.js +4 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
- package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
- package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
- package/dist/common/aggregator/index.d.ts +6 -0
- package/dist/common/aggregator/index.d.ts.map +1 -0
- package/dist/common/aggregator/index.js +5 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +4 -0
- package/dist/common/utils/bounds-utils.d.ts +10 -0
- package/dist/common/utils/bounds-utils.d.ts.map +1 -0
- package/dist/common/utils/bounds-utils.js +20 -0
- package/dist/common/utils/color-utils.d.ts +10 -0
- package/dist/common/utils/color-utils.d.ts.map +1 -0
- package/dist/common/utils/color-utils.js +65 -0
- package/dist/common/utils/prop-utils.d.ts.map +1 -0
- package/dist/common/utils/prop-utils.js +12 -0
- package/dist/common/utils/scale-utils.d.ts +46 -0
- package/dist/common/utils/scale-utils.d.ts.map +1 -0
- package/dist/common/utils/scale-utils.js +180 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/contour-layer/bin-options-uniforms.js +17 -0
- package/dist/contour-layer/contour-layer.d.ts +42 -50
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +232 -192
- package/dist/contour-layer/contour-utils.d.ts +36 -15
- package/dist/contour-layer/contour-utils.d.ts.map +1 -1
- package/dist/contour-layer/contour-utils.js +24 -29
- package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares-codes.js +3 -0
- package/dist/contour-layer/marching-squares.d.ts +22 -6
- package/dist/contour-layer/marching-squares.d.ts.map +1 -1
- package/dist/contour-layer/marching-squares.js +71 -68
- package/dist/contour-layer/value-reader.d.ts +10 -0
- package/dist/contour-layer/value-reader.d.ts.map +1 -0
- package/dist/contour-layer/value-reader.js +46 -0
- package/dist/dist.dev.js +4842 -4081
- package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
- package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/bin-options-uniforms.js +17 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.js +93 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.js +23 -0
- package/dist/grid-layer/grid-layer.d.ts +175 -13
- package/dist/grid-layer/grid-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer.js +342 -46
- package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
- package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
- package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
- package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +43 -33
- package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-fs.glsl.js +3 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +6 -4
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
- package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +17 -30
- package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
- package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
- package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +307 -123
- package/dist/hexagon-layer/hexbin.d.ts +17 -0
- package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
- package/dist/hexagon-layer/hexbin.js +69 -0
- package/dist/index.cjs +3025 -2946
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -27
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
- package/dist.min.js +401 -382
- package/package.json +10 -9
- package/src/common/aggregation-layer.ts +107 -0
- package/src/common/aggregator/aggregator.ts +88 -0
- package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
- package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
- package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
- package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
- package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
- package/src/common/aggregator/index.ts +10 -0
- package/src/{types.ts → common/types.ts} +10 -4
- package/src/common/utils/bounds-utils.ts +34 -0
- package/src/common/utils/color-utils.ts +86 -0
- package/src/common/utils/prop-utils.ts +13 -0
- package/src/common/utils/scale-utils.ts +236 -0
- package/src/contour-layer/bin-options-uniforms.ts +26 -0
- package/src/contour-layer/contour-layer.ts +300 -265
- package/src/contour-layer/contour-utils.ts +68 -39
- package/src/contour-layer/marching-squares-codes.ts +4 -0
- package/src/contour-layer/marching-squares.ts +93 -82
- package/src/contour-layer/value-reader.ts +65 -0
- package/src/grid-layer/bin-options-uniforms.ts +26 -0
- package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
- package/src/grid-layer/grid-cell-layer.ts +141 -0
- package/src/grid-layer/grid-layer-uniforms.ts +37 -0
- package/src/grid-layer/grid-layer.ts +614 -73
- package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
- package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
- package/src/heatmap-layer/heatmap-layer.ts +59 -36
- package/src/heatmap-layer/max-fs.glsl.ts +4 -0
- package/src/heatmap-layer/max-vs.glsl.ts +7 -4
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
- package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
- package/src/heatmap-layer/triangle-layer.ts +26 -31
- package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
- package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
- package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
- package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
- package/src/hexagon-layer/hexagon-layer.ts +454 -186
- package/src/hexagon-layer/hexbin.ts +79 -0
- package/src/index.ts +21 -34
- package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
- package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
- package/dist/aggregation-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
- package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
- package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
- package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
- package/dist/grid-aggregation-layer.d.ts +0 -67
- package/dist/grid-aggregation-layer.d.ts.map +0 -1
- package/dist/grid-aggregation-layer.js +0 -173
- package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
- package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
- package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
- package/dist/types.d.ts +0 -12
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/aggregation-operation-utils.d.ts +0 -19
- package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
- package/dist/utils/aggregation-operation-utils.js +0 -94
- package/dist/utils/bin-sorter.d.ts +0 -52
- package/dist/utils/bin-sorter.d.ts.map +0 -1
- package/dist/utils/bin-sorter.js +0 -167
- package/dist/utils/color-utils.d.ts +0 -3
- package/dist/utils/color-utils.d.ts.map +0 -1
- package/dist/utils/color-utils.js +0 -53
- package/dist/utils/cpu-aggregator.d.ts +0 -169
- package/dist/utils/cpu-aggregator.d.ts.map +0 -1
- package/dist/utils/cpu-aggregator.js +0 -421
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
- package/dist/utils/grid-aggregation-utils.d.ts +0 -30
- package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
- package/dist/utils/grid-aggregation-utils.js +0 -114
- package/dist/utils/prop-utils.d.ts.map +0 -1
- package/dist/utils/prop-utils.js +0 -28
- package/dist/utils/resource-utils.d.ts +0 -14
- package/dist/utils/resource-utils.d.ts.map +0 -1
- package/dist/utils/resource-utils.js +0 -38
- package/dist/utils/scale-utils.d.ts +0 -15
- package/dist/utils/scale-utils.d.ts.map +0 -1
- package/dist/utils/scale-utils.js +0 -184
- package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
- package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
- package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
- package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
- package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
- package/src/grid-aggregation-layer.ts +0 -243
- package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
- package/src/utils/aggregation-operation-utils.ts +0 -118
- package/src/utils/bin-sorter.ts +0 -218
- package/src/utils/color-utils.ts +0 -57
- package/src/utils/cpu-aggregator.ts +0 -503
- package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
- package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
- package/src/utils/grid-aggregation-utils.ts +0 -147
- package/src/utils/prop-utils.ts +0 -29
- package/src/utils/resource-utils.ts +0 -53
- package/src/utils/scale-utils.js +0 -219
- /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
const THIRD_PI = Math.PI / 3;
|
|
6
|
+
const DIST_X = 2 * Math.sin(THIRD_PI);
|
|
7
|
+
const DIST_Y = 1.5;
|
|
8
|
+
|
|
9
|
+
type HexBin = [i: number, j: number];
|
|
10
|
+
type Point = [x: number, y: number];
|
|
11
|
+
|
|
12
|
+
export const HexbinVertices = Array.from({length: 6}, (_, i) => {
|
|
13
|
+
const angle = i * THIRD_PI;
|
|
14
|
+
return [Math.sin(angle), -Math.cos(angle)];
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Adapted from d3-hexbin
|
|
19
|
+
* Copyright Mike Bostock, 2012-2016
|
|
20
|
+
All rights reserved.
|
|
21
|
+
* https://github.com/d3/d3-hexbin/blob/master/src/hexbin.js
|
|
22
|
+
*
|
|
23
|
+
* Returns the hexbin that a point (x,y) falls into
|
|
24
|
+
*/
|
|
25
|
+
export function pointToHexbin([px, py]: Point, radius: number): HexBin {
|
|
26
|
+
let pj = Math.round((py = py / radius / DIST_Y));
|
|
27
|
+
let pi = Math.round((px = px / radius / DIST_X - (pj & 1) / 2));
|
|
28
|
+
const py1 = py - pj;
|
|
29
|
+
|
|
30
|
+
if (Math.abs(py1) * 3 > 1) {
|
|
31
|
+
const px1 = px - pi;
|
|
32
|
+
const pi2 = pi + (px < pi ? -1 : 1) / 2;
|
|
33
|
+
const pj2 = pj + (py < pj ? -1 : 1);
|
|
34
|
+
const px2 = px - pi2;
|
|
35
|
+
const py2 = py - pj2;
|
|
36
|
+
if (px1 * px1 + py1 * py1 > px2 * px2 + py2 * py2) {
|
|
37
|
+
pi = pi2 + (pj & 1 ? 1 : -1) / 2;
|
|
38
|
+
pj = pj2;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [pi, pj];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const pointToHexbinGLSL = /* glsl */ `
|
|
45
|
+
const vec2 DIST = vec2(${DIST_X}, ${DIST_Y});
|
|
46
|
+
|
|
47
|
+
ivec2 pointToHexbin(vec2 p, float radius) {
|
|
48
|
+
p /= radius * DIST;
|
|
49
|
+
float pj = round(p.y);
|
|
50
|
+
float pjm2 = mod(pj, 2.0);
|
|
51
|
+
p.x -= pjm2 * 0.5;
|
|
52
|
+
float pi = round(p.x);
|
|
53
|
+
vec2 d1 = p - vec2(pi, pj);
|
|
54
|
+
|
|
55
|
+
if (abs(d1.y) * 3. > 1.) {
|
|
56
|
+
vec2 v2 = step(0.0, d1) - 0.5;
|
|
57
|
+
v2.y *= 2.0;
|
|
58
|
+
vec2 d2 = d1 - v2;
|
|
59
|
+
if (dot(d1, d1) > dot(d2, d2)) {
|
|
60
|
+
pi += v2.x + pjm2 - 0.5;
|
|
61
|
+
pj += v2.y;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return ivec2(pi, pj);
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
export function getHexbinCentroid([i, j]: HexBin, radius: number): Point {
|
|
69
|
+
return [(i + (j & 1) / 2) * radius * DIST_X, j * radius * DIST_Y];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const getHexbinCentroidGLSL = `
|
|
73
|
+
const vec2 DIST = vec2(${DIST_X}, ${DIST_Y});
|
|
74
|
+
|
|
75
|
+
vec2 hexbinCentroid(vec2 binId, float radius) {
|
|
76
|
+
binId.x += fract(binId.y * 0.5);
|
|
77
|
+
return binId * DIST * radius;
|
|
78
|
+
}
|
|
79
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
|
|
21
5
|
export {default as ScreenGridLayer} from './screen-grid-layer/screen-grid-layer';
|
|
22
|
-
export {default as CPUGridLayer} from './cpu-grid-layer/cpu-grid-layer';
|
|
23
6
|
export {default as HexagonLayer} from './hexagon-layer/hexagon-layer';
|
|
24
7
|
export {default as ContourLayer} from './contour-layer/contour-layer';
|
|
25
8
|
export {default as GridLayer} from './grid-layer/grid-layer';
|
|
26
|
-
export {default as GPUGridLayer} from './gpu-grid-layer/gpu-grid-layer';
|
|
27
|
-
export {AGGREGATION_OPERATION} from './utils/aggregation-operation-utils';
|
|
28
|
-
|
|
29
|
-
// experimental export
|
|
30
9
|
export {default as HeatmapLayer} from './heatmap-layer/heatmap-layer';
|
|
31
|
-
|
|
32
|
-
export {default as
|
|
33
|
-
export {
|
|
34
|
-
export {default as _BinSorter} from './utils/bin-sorter';
|
|
10
|
+
|
|
11
|
+
export {default as _AggregationLayer} from './common/aggregation-layer';
|
|
12
|
+
export {WebGLAggregator, CPUAggregator} from './common/aggregator/index';
|
|
35
13
|
|
|
36
14
|
// types
|
|
37
|
-
export type {ContourLayerProps} from './contour-layer/contour-layer';
|
|
15
|
+
export type {ContourLayerProps, ContourLayerPickingInfo} from './contour-layer/contour-layer';
|
|
38
16
|
export type {HeatmapLayerProps} from './heatmap-layer/heatmap-layer';
|
|
39
|
-
export type {HexagonLayerProps} from './hexagon-layer/hexagon-layer';
|
|
40
|
-
export type {
|
|
41
|
-
export type {
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
export type {HexagonLayerProps, HexagonLayerPickingInfo} from './hexagon-layer/hexagon-layer';
|
|
18
|
+
export type {GridLayerProps, GridLayerPickingInfo} from './grid-layer/grid-layer';
|
|
19
|
+
export type {
|
|
20
|
+
ScreenGridLayerProps,
|
|
21
|
+
ScreenGridLayerPickingInfo
|
|
22
|
+
} from './screen-grid-layer/screen-grid-layer';
|
|
23
|
+
|
|
24
|
+
export type {
|
|
25
|
+
Aggregator,
|
|
26
|
+
AggregationOperation,
|
|
27
|
+
AggregationProps,
|
|
28
|
+
WebGLAggregatorProps,
|
|
29
|
+
CPUAggregatorProps
|
|
30
|
+
} from './common/aggregator/index';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
6
|
+
|
|
7
|
+
const uniformBlock = /* glsl */ `\
|
|
8
|
+
uniform binOptionsUniforms {
|
|
9
|
+
float cellSizePixels;
|
|
10
|
+
} binOptions;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export type BinOptions = {
|
|
14
|
+
cellSizePixels: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const binOptionsUniforms = {
|
|
18
|
+
name: 'binOptions',
|
|
19
|
+
vs: uniformBlock,
|
|
20
|
+
uniformTypes: {
|
|
21
|
+
cellSizePixels: 'f32'
|
|
22
|
+
}
|
|
23
|
+
} as const satisfies ShaderModule<BinOptions>;
|
|
@@ -1,142 +1,106 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
|
|
21
5
|
import {Texture} from '@luma.gl/core';
|
|
22
6
|
import {Model, Geometry} from '@luma.gl/engine';
|
|
23
|
-
import {Layer,
|
|
24
|
-
import {
|
|
7
|
+
import {Layer, picking, UpdateParameters, DefaultProps, Color} from '@deck.gl/core';
|
|
8
|
+
import {createColorRangeTexture, updateColorRangeTexture} from '../common/utils/color-utils';
|
|
25
9
|
import vs from './screen-grid-layer-vertex.glsl';
|
|
26
10
|
import fs from './screen-grid-layer-fragment.glsl';
|
|
27
|
-
import
|
|
11
|
+
import {ScreenGridProps, screenGridUniforms} from './screen-grid-layer-uniforms';
|
|
28
12
|
import {ShaderModule} from '@luma.gl/shadertools';
|
|
29
|
-
|
|
30
|
-
const DEFAULT_MINCOLOR = [0, 0, 0, 0];
|
|
31
|
-
const DEFAULT_MAXCOLOR = [0, 255, 0, 255];
|
|
32
|
-
const COLOR_PROPS = ['minColor', 'maxColor', 'colorRange', 'colorDomain'];
|
|
33
|
-
|
|
34
|
-
const defaultProps: DefaultProps<ScreenGridCellLayerProps> = {
|
|
35
|
-
cellSizePixels: {type: 'number', value: 100, min: 1},
|
|
36
|
-
cellMarginPixels: {type: 'number', value: 2, min: 0, max: 5},
|
|
37
|
-
|
|
38
|
-
colorDomain: null,
|
|
39
|
-
colorRange: defaultColorRange
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/** All properties supported by ScreenGridCellLayer. */
|
|
43
|
-
export type ScreenGridCellLayerProps<DataT = unknown> = _ScreenGridCellLayerProps<DataT> &
|
|
44
|
-
LayerProps;
|
|
13
|
+
import type {ScaleType} from '../common/types';
|
|
45
14
|
|
|
46
15
|
/** Proprties added by ScreenGridCellLayer. */
|
|
47
|
-
export type _ScreenGridCellLayerProps
|
|
48
|
-
|
|
16
|
+
export type _ScreenGridCellLayerProps = {
|
|
17
|
+
cellSizePixels: number;
|
|
18
|
+
cellMarginPixels: number;
|
|
19
|
+
colorScaleType: ScaleType;
|
|
20
|
+
colorDomain: () => [number, number];
|
|
21
|
+
colorRange?: Color[];
|
|
49
22
|
};
|
|
50
23
|
|
|
51
|
-
export default class ScreenGridCellLayer<
|
|
52
|
-
ExtraPropsT & Required<_ScreenGridCellLayerProps
|
|
24
|
+
export default class ScreenGridCellLayer<ExtraPropsT extends {} = {}> extends Layer<
|
|
25
|
+
ExtraPropsT & Required<_ScreenGridCellLayerProps>
|
|
53
26
|
> {
|
|
54
27
|
static layerName = 'ScreenGridCellLayer';
|
|
55
|
-
static defaultProps = defaultProps;
|
|
56
28
|
|
|
57
29
|
state!: {
|
|
58
30
|
model?: Model;
|
|
31
|
+
colorTexture: Texture;
|
|
59
32
|
};
|
|
60
33
|
|
|
61
34
|
getShaders(): {vs: string; fs: string; modules: ShaderModule[]} {
|
|
62
|
-
return {vs, fs, modules: [picking
|
|
35
|
+
return super.getShaders({vs, fs, modules: [picking, screenGridUniforms]});
|
|
63
36
|
}
|
|
64
37
|
|
|
65
38
|
initializeState() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
39
|
+
this.getAttributeManager()!.addInstanced({
|
|
40
|
+
instancePositions: {
|
|
41
|
+
size: 2,
|
|
42
|
+
type: 'float32',
|
|
43
|
+
accessor: 'getBin'
|
|
44
|
+
},
|
|
45
|
+
instanceWeights: {
|
|
46
|
+
size: 1,
|
|
47
|
+
type: 'float32',
|
|
48
|
+
accessor: 'getWeight'
|
|
49
|
+
}
|
|
74
50
|
});
|
|
75
|
-
}
|
|
76
51
|
|
|
77
|
-
|
|
78
|
-
// 'instanceCounts' buffer contetns change on viewport change.
|
|
79
|
-
return changeFlags.somethingChanged;
|
|
52
|
+
this.state.model = this._getModel();
|
|
80
53
|
}
|
|
81
54
|
|
|
82
55
|
updateState(params: UpdateParameters<this>) {
|
|
83
56
|
super.updateState(params);
|
|
84
57
|
|
|
85
|
-
const {
|
|
58
|
+
const {props, oldProps, changeFlags} = params;
|
|
59
|
+
const model = this.state.model!;
|
|
86
60
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
if (oldProps.colorRange !== props.colorRange) {
|
|
62
|
+
this.state.colorTexture?.destroy();
|
|
63
|
+
this.state.colorTexture = createColorRangeTexture(
|
|
64
|
+
this.context.device,
|
|
65
|
+
props.colorRange,
|
|
66
|
+
props.colorScaleType
|
|
67
|
+
);
|
|
68
|
+
const screenGridProps: Partial<ScreenGridProps> = {colorRange: this.state.colorTexture};
|
|
69
|
+
model.shaderInputs.setProps({screenGrid: screenGridProps});
|
|
70
|
+
} else if (oldProps.colorScaleType !== props.colorScaleType) {
|
|
71
|
+
updateColorRangeTexture(this.state.colorTexture, props.colorScaleType);
|
|
92
72
|
}
|
|
93
73
|
|
|
94
|
-
|
|
74
|
+
if (
|
|
75
|
+
oldProps.cellMarginPixels !== props.cellMarginPixels ||
|
|
76
|
+
oldProps.cellSizePixels !== props.cellSizePixels ||
|
|
77
|
+
changeFlags.viewportChanged
|
|
78
|
+
) {
|
|
79
|
+
const {width, height} = this.context.viewport;
|
|
80
|
+
const {cellSizePixels: gridSize, cellMarginPixels} = this.props;
|
|
81
|
+
const cellSize = Math.max(gridSize - cellMarginPixels, 0);
|
|
82
|
+
|
|
83
|
+
const screenGridProps: Partial<ScreenGridProps> = {
|
|
84
|
+
gridSizeClipspace: [(gridSize / width) * 2, (gridSize / height) * 2],
|
|
85
|
+
cellSizeClipspace: [(cellSize / width) * 2, (cellSize / height) * 2]
|
|
86
|
+
};
|
|
87
|
+
model.shaderInputs.setProps({screenGrid: screenGridProps});
|
|
88
|
+
}
|
|
95
89
|
}
|
|
96
90
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const minColor = this.props.minColor || DEFAULT_MINCOLOR;
|
|
100
|
-
const maxColor = this.props.maxColor || DEFAULT_MAXCOLOR;
|
|
91
|
+
finalizeState(context) {
|
|
92
|
+
super.finalizeState(context);
|
|
101
93
|
|
|
102
|
-
|
|
103
|
-
// maxCount value will be sampled form maxTexture in vertex shader.
|
|
104
|
-
const colorDomain = this.props.colorDomain || [1, 0];
|
|
105
|
-
const model = this.state.model!;
|
|
106
|
-
model.setUniforms(uniforms);
|
|
107
|
-
model.setBindings({
|
|
108
|
-
maxTexture
|
|
109
|
-
});
|
|
110
|
-
model.setUniforms({
|
|
111
|
-
// @ts-expect-error stricter luma gl types
|
|
112
|
-
minColor,
|
|
113
|
-
// @ts-expect-error stricter luma gl types
|
|
114
|
-
maxColor,
|
|
115
|
-
colorDomain
|
|
116
|
-
});
|
|
117
|
-
model.setParameters({
|
|
118
|
-
depthWriteEnabled: false,
|
|
119
|
-
// How to specify depth mask in WebGPU?
|
|
120
|
-
// depthMask: false,
|
|
121
|
-
...parameters
|
|
122
|
-
});
|
|
123
|
-
model.draw(this.context.renderPass);
|
|
94
|
+
this.state.colorTexture?.destroy();
|
|
124
95
|
}
|
|
125
96
|
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const numCol = Math.ceil(width / cellSizePixels);
|
|
130
|
-
|
|
131
|
-
const {value, size} = attribute;
|
|
97
|
+
draw({uniforms}) {
|
|
98
|
+
const colorDomain = this.props.colorDomain();
|
|
99
|
+
const model = this.state.model!;
|
|
132
100
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
value[i * size + 0] = ((x * cellSizePixels) / width) * 2 - 1;
|
|
137
|
-
value[i * size + 1] = 1 - ((y * cellSizePixels) / height) * 2;
|
|
138
|
-
value[i * size + 2] = 0;
|
|
139
|
-
}
|
|
101
|
+
const screenGridProps: Partial<ScreenGridProps> = {colorDomain};
|
|
102
|
+
model.shaderInputs.setProps({screenGrid: screenGridProps});
|
|
103
|
+
model.draw(this.context.renderPass);
|
|
140
104
|
}
|
|
141
105
|
|
|
142
106
|
// Private Methods
|
|
@@ -147,64 +111,15 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
147
111
|
id: this.props.id,
|
|
148
112
|
bufferLayout: this.getAttributeManager()!.getBufferLayouts(),
|
|
149
113
|
geometry: new Geometry({
|
|
150
|
-
topology: 'triangle-
|
|
114
|
+
topology: 'triangle-strip',
|
|
151
115
|
attributes: {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
1, 1, 0,
|
|
157
|
-
0, 0, 0,
|
|
158
|
-
1, 1, 0,
|
|
159
|
-
0, 1, 0,
|
|
160
|
-
])
|
|
116
|
+
positions: {
|
|
117
|
+
value: new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]),
|
|
118
|
+
size: 2
|
|
119
|
+
}
|
|
161
120
|
}
|
|
162
121
|
}),
|
|
163
122
|
isInstanced: true
|
|
164
123
|
});
|
|
165
124
|
}
|
|
166
|
-
|
|
167
|
-
_shouldUseMinMax(): boolean {
|
|
168
|
-
const {minColor, maxColor, colorDomain, colorRange} = this.props;
|
|
169
|
-
if (minColor || maxColor) {
|
|
170
|
-
log.deprecated('ScreenGridLayer props: minColor and maxColor', 'colorRange, colorDomain')();
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
// minColor and maxColor not supplied, check if colorRange or colorDomain supplied.
|
|
174
|
-
// NOTE: colorDomain and colorRange are experimental features, use them only when supplied.
|
|
175
|
-
if (colorDomain || colorRange) {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
// None specified, use default minColor and maxColor
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
_updateUniforms(oldProps, props, changeFlags): void {
|
|
183
|
-
const model = this.state.model!;
|
|
184
|
-
if (COLOR_PROPS.some(key => oldProps[key] !== props[key])) {
|
|
185
|
-
model.setUniforms({shouldUseMinMax: this._shouldUseMinMax()});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (oldProps.colorRange !== props.colorRange) {
|
|
189
|
-
model.setUniforms({colorRange: colorRangeToFlatArray(props.colorRange)});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
oldProps.cellMarginPixels !== props.cellMarginPixels ||
|
|
194
|
-
oldProps.cellSizePixels !== props.cellSizePixels ||
|
|
195
|
-
changeFlags.viewportChanged
|
|
196
|
-
) {
|
|
197
|
-
const {width, height} = this.context.viewport;
|
|
198
|
-
const {cellSizePixels, cellMarginPixels} = this.props;
|
|
199
|
-
const margin = cellSizePixels > cellMarginPixels ? cellMarginPixels : 0;
|
|
200
|
-
|
|
201
|
-
const cellScale = new Float32Array([
|
|
202
|
-
((cellSizePixels - margin) / width) * 2,
|
|
203
|
-
(-(cellSizePixels - margin) / height) * 2,
|
|
204
|
-
1
|
|
205
|
-
]);
|
|
206
|
-
// @ts-expect-error stricter luma gl types
|
|
207
|
-
model.setUniforms({cellScale});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
125
|
}
|
|
@@ -1,39 +1,19 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
|
|
21
5
|
/* fragment shader for the grid-layer */
|
|
22
|
-
export default `\
|
|
6
|
+
export default /* glsl */ `\
|
|
23
7
|
#version 300 es
|
|
24
8
|
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
25
9
|
|
|
26
10
|
precision highp float;
|
|
27
11
|
|
|
28
12
|
in vec4 vColor;
|
|
29
|
-
in float vSampleCount;
|
|
30
13
|
|
|
31
14
|
out vec4 fragColor;
|
|
32
15
|
|
|
33
16
|
void main(void) {
|
|
34
|
-
if (vSampleCount <= 0.0) {
|
|
35
|
-
discard;
|
|
36
|
-
}
|
|
37
17
|
fragColor = vColor;
|
|
38
18
|
|
|
39
19
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Texture} from '@luma.gl/core';
|
|
6
|
+
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
7
|
+
|
|
8
|
+
const uniformBlock = /* glsl */ `\
|
|
9
|
+
uniform screenGridUniforms {
|
|
10
|
+
vec2 cellSizeClipspace;
|
|
11
|
+
vec2 gridSizeClipspace;
|
|
12
|
+
vec2 colorDomain;
|
|
13
|
+
} screenGrid;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export type ScreenGridProps = {
|
|
17
|
+
cellSizeClipspace: [number, number];
|
|
18
|
+
gridSizeClipspace: [number, number];
|
|
19
|
+
colorDomain: [number, number];
|
|
20
|
+
colorRange: Texture;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const screenGridUniforms = {
|
|
24
|
+
name: 'screenGrid',
|
|
25
|
+
vs: uniformBlock,
|
|
26
|
+
uniformTypes: {
|
|
27
|
+
cellSizeClipspace: 'vec2<f32>',
|
|
28
|
+
gridSizeClipspace: 'vec2<f32>',
|
|
29
|
+
colorDomain: 'vec2<f32>'
|
|
30
|
+
}
|
|
31
|
+
} as const satisfies ShaderModule<ScreenGridProps>;
|
|
@@ -1,85 +1,42 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
20
4
|
|
|
21
|
-
export default `\
|
|
5
|
+
export default /* glsl */ `\
|
|
22
6
|
#version 300 es
|
|
23
7
|
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
24
8
|
#define RANGE_COUNT 6
|
|
25
9
|
|
|
26
|
-
in
|
|
27
|
-
in
|
|
28
|
-
in
|
|
10
|
+
in vec2 positions;
|
|
11
|
+
in vec2 instancePositions;
|
|
12
|
+
in float instanceWeights;
|
|
29
13
|
in vec3 instancePickingColors;
|
|
30
14
|
|
|
31
|
-
uniform
|
|
32
|
-
uniform vec3 cellScale;
|
|
33
|
-
uniform vec4 minColor;
|
|
34
|
-
uniform vec4 maxColor;
|
|
35
|
-
uniform vec4 colorRange[RANGE_COUNT];
|
|
36
|
-
uniform vec2 colorDomain;
|
|
37
|
-
uniform bool shouldUseMinMax;
|
|
38
|
-
uniform sampler2D maxTexture;
|
|
15
|
+
uniform sampler2D colorRange;
|
|
39
16
|
|
|
40
17
|
out vec4 vColor;
|
|
41
|
-
out float vSampleCount;
|
|
42
18
|
|
|
43
|
-
vec4
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
float domainRange = domain.y - domain.x;
|
|
47
|
-
if (domainRange <= 0.) {
|
|
48
|
-
outColor = colorRange[0];
|
|
49
|
-
} else {
|
|
50
|
-
float rangeCount = float(RANGE_COUNT);
|
|
51
|
-
float rangeStep = domainRange / rangeCount;
|
|
52
|
-
float idx = floor((value - domain.x) / rangeStep);
|
|
53
|
-
idx = clamp(idx, 0., rangeCount - 1.);
|
|
54
|
-
int intIdx = int(idx);
|
|
55
|
-
outColor = colorRange[intIdx];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
outColor = outColor / 255.;
|
|
59
|
-
return outColor;
|
|
19
|
+
vec4 interp(float value, vec2 domain, sampler2D range) {
|
|
20
|
+
float r = (value - domain.x) / (domain.y - domain.x);
|
|
21
|
+
return texture(range, vec2(r, 0.5));
|
|
60
22
|
}
|
|
61
23
|
|
|
62
24
|
void main(void) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
25
|
+
if (isnan(instanceWeights)) {
|
|
26
|
+
gl_Position = vec4(0.);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
67
29
|
|
|
68
|
-
|
|
69
|
-
|
|
30
|
+
vec2 pos = instancePositions * screenGrid.gridSizeClipspace + positions * screenGrid.cellSizeClipspace;
|
|
31
|
+
pos.x = pos.x - 1.0;
|
|
32
|
+
pos.y = 1.0 - pos.y;
|
|
70
33
|
|
|
71
|
-
|
|
72
|
-
float domainMaxValid = float(colorDomain.y != 0.);
|
|
73
|
-
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
|
|
74
|
-
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
|
|
34
|
+
gl_Position = vec4(pos, 0., 1.);
|
|
75
35
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
vColor = vec4(color.rgb, color.a * opacity);
|
|
36
|
+
vColor = interp(instanceWeights, screenGrid.colorDomain, colorRange);
|
|
37
|
+
vColor.a *= layer.opacity;
|
|
79
38
|
|
|
80
39
|
// Set color to be rendered to picking fbo (also used to check for selection highlight).
|
|
81
40
|
picking_setPickingColor(instancePickingColors);
|
|
82
|
-
|
|
83
|
-
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
84
41
|
}
|
|
85
42
|
`;
|