@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.11
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/{typed → dist}/aggregation-layer.d.ts +2 -2
- package/dist/aggregation-layer.d.ts.map +1 -0
- package/dist/aggregation-layer.js +153 -0
- package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
- package/dist/contour-layer/contour-layer.d.ts.map +1 -0
- package/dist/contour-layer/contour-layer.js +240 -0
- package/dist/contour-layer/contour-utils.js +64 -0
- package/dist/contour-layer/marching-squares-codes.js +337 -0
- package/dist/contour-layer/marching-squares.js +147 -0
- package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
- package/dist/cpu-grid-layer/cpu-grid-layer.js +129 -0
- package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
- package/dist/dist.dev.js +1442 -10868
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +30 -0
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +112 -0
- package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
- package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +4 -4
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
- package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
- package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
- package/dist/grid-aggregation-layer.d.ts.map +1 -0
- package/dist/grid-aggregation-layer.js +172 -0
- package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
- package/dist/grid-layer/grid-layer.d.ts.map +1 -0
- package/dist/grid-layer/grid-layer.js +63 -0
- package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
- package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
- package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +5 -6
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer.js +455 -0
- package/dist/heatmap-layer/max-fs.glsl.js +9 -0
- package/dist/heatmap-layer/max-vs.glsl.d.ts +3 -0
- package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/max-vs.glsl.js +15 -0
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +51 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +47 -0
- package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +10 -2
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer.js +59 -0
- package/dist/heatmap-layer/weights-fs.glsl.js +17 -0
- package/dist/heatmap-layer/weights-vs.glsl.d.ts +3 -0
- package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/dist/heatmap-layer/weights-vs.glsl.js +21 -0
- package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
- package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +4 -4
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-layer.js +173 -0
- package/dist/index.cjs +4328 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +2 -3
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +164 -0
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +35 -0
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +72 -0
- package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -4
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer.js +209 -0
- package/dist/types.js +1 -0
- package/dist/utils/aggregation-operation-utils.js +94 -0
- package/{typed → dist}/utils/bin-sorter.d.ts +1 -1
- package/dist/utils/bin-sorter.js +167 -0
- package/dist/utils/color-utils.js +53 -0
- package/dist/utils/cpu-aggregator.js +421 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +36 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +42 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +30 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +61 -0
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
- package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +555 -0
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +32 -0
- package/dist/utils/grid-aggregation-utils.js +114 -0
- package/dist/utils/prop-utils.js +28 -0
- package/dist/utils/resource-utils.js +38 -0
- package/dist/utils/scale-utils.js +184 -0
- package/dist.min.js +299 -555
- package/package.json +19 -14
- package/src/aggregation-layer.ts +3 -2
- package/src/contour-layer/contour-layer.ts +2 -3
- package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
- package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
- package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
- package/src/heatmap-layer/heatmap-layer.ts +91 -127
- package/src/heatmap-layer/max-vs.glsl.ts +11 -5
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
- package/src/heatmap-layer/triangle-layer.ts +17 -23
- package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
- package/src/hexagon-layer/hexagon-layer.ts +2 -3
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +3 -6
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +16 -30
- package/dist/es5/aggregation-layer.js +0 -215
- package/dist/es5/aggregation-layer.js.map +0 -1
- package/dist/es5/contour-layer/contour-layer.js +0 -353
- package/dist/es5/contour-layer/contour-layer.js.map +0 -1
- package/dist/es5/contour-layer/contour-utils.js +0 -110
- package/dist/es5/contour-layer/contour-utils.js.map +0 -1
- package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
- package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
- package/dist/es5/contour-layer/marching-squares.js +0 -168
- package/dist/es5/contour-layer/marching-squares.js.map +0 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
- package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
- package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
- package/dist/es5/grid-aggregation-layer.js +0 -280
- package/dist/es5/grid-aggregation-layer.js.map +0 -1
- package/dist/es5/grid-layer/grid-layer.js +0 -125
- package/dist/es5/grid-layer/grid-layer.js.map +0 -1
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -122
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +0 -672
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
- package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
- package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
- package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
- package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
- package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
- package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
- package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
- package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
- package/dist/es5/heatmap-layer/triangle-layer.js +0 -122
- package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
- package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
- package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
- package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
- package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
- package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
- package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
- package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
- package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
- package/dist/es5/index.js +0 -104
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
- package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
- package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/es5/utils/aggregation-operation-utils.js +0 -123
- package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
- package/dist/es5/utils/bin-sorter.js +0 -248
- package/dist/es5/utils/bin-sorter.js.map +0 -1
- package/dist/es5/utils/color-utils.js +0 -39
- package/dist/es5/utils/color-utils.js.map +0 -1
- package/dist/es5/utils/cpu-aggregator.js +0 -496
- package/dist/es5/utils/cpu-aggregator.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
- package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
- package/dist/es5/utils/grid-aggregation-utils.js +0 -118
- package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
- package/dist/es5/utils/prop-utils.js +0 -19
- package/dist/es5/utils/prop-utils.js.map +0 -1
- package/dist/es5/utils/resource-utils.js +0 -59
- package/dist/es5/utils/resource-utils.js.map +0 -1
- package/dist/es5/utils/scale-utils.js +0 -254
- package/dist/es5/utils/scale-utils.js.map +0 -1
- package/dist/esm/aggregation-layer.js +0 -156
- package/dist/esm/aggregation-layer.js.map +0 -1
- package/dist/esm/contour-layer/contour-layer.js +0 -316
- package/dist/esm/contour-layer/contour-layer.js.map +0 -1
- package/dist/esm/contour-layer/contour-utils.js +0 -81
- package/dist/esm/contour-layer/contour-utils.js.map +0 -1
- package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
- package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
- package/dist/esm/contour-layer/marching-squares.js +0 -151
- package/dist/esm/contour-layer/marching-squares.js.map +0 -1
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
- package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
- package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -122
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
- package/dist/esm/grid-aggregation-layer.js +0 -240
- package/dist/esm/grid-aggregation-layer.js.map +0 -1
- package/dist/esm/grid-layer/grid-layer.js +0 -80
- package/dist/esm/grid-layer/grid-layer.js.map +0 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -68
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +0 -626
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
- package/dist/esm/heatmap-layer/max-fs.glsl.js +0 -10
- package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
- package/dist/esm/heatmap-layer/max-vs.glsl.js +0 -14
- package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
- package/dist/esm/heatmap-layer/triangle-layer.js +0 -80
- package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
- package/dist/esm/heatmap-layer/weights-fs.glsl.js +0 -22
- package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
- package/dist/esm/heatmap-layer/weights-vs.glsl.js +0 -25
- package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
- package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
- package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
- package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
- package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
- package/dist/esm/index.js +0 -13
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
- package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -66
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/utils/aggregation-operation-utils.js +0 -91
- package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
- package/dist/esm/utils/bin-sorter.js +0 -165
- package/dist/esm/utils/bin-sorter.js.map +0 -1
- package/dist/esm/utils/color-utils.js +0 -28
- package/dist/esm/utils/color-utils.js.map +0 -1
- package/dist/esm/utils/cpu-aggregator.js +0 -487
- package/dist/esm/utils/cpu-aggregator.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -60
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
- package/dist/esm/utils/grid-aggregation-utils.js +0 -109
- package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
- package/dist/esm/utils/prop-utils.js +0 -12
- package/dist/esm/utils/prop-utils.js.map +0 -1
- package/dist/esm/utils/resource-utils.js +0 -44
- package/dist/esm/utils/resource-utils.js.map +0 -1
- package/dist/esm/utils/scale-utils.js +0 -192
- package/dist/esm/utils/scale-utils.js.map +0 -1
- package/typed/aggregation-layer.d.ts.map +0 -1
- package/typed/contour-layer/contour-layer.d.ts.map +0 -1
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
- package/typed/grid-aggregation-layer.d.ts.map +0 -1
- package/typed/grid-layer/grid-layer.d.ts.map +0 -1
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -1
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
- package/typed/heatmap-layer/max-vs.glsl.d.ts +0 -3
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -3
- package/typed/heatmap-layer/triangle-layer.d.ts.map +0 -1
- package/typed/heatmap-layer/weights-vs.glsl.d.ts +0 -3
- package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
- package/typed/index.d.ts +0 -20
- package/typed/index.d.ts.map +0 -1
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
- package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
- /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
- /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
- /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
- /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
- /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
- /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
- /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
- /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
- /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
- /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
- /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
- /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
- /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
- /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
- /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
- /package/{typed → dist}/types.d.ts +0 -0
- /package/{typed → dist}/types.d.ts.map +0 -0
- /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
- /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
- /package/{typed → dist}/utils/color-utils.d.ts +0 -0
- /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
- /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
- /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
- /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
- /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
- /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
- /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
- /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
- /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default as ScreenGridLayer } from "./screen-grid-layer/screen-grid-layer.js";
|
|
2
|
+
export { default as CPUGridLayer } from "./cpu-grid-layer/cpu-grid-layer.js";
|
|
3
|
+
export { default as HexagonLayer } from "./hexagon-layer/hexagon-layer.js";
|
|
4
|
+
export { default as ContourLayer } from "./contour-layer/contour-layer.js";
|
|
5
|
+
export { default as GridLayer } from "./grid-layer/grid-layer.js";
|
|
6
|
+
export { default as GPUGridLayer } from "./gpu-grid-layer/gpu-grid-layer.js";
|
|
7
|
+
export { AGGREGATION_OPERATION } from "./utils/aggregation-operation-utils.js";
|
|
8
|
+
export { default as HeatmapLayer } from "./heatmap-layer/heatmap-layer.js";
|
|
9
|
+
export { default as _GPUGridAggregator } from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
10
|
+
export { default as _CPUAggregator } from "./utils/cpu-aggregator.js";
|
|
11
|
+
export { default as _AggregationLayer } from "./aggregation-layer.js";
|
|
12
|
+
export { default as _BinSorter } from "./utils/bin-sorter.js";
|
|
13
|
+
export type { ContourLayerProps } from "./contour-layer/contour-layer.js";
|
|
14
|
+
export type { HeatmapLayerProps } from "./heatmap-layer/heatmap-layer.js";
|
|
15
|
+
export type { HexagonLayerProps } from "./hexagon-layer/hexagon-layer.js";
|
|
16
|
+
export type { CPUGridLayerProps } from "./cpu-grid-layer/cpu-grid-layer.js";
|
|
17
|
+
export type { GridLayerProps } from "./grid-layer/grid-layer.js";
|
|
18
|
+
export type { GPUGridLayerProps } from "./gpu-grid-layer/gpu-grid-layer.js";
|
|
19
|
+
export type { ScreenGridLayerProps } from "./screen-grid-layer/screen-grid-layer.js";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,iDAA8C;AACjF,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,2CAAwC;AACxE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,mCAAgC;AAC7D,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,2CAAwC;AACxE,OAAO,EAAC,qBAAqB,EAAC,+CAA4C;AAG1E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,yCAAsC;AACtE,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,4DAAyD;AAC/F,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,kCAA+B;AACjE,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,+BAA4B;AACjE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,8BAA2B;AAGzD,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,yCAAsC;AACrE,YAAY,EAAC,iBAAiB,EAAC,2CAAwC;AACvE,YAAY,EAAC,cAAc,EAAC,mCAAgC;AAC5D,YAAY,EAAC,iBAAiB,EAAC,2CAAwC;AACvE,YAAY,EAAC,oBAAoB,EAAC,iDAA8C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
+
export { default as ScreenGridLayer } from "./screen-grid-layer/screen-grid-layer.js";
|
|
21
|
+
export { default as CPUGridLayer } from "./cpu-grid-layer/cpu-grid-layer.js";
|
|
22
|
+
export { default as HexagonLayer } from "./hexagon-layer/hexagon-layer.js";
|
|
23
|
+
export { default as ContourLayer } from "./contour-layer/contour-layer.js";
|
|
24
|
+
export { default as GridLayer } from "./grid-layer/grid-layer.js";
|
|
25
|
+
export { default as GPUGridLayer } from "./gpu-grid-layer/gpu-grid-layer.js";
|
|
26
|
+
export { AGGREGATION_OPERATION } from "./utils/aggregation-operation-utils.js";
|
|
27
|
+
// experimental export
|
|
28
|
+
export { default as HeatmapLayer } from "./heatmap-layer/heatmap-layer.js";
|
|
29
|
+
export { default as _GPUGridAggregator } from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
30
|
+
export { default as _CPUAggregator } from "./utils/cpu-aggregator.js";
|
|
31
|
+
export { default as _AggregationLayer } from "./aggregation-layer.js";
|
|
32
|
+
export { default as _BinSorter } from "./utils/bin-sorter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Texture } from '@luma.gl/core';
|
|
2
2
|
import { Model } from '@luma.gl/engine';
|
|
3
3
|
import { Layer, LayerProps, UpdateParameters, DefaultProps } from '@deck.gl/core';
|
|
4
|
-
import type { _ScreenGridLayerProps } from
|
|
4
|
+
import type { _ScreenGridLayerProps } from "./screen-grid-layer.js";
|
|
5
5
|
import { ShaderModule } from '@luma.gl/shadertools';
|
|
6
6
|
/** All properties supported by ScreenGridCellLayer. */
|
|
7
7
|
export type ScreenGridCellLayerProps<DataT = unknown> = _ScreenGridCellLayerProps<DataT> & LayerProps;
|
|
@@ -12,7 +12,6 @@ export type _ScreenGridCellLayerProps<DataT> = _ScreenGridLayerProps<DataT> & {
|
|
|
12
12
|
export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {}> extends Layer<ExtraPropsT & Required<_ScreenGridCellLayerProps<DataT>>> {
|
|
13
13
|
static layerName: string;
|
|
14
14
|
static defaultProps: DefaultProps<ScreenGridCellLayerProps<unknown>>;
|
|
15
|
-
static isSupported(device: Device): boolean;
|
|
16
15
|
state: {
|
|
17
16
|
model?: Model;
|
|
18
17
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-grid-cell-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-cell-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,KAAK,EAAW,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAE,UAAU,EAAgB,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAI9F,OAAO,KAAK,EAAC,qBAAqB,EAAC,+BAA4B;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAclD,uDAAuD;AACvD,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,GACtF,UAAU,CAAC;AAEb,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAC5E,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBAAmB,CAAC,KAAK,GAAG,GAAG,EAAE,WAAW,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,KAAK,CAC9F,WAAW,GAAG,QAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CACzD;IACC,MAAM,CAAC,SAAS,SAAyB;IACzC,MAAM,CAAC,YAAY,kDAAgB;IAEnC,KAAK,EAAG;QACN,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IAEF,UAAU,IAAI;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,EAAE,CAAA;KAAC;IAI/D,eAAe;IAYf,iBAAiB,CAAC,EAAC,WAAW,EAAC;;KAAA;IAK/B,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAe1C,IAAI,CAAC,EAAC,QAAQ,EAAC;;KAAA;IA2Bf,0BAA0B,CAAC,SAAS,KAAA,EAAE,EAAC,YAAY,EAAC;;KAAA;IAkBpD,SAAS,IAAI,KAAK;IAuBlB,gBAAgB,IAAI,OAAO;IAe3B,eAAe,CAAC,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,WAAW,KAAA,GAAG,IAAI;CA2BpD"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2019 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
+
import { Model, Geometry } from '@luma.gl/engine';
|
|
21
|
+
import { Layer, log, picking } from '@deck.gl/core';
|
|
22
|
+
import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
|
|
23
|
+
import vs from "./screen-grid-layer-vertex.glsl.js";
|
|
24
|
+
import fs from "./screen-grid-layer-fragment.glsl.js";
|
|
25
|
+
const DEFAULT_MINCOLOR = [0, 0, 0, 0];
|
|
26
|
+
const DEFAULT_MAXCOLOR = [0, 255, 0, 255];
|
|
27
|
+
const COLOR_PROPS = ['minColor', 'maxColor', 'colorRange', 'colorDomain'];
|
|
28
|
+
const defaultProps = {
|
|
29
|
+
cellSizePixels: { type: 'number', value: 100, min: 1 },
|
|
30
|
+
cellMarginPixels: { type: 'number', value: 2, min: 0, max: 5 },
|
|
31
|
+
colorDomain: null,
|
|
32
|
+
colorRange: defaultColorRange
|
|
33
|
+
};
|
|
34
|
+
export default class ScreenGridCellLayer extends Layer {
|
|
35
|
+
static { this.layerName = 'ScreenGridCellLayer'; }
|
|
36
|
+
static { this.defaultProps = defaultProps; }
|
|
37
|
+
getShaders() {
|
|
38
|
+
return { vs, fs, modules: [picking] };
|
|
39
|
+
}
|
|
40
|
+
initializeState() {
|
|
41
|
+
const attributeManager = this.getAttributeManager();
|
|
42
|
+
attributeManager.addInstanced({
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
44
|
+
instancePositions: { size: 3, update: this.calculateInstancePositions },
|
|
45
|
+
instanceCounts: { size: 4, noAlloc: true }
|
|
46
|
+
});
|
|
47
|
+
this.setState({
|
|
48
|
+
model: this._getModel()
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
shouldUpdateState({ changeFlags }) {
|
|
52
|
+
// 'instanceCounts' buffer contetns change on viewport change.
|
|
53
|
+
return changeFlags.somethingChanged;
|
|
54
|
+
}
|
|
55
|
+
updateState(params) {
|
|
56
|
+
super.updateState(params);
|
|
57
|
+
const { oldProps, props, changeFlags } = params;
|
|
58
|
+
const attributeManager = this.getAttributeManager();
|
|
59
|
+
if (props.numInstances !== oldProps.numInstances) {
|
|
60
|
+
attributeManager.invalidateAll();
|
|
61
|
+
}
|
|
62
|
+
else if (oldProps.cellSizePixels !== props.cellSizePixels) {
|
|
63
|
+
attributeManager.invalidate('instancePositions');
|
|
64
|
+
}
|
|
65
|
+
this._updateUniforms(oldProps, props, changeFlags);
|
|
66
|
+
}
|
|
67
|
+
draw({ uniforms }) {
|
|
68
|
+
const { parameters, maxTexture } = this.props;
|
|
69
|
+
const minColor = this.props.minColor || DEFAULT_MINCOLOR;
|
|
70
|
+
const maxColor = this.props.maxColor || DEFAULT_MAXCOLOR;
|
|
71
|
+
// If colorDomain not specified we use default domain [1, maxCount]
|
|
72
|
+
// maxCount value will be sampled form maxTexture in vertex shader.
|
|
73
|
+
const colorDomain = this.props.colorDomain || [1, 0];
|
|
74
|
+
const model = this.state.model;
|
|
75
|
+
model.setUniforms(uniforms);
|
|
76
|
+
model.setBindings({
|
|
77
|
+
maxTexture
|
|
78
|
+
});
|
|
79
|
+
model.setUniforms({
|
|
80
|
+
minColor,
|
|
81
|
+
maxColor,
|
|
82
|
+
colorDomain
|
|
83
|
+
});
|
|
84
|
+
model.setParameters({
|
|
85
|
+
depthWriteEnabled: false,
|
|
86
|
+
// How to specify depth mask in WebGPU?
|
|
87
|
+
// depthMask: false,
|
|
88
|
+
...parameters
|
|
89
|
+
});
|
|
90
|
+
model.draw(this.context.renderPass);
|
|
91
|
+
}
|
|
92
|
+
calculateInstancePositions(attribute, { numInstances }) {
|
|
93
|
+
const { width, height } = this.context.viewport;
|
|
94
|
+
const { cellSizePixels } = this.props;
|
|
95
|
+
const numCol = Math.ceil(width / cellSizePixels);
|
|
96
|
+
const { value, size } = attribute;
|
|
97
|
+
for (let i = 0; i < numInstances; i++) {
|
|
98
|
+
const x = i % numCol;
|
|
99
|
+
const y = Math.floor(i / numCol);
|
|
100
|
+
value[i * size + 0] = ((x * cellSizePixels) / width) * 2 - 1;
|
|
101
|
+
value[i * size + 1] = 1 - ((y * cellSizePixels) / height) * 2;
|
|
102
|
+
value[i * size + 2] = 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Private Methods
|
|
106
|
+
_getModel() {
|
|
107
|
+
return new Model(this.context.device, {
|
|
108
|
+
...this.getShaders(),
|
|
109
|
+
id: this.props.id,
|
|
110
|
+
bufferLayout: this.getAttributeManager().getBufferLayouts(),
|
|
111
|
+
geometry: new Geometry({
|
|
112
|
+
topology: 'triangle-list',
|
|
113
|
+
attributes: {
|
|
114
|
+
// prettier-ignore
|
|
115
|
+
positions: new Float32Array([
|
|
116
|
+
0, 0, 0,
|
|
117
|
+
1, 0, 0,
|
|
118
|
+
1, 1, 0,
|
|
119
|
+
0, 0, 0,
|
|
120
|
+
1, 1, 0,
|
|
121
|
+
0, 1, 0,
|
|
122
|
+
])
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
isInstanced: true
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
_shouldUseMinMax() {
|
|
129
|
+
const { minColor, maxColor, colorDomain, colorRange } = this.props;
|
|
130
|
+
if (minColor || maxColor) {
|
|
131
|
+
log.deprecated('ScreenGridLayer props: minColor and maxColor', 'colorRange, colorDomain')();
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
// minColor and maxColor not supplied, check if colorRange or colorDomain supplied.
|
|
135
|
+
// NOTE: colorDomain and colorRange are experimental features, use them only when supplied.
|
|
136
|
+
if (colorDomain || colorRange) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
// None specified, use default minColor and maxColor
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
_updateUniforms(oldProps, props, changeFlags) {
|
|
143
|
+
const model = this.state.model;
|
|
144
|
+
if (COLOR_PROPS.some(key => oldProps[key] !== props[key])) {
|
|
145
|
+
model.setUniforms({ shouldUseMinMax: this._shouldUseMinMax() });
|
|
146
|
+
}
|
|
147
|
+
if (oldProps.colorRange !== props.colorRange) {
|
|
148
|
+
model.setUniforms({ colorRange: colorRangeToFlatArray(props.colorRange) });
|
|
149
|
+
}
|
|
150
|
+
if (oldProps.cellMarginPixels !== props.cellMarginPixels ||
|
|
151
|
+
oldProps.cellSizePixels !== props.cellSizePixels ||
|
|
152
|
+
changeFlags.viewportChanged) {
|
|
153
|
+
const { width, height } = this.context.viewport;
|
|
154
|
+
const { cellSizePixels, cellMarginPixels } = this.props;
|
|
155
|
+
const margin = cellSizePixels > cellMarginPixels ? cellMarginPixels : 0;
|
|
156
|
+
const cellScale = new Float32Array([
|
|
157
|
+
((cellSizePixels - margin) / width) * 2,
|
|
158
|
+
(-(cellSizePixels - margin) / height) * 2,
|
|
159
|
+
1
|
|
160
|
+
]);
|
|
161
|
+
model.setUniforms({ cellScale });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
+
/* fragment shader for the grid-layer */
|
|
21
|
+
export default `\
|
|
22
|
+
#version 300 es
|
|
23
|
+
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
24
|
+
precision highp float;
|
|
25
|
+
in vec4 vColor;
|
|
26
|
+
in float vSampleCount;
|
|
27
|
+
out vec4 fragColor;
|
|
28
|
+
void main(void) {
|
|
29
|
+
if (vSampleCount <= 0.0) {
|
|
30
|
+
discard;
|
|
31
|
+
}
|
|
32
|
+
fragColor = vColor;
|
|
33
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
+
export default `\
|
|
21
|
+
#version 300 es
|
|
22
|
+
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
23
|
+
#define RANGE_COUNT 6
|
|
24
|
+
in vec3 positions;
|
|
25
|
+
in vec3 instancePositions;
|
|
26
|
+
in vec4 instanceCounts;
|
|
27
|
+
in vec3 instancePickingColors;
|
|
28
|
+
uniform float opacity;
|
|
29
|
+
uniform vec3 cellScale;
|
|
30
|
+
uniform vec4 minColor;
|
|
31
|
+
uniform vec4 maxColor;
|
|
32
|
+
uniform vec4 colorRange[RANGE_COUNT];
|
|
33
|
+
uniform vec2 colorDomain;
|
|
34
|
+
uniform bool shouldUseMinMax;
|
|
35
|
+
uniform sampler2D maxTexture;
|
|
36
|
+
out vec4 vColor;
|
|
37
|
+
out float vSampleCount;
|
|
38
|
+
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
39
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
40
|
+
if (value >= domain.x && value <= domain.y) {
|
|
41
|
+
float domainRange = domain.y - domain.x;
|
|
42
|
+
if (domainRange <= 0.) {
|
|
43
|
+
outColor = colorRange[0];
|
|
44
|
+
} else {
|
|
45
|
+
float rangeCount = float(RANGE_COUNT);
|
|
46
|
+
float rangeStep = domainRange / rangeCount;
|
|
47
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
48
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
49
|
+
int intIdx = int(idx);
|
|
50
|
+
outColor = colorRange[intIdx];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
outColor = outColor / 255.;
|
|
54
|
+
return outColor;
|
|
55
|
+
}
|
|
56
|
+
void main(void) {
|
|
57
|
+
vSampleCount = instanceCounts.a;
|
|
58
|
+
float weight = instanceCounts.r;
|
|
59
|
+
float maxWeight = texture(maxTexture, vec2(0.5)).r;
|
|
60
|
+
float step = weight / maxWeight;
|
|
61
|
+
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
|
|
62
|
+
vec2 domain = colorDomain;
|
|
63
|
+
float domainMaxValid = float(colorDomain.y != 0.);
|
|
64
|
+
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
|
|
65
|
+
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
|
|
66
|
+
float rangeMinMax = float(shouldUseMinMax);
|
|
67
|
+
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
|
|
68
|
+
vColor = vec4(color.rgb, color.a * opacity);
|
|
69
|
+
picking_setPickingColor(instancePickingColors);
|
|
70
|
+
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Accessor, Color, GetPickingInfoParams, Layer, LayerContext, LayersList, PickingInfo, Position, UpdateParameters, DefaultProps } from '@deck.gl/core';
|
|
2
2
|
import type { Buffer, Texture } from '@luma.gl/core';
|
|
3
|
-
import GridAggregationLayer, { GridAggregationLayerProps } from
|
|
3
|
+
import GridAggregationLayer, { GridAggregationLayerProps } from "../grid-aggregation-layer.js";
|
|
4
4
|
/** All properties supported by ScreenGridLayer. */
|
|
5
5
|
export type ScreenGridLayerProps<DataT = unknown> = _ScreenGridLayerProps<DataT> & GridAggregationLayerProps<DataT>;
|
|
6
6
|
/** Properties added by ScreenGridLayer. */
|
|
@@ -53,9 +53,6 @@ export type _ScreenGridLayerProps<DataT> = {
|
|
|
53
53
|
/**
|
|
54
54
|
* Perform aggregation is performed on GPU.
|
|
55
55
|
*
|
|
56
|
-
* NOTE: GPU Aggregation requires WebGL2 support by the browser.
|
|
57
|
-
* When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
|
|
58
|
-
*
|
|
59
56
|
* @default true
|
|
60
57
|
*/
|
|
61
58
|
gpuAggregation?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-grid-layer.d.ts","sourceRoot":"","sources":["../../src/screen-grid-layer/screen-grid-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,oBAAoB,EACpB,KAAK,EACL,YAAY,EACZ,UAAU,EAEV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAInD,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,qCAAkC;AAuB1F,mDAAmD;AACnD,MAAM,MAAM,oBAAoB,CAAC,KAAK,GAAG,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,GAC9E,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,2CAA2C;AAC3C,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IAErB;;;;OAIG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAExC;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEpC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;CAC9C,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,OAAO,OAAO,eAAe,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,EAAE,GAAG,EAAE,CAC1B,SAAQ,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxF,MAAM,CAAC,SAAS,SAAqB;IACrC,MAAM,CAAC,YAAY,8CAAgB;IAEnC,KAAK,EAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QAC7C,SAAS,EAAE,OAAO,CAAC;QACnB,iBAAiB,CAAC,EAAE,GAAG,CAAC;QACxB,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,OAAO,CAAC,EAAE,GAAG,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,eAAe;IAqCf,iBAAiB,CAAC,EAAC,WAAW,EAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAIvD,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAIxC,YAAY,IAAI,UAAU,GAAG,KAAK;IAuBlC,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAU1C,cAAc,CAAC,EAAC,IAAI,EAAC,EAAE,oBAAoB,GAAG,WAAW;IAsBzD,aAAa,CAAC,EAAC,eAAe,EAAE,OAAO,EAAC;;;KAAA;IASxC,sBAAsB,CAAC,IAAI,KAAA;IAiE3B,gBAAgB,CAAC,IAAI,KAAA;IAUrB,aAAa;CAMd"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
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.
|
|
20
|
+
import { log } from '@deck.gl/core';
|
|
21
|
+
import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
22
|
+
import { AGGREGATION_OPERATION, getValueFunc } from "../utils/aggregation-operation-utils.js";
|
|
23
|
+
import ScreenGridCellLayer from "./screen-grid-cell-layer.js";
|
|
24
|
+
import GridAggregationLayer from "../grid-aggregation-layer.js";
|
|
25
|
+
import { getFloatTexture } from "../utils/resource-utils.js";
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
...ScreenGridCellLayer.defaultProps,
|
|
28
|
+
getPosition: { type: 'accessor', value: (d) => d.position },
|
|
29
|
+
getWeight: { type: 'accessor', value: 1 },
|
|
30
|
+
gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
|
|
31
|
+
aggregation: 'SUM'
|
|
32
|
+
};
|
|
33
|
+
const POSITION_ATTRIBUTE_NAME = 'positions';
|
|
34
|
+
const DIMENSIONS = {
|
|
35
|
+
data: {
|
|
36
|
+
props: ['cellSizePixels']
|
|
37
|
+
},
|
|
38
|
+
weights: {
|
|
39
|
+
props: ['aggregation'],
|
|
40
|
+
accessors: ['getWeight']
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/** Aggregates data into histogram bins and renders them as a grid. */
|
|
44
|
+
export default class ScreenGridLayer extends GridAggregationLayer {
|
|
45
|
+
static { this.layerName = 'ScreenGridLayer'; }
|
|
46
|
+
static { this.defaultProps = defaultProps; }
|
|
47
|
+
initializeState() {
|
|
48
|
+
super.initializeAggregationLayer({
|
|
49
|
+
dimensions: DIMENSIONS,
|
|
50
|
+
// @ts-expect-error
|
|
51
|
+
getCellSize: props => props.cellSizePixels // TODO
|
|
52
|
+
});
|
|
53
|
+
const weights = {
|
|
54
|
+
count: {
|
|
55
|
+
size: 1,
|
|
56
|
+
operation: AGGREGATION_OPERATION.SUM,
|
|
57
|
+
needMax: true,
|
|
58
|
+
maxTexture: getFloatTexture(this.context.device, { id: `${this.id}-max-texture` })
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this.setState({
|
|
62
|
+
supported: true,
|
|
63
|
+
projectPoints: true, // aggregation in screen space
|
|
64
|
+
weights,
|
|
65
|
+
subLayerData: { attributes: {} },
|
|
66
|
+
maxTexture: weights.count.maxTexture,
|
|
67
|
+
positionAttributeName: 'positions',
|
|
68
|
+
posOffset: [0, 0],
|
|
69
|
+
translation: [1, -1]
|
|
70
|
+
});
|
|
71
|
+
const attributeManager = this.getAttributeManager();
|
|
72
|
+
attributeManager.add({
|
|
73
|
+
[POSITION_ATTRIBUTE_NAME]: {
|
|
74
|
+
size: 3,
|
|
75
|
+
accessor: 'getPosition',
|
|
76
|
+
type: 'float64',
|
|
77
|
+
fp64: this.use64bitPositions()
|
|
78
|
+
},
|
|
79
|
+
// this attribute is used in gpu aggregation path only
|
|
80
|
+
count: { size: 3, accessor: 'getWeight' }
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
shouldUpdateState({ changeFlags }) {
|
|
84
|
+
return this.state.supported && changeFlags.somethingChanged;
|
|
85
|
+
}
|
|
86
|
+
updateState(opts) {
|
|
87
|
+
super.updateState(opts);
|
|
88
|
+
}
|
|
89
|
+
renderLayers() {
|
|
90
|
+
if (!this.state.supported) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
const { maxTexture, numRow, numCol, weights } = this.state;
|
|
94
|
+
const { updateTriggers } = this.props;
|
|
95
|
+
const { aggregationBuffer } = weights.count;
|
|
96
|
+
const CellLayerClass = this.getSubLayerClass('cells', ScreenGridCellLayer);
|
|
97
|
+
return new CellLayerClass(this.props, this.getSubLayerProps({
|
|
98
|
+
id: 'cell-layer',
|
|
99
|
+
updateTriggers
|
|
100
|
+
}), {
|
|
101
|
+
data: { attributes: { instanceCounts: aggregationBuffer } },
|
|
102
|
+
maxTexture,
|
|
103
|
+
numInstances: numRow * numCol
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
finalizeState(context) {
|
|
107
|
+
super.finalizeState(context);
|
|
108
|
+
const { aggregationBuffer, maxBuffer, maxTexture } = this.state;
|
|
109
|
+
aggregationBuffer?.delete();
|
|
110
|
+
maxBuffer?.delete();
|
|
111
|
+
maxTexture?.delete();
|
|
112
|
+
}
|
|
113
|
+
getPickingInfo({ info }) {
|
|
114
|
+
const { index } = info;
|
|
115
|
+
if (index >= 0) {
|
|
116
|
+
const { gpuGridAggregator, gpuAggregation, weights } = this.state;
|
|
117
|
+
// Get count aggregation results
|
|
118
|
+
const aggregationResults = gpuAggregation
|
|
119
|
+
? gpuGridAggregator.getData('count')
|
|
120
|
+
: weights.count;
|
|
121
|
+
// Each instance (one cell) is aggregated into single pixel,
|
|
122
|
+
// Get current instance's aggregation details.
|
|
123
|
+
info.object = GPUGridAggregator.getAggregationData({
|
|
124
|
+
pixelIndex: index,
|
|
125
|
+
...aggregationResults
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return info;
|
|
129
|
+
}
|
|
130
|
+
// Aggregation Overrides
|
|
131
|
+
updateResults({ aggregationData, maxData }) {
|
|
132
|
+
const { count } = this.state.weights;
|
|
133
|
+
count.aggregationData = aggregationData;
|
|
134
|
+
count.aggregationBuffer.write(aggregationData);
|
|
135
|
+
count.maxData = maxData;
|
|
136
|
+
count.maxTexture.setImageData({ data: maxData });
|
|
137
|
+
}
|
|
138
|
+
/* eslint-disable complexity, max-statements */
|
|
139
|
+
updateAggregationState(opts) {
|
|
140
|
+
const cellSize = opts.props.cellSizePixels;
|
|
141
|
+
const cellSizeChanged = opts.oldProps.cellSizePixels !== cellSize;
|
|
142
|
+
const { viewportChanged } = opts.changeFlags;
|
|
143
|
+
let gpuAggregation = opts.props.gpuAggregation;
|
|
144
|
+
if (this.state.gpuAggregation !== opts.props.gpuAggregation) {
|
|
145
|
+
if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
|
|
146
|
+
log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
|
|
147
|
+
gpuAggregation = false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
|
|
151
|
+
this.setState({
|
|
152
|
+
gpuAggregation
|
|
153
|
+
});
|
|
154
|
+
const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
|
|
155
|
+
const { dimensions } = this.state;
|
|
156
|
+
const { data, weights } = dimensions;
|
|
157
|
+
const aggregationDataDirty = positionsChanged ||
|
|
158
|
+
gpuAggregationChanged ||
|
|
159
|
+
viewportChanged ||
|
|
160
|
+
this.isAggregationDirty(opts, {
|
|
161
|
+
compareAll: gpuAggregation, // check for all (including extentions props) when using gpu aggregation
|
|
162
|
+
dimension: data
|
|
163
|
+
});
|
|
164
|
+
const aggregationWeightsDirty = this.isAggregationDirty(opts, { dimension: weights });
|
|
165
|
+
this.setState({
|
|
166
|
+
aggregationDataDirty,
|
|
167
|
+
aggregationWeightsDirty
|
|
168
|
+
});
|
|
169
|
+
const { viewport } = this.context;
|
|
170
|
+
if (viewportChanged || cellSizeChanged) {
|
|
171
|
+
const { width, height } = viewport;
|
|
172
|
+
const numCol = Math.ceil(width / cellSize);
|
|
173
|
+
const numRow = Math.ceil(height / cellSize);
|
|
174
|
+
this.allocateResources(numRow, numCol);
|
|
175
|
+
this.setState({
|
|
176
|
+
// transformation from clipspace to screen(pixel) space
|
|
177
|
+
scaling: [width / 2, -height / 2, 1],
|
|
178
|
+
gridOffset: { xOffset: cellSize, yOffset: cellSize },
|
|
179
|
+
width,
|
|
180
|
+
height,
|
|
181
|
+
numCol,
|
|
182
|
+
numRow
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (aggregationWeightsDirty) {
|
|
186
|
+
this._updateAccessors(opts);
|
|
187
|
+
}
|
|
188
|
+
if (aggregationDataDirty || aggregationWeightsDirty) {
|
|
189
|
+
this._resetResults();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/* eslint-enable complexity, max-statements */
|
|
193
|
+
// Private
|
|
194
|
+
_updateAccessors(opts) {
|
|
195
|
+
const { getWeight, aggregation, data } = opts.props;
|
|
196
|
+
const { count } = this.state.weights;
|
|
197
|
+
if (count) {
|
|
198
|
+
count.getWeight = getWeight;
|
|
199
|
+
count.operation = AGGREGATION_OPERATION[aggregation];
|
|
200
|
+
}
|
|
201
|
+
this.setState({ getValue: getValueFunc(aggregation, getWeight, { data }) });
|
|
202
|
+
}
|
|
203
|
+
_resetResults() {
|
|
204
|
+
const { count } = this.state.weights;
|
|
205
|
+
if (count) {
|
|
206
|
+
count.aggregationData = null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|