@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/dist/index.cjs
CHANGED
|
@@ -37,7 +37,6 @@ module.exports = __toCommonJS(dist_exports);
|
|
|
37
37
|
|
|
38
38
|
// dist/screen-grid-layer/screen-grid-layer.js
|
|
39
39
|
var import_core8 = require("@deck.gl/core");
|
|
40
|
-
var import_constants4 = require("@luma.gl/constants");
|
|
41
40
|
|
|
42
41
|
// dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js
|
|
43
42
|
var import_engine = require("@luma.gl/engine");
|
|
@@ -132,12 +131,12 @@ var DEFAULT_RUN_PARAMS = {
|
|
|
132
131
|
moduleSettings: {}
|
|
133
132
|
};
|
|
134
133
|
var MAX_32_BIT_FLOAT = 3402823466e29;
|
|
135
|
-
var MIN_BLEND_EQUATION = [
|
|
136
|
-
var MAX_BLEND_EQUATION = [
|
|
137
|
-
var MAX_MIN_BLEND_EQUATION = [
|
|
134
|
+
var MIN_BLEND_EQUATION = [32775, 32774];
|
|
135
|
+
var MAX_BLEND_EQUATION = [32776, 32774];
|
|
136
|
+
var MAX_MIN_BLEND_EQUATION = [32776, 32775];
|
|
138
137
|
var EQUATION_MAP = {
|
|
139
|
-
[AGGREGATION_OPERATION.SUM]:
|
|
140
|
-
[AGGREGATION_OPERATION.MEAN]:
|
|
138
|
+
[AGGREGATION_OPERATION.SUM]: 32774,
|
|
139
|
+
[AGGREGATION_OPERATION.MEAN]: 32774,
|
|
141
140
|
[AGGREGATION_OPERATION.MIN]: MIN_BLEND_EQUATION,
|
|
142
141
|
[AGGREGATION_OPERATION.MAX]: MAX_BLEND_EQUATION
|
|
143
142
|
};
|
|
@@ -149,24 +148,10 @@ var DEFAULT_WEIGHT_PARAMS = {
|
|
|
149
148
|
combineMaxMin: false
|
|
150
149
|
};
|
|
151
150
|
var PIXEL_SIZE = 4;
|
|
152
|
-
var MAX_MIN_TEXTURE_OPTS = {
|
|
153
|
-
format: import_constants.GL.RGBA32F,
|
|
154
|
-
type: import_constants.GL.FLOAT,
|
|
155
|
-
border: 0,
|
|
156
|
-
mipmaps: false,
|
|
157
|
-
sampler: {
|
|
158
|
-
minFilter: "nearest",
|
|
159
|
-
magFilter: "nearest"
|
|
160
|
-
},
|
|
161
|
-
dataFormat: import_constants.GL.RGBA,
|
|
162
|
-
width: 1,
|
|
163
|
-
height: 1
|
|
164
|
-
};
|
|
165
151
|
|
|
166
152
|
// dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js
|
|
167
153
|
var aggregate_to_grid_vs_glsl_default = `#version 300 es
|
|
168
154
|
#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
169
|
-
|
|
170
155
|
in vec3 positions;
|
|
171
156
|
in vec3 positions64Low;
|
|
172
157
|
in vec3 weights;
|
|
@@ -175,123 +160,89 @@ uniform vec2 gridSize;
|
|
|
175
160
|
uniform bool projectPoints;
|
|
176
161
|
uniform vec2 translation;
|
|
177
162
|
uniform vec3 scaling;
|
|
178
|
-
|
|
179
163
|
out vec3 vWeights;
|
|
180
|
-
|
|
181
164
|
vec2 project_to_pixel(vec4 pos) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
165
|
+
vec4 result;
|
|
166
|
+
pos.xy = pos.xy/pos.w;
|
|
167
|
+
result = pos + vec4(translation, 0., 0.);
|
|
168
|
+
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
|
|
169
|
+
return result.xy;
|
|
187
170
|
}
|
|
188
|
-
|
|
189
171
|
void main(void) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
pos = vec2(x, y);
|
|
211
|
-
|
|
212
|
-
// Transform (0,0):gridSize -> (-1, -1):(1,1)
|
|
213
|
-
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
214
|
-
|
|
215
|
-
// Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
|
|
216
|
-
vec2 offset = 1.0 / gridSize;
|
|
217
|
-
pos = pos + offset;
|
|
218
|
-
|
|
219
|
-
gl_Position = vec4(pos, 0.0, 1.0);
|
|
220
|
-
|
|
221
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
222
|
-
gl_PointSize = 1.0;
|
|
172
|
+
vWeights = weights;
|
|
173
|
+
vec4 windowPos = vec4(positions, 1.);
|
|
174
|
+
if (projectPoints) {
|
|
175
|
+
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
|
|
176
|
+
}
|
|
177
|
+
vec2 pos = project_to_pixel(windowPos);
|
|
178
|
+
vec2 pixelXY64[2];
|
|
179
|
+
pixelXY64[0] = vec2(pos.x, 0.);
|
|
180
|
+
pixelXY64[1] = vec2(pos.y, 0.);
|
|
181
|
+
vec2 gridXY64[2];
|
|
182
|
+
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
|
|
183
|
+
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
|
|
184
|
+
float x = floor(gridXY64[0].x);
|
|
185
|
+
float y = floor(gridXY64[1].x);
|
|
186
|
+
pos = vec2(x, y);
|
|
187
|
+
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
188
|
+
vec2 offset = 1.0 / gridSize;
|
|
189
|
+
pos = pos + offset;
|
|
190
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
191
|
+
gl_PointSize = 1.0;
|
|
223
192
|
}
|
|
224
193
|
`;
|
|
225
194
|
|
|
226
195
|
// dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js
|
|
227
196
|
var aggregate_to_grid_fs_glsl_default = `#version 300 es
|
|
228
197
|
#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
229
|
-
|
|
230
198
|
precision highp float;
|
|
231
|
-
|
|
232
199
|
in vec3 vWeights;
|
|
233
|
-
|
|
234
200
|
out vec4 fragColor;
|
|
235
|
-
|
|
236
201
|
void main(void) {
|
|
237
|
-
|
|
238
|
-
|
|
202
|
+
fragColor = vec4(vWeights, 1.0);
|
|
203
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
239
204
|
}
|
|
240
205
|
`;
|
|
241
206
|
|
|
242
207
|
// dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js
|
|
243
208
|
var aggregate_all_vs_glsl_default = `#version 300 es
|
|
244
209
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
245
|
-
|
|
246
210
|
in vec2 position;
|
|
247
211
|
uniform ivec2 gridSize;
|
|
248
212
|
out vec2 vTextureCoord;
|
|
249
|
-
|
|
250
213
|
void main(void) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
|
|
266
|
-
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
|
|
267
|
-
|
|
268
|
-
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
269
|
-
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
270
|
-
|
|
271
|
-
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
272
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
273
|
-
gl_PointSize = 1.0;
|
|
214
|
+
vec2 pos = vec2(-1.0, -1.0);
|
|
215
|
+
vec2 offset = 1.0 / vec2(gridSize);
|
|
216
|
+
pos = pos + offset;
|
|
217
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
218
|
+
int yIndex = gl_InstanceID / gridSize[0];
|
|
219
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
220
|
+
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
|
|
221
|
+
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
|
|
222
|
+
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
|
|
223
|
+
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
|
|
224
|
+
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
225
|
+
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
226
|
+
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
227
|
+
gl_PointSize = 1.0;
|
|
274
228
|
}
|
|
275
229
|
`;
|
|
276
230
|
|
|
277
231
|
// dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js
|
|
278
232
|
var aggregate_all_fs_glsl_default = `#version 300 es
|
|
279
233
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
280
|
-
|
|
281
234
|
precision highp float;
|
|
282
|
-
|
|
283
235
|
in vec2 vTextureCoord;
|
|
284
236
|
uniform sampler2D uSampler;
|
|
285
237
|
uniform bool combineMaxMin;
|
|
286
238
|
out vec4 fragColor;
|
|
287
239
|
void main(void) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
240
|
+
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
|
|
241
|
+
if (textureColor.a == 0.) {
|
|
242
|
+
discard;
|
|
243
|
+
}
|
|
244
|
+
fragColor.rgb = textureColor.rgb;
|
|
245
|
+
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
295
246
|
}
|
|
296
247
|
`;
|
|
297
248
|
|
|
@@ -300,17 +251,12 @@ var transform_mean_vs_glsl_default = `#version 300 es
|
|
|
300
251
|
#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
301
252
|
in vec4 aggregationValues;
|
|
302
253
|
out vec4 meanValues;
|
|
303
|
-
|
|
304
254
|
void main()
|
|
305
255
|
{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
meanValues.w = aggregationValues.w;
|
|
311
|
-
|
|
312
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
313
|
-
gl_PointSize = 1.0;
|
|
256
|
+
bool isCellValid = bool(aggregationValues.w > 0.);
|
|
257
|
+
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
|
|
258
|
+
meanValues.w = aggregationValues.w;
|
|
259
|
+
gl_PointSize = 1.0;
|
|
314
260
|
}
|
|
315
261
|
`;
|
|
316
262
|
|
|
@@ -350,11 +296,8 @@ var ARRAY_BUFFER_MAP = {
|
|
|
350
296
|
maxMinData: "maxMinBuffer"
|
|
351
297
|
};
|
|
352
298
|
var REQUIRED_FEATURES = [
|
|
353
|
-
"
|
|
354
|
-
"blend-
|
|
355
|
-
"texture-renderable-float32-webgl",
|
|
356
|
-
"texture-blend-float-webgl1",
|
|
357
|
-
"texture-formats-float32-webgl1"
|
|
299
|
+
"float32-renderable-webgl",
|
|
300
|
+
"texture-blend-float-webgl"
|
|
358
301
|
];
|
|
359
302
|
var GPUGridAggregator = class {
|
|
360
303
|
static getAggregationData({ aggregationData, maxData, minData, maxMinData, pixelIndex }) {
|
|
@@ -412,12 +355,10 @@ var GPUGridAggregator = class {
|
|
|
412
355
|
};
|
|
413
356
|
this.id = props.id || "gpu-grid-aggregator";
|
|
414
357
|
this.device = device;
|
|
415
|
-
const
|
|
416
|
-
"
|
|
417
|
-
"texture-renderable-float32-webgl",
|
|
418
|
-
"texture-formats-float32-webgl1"
|
|
358
|
+
const REQUIRED_FEATURES2 = [
|
|
359
|
+
"float32-renderable-webgl"
|
|
419
360
|
];
|
|
420
|
-
this._hasGPUSupport =
|
|
361
|
+
this._hasGPUSupport = REQUIRED_FEATURES2.every((feature) => device.features.has(feature));
|
|
421
362
|
if (this._hasGPUSupport) {
|
|
422
363
|
this._setupModels();
|
|
423
364
|
}
|
|
@@ -441,9 +382,6 @@ var GPUGridAggregator = class {
|
|
|
441
382
|
run(opts = {}) {
|
|
442
383
|
this.setState({ results: {} });
|
|
443
384
|
const aggregationParams = this._normalizeAggregationParams(opts);
|
|
444
|
-
if (!this._hasGPUSupport) {
|
|
445
|
-
import_core.log.log(1, "GPUGridAggregator: not supported")();
|
|
446
|
-
}
|
|
447
385
|
return this._runAggregation(aggregationParams);
|
|
448
386
|
}
|
|
449
387
|
getData(weightId) {
|
|
@@ -486,26 +424,26 @@ var GPUGridAggregator = class {
|
|
|
486
424
|
results[id].aggregationTexture = textures[id];
|
|
487
425
|
results[id].aggregationBuffer = this.device.readPixelsToBufferWebGL(framebuffers[id], {
|
|
488
426
|
target: weights[id].aggregationBuffer,
|
|
489
|
-
sourceType:
|
|
427
|
+
sourceType: 5126
|
|
490
428
|
});
|
|
491
429
|
if (needMin && needMax && combineMaxMin) {
|
|
492
430
|
results[id].maxMinBuffer = this.device.readPixelsToBufferWebGL(maxMinFramebuffers[id], {
|
|
493
431
|
target: weights[id].maxMinBuffer,
|
|
494
|
-
sourceType:
|
|
432
|
+
sourceType: 5126
|
|
495
433
|
});
|
|
496
434
|
results[id].maxMinTexture = resources[`${id}-maxMinTexture`];
|
|
497
435
|
} else {
|
|
498
436
|
if (needMin) {
|
|
499
437
|
results[id].minBuffer = this.device.readPixelsToBufferWebGL(minFramebuffers[id], {
|
|
500
438
|
target: weights[id].minBuffer,
|
|
501
|
-
sourceType:
|
|
439
|
+
sourceType: 5126
|
|
502
440
|
});
|
|
503
441
|
results[id].minTexture = resources[`${id}-minTexture`];
|
|
504
442
|
}
|
|
505
443
|
if (needMax) {
|
|
506
444
|
results[id].maxBuffer = this.device.readPixelsToBufferWebGL(maxFramebuffers[id], {
|
|
507
445
|
target: weights[id].maxBuffer,
|
|
508
|
-
sourceType:
|
|
446
|
+
sourceType: 5126
|
|
509
447
|
});
|
|
510
448
|
results[id].maxTexture = resources[`${id}-maxTexture`];
|
|
511
449
|
}
|
|
@@ -521,7 +459,7 @@ var GPUGridAggregator = class {
|
|
|
521
459
|
const parameters = {
|
|
522
460
|
blend: true,
|
|
523
461
|
depthTest: false,
|
|
524
|
-
blendFunc: [
|
|
462
|
+
blendFunc: [1, 1]
|
|
525
463
|
};
|
|
526
464
|
const uniforms = {
|
|
527
465
|
cellSize,
|
|
@@ -628,7 +566,7 @@ var GPUGridAggregator = class {
|
|
|
628
566
|
depthTest: false
|
|
629
567
|
}
|
|
630
568
|
});
|
|
631
|
-
framebuffers[id].attach({ [
|
|
569
|
+
framebuffers[id].attach({ [36064]: textures[id] });
|
|
632
570
|
}
|
|
633
571
|
}
|
|
634
572
|
_runAggregation(opts) {
|
|
@@ -655,7 +593,7 @@ var GPUGridAggregator = class {
|
|
|
655
593
|
texture = meanTextures[id];
|
|
656
594
|
}
|
|
657
595
|
if (framebuffers[id]) {
|
|
658
|
-
framebuffers[id].attach({ [
|
|
596
|
+
framebuffers[id].attach({ [36064]: texture });
|
|
659
597
|
} else {
|
|
660
598
|
framebuffers[id] = getFramebuffer(this.device, {
|
|
661
599
|
id: `${id}-fb`,
|
|
@@ -772,7 +710,7 @@ function getAggregationModel(device, shaderOptions) {
|
|
|
772
710
|
return new import_engine.Model(device, {
|
|
773
711
|
id: "Grid-Aggregation-Model",
|
|
774
712
|
vertexCount: 1,
|
|
775
|
-
drawMode:
|
|
713
|
+
drawMode: 0,
|
|
776
714
|
shaderAssembler: (0, import_core.getShaderAssembler)(),
|
|
777
715
|
...shaders
|
|
778
716
|
});
|
|
@@ -840,12 +778,10 @@ function colorRangeToFlatArray(colorRange, normalize = false, ArrayType = Float3
|
|
|
840
778
|
var screen_grid_layer_vertex_glsl_default = `#version 300 es
|
|
841
779
|
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
842
780
|
#define RANGE_COUNT 6
|
|
843
|
-
|
|
844
781
|
in vec3 positions;
|
|
845
782
|
in vec3 instancePositions;
|
|
846
783
|
in vec4 instanceCounts;
|
|
847
784
|
in vec3 instancePickingColors;
|
|
848
|
-
|
|
849
785
|
uniform float opacity;
|
|
850
786
|
uniform vec3 cellScale;
|
|
851
787
|
uniform vec4 minColor;
|
|
@@ -854,72 +790,57 @@ uniform vec4 colorRange[RANGE_COUNT];
|
|
|
854
790
|
uniform vec2 colorDomain;
|
|
855
791
|
uniform bool shouldUseMinMax;
|
|
856
792
|
uniform sampler2D maxTexture;
|
|
857
|
-
|
|
858
793
|
out vec4 vColor;
|
|
859
794
|
out float vSampleCount;
|
|
860
|
-
|
|
861
795
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
796
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
797
|
+
if (value >= domain.x && value <= domain.y) {
|
|
798
|
+
float domainRange = domain.y - domain.x;
|
|
799
|
+
if (domainRange <= 0.) {
|
|
800
|
+
outColor = colorRange[0];
|
|
801
|
+
} else {
|
|
802
|
+
float rangeCount = float(RANGE_COUNT);
|
|
803
|
+
float rangeStep = domainRange / rangeCount;
|
|
804
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
805
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
806
|
+
int intIdx = int(idx);
|
|
807
|
+
outColor = colorRange[intIdx];
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
outColor = outColor / 255.;
|
|
811
|
+
return outColor;
|
|
878
812
|
}
|
|
879
|
-
|
|
880
813
|
void main(void) {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
|
|
896
|
-
vColor = vec4(color.rgb, color.a * opacity);
|
|
897
|
-
|
|
898
|
-
// Set color to be rendered to picking fbo (also used to check for selection highlight).
|
|
899
|
-
picking_setPickingColor(instancePickingColors);
|
|
900
|
-
|
|
901
|
-
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
814
|
+
vSampleCount = instanceCounts.a;
|
|
815
|
+
float weight = instanceCounts.r;
|
|
816
|
+
float maxWeight = texture(maxTexture, vec2(0.5)).r;
|
|
817
|
+
float step = weight / maxWeight;
|
|
818
|
+
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
|
|
819
|
+
vec2 domain = colorDomain;
|
|
820
|
+
float domainMaxValid = float(colorDomain.y != 0.);
|
|
821
|
+
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
|
|
822
|
+
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
|
|
823
|
+
float rangeMinMax = float(shouldUseMinMax);
|
|
824
|
+
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
|
|
825
|
+
vColor = vec4(color.rgb, color.a * opacity);
|
|
826
|
+
picking_setPickingColor(instancePickingColors);
|
|
827
|
+
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
902
828
|
}
|
|
903
829
|
`;
|
|
904
830
|
|
|
905
831
|
// dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js
|
|
906
832
|
var screen_grid_layer_fragment_glsl_default = `#version 300 es
|
|
907
833
|
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
908
|
-
|
|
909
834
|
precision highp float;
|
|
910
|
-
|
|
911
835
|
in vec4 vColor;
|
|
912
836
|
in float vSampleCount;
|
|
913
|
-
|
|
914
837
|
out vec4 fragColor;
|
|
915
|
-
|
|
916
838
|
void main(void) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
839
|
+
if (vSampleCount <= 0.0) {
|
|
840
|
+
discard;
|
|
841
|
+
}
|
|
842
|
+
fragColor = vColor;
|
|
843
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
923
844
|
}
|
|
924
845
|
`;
|
|
925
846
|
|
|
@@ -934,9 +855,6 @@ var defaultProps = {
|
|
|
934
855
|
colorRange: defaultColorRange
|
|
935
856
|
};
|
|
936
857
|
var _ScreenGridCellLayer = class extends import_core2.Layer {
|
|
937
|
-
static isSupported(device) {
|
|
938
|
-
return device.features.has("texture-formats-float32-webgl1");
|
|
939
|
-
}
|
|
940
858
|
getShaders() {
|
|
941
859
|
return { vs: screen_grid_layer_vertex_glsl_default, fs: screen_grid_layer_fragment_glsl_default, modules: [import_core2.picking] };
|
|
942
860
|
}
|
|
@@ -1676,7 +1594,7 @@ var _GridAggregationLayer = class extends AggregationLayer {
|
|
|
1676
1594
|
byteLength: dataBytes,
|
|
1677
1595
|
accessor: {
|
|
1678
1596
|
size: 4,
|
|
1679
|
-
type:
|
|
1597
|
+
type: 5126,
|
|
1680
1598
|
divisor: 1
|
|
1681
1599
|
}
|
|
1682
1600
|
});
|
|
@@ -1776,11 +1694,6 @@ var DIMENSIONS = {
|
|
|
1776
1694
|
};
|
|
1777
1695
|
var _ScreenGridLayer = class extends GridAggregationLayer {
|
|
1778
1696
|
initializeState() {
|
|
1779
|
-
if (!ScreenGridCellLayer.isSupported(this.context.device)) {
|
|
1780
|
-
this.setState({ supported: false });
|
|
1781
|
-
import_core8.log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
|
|
1782
|
-
return;
|
|
1783
|
-
}
|
|
1784
1697
|
super.initializeAggregationLayer({
|
|
1785
1698
|
dimensions: DIMENSIONS,
|
|
1786
1699
|
getCellSize: (props) => props.cellSizePixels
|
|
@@ -1808,7 +1721,7 @@ var _ScreenGridLayer = class extends GridAggregationLayer {
|
|
|
1808
1721
|
[POSITION_ATTRIBUTE_NAME]: {
|
|
1809
1722
|
size: 3,
|
|
1810
1723
|
accessor: "getPosition",
|
|
1811
|
-
type:
|
|
1724
|
+
type: "float64",
|
|
1812
1725
|
fp64: this.use64bitPositions()
|
|
1813
1726
|
},
|
|
1814
1727
|
count: { size: 3, accessor: "getWeight" }
|
|
@@ -1937,7 +1850,6 @@ var ScreenGridLayer = _ScreenGridLayer;
|
|
|
1937
1850
|
})();
|
|
1938
1851
|
|
|
1939
1852
|
// dist/cpu-grid-layer/cpu-grid-layer.js
|
|
1940
|
-
var import_constants5 = require("@luma.gl/constants");
|
|
1941
1853
|
var import_layers = require("@deck.gl/layers");
|
|
1942
1854
|
|
|
1943
1855
|
// dist/utils/cpu-aggregator.js
|
|
@@ -2319,7 +2231,7 @@ var _CPUGridLayer = class extends AggregationLayer {
|
|
|
2319
2231
|
};
|
|
2320
2232
|
const attributeManager = this.getAttributeManager();
|
|
2321
2233
|
attributeManager.add({
|
|
2322
|
-
positions: { size: 3, type:
|
|
2234
|
+
positions: { size: 3, type: "float64", accessor: "getPosition" }
|
|
2323
2235
|
});
|
|
2324
2236
|
}
|
|
2325
2237
|
updateState(opts) {
|
|
@@ -2380,7 +2292,6 @@ var CPUGridLayer = _CPUGridLayer;
|
|
|
2380
2292
|
// dist/hexagon-layer/hexagon-layer.js
|
|
2381
2293
|
var import_core10 = require("@deck.gl/core");
|
|
2382
2294
|
var import_layers2 = require("@deck.gl/layers");
|
|
2383
|
-
var import_constants6 = require("@luma.gl/constants");
|
|
2384
2295
|
|
|
2385
2296
|
// dist/hexagon-layer/hexagon-aggregator.js
|
|
2386
2297
|
var import_d3_hexbin = require("d3-hexbin");
|
|
@@ -2491,7 +2402,7 @@ var _HexagonLayer = class extends AggregationLayer {
|
|
|
2491
2402
|
};
|
|
2492
2403
|
const attributeManager = this.getAttributeManager();
|
|
2493
2404
|
attributeManager.add({
|
|
2494
|
-
positions: { size: 3, type:
|
|
2405
|
+
positions: { size: 3, type: "float64", accessor: "getPosition" }
|
|
2495
2406
|
});
|
|
2496
2407
|
}
|
|
2497
2408
|
updateState(opts) {
|
|
@@ -2584,7 +2495,6 @@ var HexagonLayer = _HexagonLayer;
|
|
|
2584
2495
|
})();
|
|
2585
2496
|
|
|
2586
2497
|
// dist/contour-layer/contour-layer.js
|
|
2587
|
-
var import_constants7 = require("@luma.gl/constants");
|
|
2588
2498
|
var import_layers3 = require("@deck.gl/layers");
|
|
2589
2499
|
|
|
2590
2500
|
// dist/contour-layer/marching-squares.js
|
|
@@ -3105,7 +3015,7 @@ var _ContourLayer = class extends GridAggregationLayer {
|
|
|
3105
3015
|
[POSITION_ATTRIBUTE_NAME2]: {
|
|
3106
3016
|
size: 3,
|
|
3107
3017
|
accessor: "getPosition",
|
|
3108
|
-
type:
|
|
3018
|
+
type: "float64",
|
|
3109
3019
|
fp64: this.use64bitPositions()
|
|
3110
3020
|
},
|
|
3111
3021
|
count: { size: 3, accessor: "getWeight" }
|
|
@@ -3223,7 +3133,7 @@ var _ContourLayer = class extends GridAggregationLayer {
|
|
|
3223
3133
|
const { count } = this.state.weights;
|
|
3224
3134
|
let { aggregationData } = count;
|
|
3225
3135
|
if (!aggregationData) {
|
|
3226
|
-
aggregationData = count.aggregationBuffer.
|
|
3136
|
+
aggregationData = count.aggregationBuffer.readSyncWebGL();
|
|
3227
3137
|
count.aggregationData = aggregationData;
|
|
3228
3138
|
}
|
|
3229
3139
|
const { cellWeights } = GPUGridAggregator.getCellData({ countsData: aggregationData });
|
|
@@ -3263,7 +3173,7 @@ var ContourLayer = _ContourLayer;
|
|
|
3263
3173
|
var import_core15 = require("@deck.gl/core");
|
|
3264
3174
|
|
|
3265
3175
|
// dist/gpu-grid-layer/gpu-grid-layer.js
|
|
3266
|
-
var
|
|
3176
|
+
var import_constants5 = require("@luma.gl/constants");
|
|
3267
3177
|
var import_core14 = require("@deck.gl/core");
|
|
3268
3178
|
|
|
3269
3179
|
// dist/gpu-grid-layer/gpu-grid-cell-layer.js
|
|
@@ -3271,28 +3181,23 @@ var import_core13 = require("@deck.gl/core");
|
|
|
3271
3181
|
var import_engine3 = require("@luma.gl/engine");
|
|
3272
3182
|
var import_shadertools2 = require("@luma.gl/shadertools");
|
|
3273
3183
|
var import_engine4 = require("@luma.gl/engine");
|
|
3274
|
-
var
|
|
3184
|
+
var import_constants4 = require("@luma.gl/constants");
|
|
3275
3185
|
|
|
3276
3186
|
// dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js
|
|
3277
3187
|
var gpu_grid_cell_layer_vertex_glsl_default = `#version 300 es
|
|
3278
3188
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
3279
3189
|
#define RANGE_COUNT 6
|
|
3280
|
-
|
|
3281
3190
|
in vec3 positions;
|
|
3282
3191
|
in vec3 normals;
|
|
3283
|
-
|
|
3284
3192
|
in vec4 colors;
|
|
3285
3193
|
in vec4 elevations;
|
|
3286
3194
|
in vec3 instancePickingColors;
|
|
3287
|
-
|
|
3288
|
-
// Custom uniforms
|
|
3289
3195
|
uniform vec2 offset;
|
|
3290
3196
|
uniform bool extruded;
|
|
3291
3197
|
uniform float cellSize;
|
|
3292
3198
|
uniform float coverage;
|
|
3293
3199
|
uniform float opacity;
|
|
3294
3200
|
uniform float elevationScale;
|
|
3295
|
-
|
|
3296
3201
|
uniform ivec2 gridSize;
|
|
3297
3202
|
uniform vec2 gridOrigin;
|
|
3298
3203
|
uniform vec2 gridOriginLow;
|
|
@@ -3300,114 +3205,86 @@ uniform vec2 gridOffset;
|
|
|
3300
3205
|
uniform vec2 gridOffsetLow;
|
|
3301
3206
|
uniform vec4 colorRange[RANGE_COUNT];
|
|
3302
3207
|
uniform vec2 elevationRange;
|
|
3303
|
-
|
|
3304
|
-
// Domain uniforms
|
|
3305
3208
|
uniform vec2 colorDomain;
|
|
3306
3209
|
uniform bool colorDomainValid;
|
|
3307
3210
|
uniform vec2 elevationDomain;
|
|
3308
3211
|
uniform bool elevationDomainValid;
|
|
3309
|
-
|
|
3310
3212
|
layout(std140) uniform;
|
|
3311
3213
|
uniform ColorData
|
|
3312
3214
|
{
|
|
3313
|
-
|
|
3215
|
+
vec4 maxMinCount;
|
|
3314
3216
|
} colorData;
|
|
3315
3217
|
uniform ElevationData
|
|
3316
3218
|
{
|
|
3317
|
-
|
|
3219
|
+
vec4 maxMinCount;
|
|
3318
3220
|
} elevationData;
|
|
3319
|
-
|
|
3320
3221
|
#define EPSILON 0.00001
|
|
3321
|
-
|
|
3322
|
-
// Result
|
|
3323
3222
|
out vec4 vColor;
|
|
3324
|
-
|
|
3325
3223
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3224
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
3225
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
3226
|
+
float domainRange = domain.y - domain.x;
|
|
3227
|
+
if (domainRange <= 0.) {
|
|
3228
|
+
outColor = colorRange[0];
|
|
3229
|
+
} else {
|
|
3230
|
+
float rangeCount = float(RANGE_COUNT);
|
|
3231
|
+
float rangeStep = domainRange / rangeCount;
|
|
3232
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
3233
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
3234
|
+
int intIdx = int(idx);
|
|
3235
|
+
outColor = colorRange[intIdx];
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
return outColor;
|
|
3341
3239
|
}
|
|
3342
|
-
|
|
3343
3240
|
float linearScale(vec2 domain, vec2 range, float value) {
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3241
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
3242
|
+
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
|
|
3243
|
+
}
|
|
3244
|
+
return -1.;
|
|
3348
3245
|
}
|
|
3349
|
-
|
|
3350
3246
|
void main(void) {
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
picking_setPickingColor(instancePickingColors);
|
|
3381
|
-
|
|
3382
|
-
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
3383
|
-
|
|
3384
|
-
// Light calculations
|
|
3385
|
-
// Worldspace is the linear space after Mercator projection
|
|
3386
|
-
|
|
3387
|
-
vec3 normals_commonspace = project_normal(normals);
|
|
3388
|
-
|
|
3389
|
-
if (extruded) {
|
|
3390
|
-
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
3391
|
-
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
3392
|
-
} else {
|
|
3393
|
-
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
3394
|
-
}
|
|
3247
|
+
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
|
|
3248
|
+
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
|
|
3249
|
+
float elevation = 0.0;
|
|
3250
|
+
if (extruded) {
|
|
3251
|
+
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
|
|
3252
|
+
elevation = linearScale(elvDomain, elevationRange, elevations.r);
|
|
3253
|
+
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
|
|
3254
|
+
}
|
|
3255
|
+
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
|
|
3256
|
+
float dotRadius = cellSize / 2. * coverage * shouldRender;
|
|
3257
|
+
int yIndex = (gl_InstanceID / gridSize[0]);
|
|
3258
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
3259
|
+
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
|
|
3260
|
+
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
|
|
3261
|
+
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
|
|
3262
|
+
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
|
|
3263
|
+
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
|
|
3264
|
+
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
|
|
3265
|
+
geometry.worldPosition = centroidPosition;
|
|
3266
|
+
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
|
|
3267
|
+
picking_setPickingColor(instancePickingColors);
|
|
3268
|
+
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
3269
|
+
vec3 normals_commonspace = project_normal(normals);
|
|
3270
|
+
if (extruded) {
|
|
3271
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
3272
|
+
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
3273
|
+
} else {
|
|
3274
|
+
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
3275
|
+
}
|
|
3395
3276
|
}
|
|
3396
3277
|
`;
|
|
3397
3278
|
|
|
3398
3279
|
// dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js
|
|
3399
3280
|
var gpu_grid_cell_layer_fragment_glsl_default = `#version 300 es
|
|
3400
3281
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
3401
|
-
|
|
3402
3282
|
precision highp float;
|
|
3403
|
-
|
|
3404
3283
|
in vec4 vColor;
|
|
3405
|
-
|
|
3406
3284
|
out vec4 fragColor;
|
|
3407
|
-
|
|
3408
3285
|
void main(void) {
|
|
3409
|
-
|
|
3410
|
-
|
|
3286
|
+
fragColor = vColor;
|
|
3287
|
+
fragColor = picking_filterColor(fragColor);
|
|
3411
3288
|
}
|
|
3412
3289
|
`;
|
|
3413
3290
|
|
|
@@ -3489,12 +3366,12 @@ var _GPUGridCellLayer = class extends import_core13.Layer {
|
|
|
3489
3366
|
this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
|
|
3490
3367
|
}
|
|
3491
3368
|
bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
3492
|
-
colorMaxMinBuffer.bind({ target:
|
|
3493
|
-
elevationMaxMinBuffer.bind({ target:
|
|
3369
|
+
colorMaxMinBuffer.bind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
|
|
3370
|
+
elevationMaxMinBuffer.bind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
|
|
3494
3371
|
}
|
|
3495
3372
|
unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
|
|
3496
|
-
colorMaxMinBuffer.unbind({ target:
|
|
3497
|
-
elevationMaxMinBuffer.unbind({ target:
|
|
3373
|
+
colorMaxMinBuffer.unbind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
|
|
3374
|
+
elevationMaxMinBuffer.unbind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
|
|
3498
3375
|
}
|
|
3499
3376
|
getDomainUniforms() {
|
|
3500
3377
|
const { colorDomain, elevationDomain } = this.props;
|
|
@@ -3573,7 +3450,7 @@ var _GPUGridLayer = class extends GridAggregationLayer {
|
|
|
3573
3450
|
combineMaxMin: true,
|
|
3574
3451
|
maxMinBuffer: device.createBuffer({
|
|
3575
3452
|
byteLength: 4 * 4,
|
|
3576
|
-
accessor: { size: 4, type:
|
|
3453
|
+
accessor: { size: 4, type: 5126, divisor: 1 }
|
|
3577
3454
|
})
|
|
3578
3455
|
},
|
|
3579
3456
|
elevation: {
|
|
@@ -3582,7 +3459,7 @@ var _GPUGridLayer = class extends GridAggregationLayer {
|
|
|
3582
3459
|
combineMaxMin: true,
|
|
3583
3460
|
maxMinBuffer: device.createBuffer({
|
|
3584
3461
|
byteLength: 4 * 4,
|
|
3585
|
-
accessor: { size: 4, type:
|
|
3462
|
+
accessor: { size: 4, type: 5126, divisor: 1 }
|
|
3586
3463
|
})
|
|
3587
3464
|
}
|
|
3588
3465
|
},
|
|
@@ -3593,7 +3470,7 @@ var _GPUGridLayer = class extends GridAggregationLayer {
|
|
|
3593
3470
|
[POSITION_ATTRIBUTE_NAME3]: {
|
|
3594
3471
|
size: 3,
|
|
3595
3472
|
accessor: "getPosition",
|
|
3596
|
-
type:
|
|
3473
|
+
type: "float64",
|
|
3597
3474
|
fp64: this.use64bitPositions()
|
|
3598
3475
|
},
|
|
3599
3476
|
color: { size: 3, accessor: "getColorWeight" },
|
|
@@ -3890,7 +3767,6 @@ function getTextureCoordinates(point, bounds) {
|
|
|
3890
3767
|
}
|
|
3891
3768
|
|
|
3892
3769
|
// dist/heatmap-layer/heatmap-layer.js
|
|
3893
|
-
var import_constants10 = require("@luma.gl/constants");
|
|
3894
3770
|
var import_engine6 = require("@luma.gl/engine");
|
|
3895
3771
|
var import_core17 = require("@deck.gl/core");
|
|
3896
3772
|
|
|
@@ -3901,76 +3777,61 @@ var import_core16 = require("@deck.gl/core");
|
|
|
3901
3777
|
// dist/heatmap-layer/triangle-layer-vertex.glsl.js
|
|
3902
3778
|
var triangle_layer_vertex_glsl_default = `#version 300 es
|
|
3903
3779
|
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
3904
|
-
|
|
3905
3780
|
uniform sampler2D maxTexture;
|
|
3906
3781
|
uniform float intensity;
|
|
3907
3782
|
uniform vec2 colorDomain;
|
|
3908
3783
|
uniform float threshold;
|
|
3909
3784
|
uniform float aggregationMode;
|
|
3910
|
-
|
|
3911
3785
|
in vec3 positions;
|
|
3912
3786
|
in vec2 texCoords;
|
|
3913
|
-
|
|
3914
3787
|
out vec2 vTexCoords;
|
|
3915
3788
|
out float vIntensityMin;
|
|
3916
3789
|
out float vIntensityMax;
|
|
3917
|
-
|
|
3918
3790
|
void main(void) {
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
vIntensityMin = intensity / minValue;
|
|
3791
|
+
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
|
|
3792
|
+
vTexCoords = texCoords;
|
|
3793
|
+
vec4 maxTexture = texture(maxTexture, vec2(0.5));
|
|
3794
|
+
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
|
|
3795
|
+
float minValue = maxValue * threshold;
|
|
3796
|
+
if (colorDomain[1] > 0.) {
|
|
3797
|
+
maxValue = colorDomain[1];
|
|
3798
|
+
minValue = colorDomain[0];
|
|
3799
|
+
}
|
|
3800
|
+
vIntensityMax = intensity / maxValue;
|
|
3801
|
+
vIntensityMin = intensity / minValue;
|
|
3931
3802
|
}
|
|
3932
3803
|
`;
|
|
3933
3804
|
|
|
3934
3805
|
// dist/heatmap-layer/triangle-layer-fragment.glsl.js
|
|
3935
3806
|
var triangle_layer_fragment_glsl_default = `#version 300 es
|
|
3936
3807
|
#define SHADER_NAME triangle-layer-fragment-shader
|
|
3937
|
-
|
|
3938
3808
|
precision highp float;
|
|
3939
|
-
|
|
3940
3809
|
uniform float opacity;
|
|
3941
3810
|
uniform sampler2D weightsTexture;
|
|
3942
3811
|
uniform sampler2D colorTexture;
|
|
3943
3812
|
uniform float aggregationMode;
|
|
3944
|
-
|
|
3945
3813
|
in vec2 vTexCoords;
|
|
3946
3814
|
in float vIntensityMin;
|
|
3947
3815
|
in float vIntensityMax;
|
|
3948
|
-
|
|
3949
3816
|
out vec4 fragColor;
|
|
3950
|
-
|
|
3951
3817
|
vec4 getLinearColor(float value) {
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3818
|
+
float factor = clamp(value * vIntensityMax, 0., 1.);
|
|
3819
|
+
vec4 color = texture(colorTexture, vec2(factor, 0.5));
|
|
3820
|
+
color.a *= min(value * vIntensityMin, 1.0);
|
|
3821
|
+
return color;
|
|
3956
3822
|
}
|
|
3957
|
-
|
|
3958
3823
|
void main(void) {
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
vec4 linearColor = getLinearColor(weight);
|
|
3972
|
-
linearColor.a *= opacity;
|
|
3973
|
-
fragColor = linearColor;
|
|
3824
|
+
vec4 weights = texture(weightsTexture, vTexCoords);
|
|
3825
|
+
float weight = weights.r;
|
|
3826
|
+
if (aggregationMode > 0.5) {
|
|
3827
|
+
weight /= max(1.0, weights.a);
|
|
3828
|
+
}
|
|
3829
|
+
if (weight <= 0.) {
|
|
3830
|
+
discard;
|
|
3831
|
+
}
|
|
3832
|
+
vec4 linearColor = getLinearColor(weight);
|
|
3833
|
+
linearColor.a *= opacity;
|
|
3834
|
+
fragColor = linearColor;
|
|
3974
3835
|
}
|
|
3975
3836
|
`;
|
|
3976
3837
|
|
|
@@ -4025,20 +3886,15 @@ uniform float radiusPixels;
|
|
|
4025
3886
|
uniform float textureWidth;
|
|
4026
3887
|
uniform vec4 commonBounds;
|
|
4027
3888
|
uniform float weightsScale;
|
|
4028
|
-
|
|
4029
3889
|
void main()
|
|
4030
3890
|
{
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
// // map xy from commonBounds to [-1, 1]
|
|
4039
|
-
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
4040
|
-
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
4041
|
-
gl_Position.w = 1.0;
|
|
3891
|
+
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
|
|
3892
|
+
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
|
|
3893
|
+
gl_PointSize = radiusTexels * 2.;
|
|
3894
|
+
vec3 commonPosition = project_position(positions, positions64Low);
|
|
3895
|
+
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
3896
|
+
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
3897
|
+
gl_Position.w = 1.0;
|
|
4042
3898
|
}
|
|
4043
3899
|
`;
|
|
4044
3900
|
|
|
@@ -4046,21 +3902,17 @@ void main()
|
|
|
4046
3902
|
var weights_fs_glsl_default = `#version 300 es
|
|
4047
3903
|
in vec4 weightsTexture;
|
|
4048
3904
|
out vec4 fragColor;
|
|
4049
|
-
// Epanechnikov function, keeping for reference
|
|
4050
|
-
// float epanechnikovKDE(float u) {
|
|
4051
|
-
// return 0.75 * (1.0 - u * u);
|
|
4052
|
-
// }
|
|
4053
3905
|
float gaussianKDE(float u){
|
|
4054
|
-
|
|
3906
|
+
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
|
|
4055
3907
|
}
|
|
4056
3908
|
void main()
|
|
4057
3909
|
{
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
3910
|
+
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
|
|
3911
|
+
if (dist > 0.5) {
|
|
3912
|
+
discard;
|
|
3913
|
+
}
|
|
3914
|
+
fragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
3915
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
4064
3916
|
}
|
|
4065
3917
|
`;
|
|
4066
3918
|
|
|
@@ -4069,18 +3921,14 @@ var max_vs_glsl_default = `#version 300 es
|
|
|
4069
3921
|
uniform sampler2D inTexture;
|
|
4070
3922
|
uniform float textureSize;
|
|
4071
3923
|
out vec4 outTexture;
|
|
4072
|
-
|
|
4073
3924
|
void main()
|
|
4074
3925
|
{
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
4082
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
4083
|
-
gl_PointSize = 1.0;
|
|
3926
|
+
int yIndex = gl_VertexID / int(textureSize);
|
|
3927
|
+
int xIndex = gl_VertexID - (yIndex * int(textureSize));
|
|
3928
|
+
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
|
|
3929
|
+
outTexture = texture(inTexture, uv);
|
|
3930
|
+
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
3931
|
+
gl_PointSize = 1.0;
|
|
4084
3932
|
}
|
|
4085
3933
|
`;
|
|
4086
3934
|
|
|
@@ -4089,8 +3937,8 @@ var max_fs_glsl_default = `#version 300 es
|
|
|
4089
3937
|
in vec4 outTexture;
|
|
4090
3938
|
out vec4 fragColor;
|
|
4091
3939
|
void main() {
|
|
4092
|
-
|
|
4093
|
-
|
|
3940
|
+
fragColor = outTexture;
|
|
3941
|
+
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
4094
3942
|
}
|
|
4095
3943
|
`;
|
|
4096
3944
|
|
|
@@ -4123,13 +3971,9 @@ var defaultProps10 = {
|
|
|
4123
3971
|
weightsTextureSize: { type: "number", min: 128, max: 2048, value: 2048 },
|
|
4124
3972
|
debounceTimeout: { type: "number", min: 0, max: 1e3, value: 500 }
|
|
4125
3973
|
};
|
|
4126
|
-
var REQUIRED_FEATURES2 = [
|
|
4127
|
-
"blend-minmax-webgl1",
|
|
4128
|
-
"texture-formats-float32-webgl1"
|
|
4129
|
-
];
|
|
4130
3974
|
var FLOAT_TARGET_FEATURES = [
|
|
4131
|
-
"
|
|
4132
|
-
"texture-blend-float-
|
|
3975
|
+
"float32-renderable-webgl",
|
|
3976
|
+
"texture-blend-float-webgl"
|
|
4133
3977
|
];
|
|
4134
3978
|
var DIMENSIONS4 = {
|
|
4135
3979
|
data: {
|
|
@@ -4138,13 +3982,8 @@ var DIMENSIONS4 = {
|
|
|
4138
3982
|
};
|
|
4139
3983
|
var _HeatmapLayer = class extends AggregationLayer {
|
|
4140
3984
|
initializeState() {
|
|
4141
|
-
if (!REQUIRED_FEATURES2.every((feature) => this.context.device.features.has(feature))) {
|
|
4142
|
-
this.setState({ supported: false });
|
|
4143
|
-
import_core17.log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
|
|
4144
|
-
return;
|
|
4145
|
-
}
|
|
4146
3985
|
super.initializeAggregationLayer(DIMENSIONS4);
|
|
4147
|
-
this.setState({
|
|
3986
|
+
this.setState({ colorDomain: DEFAULT_COLOR_DOMAIN });
|
|
4148
3987
|
this._setupTextureParams();
|
|
4149
3988
|
this._setupAttributes();
|
|
4150
3989
|
this._setupResources();
|
|
@@ -4153,9 +3992,6 @@ var _HeatmapLayer = class extends AggregationLayer {
|
|
|
4153
3992
|
return changeFlags.somethingChanged;
|
|
4154
3993
|
}
|
|
4155
3994
|
updateState(opts) {
|
|
4156
|
-
if (!this.state.supported) {
|
|
4157
|
-
return;
|
|
4158
|
-
}
|
|
4159
3995
|
super.updateState(opts);
|
|
4160
3996
|
this._updateHeatmapState(opts);
|
|
4161
3997
|
}
|
|
@@ -4181,9 +4017,6 @@ var _HeatmapLayer = class extends AggregationLayer {
|
|
|
4181
4017
|
this.setState({ zoom: opts.context.viewport.zoom });
|
|
4182
4018
|
}
|
|
4183
4019
|
renderLayers() {
|
|
4184
|
-
if (!this.state.supported) {
|
|
4185
|
-
return [];
|
|
4186
|
-
}
|
|
4187
4020
|
const { weightsTexture, triPositionBuffer, triTexCoordBuffer, maxWeightsTexture, colorTexture, colorDomain } = this.state;
|
|
4188
4021
|
const { updateTriggers, intensity, threshold: threshold2, aggregation } = this.props;
|
|
4189
4022
|
const TriangleLayerClass = this.getSubLayerClass("triangle", TriangleLayer);
|
|
@@ -4262,7 +4095,7 @@ var _HeatmapLayer = class extends AggregationLayer {
|
|
|
4262
4095
|
_setupAttributes() {
|
|
4263
4096
|
const attributeManager = this.getAttributeManager();
|
|
4264
4097
|
attributeManager.add({
|
|
4265
|
-
positions: { size: 3, type:
|
|
4098
|
+
positions: { size: 3, type: "float64", accessor: "getPosition" },
|
|
4266
4099
|
weights: { size: 1, accessor: "getWeight" }
|
|
4267
4100
|
});
|
|
4268
4101
|
this.setState({ positionAttributeName: "positions" });
|