@deck.gl/aggregation-layers 9.0.0-beta.5 → 9.0.0-beta.6
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/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +2 -3
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +1 -2
- package/dist/dist.dev.js +265 -314
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +2 -6
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +50 -79
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +4 -4
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +4 -4
- package/dist/grid-aggregation-layer.js +1 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts +0 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +4 -20
- package/dist/heatmap-layer/max-fs.glsl.js +2 -2
- package/dist/heatmap-layer/max-vs.glsl.js +6 -10
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +15 -25
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -16
- package/dist/heatmap-layer/weights-fs.glsl.js +7 -11
- package/dist/heatmap-layer/weights-vs.glsl.js +7 -12
- package/dist/hexagon-layer/hexagon-layer.d.ts +1 -1
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +1 -2
- package/dist/index.cjs +223 -390
- package/dist/index.cjs.map +3 -3
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -2
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +0 -3
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -10
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +30 -42
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +0 -3
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +1 -8
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +6 -9
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +14 -25
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +2 -6
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +25 -42
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +8 -8
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +13 -24
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +4 -9
- package/dist.min.js +212 -330
- package/package.json +7 -7
- 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.ts +5 -23
- 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 +4 -15
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "deck.gl layers that aggregate the input data into alternative representations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.0-beta.
|
|
6
|
+
"version": "9.0.0-beta.6",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
|
-
"@luma.gl/constants": "9.0.0-beta.
|
|
43
|
-
"@luma.gl/core": "9.0.0-beta.
|
|
44
|
-
"@luma.gl/shadertools": "9.0.0-beta.
|
|
42
|
+
"@luma.gl/constants": "9.0.0-beta.6",
|
|
43
|
+
"@luma.gl/core": "9.0.0-beta.6",
|
|
44
|
+
"@luma.gl/shadertools": "9.0.0-beta.6",
|
|
45
45
|
"@math.gl/web-mercator": "^4.0.0",
|
|
46
46
|
"d3-hexbin": "^0.2.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@deck.gl/core": "^9.0.0-alpha",
|
|
50
50
|
"@deck.gl/layers": "^9.0.0-alpha",
|
|
51
|
-
"@luma.gl/core": "9.0.0-beta.
|
|
52
|
-
"@luma.gl/engine": "9.0.0-beta.
|
|
51
|
+
"@luma.gl/core": "9.0.0-beta.6",
|
|
52
|
+
"@luma.gl/engine": "9.0.0-beta.6"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "373729308eb3fdec4b7c8b5842ddeff4f2d70338"
|
|
55
55
|
}
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
import {GL} from '@luma.gl/constants';
|
|
22
21
|
import {LineLayer, SolidPolygonLayer} from '@deck.gl/layers';
|
|
23
22
|
import {generateContours} from './contour-utils';
|
|
24
23
|
import {
|
|
@@ -185,7 +184,7 @@ export default class ContourLayer<
|
|
|
185
184
|
[POSITION_ATTRIBUTE_NAME]: {
|
|
186
185
|
size: 3,
|
|
187
186
|
accessor: 'getPosition',
|
|
188
|
-
type:
|
|
187
|
+
type: 'float64',
|
|
189
188
|
fp64: this.use64bitPositions()
|
|
190
189
|
},
|
|
191
190
|
// this attribute is used in gpu aggregation path only
|
|
@@ -351,7 +350,7 @@ export default class ContourLayer<
|
|
|
351
350
|
let {aggregationData} = count;
|
|
352
351
|
if (!aggregationData) {
|
|
353
352
|
// @ts-ignore
|
|
354
|
-
aggregationData = count.aggregationBuffer!.
|
|
353
|
+
aggregationData = count.aggregationBuffer!.readSyncWebGL() as Float32Array;
|
|
355
354
|
count.aggregationData = aggregationData;
|
|
356
355
|
}
|
|
357
356
|
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
import {GL} from '@luma.gl/constants';
|
|
22
21
|
import {GridCellLayer} from '@deck.gl/layers';
|
|
23
22
|
import {Accessor, AccessorFunction, Color, Position, Material, DefaultProps} from '@deck.gl/core';
|
|
24
23
|
|
|
@@ -261,7 +260,7 @@ export default class CPUGridLayer<
|
|
|
261
260
|
};
|
|
262
261
|
const attributeManager = this.getAttributeManager()!;
|
|
263
262
|
attributeManager.add({
|
|
264
|
-
positions: {size: 3, type:
|
|
263
|
+
positions: {size: 3, type: 'float64', accessor: 'getPosition'}
|
|
265
264
|
});
|
|
266
265
|
// color and elevation attributes can't be added as attributes
|
|
267
266
|
// they are calcualted using 'getValue' accessor that takes an array of pints.
|
|
@@ -192,7 +192,7 @@ export default class GPUGridCellLayer extends Layer<_GPUGridCellLayerProps> {
|
|
|
192
192
|
// @ts-expect-error TODO v9 This code is not portable to WebGPU
|
|
193
193
|
const programHandle = model.pipeline.handle;
|
|
194
194
|
|
|
195
|
-
const gl = this.context.gl
|
|
195
|
+
const gl = this.context.gl;
|
|
196
196
|
const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
|
|
197
197
|
const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
|
|
198
198
|
gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
|
|
@@ -167,7 +167,7 @@ export type _GPUGridLayerProps<DataT> = {
|
|
|
167
167
|
getElevationWeight?: Accessor<DataT, number>;
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU
|
|
170
|
+
/** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
|
|
171
171
|
export default class GPUGridLayer<
|
|
172
172
|
DataT = any,
|
|
173
173
|
ExtraPropsT extends {} = {}
|
|
@@ -221,7 +221,7 @@ export default class GPUGridLayer<
|
|
|
221
221
|
[POSITION_ATTRIBUTE_NAME]: {
|
|
222
222
|
size: 3,
|
|
223
223
|
accessor: 'getPosition',
|
|
224
|
-
type:
|
|
224
|
+
type: 'float64',
|
|
225
225
|
fp64: this.use64bitPositions()
|
|
226
226
|
},
|
|
227
227
|
color: {size: 3, accessor: 'getColorWeight'},
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
getTextureCoordinates
|
|
28
28
|
} from './heatmap-layer-utils';
|
|
29
29
|
import {Buffer, DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';
|
|
30
|
-
import {GL} from '@luma.gl/constants';
|
|
31
30
|
import {TextureTransform, TextureTransformProps} from '@luma.gl/engine';
|
|
32
31
|
import {
|
|
33
32
|
Accessor,
|
|
@@ -83,14 +82,9 @@ const defaultProps: DefaultProps<HeatmapLayerProps> = {
|
|
|
83
82
|
debounceTimeout: {type: 'number', min: 0, max: 1000, value: 500}
|
|
84
83
|
};
|
|
85
84
|
|
|
86
|
-
const REQUIRED_FEATURES: DeviceFeature[] = [
|
|
87
|
-
'blend-minmax-webgl1', // max weight calculation
|
|
88
|
-
'texture-formats-float32-webgl1' // weight-map as texture
|
|
89
|
-
];
|
|
90
|
-
|
|
91
85
|
const FLOAT_TARGET_FEATURES: DeviceFeature[] = [
|
|
92
|
-
'
|
|
93
|
-
'texture-blend-float-
|
|
86
|
+
'float32-renderable-webgl', // ability to render to float texture
|
|
87
|
+
'texture-blend-float-webgl' // ability to blend when rendering to float texture
|
|
94
88
|
];
|
|
95
89
|
|
|
96
90
|
const DIMENSIONS = {
|
|
@@ -187,7 +181,6 @@ export default class HeatmapLayer<
|
|
|
187
181
|
static defaultProps = defaultProps;
|
|
188
182
|
|
|
189
183
|
state!: AggregationLayer<DataT>['state'] & {
|
|
190
|
-
supported: boolean;
|
|
191
184
|
colorDomain?: number[];
|
|
192
185
|
isWeightMapDirty?: boolean;
|
|
193
186
|
weightsTexture?: Texture;
|
|
@@ -209,13 +202,8 @@ export default class HeatmapLayer<
|
|
|
209
202
|
};
|
|
210
203
|
|
|
211
204
|
initializeState() {
|
|
212
|
-
if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {
|
|
213
|
-
this.setState({supported: false});
|
|
214
|
-
log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
205
|
super.initializeAggregationLayer(DIMENSIONS);
|
|
218
|
-
this.setState({
|
|
206
|
+
this.setState({colorDomain: DEFAULT_COLOR_DOMAIN});
|
|
219
207
|
this._setupTextureParams();
|
|
220
208
|
this._setupAttributes();
|
|
221
209
|
this._setupResources();
|
|
@@ -228,9 +216,6 @@ export default class HeatmapLayer<
|
|
|
228
216
|
|
|
229
217
|
/* eslint-disable max-statements,complexity */
|
|
230
218
|
updateState(opts: UpdateParameters<this>) {
|
|
231
|
-
if (!this.state.supported) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
219
|
super.updateState(opts);
|
|
235
220
|
this._updateHeatmapState(opts);
|
|
236
221
|
}
|
|
@@ -266,9 +251,6 @@ export default class HeatmapLayer<
|
|
|
266
251
|
}
|
|
267
252
|
|
|
268
253
|
renderLayers(): LayersList | Layer {
|
|
269
|
-
if (!this.state.supported) {
|
|
270
|
-
return [];
|
|
271
|
-
}
|
|
272
254
|
const {
|
|
273
255
|
weightsTexture,
|
|
274
256
|
triPositionBuffer,
|
|
@@ -387,7 +369,7 @@ export default class HeatmapLayer<
|
|
|
387
369
|
_setupAttributes() {
|
|
388
370
|
const attributeManager = this.getAttributeManager()!;
|
|
389
371
|
attributeManager.add({
|
|
390
|
-
positions: {size: 3, type:
|
|
372
|
+
positions: {size: 3, type: 'float64', accessor: 'getPosition'},
|
|
391
373
|
weights: {size: 1, accessor: 'getWeight'}
|
|
392
374
|
});
|
|
393
375
|
this.setState({positionAttributeName: 'positions'});
|
|
@@ -397,7 +379,7 @@ export default class HeatmapLayer<
|
|
|
397
379
|
const {device} = this.context;
|
|
398
380
|
const {weightsTextureSize} = this.props;
|
|
399
381
|
|
|
400
|
-
const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D
|
|
382
|
+
const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D);
|
|
401
383
|
const floatTargetSupport = FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));
|
|
402
384
|
const format: TextureFormat = floatTargetSupport ? 'rgba32float' : 'rgba8unorm';
|
|
403
385
|
const weightsScale = floatTargetSupport ? 1 : 1 / 255;
|
|
@@ -29,7 +29,6 @@ import {
|
|
|
29
29
|
DefaultProps
|
|
30
30
|
} from '@deck.gl/core';
|
|
31
31
|
import {ColumnLayer} from '@deck.gl/layers';
|
|
32
|
-
import {GL} from '@luma.gl/constants';
|
|
33
32
|
|
|
34
33
|
import {defaultColorRange} from '../utils/color-utils';
|
|
35
34
|
|
|
@@ -249,7 +248,7 @@ type _HexagonLayerProps<DataT = unknown> = {
|
|
|
249
248
|
/** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
|
|
250
249
|
export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<
|
|
251
250
|
DataT,
|
|
252
|
-
ExtraPropsT & Required<_HexagonLayerProps
|
|
251
|
+
ExtraPropsT & Required<_HexagonLayerProps<DataT>>
|
|
253
252
|
> {
|
|
254
253
|
static layerName = 'HexagonLayer';
|
|
255
254
|
static defaultProps = defaultProps;
|
|
@@ -272,7 +271,7 @@ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends Ag
|
|
|
272
271
|
};
|
|
273
272
|
const attributeManager = this.getAttributeManager()!;
|
|
274
273
|
attributeManager.add({
|
|
275
|
-
positions: {size: 3, type:
|
|
274
|
+
positions: {size: 3, type: 'float64', accessor: 'getPosition'}
|
|
276
275
|
});
|
|
277
276
|
// color and elevation attributes can't be added as attributes
|
|
278
277
|
// they are calculated using 'getValue' accessor that takes an array of pints.
|
|
@@ -54,10 +54,6 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
54
54
|
static layerName = 'ScreenGridCellLayer';
|
|
55
55
|
static defaultProps = defaultProps;
|
|
56
56
|
|
|
57
|
-
static isSupported(device: Device) {
|
|
58
|
-
return device.features.has('texture-formats-float32-webgl1');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
57
|
state!: {
|
|
62
58
|
model?: Model;
|
|
63
59
|
};
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
DefaultProps
|
|
33
33
|
} from '@deck.gl/core';
|
|
34
34
|
import type {Buffer, Texture} from '@luma.gl/core';
|
|
35
|
-
import {GL} from '@luma.gl/constants';
|
|
36
35
|
import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
|
|
37
36
|
import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
|
|
38
37
|
import ScreenGridCellLayer from './screen-grid-cell-layer';
|
|
@@ -121,9 +120,6 @@ export type _ScreenGridLayerProps<DataT> = {
|
|
|
121
120
|
/**
|
|
122
121
|
* Perform aggregation is performed on GPU.
|
|
123
122
|
*
|
|
124
|
-
* NOTE: GPU Aggregation requires WebGL2 support by the browser.
|
|
125
|
-
* When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
|
|
126
|
-
*
|
|
127
123
|
* @default true
|
|
128
124
|
*/
|
|
129
125
|
gpuAggregation?: boolean;
|
|
@@ -157,12 +153,6 @@ export default class ScreenGridLayer<
|
|
|
157
153
|
};
|
|
158
154
|
|
|
159
155
|
initializeState() {
|
|
160
|
-
if (!ScreenGridCellLayer.isSupported(this.context.device)) {
|
|
161
|
-
// max aggregated value is sampled from a float texture
|
|
162
|
-
this.setState({supported: false});
|
|
163
|
-
log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
156
|
super.initializeAggregationLayer({
|
|
167
157
|
dimensions: DIMENSIONS,
|
|
168
158
|
// @ts-expect-error
|
|
@@ -191,7 +181,7 @@ export default class ScreenGridLayer<
|
|
|
191
181
|
[POSITION_ATTRIBUTE_NAME]: {
|
|
192
182
|
size: 3,
|
|
193
183
|
accessor: 'getPosition',
|
|
194
|
-
type:
|
|
184
|
+
type: 'float64',
|
|
195
185
|
fp64: this.use64bitPositions()
|
|
196
186
|
},
|
|
197
187
|
// this attribute is used in gpu aggregation path only
|
|
@@ -51,11 +51,8 @@ const ARRAY_BUFFER_MAP = {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const REQUIRED_FEATURES: DeviceFeature[] = [
|
|
54
|
-
'
|
|
55
|
-
'blend-
|
|
56
|
-
'texture-renderable-float32-webgl',
|
|
57
|
-
'texture-blend-float-webgl1',
|
|
58
|
-
'texture-formats-float32-webgl1'
|
|
54
|
+
'float32-renderable-webgl',
|
|
55
|
+
'texture-blend-float-webgl'
|
|
59
56
|
];
|
|
60
57
|
|
|
61
58
|
export type GPUGridAggregatorProps = {
|
|
@@ -179,15 +176,10 @@ export default class GPUGridAggregator {
|
|
|
179
176
|
this.device = device;
|
|
180
177
|
|
|
181
178
|
const REQUIRED_FEATURES: DeviceFeature[] = [
|
|
182
|
-
'
|
|
183
|
-
'texture-renderable-float32-webgl', // render to float texture
|
|
184
|
-
'texture-formats-float32-webgl1' // sample from a float texture
|
|
179
|
+
'float32-renderable-webgl' // render to float texture
|
|
185
180
|
];
|
|
186
181
|
|
|
187
|
-
|
|
188
|
-
this._hasGPUSupport =
|
|
189
|
-
this.device.info.type === 'webgl2' &&
|
|
190
|
-
REQUIRED_FEATURES.every(feature => device.features.has(feature));
|
|
182
|
+
this._hasGPUSupport = REQUIRED_FEATURES.every(feature => device.features.has(feature));
|
|
191
183
|
if (this._hasGPUSupport) {
|
|
192
184
|
this._setupModels();
|
|
193
185
|
}
|
|
@@ -226,9 +218,6 @@ export default class GPUGridAggregator {
|
|
|
226
218
|
// reset results
|
|
227
219
|
this.setState({results: {}});
|
|
228
220
|
const aggregationParams = this._normalizeAggregationParams(opts);
|
|
229
|
-
if (!this._hasGPUSupport) {
|
|
230
|
-
log.log(1, 'GPUGridAggregator: not supported')();
|
|
231
|
-
}
|
|
232
221
|
return this._runAggregation(aggregationParams);
|
|
233
222
|
}
|
|
234
223
|
|