@deck.gl/aggregation-layers 9.4.0-alpha.1 → 9.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +1 -3
- package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +0 -1
- package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -1
- package/dist/dist.dev.js +642 -38
- package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -1
- package/dist/grid-layer/grid-cell-layer.js +3 -2
- package/dist/grid-layer/grid-cell-layer.js.map +1 -1
- package/dist/grid-layer/grid-cell-layer.wgsl.d.ts +3 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.js +114 -0
- package/dist/grid-layer/grid-cell-layer.wgsl.js.map +1 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts +1 -0
- package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -1
- package/dist/grid-layer/grid-layer-uniforms.js +14 -0
- package/dist/grid-layer/grid-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +2 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +19 -0
- package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +59 -12
- package/dist/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/heatmap-layer/max.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/max.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/max.wgsl.js +48 -0
- package/dist/heatmap-layer/max.wgsl.js.map +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +1 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer-uniforms.js +16 -0
- package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -1
- package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/triangle-layer.js +3 -2
- package/dist/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/heatmap-layer/triangle-layer.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.js +65 -0
- package/dist/heatmap-layer/triangle-layer.wgsl.js.map +1 -0
- package/dist/heatmap-layer/weights.wgsl.d.ts +3 -0
- package/dist/heatmap-layer/weights.wgsl.d.ts.map +1 -0
- package/dist/heatmap-layer/weights.wgsl.js +64 -0
- package/dist/heatmap-layer/weights.wgsl.js.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-cell-layer.js +2 -2
- package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -1
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts +3 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js +120 -0
- package/dist/hexagon-layer/hexagon-cell-layer.wgsl.js.map +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +1 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +13 -0
- package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -1
- package/dist/index.cjs +13268 -1488
- package/dist/index.cjs.map +3 -4
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -6
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +3 -2
- package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts +3 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.d.ts.map +1 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js +76 -0
- package/dist/screen-grid-layer/screen-grid-cell-layer.wgsl.js.map +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +1 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +12 -0
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -1
- package/dist.min.js +545 -35
- package/dist.webgl-only/common/aggregation-layer.js +68 -0
- package/dist.webgl-only/common/aggregation-layer.js.map +1 -0
- package/dist.webgl-only/common/aggregator/aggregator.js +5 -0
- package/dist.webgl-only/common/aggregator/aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/aggregate.js +69 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/aggregate.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/cpu-aggregator.js +141 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/sort-bins.js +44 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/vertex-accessor.js +56 -0
- package/dist.webgl-only/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +22 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +18 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/utils.js +24 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/utils.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +222 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregator.js +203 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +225 -0
- package/dist.webgl-only/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -0
- package/dist.webgl-only/common/aggregator/index.js +6 -0
- package/dist.webgl-only/common/aggregator/index.js.map +1 -0
- package/dist.webgl-only/common/types.js +5 -0
- package/dist.webgl-only/common/types.js.map +1 -0
- package/dist.webgl-only/common/utils/bounds-utils.js +21 -0
- package/dist.webgl-only/common/utils/bounds-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/color-utils.js +65 -0
- package/dist.webgl-only/common/utils/color-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/prop-utils.js +13 -0
- package/dist.webgl-only/common/utils/prop-utils.js.map +1 -0
- package/dist.webgl-only/common/utils/scale-utils.js +181 -0
- package/dist.webgl-only/common/utils/scale-utils.js.map +1 -0
- package/dist.webgl-only/contour-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/contour-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/contour-layer/contour-layer.js +282 -0
- package/dist.webgl-only/contour-layer/contour-layer.js.map +1 -0
- package/dist.webgl-only/contour-layer/contour-utils.js +60 -0
- package/dist.webgl-only/contour-layer/contour-utils.js.map +1 -0
- package/dist.webgl-only/contour-layer/marching-squares-codes.js +341 -0
- package/dist.webgl-only/contour-layer/marching-squares-codes.js.map +1 -0
- package/dist.webgl-only/contour-layer/marching-squares.js +151 -0
- package/dist.webgl-only/contour-layer/marching-squares.js.map +1 -0
- package/dist.webgl-only/contour-layer/value-reader.js +47 -0
- package/dist.webgl-only/contour-layer/value-reader.js.map +1 -0
- package/dist.webgl-only/grid-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/grid-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.js +95 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/grid-layer/grid-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-layer-uniforms.js +26 -0
- package/dist.webgl-only/grid-layer/grid-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/grid-layer/grid-layer.js +362 -0
- package/dist.webgl-only/grid-layer/grid-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/aggregation-layer.js +140 -0
- package/dist.webgl-only/heatmap-layer/aggregation-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-uniforms.js +36 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-utils.js +67 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer-utils.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer.js +513 -0
- package/dist.webgl-only/heatmap-layer/heatmap-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max-fs.glsl.js +13 -0
- package/dist.webgl-only/heatmap-layer/max-fs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max-vs.glsl.js +18 -0
- package/dist.webgl-only/heatmap-layer/max-vs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/max.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/max.wgsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-fragment.glsl.js +34 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-uniforms.js +25 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-vertex.glsl.js +28 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.js +49 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/triangle-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights-fs.glsl.js +21 -0
- package/dist.webgl-only/heatmap-layer/weights-fs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights-vs.glsl.js +21 -0
- package/dist.webgl-only/heatmap-layer/weights-vs.glsl.js.map +1 -0
- package/dist.webgl-only/heatmap-layer/weights.wgsl.js +5 -0
- package/dist.webgl-only/heatmap-layer/weights.wgsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/bin-options-uniforms.js +18 -0
- package/dist.webgl-only/hexagon-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.js +90 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/hexagon-layer/hexagon-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer-uniforms.js +24 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer.js +360 -0
- package/dist.webgl-only/hexagon-layer/hexagon-layer.js.map +1 -0
- package/dist.webgl-only/hexagon-layer/hexbin.js +70 -0
- package/dist.webgl-only/hexagon-layer/hexbin.js.map +1 -0
- package/dist.webgl-only/index.cjs +15625 -0
- package/dist.webgl-only/index.cjs.map +6 -0
- package/dist.webgl-only/index.js +11 -0
- package/dist.webgl-only/index.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/bin-options-uniforms.js +16 -0
- package/dist.webgl-only/screen-grid-layer/bin-options-uniforms.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.js +88 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.wgsl.js +5 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-cell-layer.wgsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-fragment.glsl.js +16 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-uniforms.js +22 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-vertex.glsl.js +31 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer.js +194 -0
- package/dist.webgl-only/screen-grid-layer/screen-grid-layer.js.map +1 -0
- package/package.json +14 -5
- package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +1 -3
- package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +0 -1
- package/src/grid-layer/grid-cell-layer.ts +3 -2
- package/src/grid-layer/grid-cell-layer.wgsl.ts +114 -0
- package/src/grid-layer/grid-layer-uniforms.ts +15 -0
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +20 -0
- package/src/heatmap-layer/heatmap-layer.ts +67 -13
- package/src/heatmap-layer/max.wgsl.ts +48 -0
- package/src/heatmap-layer/triangle-layer-uniforms.ts +17 -0
- package/src/heatmap-layer/triangle-layer.ts +3 -2
- package/src/heatmap-layer/triangle-layer.wgsl.ts +65 -0
- package/src/heatmap-layer/weights.wgsl.ts +64 -0
- package/src/hexagon-layer/hexagon-cell-layer.ts +2 -3
- package/src/hexagon-layer/hexagon-cell-layer.wgsl.ts +120 -0
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +14 -0
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +4 -4
- package/src/screen-grid-layer/screen-grid-cell-layer.wgsl.ts +76 -0
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +13 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CompositeLayer, AttributeManager } from '@deck.gl/core';
|
|
5
|
+
class AggregationLayer extends CompositeLayer {
|
|
6
|
+
/** Allow this layer to participates in the draw cycle */
|
|
7
|
+
get isDrawable() {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
initializeState() { }
|
|
11
|
+
// Extend Layer.updateState to update the Aggregator instance
|
|
12
|
+
// returns true if aggregator is changed
|
|
13
|
+
updateState(params) {
|
|
14
|
+
super.updateState(params);
|
|
15
|
+
const aggregatorType = this.getAggregatorType();
|
|
16
|
+
if (params.changeFlags.extensionsChanged || this.state.aggregatorType !== aggregatorType) {
|
|
17
|
+
this.state.aggregator?.destroy();
|
|
18
|
+
const aggregator = this.createAggregator(aggregatorType);
|
|
19
|
+
aggregator.setProps({
|
|
20
|
+
attributes: this.getAttributeManager()?.attributes
|
|
21
|
+
});
|
|
22
|
+
this.setState({ aggregator, aggregatorType });
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// Override Layer.finalizeState to dispose the Aggregator instance
|
|
28
|
+
finalizeState(context) {
|
|
29
|
+
super.finalizeState(context);
|
|
30
|
+
this.state.aggregator.destroy();
|
|
31
|
+
}
|
|
32
|
+
// Override Layer.updateAttributes to update the aggregator
|
|
33
|
+
updateAttributes(changedAttributes) {
|
|
34
|
+
const { aggregator } = this.state;
|
|
35
|
+
aggregator.setProps({
|
|
36
|
+
attributes: changedAttributes
|
|
37
|
+
});
|
|
38
|
+
for (const id in changedAttributes) {
|
|
39
|
+
this.onAttributeChange(id);
|
|
40
|
+
}
|
|
41
|
+
// In aggregator.update() the aggregator allocates the buffers to store its output
|
|
42
|
+
// These buffers will be exposed by aggregator.getResults() and passed to the sublayers
|
|
43
|
+
// Therefore update() must be called before renderLayers()
|
|
44
|
+
// CPUAggregator's output is populated right here in update()
|
|
45
|
+
// GPUAggregator's output is pre-allocated and populated in preDraw(), see comments below
|
|
46
|
+
aggregator.update();
|
|
47
|
+
}
|
|
48
|
+
draw({ shaderModuleProps }) {
|
|
49
|
+
// GPU aggregation needs `shaderModuleProps` for projection/filter uniforms which are only accessible at draw time
|
|
50
|
+
// GPUAggregator's Buffers are pre-allocated during `update()` and passed down to the sublayer attributes in renderLayers()
|
|
51
|
+
// Although the Buffers have been bound to the sublayer's Model, their content are not populated yet
|
|
52
|
+
// GPUAggregator.preDraw() is called in the draw cycle here right before Buffers are used by sublayer.draw()
|
|
53
|
+
const { aggregator } = this.state;
|
|
54
|
+
// @ts-expect-error only used by GPU aggregators
|
|
55
|
+
aggregator.setProps({ shaderModuleProps });
|
|
56
|
+
aggregator.preDraw();
|
|
57
|
+
}
|
|
58
|
+
// override CompositeLayer._getAttributeManager to create AttributeManager instance
|
|
59
|
+
_getAttributeManager() {
|
|
60
|
+
return new AttributeManager(this.context.device, {
|
|
61
|
+
id: this.props.id,
|
|
62
|
+
stats: this.context.stats
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
AggregationLayer.layerName = 'AggregationLayer';
|
|
67
|
+
export default AggregationLayer;
|
|
68
|
+
//# sourceMappingURL=aggregation-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregation-layer.js","sourceRoot":"","sources":["../../src/common/aggregation-layer.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EACL,cAAc,EAMd,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAOvB,MAA8B,gBAG5B,SAAQ,cAA+D;IAQvE,yDAAyD;IACzD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAQD,eAAe,KAAU,CAAC;IAE1B,6DAA6D;IAC7D,wCAAwC;IACxC,WAAW,CAAC,MAA8B;QACxC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAE1B,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAChD,IAAI,MAAM,CAAC,WAAW,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,cAAc,EAAE,CAAC;YACzF,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;YACjC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;YACzD,UAAU,CAAC,QAAQ,CAAC;gBAClB,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,EAAE,UAAU;aACnD,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,EAAC,UAAU,EAAE,cAAc,EAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAA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/common/aggregator/aggregator.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const count = pointIndices => {
|
|
5
|
+
return pointIndices.length;
|
|
6
|
+
};
|
|
7
|
+
const sum = (pointIndices, getValue) => {
|
|
8
|
+
let result = 0;
|
|
9
|
+
for (const i of pointIndices) {
|
|
10
|
+
result += getValue(i);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
const mean = (pointIndices, getValue) => {
|
|
15
|
+
if (pointIndices.length === 0) {
|
|
16
|
+
return NaN;
|
|
17
|
+
}
|
|
18
|
+
return sum(pointIndices, getValue) / pointIndices.length;
|
|
19
|
+
};
|
|
20
|
+
const min = (pointIndices, getValue) => {
|
|
21
|
+
let result = Infinity;
|
|
22
|
+
for (const i of pointIndices) {
|
|
23
|
+
const value = getValue(i);
|
|
24
|
+
if (value < result) {
|
|
25
|
+
result = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
const max = (pointIndices, getValue) => {
|
|
31
|
+
let result = -Infinity;
|
|
32
|
+
for (const i of pointIndices) {
|
|
33
|
+
const value = getValue(i);
|
|
34
|
+
if (value > result) {
|
|
35
|
+
result = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
export const BUILT_IN_OPERATIONS = {
|
|
41
|
+
COUNT: count,
|
|
42
|
+
SUM: sum,
|
|
43
|
+
MEAN: mean,
|
|
44
|
+
MIN: min,
|
|
45
|
+
MAX: max
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Performs the aggregation step. See interface Aggregator comments.
|
|
49
|
+
* @returns Floa32Array of aggregated values, one for each bin, and the [min,max] of the values
|
|
50
|
+
*/
|
|
51
|
+
export function aggregate({ bins, getValue, operation, target }) {
|
|
52
|
+
if (!target || target.length < bins.length) {
|
|
53
|
+
target = new Float32Array(bins.length);
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
56
|
+
let min = Infinity;
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
58
|
+
let max = -Infinity;
|
|
59
|
+
for (let j = 0; j < bins.length; j++) {
|
|
60
|
+
const { points } = bins[j];
|
|
61
|
+
target[j] = operation(points, getValue);
|
|
62
|
+
if (target[j] < min)
|
|
63
|
+
min = target[j];
|
|
64
|
+
if (target[j] > max)
|
|
65
|
+
max = target[j];
|
|
66
|
+
}
|
|
67
|
+
return { value: target, domain: [min, max] };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=aggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../../src/common/aggregator/cpu-aggregator/aggregate.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAapC,MAAM,KAAK,GAAoB,YAAY,CAAC,EAAE;IAC5C,OAAO,YAAY,CAAC,MAAM,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,GAAG,GAAoB,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE;IACtD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC7B,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,IAAI,GAAoB,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE;IACvD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC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AQ,CAAC;IACnB,wDAAwD;IACxD,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG;YAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG;YAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { _deepEqual as deepEqual } from '@deck.gl/core';
|
|
5
|
+
import { sortBins, packBinIds } from "./sort-bins.js";
|
|
6
|
+
import { aggregate, BUILT_IN_OPERATIONS } from "./aggregate.js";
|
|
7
|
+
import { evaluateVertexAccessor } from "./vertex-accessor.js";
|
|
8
|
+
/** An Aggregator implementation that calculates aggregation on the CPU */
|
|
9
|
+
export class CPUAggregator {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
this.bins = [];
|
|
12
|
+
this.binIds = null;
|
|
13
|
+
this.results = [];
|
|
14
|
+
this.dimensions = props.dimensions;
|
|
15
|
+
this.channelCount = props.getValue.length;
|
|
16
|
+
this.props = {
|
|
17
|
+
...props,
|
|
18
|
+
binOptions: {},
|
|
19
|
+
pointCount: 0,
|
|
20
|
+
operations: [],
|
|
21
|
+
customOperations: [],
|
|
22
|
+
attributes: {}
|
|
23
|
+
};
|
|
24
|
+
this.needsUpdate = true;
|
|
25
|
+
this.setProps(props);
|
|
26
|
+
}
|
|
27
|
+
destroy() { }
|
|
28
|
+
get binCount() {
|
|
29
|
+
return this.bins.length;
|
|
30
|
+
}
|
|
31
|
+
/** Update aggregation props */
|
|
32
|
+
// eslint-disable-next-line complexity
|
|
33
|
+
setProps(props) {
|
|
34
|
+
const oldProps = this.props;
|
|
35
|
+
if (props.binOptions) {
|
|
36
|
+
if (!deepEqual(props.binOptions, oldProps.binOptions, 2)) {
|
|
37
|
+
this.setNeedsUpdate();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (props.operations) {
|
|
41
|
+
for (let channel = 0; channel < this.channelCount; channel++) {
|
|
42
|
+
if (props.operations[channel] !== oldProps.operations[channel]) {
|
|
43
|
+
this.setNeedsUpdate(channel);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (props.customOperations) {
|
|
48
|
+
for (let channel = 0; channel < this.channelCount; channel++) {
|
|
49
|
+
if (Boolean(props.customOperations[channel]) !== Boolean(oldProps.customOperations[channel])) {
|
|
50
|
+
this.setNeedsUpdate(channel);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (props.pointCount !== undefined && props.pointCount !== oldProps.pointCount) {
|
|
55
|
+
this.setNeedsUpdate();
|
|
56
|
+
}
|
|
57
|
+
if (props.attributes) {
|
|
58
|
+
props.attributes = { ...oldProps.attributes, ...props.attributes };
|
|
59
|
+
}
|
|
60
|
+
Object.assign(this.props, props);
|
|
61
|
+
}
|
|
62
|
+
/** Flags a channel to need update
|
|
63
|
+
* This is called internally by setProps() if certain props change
|
|
64
|
+
* Users of this class still need to manually set the dirty flag sometimes, because even if no props changed
|
|
65
|
+
* the underlying buffers could have been updated and require rerunning the aggregation
|
|
66
|
+
* @param {number} channel - mark the given channel as dirty. If not provided, all channels will be updated.
|
|
67
|
+
*/
|
|
68
|
+
setNeedsUpdate(channel) {
|
|
69
|
+
if (channel === undefined) {
|
|
70
|
+
this.needsUpdate = true;
|
|
71
|
+
}
|
|
72
|
+
else if (this.needsUpdate !== true) {
|
|
73
|
+
this.needsUpdate = this.needsUpdate || [];
|
|
74
|
+
this.needsUpdate[channel] = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Run aggregation */
|
|
78
|
+
update() {
|
|
79
|
+
if (this.needsUpdate === true) {
|
|
80
|
+
this.bins = sortBins({
|
|
81
|
+
pointCount: this.props.pointCount,
|
|
82
|
+
getBinId: evaluateVertexAccessor(this.props.getBin, this.props.attributes, this.props.binOptions)
|
|
83
|
+
});
|
|
84
|
+
const value = packBinIds({
|
|
85
|
+
bins: this.bins,
|
|
86
|
+
dimensions: this.dimensions,
|
|
87
|
+
// Reuse allocated typed array
|
|
88
|
+
target: this.binIds?.value
|
|
89
|
+
});
|
|
90
|
+
this.binIds = { value, type: 'float32', size: this.dimensions };
|
|
91
|
+
}
|
|
92
|
+
for (let channel = 0; channel < this.channelCount; channel++) {
|
|
93
|
+
if (this.needsUpdate === true || this.needsUpdate[channel]) {
|
|
94
|
+
const operation = this.props.customOperations[channel] ||
|
|
95
|
+
BUILT_IN_OPERATIONS[this.props.operations[channel]];
|
|
96
|
+
const { value, domain } = aggregate({
|
|
97
|
+
bins: this.bins,
|
|
98
|
+
getValue: evaluateVertexAccessor(this.props.getValue[channel], this.props.attributes, undefined),
|
|
99
|
+
operation,
|
|
100
|
+
// Reuse allocated typed array
|
|
101
|
+
target: this.results[channel]?.value
|
|
102
|
+
});
|
|
103
|
+
this.results[channel] = { value, domain, type: 'float32', size: 1 };
|
|
104
|
+
this.props.onUpdate?.({ channel });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.needsUpdate = false;
|
|
108
|
+
}
|
|
109
|
+
preDraw() { }
|
|
110
|
+
/** Returns an accessor to the bins. */
|
|
111
|
+
getBins() {
|
|
112
|
+
return this.binIds;
|
|
113
|
+
}
|
|
114
|
+
/** Returns an accessor to the output for a given channel. */
|
|
115
|
+
getResult(channel) {
|
|
116
|
+
return this.results[channel];
|
|
117
|
+
}
|
|
118
|
+
/** Returns the [min, max] of aggregated values for a given channel. */
|
|
119
|
+
getResultDomain(channel) {
|
|
120
|
+
return this.results[channel]?.domain ?? [Infinity, -Infinity];
|
|
121
|
+
}
|
|
122
|
+
/** Returns the information for a given bin. */
|
|
123
|
+
getBin(index) {
|
|
124
|
+
const bin = this.bins[index];
|
|
125
|
+
if (!bin) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const value = new Array(this.channelCount);
|
|
129
|
+
for (let i = 0; i < value.length; i++) {
|
|
130
|
+
const result = this.results[i];
|
|
131
|
+
value[i] = result?.value[index];
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
id: bin.id,
|
|
135
|
+
value,
|
|
136
|
+
count: bin.points.length,
|
|
137
|
+
pointIndices: bin.points
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=cpu-aggregator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cpu-aggregator.js","sourceRoot":"","sources":["../../../../src/common/aggregator/cpu-aggregator/cpu-aggregator.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,UAAU,IAAI,SAAS,EAAkB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,uBAAoB;AACjD,OAAO,EAAC,SAAS,EAAmB,mBAAmB,EAAC,uBAAoB;AAC5E,OAAO,EAAiB,sBAAsB,EAAC,6BAA0B;AA2BzE,0EAA0E;AAC1E,MAAM,OAAO,aAAa;IAmBxB,YAAY,KAAyB;QAP3B,SAAI,GAAU,EAAE,CAAC;QACjB,WAAM,GAAqD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,MAAM;YACxB,YAAY,EAAE,GAAG,CAAC,MAAM;SACzB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/** Group data points into bins */
|
|
5
|
+
export function sortBins({ pointCount, getBinId }) {
|
|
6
|
+
const binsById = new Map();
|
|
7
|
+
for (let i = 0; i < pointCount; i++) {
|
|
8
|
+
const id = getBinId(i);
|
|
9
|
+
if (id === null) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
let bin = binsById.get(String(id));
|
|
13
|
+
if (bin) {
|
|
14
|
+
bin.points.push(i);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
bin = {
|
|
18
|
+
id,
|
|
19
|
+
index: binsById.size,
|
|
20
|
+
points: [i]
|
|
21
|
+
};
|
|
22
|
+
binsById.set(String(id), bin);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return Array.from(binsById.values());
|
|
26
|
+
}
|
|
27
|
+
/** Pack bin ids into a typed array */
|
|
28
|
+
export function packBinIds({ bins, dimensions, target }) {
|
|
29
|
+
const targetLength = bins.length * dimensions;
|
|
30
|
+
if (!target || target.length < targetLength) {
|
|
31
|
+
target = new Float32Array(targetLength);
|
|
32
|
+
}
|
|
33
|
+
for (let i = 0; i < bins.length; i++) {
|
|
34
|
+
const { id } = bins[i];
|
|
35
|
+
if (Array.isArray(id)) {
|
|
36
|
+
target.set(id, i * dimensions);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
target[i] = id;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=sort-bins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-bins.js","sourceRoot":"","sources":["../../../../src/common/aggregator/cpu-aggregator/sort-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GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,EAAC,EAAE,EAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/** Evaluate a VertexAccessor with a set of attributes */
|
|
5
|
+
export function evaluateVertexAccessor(accessor, attributes, options) {
|
|
6
|
+
const vertexReaders = {};
|
|
7
|
+
for (const id of accessor.sources || []) {
|
|
8
|
+
const attribute = attributes[id];
|
|
9
|
+
if (attribute) {
|
|
10
|
+
vertexReaders[id] = getVertexReader(attribute);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw new Error(`Cannot find attribute ${id}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const data = {};
|
|
17
|
+
return (vertexIndex) => {
|
|
18
|
+
for (const id in vertexReaders) {
|
|
19
|
+
data[id] = vertexReaders[id](vertexIndex);
|
|
20
|
+
}
|
|
21
|
+
return accessor.getValue(data, vertexIndex, options);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Read value out of a deck.gl Attribute by vertex */
|
|
25
|
+
function getVertexReader(attribute) {
|
|
26
|
+
const value = attribute.value;
|
|
27
|
+
const { offset = 0, stride, size } = attribute.getAccessor();
|
|
28
|
+
const bytesPerElement = value.BYTES_PER_ELEMENT;
|
|
29
|
+
const elementOffset = offset / bytesPerElement;
|
|
30
|
+
const elementStride = stride ? stride / bytesPerElement : size;
|
|
31
|
+
if (size === 1) {
|
|
32
|
+
// Size 1, returns (i: number) => number
|
|
33
|
+
if (attribute.isConstant) {
|
|
34
|
+
return () => value[0];
|
|
35
|
+
}
|
|
36
|
+
return (vertexIndex) => {
|
|
37
|
+
const i = elementOffset + elementStride * vertexIndex;
|
|
38
|
+
return value[i];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Size >1, returns (i: number) => number[]
|
|
42
|
+
let result;
|
|
43
|
+
if (attribute.isConstant) {
|
|
44
|
+
result = Array.from(value);
|
|
45
|
+
return () => result;
|
|
46
|
+
}
|
|
47
|
+
result = new Array(size);
|
|
48
|
+
return (vertexIndex) => {
|
|
49
|
+
const i = elementOffset + elementStride * vertexIndex;
|
|
50
|
+
for (let j = 0; j < size; j++) {
|
|
51
|
+
result[j] = value[i + j];
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=vertex-accessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex-accessor.js","sourceRoot":"","sources":["../../../../src/common/aggregator/cpu-aggregator/vertex-accessor.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAwBpC,yDAAyD;AACzD,MAAM,UAAU,sBAAsB,CACpC,QAA0C,EAC1C,UAAqC,EACrC,OAAiB;IAEjB,MAAM,aAAa,GAAqD,EAAE,CAAC;IAC3E,KAAK,MAAM,EAAE,IAAI,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,SAAS,EAAE,CAAC;YACd,aAAa,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,EA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AAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;IACtB,CAAC;IAED,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,CAAC,WAAmB,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,aAAa,GAAG,aAAa,GAAG,WAAW,CAAC;QACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const uniformBlock = /* glsl */ `\
|
|
5
|
+
layout(std140) uniform aggregatorTransformUniforms {
|
|
6
|
+
ivec4 binIdRange;
|
|
7
|
+
bvec3 isCount;
|
|
8
|
+
bvec3 isMean;
|
|
9
|
+
float naN;
|
|
10
|
+
} aggregatorTransform;
|
|
11
|
+
`;
|
|
12
|
+
export const aggregatorTransformUniforms = {
|
|
13
|
+
name: 'aggregatorTransform',
|
|
14
|
+
vs: uniformBlock,
|
|
15
|
+
uniformTypes: {
|
|
16
|
+
binIdRange: 'vec4<i32>',
|
|
17
|
+
isCount: 'vec3<f32>',
|
|
18
|
+
isMean: 'vec3<f32>',
|
|
19
|
+
naN: 'f32'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=aggregation-transform-uniforms.js.map
|
package/dist.webgl-only/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregation-transform-uniforms.js","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAMpC,MAAM,YAAY,GAAG,UAAU,CAAC;;;;;;;CAO/B,CAAC;AAUF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,qBAAqB;IAC3B,EAAE,EAAE,YAAY;IAChB,YAAY,EAAE;QACZ,UAAU,EAAE,WAAW;QACvB,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,WAAW;QACnB,GAAG,EAAE,KAAK;KACX;CACwD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const uniformBlock = /* glsl */ `\
|
|
5
|
+
layout(std140) uniform binSorterUniforms {
|
|
6
|
+
ivec4 binIdRange;
|
|
7
|
+
ivec2 targetSize;
|
|
8
|
+
} binSorter;
|
|
9
|
+
`;
|
|
10
|
+
export const binSorterUniforms = {
|
|
11
|
+
name: 'binSorter',
|
|
12
|
+
vs: uniformBlock,
|
|
13
|
+
uniformTypes: {
|
|
14
|
+
binIdRange: 'vec4<i32>',
|
|
15
|
+
targetSize: 'vec2<i32>'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=bin-sorter-uniforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-sorter-uniforms.js","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAKpC,MAAM,YAAY,GAAG,UAAU,CAAC;;;;;CAK/B,CAAC;AAOF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,YAAY;IAChB,YAAY,EAAE;QACZ,UAAU,EAAE,WAAW;QACvB,UAAU,EAAE,WAAW;KACxB;CAC8C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// deck.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Create a float texture to store aggregation result
|
|
6
|
+
*/
|
|
7
|
+
export function createRenderTarget(device, width, height) {
|
|
8
|
+
return device.createFramebuffer({
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
colorAttachments: [
|
|
12
|
+
device.createTexture({
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
format: 'rgba32float',
|
|
16
|
+
sampler: {
|
|
17
|
+
minFilter: 'nearest',
|
|
18
|
+
magFilter: 'nearest'
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/common/aggregator/gpu-aggregator/utils.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,KAAa,EAAE,MAAc;IAC9E,OAAO,MAAM,CAAC,iBAAiB,CAAC;QAC9B,KAAK;QACL,MAAM;QACN,gBAAgB,EAAE;YAChB,MAAM,CAAC,aAAa,CAAC;gBACnB,KAAK;gBACL,MAAM;gBACN,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE;oBACP,SAAS,EAAE,SAAS;oBACpB,SAAS,EAAE,SAAS;iBACrB;aACF,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC"}
|