@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.10
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/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 +1439 -10866
- 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 +4327 -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 +163 -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/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 +92 -128
- 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 +0 -4
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +14 -28
- 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/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}/aggregation-layer.d.ts +0 -0
- /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
- /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
|
@@ -0,0 +1,30 @@
|
|
|
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 gpu-grid-cell-layer-fragment-shader
|
|
23
|
+
precision highp float;
|
|
24
|
+
in vec4 vColor;
|
|
25
|
+
out vec4 fragColor;
|
|
26
|
+
void main(void) {
|
|
27
|
+
fragColor = vColor;
|
|
28
|
+
fragColor = picking_filterColor(fragColor);
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
// Inspired by screen-grid-layer vertex shader in deck.gl
|
|
21
|
+
export default `\
|
|
22
|
+
#version 300 es
|
|
23
|
+
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
24
|
+
#define RANGE_COUNT 6
|
|
25
|
+
in vec3 positions;
|
|
26
|
+
in vec3 normals;
|
|
27
|
+
in vec4 colors;
|
|
28
|
+
in vec4 elevations;
|
|
29
|
+
in vec3 instancePickingColors;
|
|
30
|
+
uniform vec2 offset;
|
|
31
|
+
uniform bool extruded;
|
|
32
|
+
uniform float cellSize;
|
|
33
|
+
uniform float coverage;
|
|
34
|
+
uniform float opacity;
|
|
35
|
+
uniform float elevationScale;
|
|
36
|
+
uniform ivec2 gridSize;
|
|
37
|
+
uniform vec2 gridOrigin;
|
|
38
|
+
uniform vec2 gridOriginLow;
|
|
39
|
+
uniform vec2 gridOffset;
|
|
40
|
+
uniform vec2 gridOffsetLow;
|
|
41
|
+
uniform vec4 colorRange[RANGE_COUNT];
|
|
42
|
+
uniform vec2 elevationRange;
|
|
43
|
+
uniform vec2 colorDomain;
|
|
44
|
+
uniform bool colorDomainValid;
|
|
45
|
+
uniform vec2 elevationDomain;
|
|
46
|
+
uniform bool elevationDomainValid;
|
|
47
|
+
layout(std140) uniform;
|
|
48
|
+
uniform ColorData
|
|
49
|
+
{
|
|
50
|
+
vec4 maxMinCount;
|
|
51
|
+
} colorData;
|
|
52
|
+
uniform ElevationData
|
|
53
|
+
{
|
|
54
|
+
vec4 maxMinCount;
|
|
55
|
+
} elevationData;
|
|
56
|
+
#define EPSILON 0.00001
|
|
57
|
+
out vec4 vColor;
|
|
58
|
+
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
59
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
60
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
61
|
+
float domainRange = domain.y - domain.x;
|
|
62
|
+
if (domainRange <= 0.) {
|
|
63
|
+
outColor = colorRange[0];
|
|
64
|
+
} else {
|
|
65
|
+
float rangeCount = float(RANGE_COUNT);
|
|
66
|
+
float rangeStep = domainRange / rangeCount;
|
|
67
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
68
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
69
|
+
int intIdx = int(idx);
|
|
70
|
+
outColor = colorRange[intIdx];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return outColor;
|
|
74
|
+
}
|
|
75
|
+
float linearScale(vec2 domain, vec2 range, float value) {
|
|
76
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
77
|
+
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
|
|
78
|
+
}
|
|
79
|
+
return -1.;
|
|
80
|
+
}
|
|
81
|
+
void main(void) {
|
|
82
|
+
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
|
|
83
|
+
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
|
|
84
|
+
float elevation = 0.0;
|
|
85
|
+
if (extruded) {
|
|
86
|
+
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
|
|
87
|
+
elevation = linearScale(elvDomain, elevationRange, elevations.r);
|
|
88
|
+
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
|
|
89
|
+
}
|
|
90
|
+
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
|
|
91
|
+
float dotRadius = cellSize / 2. * coverage * shouldRender;
|
|
92
|
+
int yIndex = (gl_InstanceID / gridSize[0]);
|
|
93
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
94
|
+
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
|
|
95
|
+
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
|
|
96
|
+
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
|
|
97
|
+
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
|
|
98
|
+
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
|
|
99
|
+
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
|
|
100
|
+
geometry.worldPosition = centroidPosition;
|
|
101
|
+
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
|
|
102
|
+
picking_setPickingColor(instancePickingColors);
|
|
103
|
+
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
104
|
+
vec3 normals_commonspace = project_normal(normals);
|
|
105
|
+
if (extruded) {
|
|
106
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
107
|
+
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
108
|
+
} else {
|
|
109
|
+
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Layer, LayerProps, DefaultProps } from '@deck.gl/core';
|
|
2
2
|
import { Model } from '@luma.gl/engine';
|
|
3
3
|
import { Buffer } from '@luma.gl/core';
|
|
4
|
-
import type { _GPUGridLayerProps } from
|
|
4
|
+
import type { _GPUGridLayerProps } from "./gpu-grid-layer.js";
|
|
5
5
|
type _GPUGridCellLayerProps = _GPUGridLayerProps<any> & {
|
|
6
6
|
cellSize: number;
|
|
7
7
|
offset: number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-grid-cell-layer.d.ts","sourceRoot":"","sources":["../../src/gpu-grid-layer/gpu-grid-cell-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,EAKL,UAAU,EACV,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAGrC,OAAO,KAAK,EAAC,kBAAkB,EAAC,4BAAyB;AA8BzD,KAAK,sBAAsB,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK,CAAC,sBAAsB,CAAC;IACzE,MAAM,CAAC,SAAS,SAAsB;IACtC,MAAM,CAAC,YAAY;;;;;;;;;;;;oBAAgB;IAEnC,KAAK,EAAG;QACN,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IAEF,UAAU;IAQV,eAAe,IAAI,IAAI;IAiBvB,SAAS,IAAI,KAAK;IASlB,IAAI,CAAC,EAAC,QAAQ,EAAC;;KAAA;IAyCf,kBAAkB,CAAC,iBAAiB,KAAA,EAAE,qBAAqB,KAAA;IAK3D,oBAAoB,CAAC,iBAAiB,KAAA,EAAE,qBAAqB,KAAA;IAK7D,iBAAiB;IAkBjB,OAAO,CAAC,mBAAmB;CAU5B"}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 { Layer, fp64LowPart, project32, gouraudLighting, picking } from '@deck.gl/core';
|
|
21
|
+
import { CubeGeometry } from '@luma.gl/engine';
|
|
22
|
+
import { fp64arithmetic } from '@luma.gl/shadertools';
|
|
23
|
+
import { Model } from '@luma.gl/engine';
|
|
24
|
+
import { GL } from '@luma.gl/constants';
|
|
25
|
+
import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
|
|
26
|
+
import vs from "./gpu-grid-cell-layer-vertex.glsl.js";
|
|
27
|
+
import fs from "./gpu-grid-cell-layer-fragment.glsl.js";
|
|
28
|
+
const COLOR_DATA_UBO_INDEX = 0;
|
|
29
|
+
const ELEVATION_DATA_UBO_INDEX = 1;
|
|
30
|
+
const defaultProps = {
|
|
31
|
+
// color
|
|
32
|
+
colorDomain: null,
|
|
33
|
+
colorRange: defaultColorRange,
|
|
34
|
+
// elevation
|
|
35
|
+
elevationDomain: null,
|
|
36
|
+
elevationRange: [0, 1000],
|
|
37
|
+
elevationScale: { type: 'number', min: 0, value: 1 },
|
|
38
|
+
// grid
|
|
39
|
+
gridSize: { type: 'array', value: [1, 1] },
|
|
40
|
+
gridOrigin: { type: 'array', value: [0, 0] },
|
|
41
|
+
gridOffset: { type: 'array', value: [0, 0] },
|
|
42
|
+
cellSize: { type: 'number', min: 0, max: 1000, value: 1000 },
|
|
43
|
+
offset: { type: 'array', value: [1, 1] },
|
|
44
|
+
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
45
|
+
extruded: true,
|
|
46
|
+
material: true // Use lighting module defaults
|
|
47
|
+
};
|
|
48
|
+
export default class GPUGridCellLayer extends Layer {
|
|
49
|
+
static { this.layerName = 'GPUGridCellLayer'; }
|
|
50
|
+
static { this.defaultProps = defaultProps; }
|
|
51
|
+
getShaders() {
|
|
52
|
+
return super.getShaders({
|
|
53
|
+
vs,
|
|
54
|
+
fs,
|
|
55
|
+
modules: [project32, gouraudLighting, picking, fp64arithmetic]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
initializeState() {
|
|
59
|
+
const attributeManager = this.getAttributeManager();
|
|
60
|
+
attributeManager.addInstanced({
|
|
61
|
+
colors: {
|
|
62
|
+
size: 4,
|
|
63
|
+
noAlloc: true
|
|
64
|
+
},
|
|
65
|
+
elevations: {
|
|
66
|
+
size: 4,
|
|
67
|
+
noAlloc: true
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const model = this._getModel();
|
|
71
|
+
this._setupUniformBuffer(model);
|
|
72
|
+
this.setState({ model });
|
|
73
|
+
}
|
|
74
|
+
_getModel() {
|
|
75
|
+
return new Model(this.context.device, {
|
|
76
|
+
...this.getShaders(),
|
|
77
|
+
id: this.props.id,
|
|
78
|
+
geometry: new CubeGeometry(),
|
|
79
|
+
isInstanced: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
draw({ uniforms }) {
|
|
83
|
+
const { cellSize, offset, extruded, elevationScale, coverage, gridSize, gridOrigin, gridOffset, elevationRange, colorMaxMinBuffer, elevationMaxMinBuffer } = this.props;
|
|
84
|
+
const model = this.state.model;
|
|
85
|
+
const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
|
|
86
|
+
const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
|
|
87
|
+
const domainUniforms = this.getDomainUniforms();
|
|
88
|
+
const colorRange = colorRangeToFlatArray(this.props.colorRange);
|
|
89
|
+
this.bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
|
|
90
|
+
model.setUniforms(uniforms);
|
|
91
|
+
model.setUniforms(domainUniforms);
|
|
92
|
+
model.setUniforms({
|
|
93
|
+
cellSize,
|
|
94
|
+
offset,
|
|
95
|
+
extruded,
|
|
96
|
+
elevationScale,
|
|
97
|
+
coverage,
|
|
98
|
+
gridSize,
|
|
99
|
+
gridOrigin,
|
|
100
|
+
gridOriginLow,
|
|
101
|
+
gridOffset,
|
|
102
|
+
gridOffsetLow,
|
|
103
|
+
colorRange,
|
|
104
|
+
elevationRange
|
|
105
|
+
});
|
|
106
|
+
model.draw(this.context.renderPass);
|
|
107
|
+
this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
|
|
108
|
+
}
|
|
109
|
+
bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
110
|
+
colorMaxMinBuffer.bind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
|
|
111
|
+
elevationMaxMinBuffer.bind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
|
|
112
|
+
}
|
|
113
|
+
unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
114
|
+
colorMaxMinBuffer.unbind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
|
|
115
|
+
elevationMaxMinBuffer.unbind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
|
|
116
|
+
}
|
|
117
|
+
getDomainUniforms() {
|
|
118
|
+
const { colorDomain, elevationDomain } = this.props;
|
|
119
|
+
const domainUniforms = {};
|
|
120
|
+
if (colorDomain !== null) {
|
|
121
|
+
domainUniforms.colorDomainValid = true;
|
|
122
|
+
domainUniforms.colorDomain = colorDomain;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
domainUniforms.colorDomainValid = false;
|
|
126
|
+
}
|
|
127
|
+
if (elevationDomain !== null) {
|
|
128
|
+
domainUniforms.elevationDomainValid = true;
|
|
129
|
+
domainUniforms.elevationDomain = elevationDomain;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
domainUniforms.elevationDomainValid = false;
|
|
133
|
+
}
|
|
134
|
+
return domainUniforms;
|
|
135
|
+
}
|
|
136
|
+
_setupUniformBuffer(model) {
|
|
137
|
+
// @ts-expect-error TODO v9 This code is not portable to WebGPU
|
|
138
|
+
const programHandle = model.pipeline.handle;
|
|
139
|
+
const gl = this.context.gl;
|
|
140
|
+
const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
|
|
141
|
+
const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
|
|
142
|
+
gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
|
|
143
|
+
gl.uniformBlockBinding(programHandle, elevationIndex, ELEVATION_DATA_UBO_INDEX);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accessor, AccessorFunction, Color, Material, GetPickingInfoParams, LayerContext, PickingInfo, Position, DefaultProps } from '@deck.gl/core';
|
|
2
|
-
import GPUGridCellLayer from
|
|
3
|
-
import { GridHash } from
|
|
4
|
-
import GridAggregationLayer, { GridAggregationLayerProps } from
|
|
2
|
+
import GPUGridCellLayer from "./gpu-grid-cell-layer.js";
|
|
3
|
+
import { GridHash } from "./../cpu-grid-layer/grid-aggregator.js";
|
|
4
|
+
import GridAggregationLayer, { GridAggregationLayerProps } from "../grid-aggregation-layer.js";
|
|
5
5
|
/** All properties supported by GPUGridLayer. */
|
|
6
6
|
export type GPUGridLayerProps<DataT = unknown> = _GPUGridLayerProps<DataT> & GridAggregationLayerProps<DataT>;
|
|
7
7
|
/** Properties added by GPUGridLayer. */
|
|
@@ -78,7 +78,7 @@ export type _GPUGridLayerProps<DataT> = {
|
|
|
78
78
|
*/
|
|
79
79
|
getElevationWeight?: Accessor<DataT, number>;
|
|
80
80
|
};
|
|
81
|
-
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU
|
|
81
|
+
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
|
|
82
82
|
export default class GPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends GridAggregationLayer<DataT, ExtraPropsT & Required<_GPUGridLayerProps<DataT>>> {
|
|
83
83
|
static layerName: string;
|
|
84
84
|
static defaultProps: DefaultProps<GPUGridLayerProps<unknown>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu-grid-layer.d.ts","sourceRoot":"","sources":["../../src/gpu-grid-layer/gpu-grid-layer.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,oBAAoB,EACpB,YAAY,EAEZ,WAAW,EACX,QAAQ,EACR,YAAY,EACb,MAAM,eAAe,CAAC;AAKvB,OAAO,gBAAgB,iCAA8B;AACrD,OAAO,EAA4B,QAAQ,EAAC,+CAA4C;AACxF,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,qCAAkC;AAsC1F,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,GACxE,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,wCAAwC;AACxC,MAAM,MAAM,kBAAkB,CAAC,KAAK,IAAI;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAElD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAEhD;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEzC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,OAAO,OAAO,YAAY,CAC/B,KAAK,GAAG,GAAG,EACX,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,2CAAgB;IAEnC,KAAK,EAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QAC7C,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,CAAC;IAEF,eAAe,CAAC,EAAC,MAAM,EAAC,EAAE,YAAY,GAAG,IAAI;IAiD7C,WAAW,CAAC,IAAI,KAAA;IAehB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAkBzC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAa5C,cAAc,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,oBAAoB,GAAG,WAAW;IAqD/D,YAAY;IAsDZ,aAAa,CAAC,OAAO,EAAE,YAAY;IAYnC,sBAAsB,CAAC,IAAI,KAAA;IAoD3B,gBAAgB,CAAC,IAAI,KAAA;CAMtB"}
|
|
@@ -0,0 +1,288 @@
|
|
|
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 { GL } from '@luma.gl/constants';
|
|
21
|
+
import { log } from '@deck.gl/core';
|
|
22
|
+
import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
23
|
+
import { AGGREGATION_OPERATION } from "../utils/aggregation-operation-utils.js";
|
|
24
|
+
import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
|
|
25
|
+
import GPUGridCellLayer from "./gpu-grid-cell-layer.js";
|
|
26
|
+
import { pointToDensityGridDataCPU } from "./../cpu-grid-layer/grid-aggregator.js";
|
|
27
|
+
import GridAggregationLayer from "../grid-aggregation-layer.js";
|
|
28
|
+
import { getBoundingBox, getGridParams } from "../utils/grid-aggregation-utils.js";
|
|
29
|
+
const defaultProps = {
|
|
30
|
+
// color
|
|
31
|
+
colorDomain: null,
|
|
32
|
+
colorRange: defaultColorRange,
|
|
33
|
+
getColorWeight: { type: 'accessor', value: 1 },
|
|
34
|
+
colorAggregation: 'SUM',
|
|
35
|
+
// elevation
|
|
36
|
+
elevationDomain: null,
|
|
37
|
+
elevationRange: [0, 1000],
|
|
38
|
+
getElevationWeight: { type: 'accessor', value: 1 },
|
|
39
|
+
elevationAggregation: 'SUM',
|
|
40
|
+
elevationScale: { type: 'number', min: 0, value: 1 },
|
|
41
|
+
// grid
|
|
42
|
+
cellSize: { type: 'number', min: 1, max: 1000, value: 1000 },
|
|
43
|
+
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
44
|
+
getPosition: { type: 'accessor', value: (x) => x.position },
|
|
45
|
+
extruded: false,
|
|
46
|
+
// Optional material for 'lighting' shader module
|
|
47
|
+
material: true
|
|
48
|
+
};
|
|
49
|
+
// This layer only perform GPU aggregation, no need to seperate data and weight props
|
|
50
|
+
// aggregation will be dirty when any of the props are changed.
|
|
51
|
+
const DIMENSIONS = {
|
|
52
|
+
data: {
|
|
53
|
+
props: ['cellSize', 'colorAggregation', 'elevationAggregation']
|
|
54
|
+
}
|
|
55
|
+
// rest of the changes are detected by `state.attributesChanged`
|
|
56
|
+
};
|
|
57
|
+
const POSITION_ATTRIBUTE_NAME = 'positions';
|
|
58
|
+
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
|
|
59
|
+
export default class GPUGridLayer extends GridAggregationLayer {
|
|
60
|
+
static { this.layerName = 'GPUGridLayer'; }
|
|
61
|
+
static { this.defaultProps = defaultProps; }
|
|
62
|
+
initializeState({ device }) {
|
|
63
|
+
const isSupported = GPUGridAggregator.isSupported(device);
|
|
64
|
+
if (!isSupported) {
|
|
65
|
+
log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
|
|
66
|
+
}
|
|
67
|
+
super.initializeAggregationLayer({
|
|
68
|
+
dimensions: DIMENSIONS
|
|
69
|
+
});
|
|
70
|
+
this.setState({
|
|
71
|
+
gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
|
|
72
|
+
projectPoints: false, // aggregation in world space
|
|
73
|
+
isSupported,
|
|
74
|
+
weights: {
|
|
75
|
+
color: {
|
|
76
|
+
needMin: true,
|
|
77
|
+
needMax: true,
|
|
78
|
+
combineMaxMin: true,
|
|
79
|
+
maxMinBuffer: device.createBuffer({
|
|
80
|
+
byteLength: 4 * 4,
|
|
81
|
+
// @ts-expect-error webgl-legacy
|
|
82
|
+
accessor: { size: 4, type: 5126, divisor: 1 }
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
elevation: {
|
|
86
|
+
needMin: true,
|
|
87
|
+
needMax: true,
|
|
88
|
+
combineMaxMin: true,
|
|
89
|
+
maxMinBuffer: device.createBuffer({
|
|
90
|
+
byteLength: 4 * 4,
|
|
91
|
+
// @ts-expect-error
|
|
92
|
+
accessor: { size: 4, type: 5126, divisor: 1 }
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
positionAttributeName: 'positions'
|
|
97
|
+
});
|
|
98
|
+
const attributeManager = this.getAttributeManager();
|
|
99
|
+
attributeManager.add({
|
|
100
|
+
[POSITION_ATTRIBUTE_NAME]: {
|
|
101
|
+
size: 3,
|
|
102
|
+
accessor: 'getPosition',
|
|
103
|
+
type: 'float64',
|
|
104
|
+
fp64: this.use64bitPositions()
|
|
105
|
+
},
|
|
106
|
+
color: { size: 3, accessor: 'getColorWeight' },
|
|
107
|
+
elevation: { size: 3, accessor: 'getElevationWeight' }
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
updateState(opts) {
|
|
111
|
+
if (this.state.isSupported === false) {
|
|
112
|
+
// Skip update, layer not supported
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
super.updateState(opts);
|
|
116
|
+
const { aggregationDirty } = this.state;
|
|
117
|
+
if (aggregationDirty) {
|
|
118
|
+
// reset cached CPU Aggregation results (used for picking)
|
|
119
|
+
this.setState({
|
|
120
|
+
gridHash: null
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
getHashKeyForIndex(index) {
|
|
125
|
+
const { numRow, numCol, boundingBox, gridOffset } = this.state;
|
|
126
|
+
const gridSize = [numCol, numRow];
|
|
127
|
+
const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
|
|
128
|
+
const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
|
|
129
|
+
const yIndex = Math.floor(index / gridSize[0]);
|
|
130
|
+
const xIndex = index - yIndex * gridSize[0];
|
|
131
|
+
// This will match the index to the hash-key to access aggregation data from CPU aggregation results.
|
|
132
|
+
const latIdx = Math.floor((yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]);
|
|
133
|
+
const lonIdx = Math.floor((xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]);
|
|
134
|
+
return `${latIdx}-${lonIdx}`;
|
|
135
|
+
}
|
|
136
|
+
getPositionForIndex(index) {
|
|
137
|
+
const { numRow, numCol, boundingBox, gridOffset } = this.state;
|
|
138
|
+
const gridSize = [numCol, numRow];
|
|
139
|
+
const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
|
|
140
|
+
const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
|
|
141
|
+
const yIndex = Math.floor(index / gridSize[0]);
|
|
142
|
+
const xIndex = index - yIndex * gridSize[0];
|
|
143
|
+
const yPos = yIndex * cellSize[1] + gridOrigin[1];
|
|
144
|
+
const xPos = xIndex * cellSize[0] + gridOrigin[0];
|
|
145
|
+
return [xPos, yPos];
|
|
146
|
+
}
|
|
147
|
+
getPickingInfo({ info, mode }) {
|
|
148
|
+
const { index } = info;
|
|
149
|
+
let object = null;
|
|
150
|
+
if (index >= 0) {
|
|
151
|
+
const gpuGridAggregator = this.state.gpuGridAggregator;
|
|
152
|
+
const position = this.getPositionForIndex(index);
|
|
153
|
+
const colorInfo = GPUGridAggregator.getAggregationData({
|
|
154
|
+
pixelIndex: index,
|
|
155
|
+
...gpuGridAggregator.getData('color')
|
|
156
|
+
});
|
|
157
|
+
const elevationInfo = GPUGridAggregator.getAggregationData({
|
|
158
|
+
pixelIndex: index,
|
|
159
|
+
...gpuGridAggregator.getData('elevation')
|
|
160
|
+
});
|
|
161
|
+
object = {
|
|
162
|
+
colorValue: colorInfo.cellWeight,
|
|
163
|
+
elevationValue: elevationInfo.cellWeight,
|
|
164
|
+
count: colorInfo.cellCount || elevationInfo.cellCount,
|
|
165
|
+
position,
|
|
166
|
+
totalCount: colorInfo.totalCount || elevationInfo.totalCount
|
|
167
|
+
};
|
|
168
|
+
if (mode !== 'hover') {
|
|
169
|
+
// perform CPU aggregation for full list of points for each cell
|
|
170
|
+
const { props } = this;
|
|
171
|
+
let { gridHash } = this.state;
|
|
172
|
+
if (!gridHash) {
|
|
173
|
+
const { gridOffset, translation, boundingBox } = this.state;
|
|
174
|
+
const { viewport } = this.context;
|
|
175
|
+
const attributes = this.getAttributes();
|
|
176
|
+
const cpuAggregation = pointToDensityGridDataCPU(props, {
|
|
177
|
+
gridOffset,
|
|
178
|
+
attributes,
|
|
179
|
+
viewport,
|
|
180
|
+
translation,
|
|
181
|
+
boundingBox
|
|
182
|
+
});
|
|
183
|
+
gridHash = cpuAggregation.gridHash;
|
|
184
|
+
this.setState({ gridHash });
|
|
185
|
+
}
|
|
186
|
+
const key = this.getHashKeyForIndex(index);
|
|
187
|
+
const cpuAggregationData = gridHash[key];
|
|
188
|
+
Object.assign(object, cpuAggregationData);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// override object with picked cell
|
|
192
|
+
info.picked = Boolean(object);
|
|
193
|
+
info.object = object;
|
|
194
|
+
return info;
|
|
195
|
+
}
|
|
196
|
+
renderLayers() {
|
|
197
|
+
if (!this.state.isSupported) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const { elevationScale, extruded, cellSize: cellSizeMeters, coverage, material, elevationRange, colorDomain, elevationDomain } = this.props;
|
|
201
|
+
const { weights, numRow, numCol, gridOrigin, gridOffset } = this.state;
|
|
202
|
+
const { color, elevation } = weights;
|
|
203
|
+
const colorRange = colorRangeToFlatArray(this.props.colorRange);
|
|
204
|
+
const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);
|
|
205
|
+
return new SubLayerClass({
|
|
206
|
+
gridSize: [numCol, numRow],
|
|
207
|
+
gridOrigin,
|
|
208
|
+
gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
|
|
209
|
+
colorRange,
|
|
210
|
+
elevationRange,
|
|
211
|
+
colorDomain,
|
|
212
|
+
elevationDomain,
|
|
213
|
+
cellSize: cellSizeMeters,
|
|
214
|
+
coverage,
|
|
215
|
+
material,
|
|
216
|
+
elevationScale,
|
|
217
|
+
extruded
|
|
218
|
+
}, this.getSubLayerProps({
|
|
219
|
+
id: 'gpu-grid-cell'
|
|
220
|
+
}), {
|
|
221
|
+
data: {
|
|
222
|
+
attributes: {
|
|
223
|
+
colors: color.aggregationBuffer,
|
|
224
|
+
elevations: elevation.aggregationBuffer
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
colorMaxMinBuffer: color.maxMinBuffer,
|
|
228
|
+
elevationMaxMinBuffer: elevation.maxMinBuffer,
|
|
229
|
+
numInstances: numCol * numRow
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
finalizeState(context) {
|
|
233
|
+
const { color, elevation } = this.state.weights;
|
|
234
|
+
[color, elevation].forEach(weight => {
|
|
235
|
+
const { aggregationBuffer, maxMinBuffer } = weight;
|
|
236
|
+
maxMinBuffer?.destroy();
|
|
237
|
+
aggregationBuffer?.destroy();
|
|
238
|
+
});
|
|
239
|
+
super.finalizeState(context);
|
|
240
|
+
}
|
|
241
|
+
// Aggregation Overrides
|
|
242
|
+
updateAggregationState(opts) {
|
|
243
|
+
const { props, oldProps } = opts;
|
|
244
|
+
const { cellSize, coordinateSystem } = props;
|
|
245
|
+
const { viewport } = this.context;
|
|
246
|
+
const cellSizeChanged = oldProps.cellSize !== cellSize;
|
|
247
|
+
const { dimensions } = this.state;
|
|
248
|
+
const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
|
|
249
|
+
// any attribute changed
|
|
250
|
+
const attributesChanged = positionsChanged || this.isAttributeChanged();
|
|
251
|
+
let { boundingBox } = this.state;
|
|
252
|
+
if (positionsChanged) {
|
|
253
|
+
boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
|
|
254
|
+
this.setState({ boundingBox });
|
|
255
|
+
}
|
|
256
|
+
if (positionsChanged || cellSizeChanged) {
|
|
257
|
+
const { gridOffset, translation, width, height, numCol, numRow } = getGridParams(boundingBox, cellSize, viewport, coordinateSystem);
|
|
258
|
+
this.allocateResources(numRow, numCol);
|
|
259
|
+
this.setState({
|
|
260
|
+
gridOffset,
|
|
261
|
+
translation,
|
|
262
|
+
gridOrigin: [-1 * translation[0], -1 * translation[1]],
|
|
263
|
+
width,
|
|
264
|
+
height,
|
|
265
|
+
numCol,
|
|
266
|
+
numRow
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const aggregationDataDirty = attributesChanged ||
|
|
270
|
+
this.isAggregationDirty(opts, {
|
|
271
|
+
dimension: dimensions.data,
|
|
272
|
+
compareAll: true
|
|
273
|
+
});
|
|
274
|
+
if (aggregationDataDirty) {
|
|
275
|
+
this._updateAccessors(opts);
|
|
276
|
+
}
|
|
277
|
+
this.setState({
|
|
278
|
+
aggregationDataDirty
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
// Private
|
|
282
|
+
_updateAccessors(opts) {
|
|
283
|
+
const { colorAggregation, elevationAggregation } = opts.props;
|
|
284
|
+
const { color, elevation } = this.state.weights;
|
|
285
|
+
color.operation = AGGREGATION_OPERATION[colorAggregation];
|
|
286
|
+
elevation.operation = AGGREGATION_OPERATION[elevationAggregation];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LayerContext, UpdateParameters, Accessor } from '@deck.gl/core';
|
|
2
|
-
import AggregationLayer, { AggregationLayerProps } from
|
|
3
|
-
import GPUGridAggregator from
|
|
4
|
-
import BinSorter from
|
|
2
|
+
import AggregationLayer, { AggregationLayerProps } from "./aggregation-layer.js";
|
|
3
|
+
import GPUGridAggregator from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
4
|
+
import BinSorter from "./utils/bin-sorter.js";
|
|
5
5
|
import type { Buffer } from '@luma.gl/core';
|
|
6
6
|
export type GridAggregationLayerProps<DataT> = AggregationLayerProps<DataT>;
|
|
7
7
|
export default abstract class GridAggregationLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT> {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-aggregation-layer.d.ts","sourceRoot":"","sources":["../src/grid-aggregation-layer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,YAAY,EAAO,gBAAgB,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,+BAA4B;AAC5E,OAAO,iBAAiB,4DAAyD;AACjF,OAAO,SAAS,8BAA2B;AAE3C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAE5E,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,oBAAoB,CAChD,KAAK,EACL,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5C,MAAM,CAAC,SAAS,SAA0B;IAE1C,KAAK,EAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QACzC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC;QACrB,UAAU,CAAC,EAAE,SAAS,CAAC;QACvB,OAAO,EAAE;YACP,CAAC,GAAG,EAAE,MAAM,GAAG;gBACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;gBAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,eAAe,EAAE,YAAY,GAAG,IAAI,CAAC;gBACrC,UAAU,EAAE,YAAY,CAAC;gBACzB,OAAO,EAAE,YAAY,CAAC;gBACtB,OAAO,EAAE,YAAY,CAAC;gBACtB,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACnC,SAAS,EAAE,MAAM,CAAC;aACnB,CAAC;SACH,CAAC;QACF,iBAAiB,CAAC,EAAE,QAAQ,CAAC;QAC7B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;QACtC,SAAS,EAAE,GAAG,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,CAAC;QAC/C,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,CAAC;QACtE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3D,CAAC;IAEF,0BAA0B,CAAC,EAAC,UAAU,EAAC;;KAAA;IAYvC,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IA8BxC,aAAa,CAAC,OAAO,EAAE,YAAY;IASnC,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAQjC,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAKnD,iBAAiB,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA;IAsBhC,aAAa,CAAC,EAAC,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC;;;;;KAAA;IAY7D,kBAAkB,CAAC,IAAI,KAAA;IAgDvB,iBAAiB;IAOjB,yBAAyB,IAAI,IAAI;CAoBlC"}
|