@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.3
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/dist/contour-layer/contour-layer.js +241 -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/dist/cpu-grid-layer/cpu-grid-layer.js +130 -0
- package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
- package/dist/dist.dev.js +1187 -10528
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
- package/dist/{esm/gpu-grid-layer → gpu-grid-layer}/gpu-grid-cell-layer-vertex.glsl.js +20 -1
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
- package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
- package/dist/grid-aggregation-layer.js +172 -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 +4 -4
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
- package/dist/heatmap-layer/heatmap-layer.js +471 -0
- package/dist/{esm/heatmap-layer → heatmap-layer}/max-fs.glsl.js +0 -1
- 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 +19 -0
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +61 -0
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +52 -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/{esm/heatmap-layer → heatmap-layer}/weights-fs.glsl.js +0 -1
- 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/{esm/heatmap-layer → heatmap-layer}/weights-vs.glsl.js +4 -3
- package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
- package/dist/hexagon-layer/hexagon-layer.js +174 -0
- package/dist/index.cjs +4494 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +32 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +166 -0
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +40 -0
- package/dist/{esm/screen-grid-layer → screen-grid-layer}/screen-grid-layer-vertex.glsl.js +19 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +216 -0
- package/dist/types.js +1 -0
- package/dist/utils/aggregation-operation-utils.js +94 -0
- 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 +39 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +34 -0
- package/dist/{esm/utils → utils}/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +19 -1
- 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 +566 -0
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +37 -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 +74 -178
- package/package.json +18 -11
- package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
- package/src/heatmap-layer/heatmap-layer.ts +87 -105
- 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/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +10 -13
- 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.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.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.map +0 -1
- 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.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.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/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 → dist}/aggregation-layer.d.ts +0 -0
- /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
- /package/{typed → dist}/contour-layer/contour-layer.d.ts +0 -0
- /package/{typed → dist}/contour-layer/contour-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/cpu-grid-layer.d.ts +0 -0
- /package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.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}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +0 -0
- /package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -0
- /package/{typed → dist}/grid-aggregation-layer.d.ts +0 -0
- /package/{typed → dist}/grid-aggregation-layer.d.ts.map +0 -0
- /package/{typed → dist}/grid-layer/grid-layer.d.ts +0 -0
- /package/{typed → dist}/grid-layer/grid-layer.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}/hexagon-layer/hexagon-layer.d.ts +0 -0
- /package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts.map +0 -0
- /package/{typed → dist}/index.d.ts +0 -0
- /package/{typed → dist}/index.d.ts.map +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.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}/screen-grid-layer/screen-grid-layer.d.ts +0 -0
- /package/{typed → dist}/screen-grid-layer/screen-grid-layer.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 +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,34 @@
|
|
|
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
|
+
|
|
24
|
+
precision highp float;
|
|
25
|
+
|
|
26
|
+
in vec4 vColor;
|
|
27
|
+
|
|
28
|
+
out vec4 fragColor;
|
|
29
|
+
|
|
30
|
+
void main(void) {
|
|
31
|
+
fragColor = vColor;
|
|
32
|
+
fragColor = picking_filterColor(fragColor);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
@@ -1,3 +1,23 @@
|
|
|
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
|
|
1
21
|
export default `\
|
|
2
22
|
#version 300 es
|
|
3
23
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
@@ -119,4 +139,3 @@ void main(void) {
|
|
|
119
139
|
}
|
|
120
140
|
}
|
|
121
141
|
`;
|
|
122
|
-
//# sourceMappingURL=gpu-grid-cell-layer-vertex.glsl.js.map
|
|
@@ -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: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
|
|
111
|
+
elevationMaxMinBuffer.bind({ target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX });
|
|
112
|
+
}
|
|
113
|
+
unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
114
|
+
colorMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
|
|
115
|
+
elevationMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, 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
|
+
}
|
|
@@ -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 (WebGL2 only). */
|
|
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: GL.FLOAT, 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: GL.FLOAT, 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: GL.DOUBLE,
|
|
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
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
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 AggregationLayer from "./aggregation-layer.js";
|
|
23
|
+
import GPUGridAggregator from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
|
|
24
|
+
import BinSorter from "./utils/bin-sorter.js";
|
|
25
|
+
import { pointToDensityGridDataCPU } from "./cpu-grid-layer/grid-aggregator.js";
|
|
26
|
+
export default class GridAggregationLayer extends AggregationLayer {
|
|
27
|
+
static { this.layerName = 'GridAggregationLayer'; }
|
|
28
|
+
initializeAggregationLayer({ dimensions }) {
|
|
29
|
+
super.initializeAggregationLayer(dimensions);
|
|
30
|
+
this.setState({
|
|
31
|
+
// CPU aggregation results
|
|
32
|
+
layerData: {},
|
|
33
|
+
gpuGridAggregator: new GPUGridAggregator(this.context.device, {
|
|
34
|
+
id: `${this.id}-gpu-aggregator`
|
|
35
|
+
}),
|
|
36
|
+
cpuGridAggregator: pointToDensityGridDataCPU
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
updateState(opts) {
|
|
40
|
+
// get current attributes
|
|
41
|
+
super.updateState(opts);
|
|
42
|
+
this.updateAggregationState(opts);
|
|
43
|
+
const { aggregationDataDirty, aggregationWeightsDirty, gpuAggregation } = this.state;
|
|
44
|
+
if (this.getNumInstances() <= 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let aggregationDirty = false;
|
|
48
|
+
// CPU aggregation is two steps
|
|
49
|
+
// 1. Create bins (based on cellSize and position) 2. Aggregate weights for each bin
|
|
50
|
+
// For GPU aggregation both above steps are combined into one step
|
|
51
|
+
// step-1
|
|
52
|
+
if (aggregationDataDirty || (gpuAggregation && aggregationWeightsDirty)) {
|
|
53
|
+
this._updateAggregation(opts);
|
|
54
|
+
aggregationDirty = true;
|
|
55
|
+
}
|
|
56
|
+
// step-2 (Applicalbe for CPU aggregation only)
|
|
57
|
+
if (!gpuAggregation && (aggregationDataDirty || aggregationWeightsDirty)) {
|
|
58
|
+
this._updateWeightBins();
|
|
59
|
+
this._uploadAggregationResults();
|
|
60
|
+
aggregationDirty = true;
|
|
61
|
+
}
|
|
62
|
+
this.setState({ aggregationDirty });
|
|
63
|
+
}
|
|
64
|
+
finalizeState(context) {
|
|
65
|
+
const { count } = this.state.weights;
|
|
66
|
+
if (count && count.aggregationBuffer) {
|
|
67
|
+
count.aggregationBuffer.delete();
|
|
68
|
+
}
|
|
69
|
+
this.state.gpuGridAggregator?.delete();
|
|
70
|
+
super.finalizeState(context);
|
|
71
|
+
}
|
|
72
|
+
updateShaders(shaders) {
|
|
73
|
+
if (this.state.gpuAggregation) {
|
|
74
|
+
this.state.gpuGridAggregator.updateShaders(shaders);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Methods that can be overriden by subclasses for customizations
|
|
78
|
+
updateAggregationState(opts) {
|
|
79
|
+
// Sublayers should implement this method.
|
|
80
|
+
log.assert(false);
|
|
81
|
+
}
|
|
82
|
+
allocateResources(numRow, numCol) {
|
|
83
|
+
if (this.state.numRow !== numRow || this.state.numCol !== numCol) {
|
|
84
|
+
const dataBytes = numCol * numRow * 4 * 4;
|
|
85
|
+
const { weights } = this.state;
|
|
86
|
+
for (const name in weights) {
|
|
87
|
+
const weight = weights[name];
|
|
88
|
+
if (weight.aggregationBuffer) {
|
|
89
|
+
weight.aggregationBuffer.delete();
|
|
90
|
+
}
|
|
91
|
+
weight.aggregationBuffer = this.context.device.createBuffer({
|
|
92
|
+
byteLength: dataBytes,
|
|
93
|
+
// @ts-expect-error legacy
|
|
94
|
+
accessor: {
|
|
95
|
+
size: 4,
|
|
96
|
+
type: GL.FLOAT,
|
|
97
|
+
divisor: 1
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
updateResults({ aggregationData, maxMinData, maxData, minData }) {
|
|
104
|
+
const { count } = this.state.weights;
|
|
105
|
+
if (count) {
|
|
106
|
+
count.aggregationData = aggregationData;
|
|
107
|
+
count.maxMinData = maxMinData;
|
|
108
|
+
count.maxData = maxData;
|
|
109
|
+
count.minData = minData;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Private
|
|
113
|
+
_updateAggregation(opts) {
|
|
114
|
+
const { cpuGridAggregator, gpuGridAggregator, gridOffset, posOffset, translation = [0, 0], scaling = [0, 0, 0], boundingBox, projectPoints, gpuAggregation, numCol, numRow } = this.state;
|
|
115
|
+
const { props } = opts;
|
|
116
|
+
const { viewport } = this.context;
|
|
117
|
+
const attributes = this.getAttributes();
|
|
118
|
+
const vertexCount = this.getNumInstances();
|
|
119
|
+
if (!gpuAggregation) {
|
|
120
|
+
const result = cpuGridAggregator(props, {
|
|
121
|
+
gridOffset,
|
|
122
|
+
projectPoints,
|
|
123
|
+
attributes,
|
|
124
|
+
viewport,
|
|
125
|
+
posOffset,
|
|
126
|
+
boundingBox
|
|
127
|
+
});
|
|
128
|
+
this.setState({
|
|
129
|
+
layerData: result
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const { weights } = this.state;
|
|
134
|
+
gpuGridAggregator.run({
|
|
135
|
+
weights,
|
|
136
|
+
cellSize: [gridOffset.xOffset, gridOffset.yOffset],
|
|
137
|
+
numCol,
|
|
138
|
+
numRow,
|
|
139
|
+
translation,
|
|
140
|
+
scaling,
|
|
141
|
+
vertexCount,
|
|
142
|
+
projectPoints,
|
|
143
|
+
attributes,
|
|
144
|
+
moduleSettings: this.getModuleSettings()
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
_updateWeightBins() {
|
|
149
|
+
const { getValue } = this.state;
|
|
150
|
+
const sortedBins = new BinSorter(this.state.layerData.data || [], { getValue });
|
|
151
|
+
this.setState({ sortedBins });
|
|
152
|
+
}
|
|
153
|
+
_uploadAggregationResults() {
|
|
154
|
+
const { numCol, numRow } = this.state;
|
|
155
|
+
const { data } = this.state.layerData;
|
|
156
|
+
const { aggregatedBins, minValue, maxValue, totalCount } = this.state.sortedBins;
|
|
157
|
+
const ELEMENTCOUNT = 4;
|
|
158
|
+
const aggregationSize = numCol * numRow * ELEMENTCOUNT;
|
|
159
|
+
const aggregationData = new Float32Array(aggregationSize).fill(0);
|
|
160
|
+
for (const bin of aggregatedBins) {
|
|
161
|
+
const { lonIdx, latIdx } = data[bin.i];
|
|
162
|
+
const { value, counts } = bin;
|
|
163
|
+
const cellIndex = (lonIdx + latIdx * numCol) * ELEMENTCOUNT;
|
|
164
|
+
aggregationData[cellIndex] = value;
|
|
165
|
+
aggregationData[cellIndex + ELEMENTCOUNT - 1] = counts;
|
|
166
|
+
}
|
|
167
|
+
const maxMinData = new Float32Array([maxValue, 0, 0, minValue]);
|
|
168
|
+
const maxData = new Float32Array([maxValue, 0, 0, totalCount]);
|
|
169
|
+
const minData = new Float32Array([minValue, 0, 0, totalCount]);
|
|
170
|
+
this.updateResults({ aggregationData, maxMinData, maxData, minData });
|
|
171
|
+
}
|
|
172
|
+
}
|