@deck.gl/aggregation-layers 8.10.0-alpha.7 → 9.0.0-alpha.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/dist.dev.js +9369 -356
- package/dist/es5/aggregation-layer.js +4 -6
- package/dist/es5/aggregation-layer.js.map +1 -1
- package/dist/es5/contour-layer/contour-layer.js +13 -2
- package/dist/es5/contour-layer/contour-layer.js.map +1 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +12 -1
- package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/es5/cpu-grid-layer/grid-aggregator.js +12 -8
- package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +27 -13
- package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +19 -10
- package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/es5/grid-aggregation-layer.js +7 -9
- package/dist/es5/grid-aggregation-layer.js.map +1 -1
- package/dist/es5/grid-layer/grid-layer.js +1 -1
- package/dist/es5/grid-layer/grid-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js +3 -3
- package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/es5/heatmap-layer/heatmap-layer.js +58 -55
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/triangle-layer.js +22 -12
- package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +1 -1
- package/dist/es5/hexagon-layer/hexagon-layer.js +2 -0
- package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +23 -20
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +6 -6
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/es5/utils/aggregation-operation-utils.js.map +1 -1
- package/dist/es5/utils/bin-sorter.js.map +1 -1
- package/dist/es5/utils/cpu-aggregator.js +11 -7
- package/dist/es5/utils/cpu-aggregator.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +7 -2
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +83 -60
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/dist/es5/utils/grid-aggregation-utils.js.map +1 -1
- package/dist/es5/utils/prop-utils.js.map +1 -1
- package/dist/es5/utils/resource-utils.js +12 -23
- package/dist/es5/utils/resource-utils.js.map +1 -1
- package/dist/esm/aggregation-layer.js +4 -5
- package/dist/esm/aggregation-layer.js.map +1 -1
- package/dist/esm/contour-layer/contour-layer.js +7 -1
- package/dist/esm/contour-layer/contour-layer.js.map +1 -1
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -0
- package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
- package/dist/esm/cpu-grid-layer/grid-aggregator.js +2 -1
- package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +19 -10
- package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +13 -10
- package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
- package/dist/esm/grid-aggregation-layer.js +4 -8
- package/dist/esm/grid-aggregation-layer.js.map +1 -1
- package/dist/esm/grid-layer/grid-layer.js +1 -1
- package/dist/esm/grid-layer/grid-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js +3 -3
- package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +40 -58
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer.js +13 -7
- package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
- package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +1 -1
- package/dist/esm/hexagon-layer/hexagon-layer.js +1 -0
- package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +21 -24
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +5 -8
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/esm/utils/aggregation-operation-utils.js.map +1 -1
- package/dist/esm/utils/bin-sorter.js.map +1 -1
- package/dist/esm/utils/cpu-aggregator.js +11 -7
- package/dist/esm/utils/cpu-aggregator.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +4 -3
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +62 -51
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
- package/dist/esm/utils/grid-aggregation-utils.js.map +1 -1
- package/dist/esm/utils/prop-utils.js.map +1 -1
- package/dist/esm/utils/resource-utils.js +10 -17
- package/dist/esm/utils/resource-utils.js.map +1 -1
- package/dist.min.js +185 -30
- package/package.json +7 -5
- package/src/aggregation-layer.ts +7 -6
- package/src/contour-layer/contour-layer.ts +25 -9
- package/src/cpu-grid-layer/cpu-grid-layer.ts +8 -3
- package/src/cpu-grid-layer/{grid-aggregator.js → grid-aggregator.ts} +28 -4
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +38 -27
- package/src/gpu-grid-layer/gpu-grid-layer.ts +18 -12
- package/src/grid-aggregation-layer.ts +39 -13
- package/src/grid-layer/grid-layer.ts +2 -2
- package/src/heatmap-layer/heatmap-layer-utils.ts +10 -4
- package/src/heatmap-layer/heatmap-layer.ts +74 -67
- package/src/heatmap-layer/triangle-layer.ts +26 -22
- package/src/hexagon-layer/{hexagon-aggregator.js → hexagon-aggregator.ts} +5 -1
- package/src/hexagon-layer/hexagon-layer.ts +8 -5
- package/src/index.ts +0 -1
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +36 -33
- package/src/screen-grid-layer/screen-grid-layer.ts +12 -11
- package/src/utils/{aggregation-operation-utils.js → aggregation-operation-utils.ts} +8 -2
- package/src/utils/bin-sorter.ts +1 -1
- package/src/utils/{cpu-aggregator.js → cpu-aggregator.ts} +42 -30
- package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-constants.js → gpu-grid-aggregator-constants.ts} +4 -4
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +3 -3
- package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator.js → gpu-grid-aggregator.ts} +123 -94
- package/src/utils/{grid-aggregation-utils.js → grid-aggregation-utils.ts} +1 -1
- package/src/utils/resource-utils.ts +59 -0
- package/typed/aggregation-layer.d.ts +4 -3
- package/typed/aggregation-layer.d.ts.map +1 -1
- package/typed/contour-layer/contour-layer.d.ts +19 -5
- package/typed/contour-layer/contour-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +8 -3
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/grid-aggregator.d.ts +16 -4
- package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +18 -4
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +8 -3
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/typed/grid-aggregation-layer.d.ts +39 -4
- package/typed/grid-aggregation-layer.d.ts.map +1 -1
- package/typed/grid-layer/grid-layer.d.ts +2 -2
- package/typed/grid-layer/grid-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts +7 -5
- package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer.d.ts +19 -6
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer.d.ts +10 -6
- package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/typed/hexagon-layer/hexagon-aggregator.d.ts +6 -3
- package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -1
- package/typed/hexagon-layer/hexagon-layer.d.ts +5 -4
- package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/typed/index.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +10 -9
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-layer.d.ts +6 -4
- package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/typed/utils/aggregation-operation-utils.d.ts +18 -12
- package/typed/utils/aggregation-operation-utils.d.ts.map +1 -1
- package/typed/utils/bin-sorter.d.ts +1 -1
- package/typed/utils/bin-sorter.d.ts.map +1 -1
- package/typed/utils/cpu-aggregator.d.ts +28 -14
- package/typed/utils/cpu-aggregator.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +35 -33
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +29 -19
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -1
- package/typed/utils/grid-aggregation-utils.d.ts +11 -5
- package/typed/utils/grid-aggregation-utils.d.ts.map +1 -1
- package/typed/utils/prop-utils.d.ts +1 -1
- package/typed/utils/prop-utils.d.ts.map +1 -1
- package/typed/utils/resource-utils.d.ts +13 -3
- package/typed/utils/resource-utils.d.ts.map +1 -1
- package/src/utils/resource-utils.js +0 -51
- /package/src/utils/gpu-grid-aggregation/{aggregate-all-fs.glsl.js → aggregate-all-fs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-all-vs.glsl.js → aggregate-all-vs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-fs.glsl.js → aggregate-to-grid-fs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{aggregate-to-grid-vs.glsl.js → aggregate-to-grid-vs.glsl.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{gpu-grid-aggregator-utils.js → gpu-grid-aggregator-utils.ts} +0 -0
- /package/src/utils/gpu-grid-aggregation/{transform-mean-vs.glsl.js → transform-mean-vs.glsl.ts} +0 -0
- /package/src/utils/{prop-utils.js → prop-utils.ts} +0 -0
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
21
|
/* global setTimeout clearTimeout */
|
|
22
|
-
import GL from '@luma.gl/constants';
|
|
23
22
|
import {
|
|
24
23
|
getBounds,
|
|
25
24
|
boundsContain,
|
|
@@ -28,15 +27,10 @@ import {
|
|
|
28
27
|
getTextureCoordinates,
|
|
29
28
|
getTextureParams
|
|
30
29
|
} from './heatmap-layer-utils';
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
getParameters,
|
|
36
|
-
withParameters,
|
|
37
|
-
FEATURES,
|
|
38
|
-
hasFeatures
|
|
39
|
-
} from '@luma.gl/core';
|
|
30
|
+
import {DeviceFeature, Texture, TextureProps, TextureFormat} from '@luma.gl/core';
|
|
31
|
+
import {GL} from '@luma.gl/constants';
|
|
32
|
+
import {Transform} from '@luma.gl/engine';
|
|
33
|
+
import {BufferWithAccessor, withGLParameters} from '@luma.gl/webgl';
|
|
40
34
|
import {
|
|
41
35
|
Accessor,
|
|
42
36
|
AccessorFunction,
|
|
@@ -61,15 +55,15 @@ import vsMax from './max-vs.glsl';
|
|
|
61
55
|
import fsMax from './max-fs.glsl';
|
|
62
56
|
|
|
63
57
|
const RESOLUTION = 2; // (number of common space pixels) / (number texels)
|
|
64
|
-
const
|
|
58
|
+
const TEXTURE_PROPS: TextureProps = {
|
|
59
|
+
format: 'rgba8unorm',
|
|
65
60
|
mipmaps: false,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
dataFormat: GL.RGBA
|
|
61
|
+
sampler: {
|
|
62
|
+
minFilter: 'nearest',
|
|
63
|
+
magFilter: 'nearest',
|
|
64
|
+
addressModeU: 'clamp-to-edge',
|
|
65
|
+
addressModeV: 'clamp-to-edge'
|
|
66
|
+
}
|
|
73
67
|
};
|
|
74
68
|
const DEFAULT_COLOR_DOMAIN = [0, 0];
|
|
75
69
|
const AGGREGATION_MODE = {
|
|
@@ -78,7 +72,7 @@ const AGGREGATION_MODE = {
|
|
|
78
72
|
};
|
|
79
73
|
|
|
80
74
|
const defaultProps: DefaultProps<HeatmapLayerProps> = {
|
|
81
|
-
getPosition: {type: 'accessor', value: x => x.position},
|
|
75
|
+
getPosition: {type: 'accessor', value: (x: any) => x.position},
|
|
82
76
|
getWeight: {type: 'accessor', value: 1},
|
|
83
77
|
intensity: {type: 'number', min: 0, value: 1},
|
|
84
78
|
radiusPixels: {type: 'number', min: 1, max: 100, value: 50},
|
|
@@ -91,14 +85,14 @@ const defaultProps: DefaultProps<HeatmapLayerProps> = {
|
|
|
91
85
|
debounceTimeout: {type: 'number', min: 0, max: 1000, value: 500}
|
|
92
86
|
};
|
|
93
87
|
|
|
94
|
-
const REQUIRED_FEATURES = [
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
const REQUIRED_FEATURES: DeviceFeature[] = [
|
|
89
|
+
'blend-minmax-webgl1', // max weight calculation
|
|
90
|
+
'texture-formats-float32-webgl1' // weight-map as texture
|
|
97
91
|
];
|
|
98
92
|
|
|
99
|
-
const FLOAT_TARGET_FEATURES = [
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const FLOAT_TARGET_FEATURES: DeviceFeature[] = [
|
|
94
|
+
'texture-renderable-float32-webgl', // ability to render to float texture
|
|
95
|
+
'texture-blend-float-webgl1' // ability to blend when rendering to float texture
|
|
102
96
|
];
|
|
103
97
|
|
|
104
98
|
const DIMENSIONS = {
|
|
@@ -107,7 +101,7 @@ const DIMENSIONS = {
|
|
|
107
101
|
}
|
|
108
102
|
};
|
|
109
103
|
|
|
110
|
-
export type HeatmapLayerProps<DataT =
|
|
104
|
+
export type HeatmapLayerProps<DataT = unknown> = _HeatmapLayerProps<DataT> &
|
|
111
105
|
AggregationLayerProps<DataT>;
|
|
112
106
|
|
|
113
107
|
type _HeatmapLayerProps<DataT> = {
|
|
@@ -198,18 +192,27 @@ export default class HeatmapLayer<
|
|
|
198
192
|
supported: boolean;
|
|
199
193
|
colorDomain?: number[];
|
|
200
194
|
isWeightMapDirty?: boolean;
|
|
201
|
-
weightsTexture?:
|
|
195
|
+
weightsTexture?: Texture;
|
|
196
|
+
maxWeightsTexture?: Texture;
|
|
197
|
+
colorTexture?: Texture;
|
|
202
198
|
zoom?: number;
|
|
203
199
|
worldBounds?: number[];
|
|
204
200
|
normalizedCommonBounds?: number[];
|
|
205
201
|
updateTimer?: any;
|
|
206
|
-
triPositionBuffer?:
|
|
207
|
-
triTexCoordBuffer?:
|
|
202
|
+
triPositionBuffer?: BufferWithAccessor;
|
|
203
|
+
triTexCoordBuffer?: BufferWithAccessor;
|
|
204
|
+
weightsTransform?: Transform;
|
|
205
|
+
maxWeightTransform?: Transform;
|
|
206
|
+
textureSize: number;
|
|
207
|
+
format: TextureFormat;
|
|
208
|
+
type: GL;
|
|
209
|
+
weightsScale: number;
|
|
210
|
+
visibleWorldBounds: number[];
|
|
211
|
+
viewportCorners: number[][];
|
|
208
212
|
};
|
|
209
213
|
|
|
210
214
|
initializeState() {
|
|
211
|
-
|
|
212
|
-
if (!hasFeatures(gl, REQUIRED_FEATURES)) {
|
|
215
|
+
if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {
|
|
213
216
|
this.setState({supported: false});
|
|
214
217
|
log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
|
|
215
218
|
return;
|
|
@@ -320,13 +323,13 @@ export default class HeatmapLayer<
|
|
|
320
323
|
colorTexture,
|
|
321
324
|
updateTimer
|
|
322
325
|
} = this.state;
|
|
323
|
-
weightsTransform?.
|
|
324
|
-
weightsTexture?.
|
|
325
|
-
maxWeightTransform?.
|
|
326
|
-
maxWeightsTexture?.
|
|
327
|
-
triPositionBuffer?.
|
|
328
|
-
triTexCoordBuffer?.
|
|
329
|
-
colorTexture?.
|
|
326
|
+
weightsTransform?.destroy();
|
|
327
|
+
weightsTexture?.destroy();
|
|
328
|
+
maxWeightTransform?.destroy();
|
|
329
|
+
maxWeightsTexture?.destroy();
|
|
330
|
+
triPositionBuffer?.destroy();
|
|
331
|
+
triTexCoordBuffer?.destroy();
|
|
332
|
+
colorTexture?.destroy();
|
|
330
333
|
if (updateTimer) {
|
|
331
334
|
clearTimeout(updateTimer);
|
|
332
335
|
}
|
|
@@ -336,7 +339,7 @@ export default class HeatmapLayer<
|
|
|
336
339
|
|
|
337
340
|
// override Composite layer private method to create AttributeManager instance
|
|
338
341
|
_getAttributeManager() {
|
|
339
|
-
return new AttributeManager(this.context.
|
|
342
|
+
return new AttributeManager(this.context.device, {
|
|
340
343
|
id: this.props.id,
|
|
341
344
|
stats: this.context.stats
|
|
342
345
|
});
|
|
@@ -349,11 +352,12 @@ export default class HeatmapLayer<
|
|
|
349
352
|
} = {};
|
|
350
353
|
const {dimensions} = this.state;
|
|
351
354
|
changeFlags.dataChanged =
|
|
352
|
-
this.isAttributeChanged() || // if any attribute is changed
|
|
353
|
-
this.isAggregationDirty(opts, {
|
|
355
|
+
(this.isAttributeChanged() && 'attribute changed') || // if any attribute is changed
|
|
356
|
+
(this.isAggregationDirty(opts, {
|
|
354
357
|
compareAll: true,
|
|
355
358
|
dimension: dimensions.data
|
|
356
|
-
})
|
|
359
|
+
}) &&
|
|
360
|
+
'aggregation is dirty');
|
|
357
361
|
changeFlags.viewportChanged = opts.changeFlags.viewportChanged;
|
|
358
362
|
|
|
359
363
|
const {zoom} = this.state;
|
|
@@ -365,18 +369,17 @@ export default class HeatmapLayer<
|
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
_createTextures() {
|
|
368
|
-
const {gl} = this.context;
|
|
369
372
|
const {textureSize, format, type} = this.state;
|
|
370
373
|
|
|
371
374
|
this.setState({
|
|
372
|
-
weightsTexture:
|
|
375
|
+
weightsTexture: this.context.device.createTexture({
|
|
373
376
|
width: textureSize,
|
|
374
377
|
height: textureSize,
|
|
375
378
|
format,
|
|
376
379
|
type,
|
|
377
|
-
...
|
|
380
|
+
...TEXTURE_PROPS
|
|
378
381
|
}),
|
|
379
|
-
maxWeightsTexture:
|
|
382
|
+
maxWeightsTexture: this.context.device.createTexture({format, type, ...TEXTURE_PROPS}) // 1 X 1 texture,
|
|
380
383
|
});
|
|
381
384
|
}
|
|
382
385
|
|
|
@@ -390,12 +393,12 @@ export default class HeatmapLayer<
|
|
|
390
393
|
}
|
|
391
394
|
|
|
392
395
|
_setupTextureParams() {
|
|
393
|
-
const {
|
|
396
|
+
const {device} = this.context;
|
|
394
397
|
const {weightsTextureSize} = this.props;
|
|
395
398
|
|
|
396
|
-
const textureSize = Math.min(weightsTextureSize,
|
|
397
|
-
const floatTargetSupport =
|
|
398
|
-
const {format, type} = getTextureParams({
|
|
399
|
+
const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D as number);
|
|
400
|
+
const floatTargetSupport = FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));
|
|
401
|
+
const {format, type} = getTextureParams({device, floatTargetSupport});
|
|
399
402
|
const weightsScale = floatTargetSupport ? 1 : 1 / 255;
|
|
400
403
|
this.setState({textureSize, format, type, weightsScale});
|
|
401
404
|
if (!floatTargetSupport) {
|
|
@@ -420,12 +423,11 @@ export default class HeatmapLayer<
|
|
|
420
423
|
}
|
|
421
424
|
|
|
422
425
|
_createWeightsTransform(shaders = {}) {
|
|
423
|
-
const {gl} = this.context;
|
|
424
426
|
let {weightsTransform} = this.state;
|
|
425
427
|
const {weightsTexture} = this.state;
|
|
426
428
|
weightsTransform?.delete();
|
|
427
429
|
|
|
428
|
-
weightsTransform = new Transform(
|
|
430
|
+
weightsTransform = new Transform(this.context.device, {
|
|
429
431
|
id: `${this.id}-weights-transform`,
|
|
430
432
|
elementCount: 1,
|
|
431
433
|
_targetTexture: weightsTexture,
|
|
@@ -436,7 +438,6 @@ export default class HeatmapLayer<
|
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
_setupResources() {
|
|
439
|
-
const {gl} = this.context;
|
|
440
441
|
this._createTextures();
|
|
441
442
|
const {textureSize, weightsTexture, maxWeightsTexture} = this.state;
|
|
442
443
|
|
|
@@ -444,7 +445,7 @@ export default class HeatmapLayer<
|
|
|
444
445
|
this._createWeightsTransform(weightsTransformShaders);
|
|
445
446
|
|
|
446
447
|
const maxWeightsTransformShaders = this.getShaders('max-weights-transform');
|
|
447
|
-
const maxWeightTransform = new Transform(
|
|
448
|
+
const maxWeightTransform = new Transform(this.context.device, {
|
|
448
449
|
id: `${this.id}-max-weights-transform`,
|
|
449
450
|
_sourceTextures: {
|
|
450
451
|
inTexture: weightsTexture
|
|
@@ -460,12 +461,14 @@ export default class HeatmapLayer<
|
|
|
460
461
|
maxWeightsTexture,
|
|
461
462
|
maxWeightTransform,
|
|
462
463
|
zoom: null,
|
|
463
|
-
triPositionBuffer:
|
|
464
|
+
triPositionBuffer: this.context.device.createBuffer({
|
|
464
465
|
byteLength: 48,
|
|
466
|
+
// @ts-expect-error
|
|
465
467
|
accessor: {size: 3}
|
|
466
468
|
}),
|
|
467
|
-
triTexCoordBuffer:
|
|
469
|
+
triTexCoordBuffer: this.context.device.createBuffer({
|
|
468
470
|
byteLength: 48,
|
|
471
|
+
// @ts-expect-error
|
|
469
472
|
accessor: {size: 2}
|
|
470
473
|
})
|
|
471
474
|
});
|
|
@@ -479,7 +482,7 @@ export default class HeatmapLayer<
|
|
|
479
482
|
|
|
480
483
|
_updateMaxWeightValue() {
|
|
481
484
|
const {maxWeightTransform} = this.state;
|
|
482
|
-
maxWeightTransform
|
|
485
|
+
maxWeightTransform!.run({
|
|
483
486
|
parameters: {
|
|
484
487
|
blend: true,
|
|
485
488
|
depthTest: false,
|
|
@@ -547,12 +550,12 @@ export default class HeatmapLayer<
|
|
|
547
550
|
|
|
548
551
|
const {viewport} = this.context;
|
|
549
552
|
|
|
550
|
-
triPositionBuffer
|
|
553
|
+
triPositionBuffer!.subData(packVertices(viewportCorners, 3));
|
|
551
554
|
|
|
552
555
|
const textureBounds = viewportCorners.map(p =>
|
|
553
556
|
getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds!)
|
|
554
557
|
);
|
|
555
|
-
triTexCoordBuffer
|
|
558
|
+
triTexCoordBuffer!.subData(packVertices(textureBounds, 2));
|
|
556
559
|
}
|
|
557
560
|
|
|
558
561
|
_updateColorTexture(opts) {
|
|
@@ -561,16 +564,17 @@ export default class HeatmapLayer<
|
|
|
561
564
|
const colors = colorRangeToFlatArray(colorRange, false, Uint8Array as any);
|
|
562
565
|
|
|
563
566
|
if (colorTexture) {
|
|
567
|
+
// @ts-expect-error TODO - no longer supported in v9?
|
|
564
568
|
colorTexture.setImageData({
|
|
565
569
|
data: colors,
|
|
566
570
|
width: colorRange.length
|
|
567
571
|
});
|
|
568
572
|
} else {
|
|
569
|
-
colorTexture =
|
|
573
|
+
colorTexture = this.context.device.createTexture({
|
|
570
574
|
data: colors,
|
|
571
575
|
width: colorRange.length,
|
|
572
576
|
height: 1,
|
|
573
|
-
...
|
|
577
|
+
...TEXTURE_PROPS
|
|
574
578
|
});
|
|
575
579
|
}
|
|
576
580
|
this.setState({colorTexture});
|
|
@@ -578,7 +582,8 @@ export default class HeatmapLayer<
|
|
|
578
582
|
|
|
579
583
|
_updateWeightmap() {
|
|
580
584
|
const {radiusPixels, colorDomain, aggregation} = this.props;
|
|
581
|
-
const {
|
|
585
|
+
const {worldBounds, textureSize, weightsScale} = this.state;
|
|
586
|
+
const weightsTransform = this.state.weightsTransform!;
|
|
582
587
|
this.state.isWeightMapDirty = false;
|
|
583
588
|
|
|
584
589
|
// convert world bounds to common using Layer's coordiante system and origin
|
|
@@ -609,7 +614,7 @@ export default class HeatmapLayer<
|
|
|
609
614
|
elementCount: this.getNumInstances()
|
|
610
615
|
});
|
|
611
616
|
// Need to explictly specify clearColor as external context may have modified it
|
|
612
|
-
|
|
617
|
+
withGLParameters(this.context.gl, {clearColor: [0, 0, 0, 0]}, () => {
|
|
613
618
|
weightsTransform.run({
|
|
614
619
|
uniforms,
|
|
615
620
|
parameters: {
|
|
@@ -619,6 +624,7 @@ export default class HeatmapLayer<
|
|
|
619
624
|
blendEquation: GL.FUNC_ADD
|
|
620
625
|
},
|
|
621
626
|
clearRenderTarget: true,
|
|
627
|
+
// @ts-expect-error TODO - no longer supported in v9?
|
|
622
628
|
attributes: this.getAttributes(),
|
|
623
629
|
moduleSettings: this.getModuleSettings()
|
|
624
630
|
});
|
|
@@ -626,10 +632,11 @@ export default class HeatmapLayer<
|
|
|
626
632
|
this._updateMaxWeightValue();
|
|
627
633
|
|
|
628
634
|
// reset filtering parameters (TODO: remove once luma issue#1193 is fixed)
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
635
|
+
// TODO v9 sampler support in luma.gl needs to improve
|
|
636
|
+
// weightsTexture.setSampler({
|
|
637
|
+
// magFilter: 'linear',
|
|
638
|
+
// minFilter: 'linear'
|
|
639
|
+
// });
|
|
633
640
|
}
|
|
634
641
|
|
|
635
642
|
_debouncedUpdateWeightmap(fromTimer = false) {
|
|
@@ -18,8 +18,9 @@
|
|
|
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
|
|
22
|
-
import {Model, Geometry
|
|
21
|
+
import type {Device, Texture} from '@luma.gl/core';
|
|
22
|
+
import {Model, Geometry} from '@luma.gl/engine';
|
|
23
|
+
import {GL} from '@luma.gl/constants';
|
|
23
24
|
import {Layer, LayerContext, project32} from '@deck.gl/core';
|
|
24
25
|
import vs from './triangle-layer-vertex.glsl';
|
|
25
26
|
import fs from './triangle-layer-fragment.glsl';
|
|
@@ -30,37 +31,41 @@ type _TriangleLayerProps = {
|
|
|
30
31
|
threshold: number;
|
|
31
32
|
intensity: number;
|
|
32
33
|
vertexCount: number;
|
|
33
|
-
colorTexture:
|
|
34
|
-
maxTexture:
|
|
35
|
-
texture:
|
|
34
|
+
colorTexture: Texture;
|
|
35
|
+
maxTexture: Texture;
|
|
36
|
+
texture: Texture;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export default class TriangleLayer extends Layer<_TriangleLayerProps> {
|
|
39
40
|
static layerName = 'TriangleLayer';
|
|
40
41
|
|
|
42
|
+
state!: {
|
|
43
|
+
model: Model;
|
|
44
|
+
};
|
|
45
|
+
|
|
41
46
|
getShaders() {
|
|
42
47
|
return {vs, fs, modules: [project32]};
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
initializeState({
|
|
50
|
+
initializeState({device}: LayerContext): void {
|
|
46
51
|
const attributeManager = this.getAttributeManager()!;
|
|
47
52
|
attributeManager.add({
|
|
48
53
|
positions: {size: 3, noAlloc: true},
|
|
49
54
|
texCoords: {size: 2, noAlloc: true}
|
|
50
55
|
});
|
|
51
56
|
this.setState({
|
|
52
|
-
model: this._getModel(
|
|
57
|
+
model: this._getModel(device)
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
_getModel(
|
|
61
|
+
_getModel(device: Device): Model {
|
|
57
62
|
const {vertexCount} = this.props;
|
|
58
63
|
|
|
59
|
-
return new Model(
|
|
64
|
+
return new Model(device, {
|
|
60
65
|
...this.getShaders(),
|
|
61
66
|
id: this.props.id,
|
|
62
67
|
geometry: new Geometry({
|
|
63
|
-
|
|
68
|
+
topology: 'triangle-fan-webgl',
|
|
64
69
|
vertexCount
|
|
65
70
|
})
|
|
66
71
|
});
|
|
@@ -72,17 +77,16 @@ export default class TriangleLayer extends Layer<_TriangleLayerProps> {
|
|
|
72
77
|
const {texture, maxTexture, colorTexture, intensity, threshold, aggregationMode, colorDomain} =
|
|
73
78
|
this.props;
|
|
74
79
|
|
|
75
|
-
model
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.draw();
|
|
80
|
+
model.setUniforms({
|
|
81
|
+
...uniforms,
|
|
82
|
+
texture,
|
|
83
|
+
maxTexture,
|
|
84
|
+
colorTexture,
|
|
85
|
+
intensity,
|
|
86
|
+
threshold,
|
|
87
|
+
aggregationMode,
|
|
88
|
+
colorDomain
|
|
89
|
+
});
|
|
90
|
+
model.draw(this.context.renderPass);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
@@ -38,7 +38,11 @@ export function pointToHexbin(props, aggregationParams) {
|
|
|
38
38
|
const radiusCommon = getRadiusInCommon(radius, viewport, centerLngLat);
|
|
39
39
|
|
|
40
40
|
// add world space coordinates to points
|
|
41
|
-
const screenPoints
|
|
41
|
+
const screenPoints: {
|
|
42
|
+
screenCoord: number[];
|
|
43
|
+
source: any;
|
|
44
|
+
index: number;
|
|
45
|
+
}[] = [];
|
|
42
46
|
const {iterable, objectInfo} = createIterable(data);
|
|
43
47
|
const positions = attributes.positions.value;
|
|
44
48
|
const {size} = attributes.positions.getAccessor();
|
|
@@ -29,6 +29,7 @@ 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';
|
|
32
33
|
|
|
33
34
|
import {defaultColorRange} from '../utils/color-utils';
|
|
34
35
|
|
|
@@ -36,7 +37,6 @@ import {pointToHexbin} from './hexagon-aggregator';
|
|
|
36
37
|
import CPUAggregator from '../utils/cpu-aggregator';
|
|
37
38
|
import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';
|
|
38
39
|
|
|
39
|
-
import GL from '@luma.gl/constants';
|
|
40
40
|
import {AggregateAccessor} from '../types';
|
|
41
41
|
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -70,7 +70,7 @@ const defaultProps: DefaultProps<HexagonLayerProps> = {
|
|
|
70
70
|
coverage: {type: 'number', min: 0, max: 1, value: 1},
|
|
71
71
|
extruded: false,
|
|
72
72
|
hexagonAggregator: pointToHexbin,
|
|
73
|
-
getPosition: {type: 'accessor', value: x => x.position},
|
|
73
|
+
getPosition: {type: 'accessor', value: (x: any) => x.position},
|
|
74
74
|
// Optional material for 'lighting' shader module
|
|
75
75
|
material: true,
|
|
76
76
|
|
|
@@ -79,11 +79,11 @@ const defaultProps: DefaultProps<HexagonLayerProps> = {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
/** All properties supported by by HexagonLayer. */
|
|
82
|
-
export type HexagonLayerProps<DataT =
|
|
82
|
+
export type HexagonLayerProps<DataT = unknown> = _HexagonLayerProps<DataT> &
|
|
83
83
|
AggregationLayerProps<DataT>;
|
|
84
84
|
|
|
85
85
|
/** Properties added by HexagonLayer. */
|
|
86
|
-
type _HexagonLayerProps<DataT =
|
|
86
|
+
type _HexagonLayerProps<DataT = unknown> = {
|
|
87
87
|
/**
|
|
88
88
|
* Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).
|
|
89
89
|
* @default 1000
|
|
@@ -256,7 +256,8 @@ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends Ag
|
|
|
256
256
|
|
|
257
257
|
state!: AggregationLayer<DataT>['state'] & {
|
|
258
258
|
cpuAggregator: CPUAggregator;
|
|
259
|
-
aggregatorState:
|
|
259
|
+
aggregatorState: CPUAggregator['state'];
|
|
260
|
+
vertices: number[][] | null;
|
|
260
261
|
};
|
|
261
262
|
initializeState() {
|
|
262
263
|
const cpuAggregator = new CPUAggregator({
|
|
@@ -288,6 +289,7 @@ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends Ag
|
|
|
288
289
|
if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {
|
|
289
290
|
// if user provided custom aggregator and returns hexagonVertices,
|
|
290
291
|
// Need to recalculate radius and angle based on vertices
|
|
292
|
+
// @ts-expect-error
|
|
291
293
|
const {hexagonVertices} = aggregatorState.layerData || {};
|
|
292
294
|
this.setState({
|
|
293
295
|
vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)
|
|
@@ -359,6 +361,7 @@ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends Ag
|
|
|
359
361
|
? {vertices, radius: 1}
|
|
360
362
|
: {
|
|
361
363
|
// default geometry
|
|
364
|
+
// @ts-expect-error TODO - undefined property?
|
|
362
365
|
radius: aggregatorState.layerData.radiusCommon || 1,
|
|
363
366
|
radiusUnits: 'common',
|
|
364
367
|
angle: 90
|
package/src/index.ts
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
|
-
/* eslint-disable max-len */
|
|
21
20
|
|
|
22
21
|
export {default as ScreenGridLayer} from './screen-grid-layer/screen-grid-layer';
|
|
23
22
|
export {default as CPUGridLayer} from './cpu-grid-layer/cpu-grid-layer';
|
|
@@ -18,9 +18,10 @@
|
|
|
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
|
|
22
|
-
import {Model, Geometry
|
|
23
|
-
import {
|
|
21
|
+
import {Device, Texture} from '@luma.gl/core';
|
|
22
|
+
import {Model, Geometry} from '@luma.gl/engine';
|
|
23
|
+
import {GL} from '@luma.gl/constants';
|
|
24
|
+
import {Layer, LayerProps, log, picking, UpdateParameters, DefaultProps} from '@deck.gl/core';
|
|
24
25
|
import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
|
|
25
26
|
import vs from './screen-grid-layer-vertex.glsl';
|
|
26
27
|
import fs from './screen-grid-layer-fragment.glsl';
|
|
@@ -31,19 +32,20 @@ const DEFAULT_MAXCOLOR = [0, 255, 0, 255];
|
|
|
31
32
|
const COLOR_PROPS = ['minColor', 'maxColor', 'colorRange', 'colorDomain'];
|
|
32
33
|
|
|
33
34
|
const defaultProps: DefaultProps<ScreenGridCellLayerProps> = {
|
|
34
|
-
cellSizePixels: {value: 100, min: 1},
|
|
35
|
-
cellMarginPixels: {value: 2, min: 0, max: 5},
|
|
35
|
+
cellSizePixels: {type: 'number', value: 100, min: 1},
|
|
36
|
+
cellMarginPixels: {type: 'number', value: 2, min: 0, max: 5},
|
|
36
37
|
|
|
37
38
|
colorDomain: null,
|
|
38
39
|
colorRange: defaultColorRange
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
/** All properties supported by ScreenGridCellLayer. */
|
|
42
|
-
export type ScreenGridCellLayerProps<DataT =
|
|
43
|
+
export type ScreenGridCellLayerProps<DataT = unknown> = _ScreenGridCellLayerProps<DataT> &
|
|
44
|
+
LayerProps;
|
|
43
45
|
|
|
44
46
|
/** Proprties added by ScreenGridCellLayer. */
|
|
45
47
|
export type _ScreenGridCellLayerProps<DataT> = _ScreenGridLayerProps<DataT> & {
|
|
46
|
-
maxTexture:
|
|
48
|
+
maxTexture: Texture;
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {}> extends Layer<
|
|
@@ -52,19 +54,18 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
52
54
|
static layerName = 'ScreenGridCellLayer';
|
|
53
55
|
static defaultProps = defaultProps;
|
|
54
56
|
|
|
55
|
-
static isSupported(
|
|
56
|
-
return
|
|
57
|
+
static isSupported(device: Device) {
|
|
58
|
+
return device.features.has('texture-formats-float32-webgl1');
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
state!:
|
|
60
|
-
model
|
|
61
|
+
state!: {
|
|
62
|
+
model?: Model;
|
|
61
63
|
};
|
|
62
64
|
getShaders() {
|
|
63
65
|
return {vs, fs, modules: [picking]};
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
initializeState() {
|
|
67
|
-
const {gl} = this.context;
|
|
68
69
|
const attributeManager = this.getAttributeManager()!;
|
|
69
70
|
attributeManager.addInstanced({
|
|
70
71
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
@@ -72,7 +73,7 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
72
73
|
instanceCounts: {size: 4, noAlloc: true}
|
|
73
74
|
});
|
|
74
75
|
this.setState({
|
|
75
|
-
model: this._getModel(
|
|
76
|
+
model: this._getModel()
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -104,22 +105,23 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
104
105
|
// If colorDomain not specified we use default domain [1, maxCount]
|
|
105
106
|
// maxCount value will be sampled form maxTexture in vertex shader.
|
|
106
107
|
const colorDomain = this.props.colorDomain || [1, 0];
|
|
107
|
-
const
|
|
108
|
-
model
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
const model = this.state.model!;
|
|
109
|
+
model.setUniforms(uniforms);
|
|
110
|
+
model.setBindings({
|
|
111
|
+
maxTexture
|
|
112
|
+
});
|
|
113
|
+
model.setUniforms({
|
|
114
|
+
minColor,
|
|
115
|
+
maxColor,
|
|
116
|
+
colorDomain
|
|
117
|
+
});
|
|
118
|
+
model.setParameters({
|
|
119
|
+
depthWriteEnabled: false,
|
|
120
|
+
// How to specify depth mask in WebGPU?
|
|
121
|
+
// depthMask: false,
|
|
122
|
+
...parameters
|
|
123
|
+
});
|
|
124
|
+
model.draw(this.context.renderPass);
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
calculateInstancePositions(attribute, {numInstances}) {
|
|
@@ -140,16 +142,17 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
140
142
|
|
|
141
143
|
// Private Methods
|
|
142
144
|
|
|
143
|
-
_getModel(
|
|
144
|
-
return new Model(
|
|
145
|
+
_getModel(): Model {
|
|
146
|
+
return new Model(this.context.device, {
|
|
145
147
|
...this.getShaders(),
|
|
146
148
|
id: this.props.id,
|
|
147
149
|
geometry: new Geometry({
|
|
148
|
-
|
|
150
|
+
topology: 'triangle-fan-webgl',
|
|
149
151
|
attributes: {
|
|
150
152
|
positions: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])
|
|
151
153
|
}
|
|
152
154
|
}),
|
|
155
|
+
// @ts-expect-error TODO v9 API not as dynamic
|
|
153
156
|
isInstanced: true
|
|
154
157
|
});
|
|
155
158
|
}
|
|
@@ -170,7 +173,7 @@ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT extends {} = {
|
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
_updateUniforms(oldProps, props, changeFlags): void {
|
|
173
|
-
const
|
|
176
|
+
const model = this.state.model!;
|
|
174
177
|
if (COLOR_PROPS.some(key => oldProps[key] !== props[key])) {
|
|
175
178
|
model.setUniforms({shouldUseMinMax: this._shouldUseMinMax()});
|
|
176
179
|
}
|