@deck.gl/extensions 9.0.0-beta.4 → 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.
Files changed (47) hide show
  1. package/dist/brushing/shader-module.d.ts.map +1 -1
  2. package/dist/brushing/shader-module.js +52 -57
  3. package/dist/clip/clip-extension.d.ts.map +1 -1
  4. package/dist/clip/clip-extension.js +6 -6
  5. package/dist/collision-filter/shader-module.d.ts.map +1 -1
  6. package/dist/collision-filter/shader-module.js +46 -56
  7. package/dist/data-filter/aggregator.d.ts.map +1 -1
  8. package/dist/data-filter/aggregator.js +11 -14
  9. package/dist/data-filter/data-filter-extension.d.ts +2 -1
  10. package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
  11. package/dist/data-filter/data-filter-extension.js +13 -7
  12. package/dist/data-filter/shader-module.d.ts.map +1 -1
  13. package/dist/data-filter/shader-module.js +70 -78
  14. package/dist/dist.dev.js +297 -302
  15. package/dist/fill-style/fill-style-extension.js +1 -1
  16. package/dist/fill-style/{shaders.glsl.d.ts → shader-module.d.ts} +1 -1
  17. package/dist/fill-style/shader-module.d.ts.map +1 -0
  18. package/dist/fill-style/{shaders.glsl.js → shader-module.js} +27 -33
  19. package/dist/fp64/project64.glsl.js +41 -60
  20. package/dist/index.cjs +374 -432
  21. package/dist/index.cjs.map +4 -4
  22. package/dist/mask/mask-pass.js +2 -2
  23. package/dist/mask/shader-module.d.ts.map +1 -1
  24. package/dist/mask/shader-module.js +33 -37
  25. package/dist/path-style/shaders.glsl.js +42 -47
  26. package/dist/terrain/shader-module.d.ts.map +1 -1
  27. package/dist/terrain/shader-module.js +30 -32
  28. package/dist/terrain/terrain-pass.js +2 -2
  29. package/dist/terrain/utils.js +2 -2
  30. package/dist/utils/syntax-tags.d.ts +6 -0
  31. package/dist/utils/syntax-tags.d.ts.map +1 -0
  32. package/dist/utils/syntax-tags.js +5 -0
  33. package/dist.min.js +364 -431
  34. package/package.json +8 -8
  35. package/src/brushing/shader-module.ts +4 -3
  36. package/src/clip/clip-extension.ts +10 -9
  37. package/src/collision-filter/shader-module.ts +6 -4
  38. package/src/data-filter/aggregator.ts +8 -13
  39. package/src/data-filter/data-filter-extension.ts +18 -8
  40. package/src/data-filter/shader-module.ts +7 -6
  41. package/src/fill-style/fill-style-extension.ts +1 -1
  42. package/src/fill-style/{shaders.glsl.ts → shader-module.ts} +6 -5
  43. package/src/mask/shader-module.ts +7 -6
  44. package/src/terrain/shader-module.ts +11 -10
  45. package/src/terrain/utils.ts +1 -1
  46. package/src/utils/syntax-tags.ts +5 -0
  47. package/dist/fill-style/shaders.glsl.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -39,41 +39,35 @@ var import_core2 = require("@deck.gl/core");
39
39
  // dist/brushing/shader-module.js
40
40
  var import_core = require("@deck.gl/core");
41
41
  var vs = `
42
- uniform bool brushing_enabled;
43
- uniform int brushing_target;
44
- uniform vec2 brushing_mousePos;
45
- uniform float brushing_radius;
46
-
47
- #ifdef NON_INSTANCED_MODEL
48
- in vec2 brushingTargets;
49
- #else
50
- in vec2 instanceBrushingTargets;
51
- #endif
52
-
53
- out float brushing_isVisible;
54
-
55
- bool brushing_isPointInRange(vec2 position) {
56
- if (!brushing_enabled) {
57
- return true;
58
- }
59
- vec2 source_commonspace = project_position(position);
60
- vec2 target_commonspace = project_position(brushing_mousePos);
61
- float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);
62
-
63
- return distance <= brushing_radius;
64
- }
65
-
66
- bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {
67
- return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);
68
- }
69
-
70
- void brushing_setVisible(bool visible) {
71
- brushing_isVisible = float(visible);
72
- }
42
+ uniform bool brushing_enabled;
43
+ uniform int brushing_target;
44
+ uniform vec2 brushing_mousePos;
45
+ uniform float brushing_radius;
46
+ #ifdef NON_INSTANCED_MODEL
47
+ in vec2 brushingTargets;
48
+ #else
49
+ in vec2 instanceBrushingTargets;
50
+ #endif
51
+ out float brushing_isVisible;
52
+ bool brushing_isPointInRange(vec2 position) {
53
+ if (!brushing_enabled) {
54
+ return true;
55
+ }
56
+ vec2 source_commonspace = project_position(position);
57
+ vec2 target_commonspace = project_position(brushing_mousePos);
58
+ float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);
59
+ return distance <= brushing_radius;
60
+ }
61
+ bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {
62
+ return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);
63
+ }
64
+ void brushing_setVisible(bool visible) {
65
+ brushing_isVisible = float(visible);
66
+ }
73
67
  `;
74
68
  var fs = `
75
- uniform bool brushing_enabled;
76
- in float brushing_isVisible;
69
+ uniform bool brushing_enabled;
70
+ in float brushing_isVisible;
77
71
  `;
78
72
  var TARGET = {
79
73
  source: 0,
@@ -83,30 +77,30 @@ var TARGET = {
83
77
  };
84
78
  var inject = {
85
79
  "vs:DECKGL_FILTER_GL_POSITION": `
86
- vec2 brushingTarget;
87
- vec2 brushingSource;
88
- if (brushing_target == 3) {
89
- brushingTarget = geometry.worldPositionAlt.xy;
90
- brushingSource = geometry.worldPosition.xy;
91
- } else if (brushing_target == 0) {
92
- brushingTarget = geometry.worldPosition.xy;
93
- } else if (brushing_target == 1) {
94
- brushingTarget = geometry.worldPositionAlt.xy;
95
- } else {
96
- #ifdef NON_INSTANCED_MODEL
97
- brushingTarget = brushingTargets;
98
- #else
99
- brushingTarget = instanceBrushingTargets;
100
- #endif
101
- }
102
- bool visible;
103
- if (brushing_target == 3) {
104
- visible = brushing_arePointsInRange(brushingSource, brushingTarget);
105
- } else {
106
- visible = brushing_isPointInRange(brushingTarget);
107
- }
108
- brushing_setVisible(visible);
109
- `,
80
+ vec2 brushingTarget;
81
+ vec2 brushingSource;
82
+ if (brushing_target == 3) {
83
+ brushingTarget = geometry.worldPositionAlt.xy;
84
+ brushingSource = geometry.worldPosition.xy;
85
+ } else if (brushing_target == 0) {
86
+ brushingTarget = geometry.worldPosition.xy;
87
+ } else if (brushing_target == 1) {
88
+ brushingTarget = geometry.worldPositionAlt.xy;
89
+ } else {
90
+ #ifdef NON_INSTANCED_MODEL
91
+ brushingTarget = brushingTargets;
92
+ #else
93
+ brushingTarget = instanceBrushingTargets;
94
+ #endif
95
+ }
96
+ bool visible;
97
+ if (brushing_target == 3) {
98
+ visible = brushing_arePointsInRange(brushingSource, brushingTarget);
99
+ } else {
100
+ visible = brushing_isPointInRange(brushingTarget);
101
+ }
102
+ brushing_setVisible(visible);
103
+ `,
110
104
  "fs:DECKGL_FILTER_COLOR": `
111
105
  if (brushing_enabled && brushing_isVisible < 0.5) {
112
106
  discard;
@@ -195,7 +189,6 @@ var BrushingExtension = _BrushingExtension;
195
189
  })();
196
190
 
197
191
  // dist/data-filter/data-filter-extension.js
198
- var import_constants2 = require("@luma.gl/constants");
199
192
  var import_core3 = require("@deck.gl/core");
200
193
 
201
194
  // dist/data-filter/shader-module.js
@@ -208,78 +201,69 @@ uniform bool filter_useSoftMargin;
208
201
  uniform bool filter_enabled;
209
202
  uniform bool filter_transformSize;
210
203
  uniform ivec4 filter_categoryBitMask;
211
-
212
204
  #ifdef NON_INSTANCED_MODEL
213
- #define DATAFILTER_ATTRIB filterValues
214
- #define DATAFILTER_ATTRIB_64LOW filterValues64Low
215
- #define DATACATEGORY_ATTRIB filterCategoryValues
205
+ #define DATAFILTER_ATTRIB filterValues
206
+ #define DATAFILTER_ATTRIB_64LOW filterValues64Low
207
+ #define DATACATEGORY_ATTRIB filterCategoryValues
216
208
  #else
217
- #define DATAFILTER_ATTRIB instanceFilterValues
218
- #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low
219
- #define DATACATEGORY_ATTRIB instanceFilterCategoryValues
209
+ #define DATAFILTER_ATTRIB instanceFilterValues
210
+ #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low
211
+ #define DATACATEGORY_ATTRIB instanceFilterCategoryValues
220
212
  #endif
221
-
222
213
  in DATAFILTER_TYPE DATAFILTER_ATTRIB;
223
214
  #ifdef DATAFILTER_DOUBLE
224
- in DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;
225
-
226
- uniform DATAFILTER_TYPE filter_min64High;
227
- uniform DATAFILTER_TYPE filter_max64High;
215
+ in DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;
216
+ uniform DATAFILTER_TYPE filter_min64High;
217
+ uniform DATAFILTER_TYPE filter_max64High;
228
218
  #endif
229
219
  in DATACATEGORY_TYPE DATACATEGORY_ATTRIB;
230
-
231
220
  out float dataFilter_value;
232
-
233
221
  float dataFilter_reduceValue(float value) {
234
- return value;
222
+ return value;
235
223
  }
236
224
  float dataFilter_reduceValue(vec2 value) {
237
- return min(value.x, value.y);
225
+ return min(value.x, value.y);
238
226
  }
239
227
  float dataFilter_reduceValue(vec3 value) {
240
- return min(min(value.x, value.y), value.z);
228
+ return min(min(value.x, value.y), value.z);
241
229
  }
242
230
  float dataFilter_reduceValue(vec4 value) {
243
- return min(min(value.x, value.y), min(value.z, value.w));
231
+ return min(min(value.x, value.y), min(value.z, value.w));
244
232
  }
245
233
  void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax, DATACATEGORY_TYPE category) {
246
- if (filter_enabled) {
247
- if (filter_useSoftMargin) {
248
- dataFilter_value = dataFilter_reduceValue(
249
- smoothstep(filter_min, filter_softMin, valueFromMin) *
250
- (1.0 - smoothstep(filter_softMax, filter_max, valueFromMax))
251
- );
252
- } else {
253
- dataFilter_value = dataFilter_reduceValue(
254
- step(filter_min, valueFromMin) * step(valueFromMax, filter_max)
255
- );
256
- }
257
-
258
- #if DATACATEGORY_CHANNELS == 1 // One 128-bit mask
259
- int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)];
260
- #elif DATACATEGORY_CHANNELS == 2 // Two 64-bit masks
261
- ivec2 dataFilter_masks = ivec2(
262
- filter_categoryBitMask[int(category.x / 32.0)],
263
- filter_categoryBitMask[int(category.y / 32.0) + 2]
264
- );
265
- #elif DATACATEGORY_CHANNELS == 3 // Three 32-bit masks
266
- ivec3 dataFilter_masks = filter_categoryBitMask.xyz;
267
- #else // Four 32-bit masks
268
- ivec4 dataFilter_masks = filter_categoryBitMask;
269
- #endif
270
-
271
- // Shift mask and extract relevant bits
272
- DATACATEGORY_TYPE dataFilter_bits = DATACATEGORY_TYPE(dataFilter_masks) / pow(DATACATEGORY_TYPE(2.0), mod(category, 32.0));
273
- dataFilter_bits = mod(floor(dataFilter_bits), 2.0);
274
-
275
- #if DATACATEGORY_CHANNELS == 1
276
- if(dataFilter_bits == 0.0) dataFilter_value = 0.0;
277
- #else
278
- if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
279
- #endif
280
- } else {
281
- dataFilter_value = 1.0;
282
- }
234
+ if (filter_enabled) {
235
+ if (filter_useSoftMargin) {
236
+ dataFilter_value = dataFilter_reduceValue(
237
+ smoothstep(filter_min, filter_softMin, valueFromMin) *
238
+ (1.0 - smoothstep(filter_softMax, filter_max, valueFromMax))
239
+ );
240
+ } else {
241
+ dataFilter_value = dataFilter_reduceValue(
242
+ step(filter_min, valueFromMin) * step(valueFromMax, filter_max)
243
+ );
244
+ }
245
+ #if DATACATEGORY_CHANNELS == 1
246
+ int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)];
247
+ #elif DATACATEGORY_CHANNELS == 2
248
+ ivec2 dataFilter_masks = ivec2(
249
+ filter_categoryBitMask[int(category.x / 32.0)],
250
+ filter_categoryBitMask[int(category.y / 32.0) + 2]
251
+ );
252
+ #elif DATACATEGORY_CHANNELS == 3
253
+ ivec3 dataFilter_masks = filter_categoryBitMask.xyz;
254
+ #else
255
+ ivec4 dataFilter_masks = filter_categoryBitMask;
256
+ #endif
257
+ DATACATEGORY_TYPE dataFilter_bits = DATACATEGORY_TYPE(dataFilter_masks) / pow(DATACATEGORY_TYPE(2.0), mod(category, 32.0));
258
+ dataFilter_bits = mod(floor(dataFilter_bits), 2.0);
259
+ #if DATACATEGORY_CHANNELS == 1
260
+ if(dataFilter_bits == 0.0) dataFilter_value = 0.0;
261
+ #else
262
+ if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0;
263
+ #endif
264
+ } else {
265
+ dataFilter_value = 1.0;
266
+ }
283
267
  }
284
268
  `;
285
269
  var fs2 = `
@@ -338,32 +322,32 @@ function getUniforms64(opts) {
338
322
  }
339
323
  var inject2 = {
340
324
  "vs:#main-start": `
341
- #ifdef DATAFILTER_DOUBLE
342
- dataFilter_setValue(
343
- DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,
344
- DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW,
345
- DATACATEGORY_ATTRIB
346
- );
347
- #else
348
- dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB, DATACATEGORY_ATTRIB);
349
- #endif
350
- `,
325
+ #ifdef DATAFILTER_DOUBLE
326
+ dataFilter_setValue(
327
+ DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,
328
+ DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW,
329
+ DATACATEGORY_ATTRIB
330
+ );
331
+ #else
332
+ dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB, DATACATEGORY_ATTRIB);
333
+ #endif
334
+ `,
351
335
  "vs:#main-end": `
352
- if (dataFilter_value == 0.0) {
353
- gl_Position = vec4(0.);
354
- }
355
- `,
336
+ if (dataFilter_value == 0.0) {
337
+ gl_Position = vec4(0.);
338
+ }
339
+ `,
356
340
  "vs:DECKGL_FILTER_SIZE": `
357
- if (filter_transformSize) {
358
- size = size * dataFilter_value;
359
- }
360
- `,
341
+ if (filter_transformSize) {
342
+ size = size * dataFilter_value;
343
+ }
344
+ `,
361
345
  "fs:DECKGL_FILTER_COLOR": `
362
- if (dataFilter_value == 0.0) discard;
363
- if (filter_transformColor) {
364
- color.a *= dataFilter_value;
365
- }
366
- `
346
+ if (dataFilter_value == 0.0) discard;
347
+ if (filter_transformColor) {
348
+ color.a *= dataFilter_value;
349
+ }
350
+ `
367
351
  };
368
352
  var shaderModule = {
369
353
  name: "data-filter",
@@ -430,9 +414,12 @@ void main() {
430
414
  fragColor = vColor;
431
415
  }
432
416
  `;
417
+ var FLOAT_TARGET_FEATURES = [
418
+ "float32-renderable-webgl",
419
+ "texture-blend-float-webgl"
420
+ ];
433
421
  function supportsFloatTarget(device) {
434
- const gl = device.gl;
435
- return Boolean(gl.getExtension("EXT_float_blend") && (gl.getExtension("EXT_color_buffer_float") || gl.getExtension("WEBGL_color_buffer_float")));
422
+ return FLOAT_TARGET_FEATURES.every((feature) => device.features.has(feature));
436
423
  }
437
424
  function getFramebuffer(device, useFloatTarget) {
438
425
  if (useFloatTarget) {
@@ -441,8 +428,8 @@ function getFramebuffer(device, useFloatTarget) {
441
428
  height: 1,
442
429
  colorAttachments: [
443
430
  device.createTexture({
444
- format: device.info.type === "webgl2" ? "rgba32float" : "rgba8unorm",
445
- type: import_constants.GL.FLOAT,
431
+ format: "rgba32float",
432
+ type: 5126,
446
433
  mipmaps: false
447
434
  })
448
435
  ]
@@ -451,7 +438,7 @@ function getFramebuffer(device, useFloatTarget) {
451
438
  return device.createFramebuffer({
452
439
  width: 256,
453
440
  height: 64,
454
- colorAttachments: [device.createTexture({ format: "rgba8unorm", type: import_constants.GL.FLOAT, mipmaps: false })]
441
+ colorAttachments: [device.createTexture({ format: "rgba8unorm", type: 5126, mipmaps: false })]
455
442
  });
456
443
  }
457
444
  function getModel(device, shaderOptions, useFloatTarget) {
@@ -463,7 +450,7 @@ function getModel(device, shaderOptions, useFloatTarget) {
463
450
  id: "data-filter-aggregation-model",
464
451
  vertexCount: 1,
465
452
  isInstanced: false,
466
- drawMode: import_constants.GL.POINTS,
453
+ drawMode: 0,
467
454
  vs: AGGREGATE_VS,
468
455
  fs: AGGREGATE_FS,
469
456
  ...shaderOptions
@@ -471,8 +458,8 @@ function getModel(device, shaderOptions, useFloatTarget) {
471
458
  }
472
459
  var parameters = {
473
460
  blend: true,
474
- blendFunc: [import_constants.GL.ONE, import_constants.GL.ONE, import_constants.GL.ONE, import_constants.GL.ONE],
475
- blendEquation: [import_constants.GL.FUNC_ADD, import_constants.GL.FUNC_ADD],
461
+ blendFunc: [1, 1, 1, 1],
462
+ blendEquation: [32774, 32774],
476
463
  depthTest: false
477
464
  };
478
465
 
@@ -488,6 +475,12 @@ var defaultProps2 = {
488
475
  filterTransformSize: true,
489
476
  filterTransformColor: true
490
477
  };
478
+ var defaultOptions = {
479
+ categorySize: 1,
480
+ filterSize: 1,
481
+ fp64: false,
482
+ countItems: false
483
+ };
491
484
  var DATA_TYPE_FROM_SIZE = {
492
485
  1: "float",
493
486
  2: "vec2",
@@ -495,14 +488,17 @@ var DATA_TYPE_FROM_SIZE = {
495
488
  4: "vec4"
496
489
  };
497
490
  var _DataFilterExtension = class extends import_core3.LayerExtension {
491
+ constructor(opts) {
492
+ super({ ...defaultOptions, ...opts });
493
+ }
498
494
  getShaders(extension) {
499
495
  const { categorySize, filterSize, fp64: fp642 } = extension.opts;
500
496
  return {
501
497
  modules: [fp642 ? shaderModule64 : shaderModule],
502
498
  defines: {
503
- DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize || 1],
499
+ DATACATEGORY_TYPE: DATA_TYPE_FROM_SIZE[categorySize],
504
500
  DATACATEGORY_CHANNELS: categorySize,
505
- DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize || 1],
501
+ DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],
506
502
  DATAFILTER_DOUBLE: Boolean(fp642)
507
503
  }
508
504
  };
@@ -514,7 +510,7 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
514
510
  attributeManager.add({
515
511
  filterValues: {
516
512
  size: filterSize,
517
- type: fp642 ? import_constants2.GL.DOUBLE : import_constants2.GL.FLOAT,
513
+ type: fp642 ? "float64" : "float32",
518
514
  accessor: "getFilterValue",
519
515
  shaderAttributes: {
520
516
  filterValues: {
@@ -527,7 +523,6 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
527
523
  },
528
524
  filterCategoryValues: {
529
525
  size: categorySize,
530
- type: import_constants2.GL.FLOAT,
531
526
  accessor: "getFilterCategory",
532
527
  transform: categorySize === 1 ? (d) => extension._getCategoryKey.call(this, d, 0) : (d) => d.map((x, i) => extension._getCategoryKey.call(this, x, i)),
533
528
  shaderAttributes: {
@@ -548,8 +543,7 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
548
543
  filterIndices: {
549
544
  size: useFloatTarget ? 1 : 2,
550
545
  vertexOffset: 1,
551
- type: import_constants2.GL.UNSIGNED_BYTE,
552
- normalized: true,
546
+ type: "unorm8",
553
547
  accessor: (object, { index }) => {
554
548
  const i = object && object.__source ? object.__source.index : index;
555
549
  return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];
@@ -680,84 +674,65 @@ var import_shadertools = require("@luma.gl/shadertools");
680
674
  var import_core4 = require("@deck.gl/core");
681
675
 
682
676
  // dist/fp64/project64.glsl.js
683
- var project64_glsl_default = `
684
- const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
685
-
677
+ var project64_glsl_default = `const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
686
678
  uniform vec2 project_uViewProjectionMatrixFP64[16];
687
-
688
- // longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw
689
679
  void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
690
-
691
680
  #if defined(NVIDIA_FP64_WORKAROUND)
692
- out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);
681
+ out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);
693
682
  #else
694
- out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);
683
+ out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);
695
684
  #endif
696
- out_val[1] = sum_fp64(PI_FP64,
697
- log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));
698
- return;
685
+ out_val[1] = sum_fp64(PI_FP64,
686
+ log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));
687
+ return;
699
688
  }
700
-
701
689
  void project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {
702
- vec2 pos_fp64[2];
703
- mercatorProject_fp64(position_fp64, pos_fp64);
704
- out_val[0] = mul_fp64(pos_fp64[0], WORLD_SCALE_FP64);
705
- out_val[1] = mul_fp64(pos_fp64[1], WORLD_SCALE_FP64);
706
-
707
- return;
690
+ vec2 pos_fp64[2];
691
+ mercatorProject_fp64(position_fp64, pos_fp64);
692
+ out_val[0] = mul_fp64(pos_fp64[0], WORLD_SCALE_FP64);
693
+ out_val[1] = mul_fp64(pos_fp64[1], WORLD_SCALE_FP64);
694
+ return;
708
695
  }
709
-
710
696
  void project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) {
711
- vec4 position64xy = vec4(
712
- position.x, position64xyLow.x,
713
- position.y, position64xyLow.y);
714
-
715
- project_position_fp64(position64xy, out_val);
697
+ vec4 position64xy = vec4(
698
+ position.x, position64xyLow.x,
699
+ position.y, position64xyLow.y);
700
+ project_position_fp64(position64xy, out_val);
716
701
  }
717
-
718
702
  vec4 project_common_position_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {
719
- vec2 vertex_pos_clipspace[4];
720
- mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,
721
- vertex_pos_clipspace);
722
- return vec4(
723
- vertex_pos_clipspace[0].x,
724
- vertex_pos_clipspace[1].x,
725
- vertex_pos_clipspace[2].x,
726
- vertex_pos_clipspace[3].x
727
- );
703
+ vec2 vertex_pos_clipspace[4];
704
+ mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,
705
+ vertex_pos_clipspace);
706
+ return vec4(
707
+ vertex_pos_clipspace[0].x,
708
+ vertex_pos_clipspace[1].x,
709
+ vertex_pos_clipspace[2].x,
710
+ vertex_pos_clipspace[3].x
711
+ );
728
712
  }
729
-
730
713
  vec4 project_position_to_clipspace(
731
- vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition
714
+ vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition
732
715
  ) {
733
- // This is the local offset to the instance position
734
- vec2 offset64[4];
735
- vec4_fp64(vec4(offset, 0.0), offset64);
736
-
737
- float z = project_size(position.z);
738
-
739
- // Apply web mercator projection (depends on coordinate system imn use)
740
- vec2 projectedPosition64xy[2];
741
- project_position_fp64(position.xy, position64xyLow.xy, projectedPosition64xy);
742
-
743
- vec2 commonPosition64[4];
744
- commonPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]);
745
- commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);
746
- commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));
747
- commonPosition64[3] = vec2(1.0, 0.0);
748
-
749
- commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);
750
-
751
- return project_common_position_to_clipspace_fp64(commonPosition64);
716
+ vec2 offset64[4];
717
+ vec4_fp64(vec4(offset, 0.0), offset64);
718
+ float z = project_size(position.z);
719
+ vec2 projectedPosition64xy[2];
720
+ project_position_fp64(position.xy, position64xyLow.xy, projectedPosition64xy);
721
+ vec2 commonPosition64[4];
722
+ commonPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]);
723
+ commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);
724
+ commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));
725
+ commonPosition64[3] = vec2(1.0, 0.0);
726
+ commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);
727
+ return project_common_position_to_clipspace_fp64(commonPosition64);
752
728
  }
753
-
754
729
  vec4 project_position_to_clipspace(
755
- vec3 position, vec3 position64xyLow, vec3 offset
730
+ vec3 position, vec3 position64xyLow, vec3 offset
756
731
  ) {
757
- vec4 commonPosition;
758
- return project_position_to_clipspace(
759
- position, position64xyLow, offset, commonPosition
760
- );
732
+ vec4 commonPosition;
733
+ return project_position_to_clipspace(
734
+ position, position64xyLow, offset, commonPosition
735
+ );
761
736
  }
762
737
  `;
763
738
 
@@ -829,41 +804,36 @@ in vec2 vDashArray;
829
804
  in float vDashOffset;
830
805
  `,
831
806
  "fs:#main-start": `
832
- float solidLength = vDashArray.x;
833
- float gapLength = vDashArray.y;
834
- float unitLength = solidLength + gapLength;
835
-
836
- float offset;
837
-
838
- if (unitLength > 0.0) {
839
- if (dashAlignMode == 0.0) {
840
- offset = vDashOffset;
841
- } else {
842
- unitLength = vPathLength / round(vPathLength / unitLength);
843
- offset = solidLength / 2.0;
844
- }
845
-
846
- float unitOffset = mod(vPathPosition.y + offset, unitLength);
847
-
848
- if (gapLength > 0.0 && unitOffset > solidLength) {
849
- if (capType <= 0.5) {
850
- if (!(dashGapPickable && bool(picking.isActive))) {
851
- discard;
852
- }
853
- } else {
854
- // caps are rounded, test the distance to solid ends
855
- float distToEnd = length(vec2(
856
- min(unitOffset - solidLength, unitLength - unitOffset),
857
- vPathPosition.x
858
- ));
859
- if (distToEnd > 1.0) {
860
- if (!(dashGapPickable && bool(picking.isActive))) {
861
- discard;
862
- }
863
- }
864
- }
865
- }
866
- }
807
+ float solidLength = vDashArray.x;
808
+ float gapLength = vDashArray.y;
809
+ float unitLength = solidLength + gapLength;
810
+ float offset;
811
+ if (unitLength > 0.0) {
812
+ if (dashAlignMode == 0.0) {
813
+ offset = vDashOffset;
814
+ } else {
815
+ unitLength = vPathLength / round(vPathLength / unitLength);
816
+ offset = solidLength / 2.0;
817
+ }
818
+ float unitOffset = mod(vPathPosition.y + offset, unitLength);
819
+ if (gapLength > 0.0 && unitOffset > solidLength) {
820
+ if (capType <= 0.5) {
821
+ if (!(dashGapPickable && bool(picking.isActive))) {
822
+ discard;
823
+ }
824
+ } else {
825
+ float distToEnd = length(vec2(
826
+ min(unitOffset - solidLength, unitLength - unitOffset),
827
+ vPathPosition.x
828
+ ));
829
+ if (distToEnd > 1.0) {
830
+ if (!(dashGapPickable && bool(picking.isActive))) {
831
+ discard;
832
+ }
833
+ }
834
+ }
835
+ }
836
+ }
867
837
  `
868
838
  }
869
839
  };
@@ -873,22 +843,22 @@ var offsetShaders = {
873
843
  in float instanceOffsets;
874
844
  `,
875
845
  "vs:DECKGL_FILTER_SIZE": `
876
- float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
877
- size *= offsetWidth;
846
+ float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
847
+ size *= offsetWidth;
878
848
  `,
879
849
  "vs:#main-end": `
880
- float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
881
- float offsetDir = sign(instanceOffsets);
882
- vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
883
- vPathPosition.y *= offsetWidth;
884
- vPathLength *= offsetWidth;
850
+ float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
851
+ float offsetDir = sign(instanceOffsets);
852
+ vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
853
+ vPathPosition.y *= offsetWidth;
854
+ vPathLength *= offsetWidth;
885
855
  `,
886
856
  "fs:#main-start": `
887
- float isInside;
888
- isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
889
- if (isInside == 0.0) {
890
- discard;
891
- }
857
+ float isInside;
858
+ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
859
+ if (isInside == 0.0) {
860
+ discard;
861
+ }
892
862
  `
893
863
  }
894
864
  };
@@ -988,26 +958,23 @@ var PathStyleExtension = _PathStyleExtension;
988
958
  // dist/fill-style/fill-style-extension.js
989
959
  var import_core9 = require("@deck.gl/core");
990
960
 
991
- // dist/fill-style/shaders.glsl.js
961
+ // dist/fill-style/shader-module.js
992
962
  var import_core8 = require("@deck.gl/core");
993
963
  var patternVs = `
994
964
  #ifdef NON_INSTANCED_MODEL
995
- #define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
996
- #define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
997
- #define FILL_PATTERN_OFFSET_ATTRIB fillPatternOffsets
965
+ #define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
966
+ #define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
967
+ #define FILL_PATTERN_OFFSET_ATTRIB fillPatternOffsets
998
968
  #else
999
- #define FILL_PATTERN_FRAME_ATTRIB instanceFillPatternFrames
1000
- #define FILL_PATTERN_SCALE_ATTRIB instanceFillPatternScales
1001
- #define FILL_PATTERN_OFFSET_ATTRIB instanceFillPatternOffsets
969
+ #define FILL_PATTERN_FRAME_ATTRIB instanceFillPatternFrames
970
+ #define FILL_PATTERN_SCALE_ATTRIB instanceFillPatternScales
971
+ #define FILL_PATTERN_OFFSET_ATTRIB instanceFillPatternOffsets
1002
972
  #endif
1003
-
1004
973
  in vec4 FILL_PATTERN_FRAME_ATTRIB;
1005
974
  in float FILL_PATTERN_SCALE_ATTRIB;
1006
975
  in vec2 FILL_PATTERN_OFFSET_ATTRIB;
1007
-
1008
976
  uniform bool fill_patternEnabled;
1009
977
  uniform vec2 fill_patternTextureSize;
1010
-
1011
978
  out vec2 fill_uv;
1012
979
  out vec4 fill_patternBounds;
1013
980
  out vec4 fill_patternPlacement;
@@ -1018,39 +985,35 @@ uniform bool fill_patternMask;
1018
985
  uniform sampler2D fill_patternTexture;
1019
986
  uniform vec2 fill_uvCoordinateOrigin;
1020
987
  uniform vec2 fill_uvCoordinateOrigin64Low;
1021
-
1022
988
  in vec4 fill_patternBounds;
1023
989
  in vec4 fill_patternPlacement;
1024
990
  in vec2 fill_uv;
1025
-
1026
991
  const float FILL_UV_SCALE = 512.0 / 40000000.0;
1027
992
  `;
1028
993
  var inject3 = {
1029
994
  "vs:DECKGL_FILTER_GL_POSITION": `
1030
- fill_uv = geometry.position.xy;
1031
- `,
995
+ fill_uv = geometry.position.xy;
996
+ `,
1032
997
  "vs:DECKGL_FILTER_COLOR": `
1033
- if (fill_patternEnabled) {
1034
- fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
1035
- fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
1036
- fill_patternPlacement.zw = FILL_PATTERN_SCALE_ATTRIB * FILL_PATTERN_FRAME_ATTRIB.zw;
1037
- }
1038
- `,
998
+ if (fill_patternEnabled) {
999
+ fill_patternBounds = FILL_PATTERN_FRAME_ATTRIB / vec4(fill_patternTextureSize, fill_patternTextureSize);
1000
+ fill_patternPlacement.xy = FILL_PATTERN_OFFSET_ATTRIB;
1001
+ fill_patternPlacement.zw = FILL_PATTERN_SCALE_ATTRIB * FILL_PATTERN_FRAME_ATTRIB.zw;
1002
+ }
1003
+ `,
1039
1004
  "fs:DECKGL_FILTER_COLOR": `
1040
- if (fill_patternEnabled) {
1041
- vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw;
1042
- vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale;
1043
- patternUV = mod(fill_patternPlacement.xy + patternUV, 1.0);
1044
-
1045
- vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV;
1046
-
1047
- vec4 patternColor = texture(fill_patternTexture, texCoords);
1048
- color.a *= patternColor.a;
1049
- if (!fill_patternMask) {
1050
- color.rgb = patternColor.rgb;
1051
- }
1052
- }
1053
- `
1005
+ if (fill_patternEnabled) {
1006
+ vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw;
1007
+ vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale;
1008
+ patternUV = mod(fill_patternPlacement.xy + patternUV, 1.0);
1009
+ vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV;
1010
+ vec4 patternColor = texture(fill_patternTexture, texCoords);
1011
+ color.a *= patternColor.a;
1012
+ if (!fill_patternMask) {
1013
+ color.rgb = patternColor.rgb;
1014
+ }
1015
+ }
1016
+ `
1054
1017
  };
1055
1018
  function getPatternUniforms(opts, uniforms) {
1056
1019
  if (!opts) {
@@ -1218,9 +1181,8 @@ var defaultProps5 = {
1218
1181
  };
1219
1182
  var shaderFunction = `
1220
1183
  uniform vec4 clip_bounds;
1221
-
1222
1184
  bool clip_isInBounds(vec2 position) {
1223
- return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
1185
+ return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
1224
1186
  }
1225
1187
  `;
1226
1188
  var shaderModuleVs = {
@@ -1232,13 +1194,13 @@ var injectionVs = {
1232
1194
  out float clip_isVisible;
1233
1195
  `,
1234
1196
  "vs:DECKGL_FILTER_GL_POSITION": `
1235
- clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
1197
+ clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
1236
1198
  `,
1237
1199
  "fs:#decl": `
1238
1200
  in float clip_isVisible;
1239
1201
  `,
1240
1202
  "fs:DECKGL_FILTER_COLOR": `
1241
- if (clip_isVisible < 0.5) discard;
1203
+ if (clip_isVisible < 0.5) discard;
1242
1204
  `
1243
1205
  };
1244
1206
  var shaderModuleFs = {
@@ -1250,13 +1212,13 @@ var injectionFs = {
1250
1212
  out vec2 clip_commonPosition;
1251
1213
  `,
1252
1214
  "vs:DECKGL_FILTER_GL_POSITION": `
1253
- clip_commonPosition = geometry.position.xy;
1215
+ clip_commonPosition = geometry.position.xy;
1254
1216
  `,
1255
1217
  "fs:#decl": `
1256
1218
  in vec2 clip_commonPosition;
1257
1219
  `,
1258
1220
  "fs:DECKGL_FILTER_COLOR": `
1259
- if (!clip_isInBounds(clip_commonPosition)) discard;
1221
+ if (!clip_isInBounds(clip_commonPosition)) discard;
1260
1222
  `
1261
1223
  };
1262
1224
  var _ClipExtension = class extends import_core10.LayerExtension {
@@ -1309,77 +1271,65 @@ in float collisionPriorities;
1309
1271
  #else
1310
1272
  in float instanceCollisionPriorities;
1311
1273
  #endif
1312
-
1313
1274
  uniform sampler2D collision_texture;
1314
1275
  uniform bool collision_sort;
1315
1276
  uniform bool collision_enabled;
1316
-
1317
1277
  vec2 collision_getCoords(vec4 position) {
1318
- vec4 collision_clipspace = project_common_position_to_clipspace(position);
1319
- return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
1278
+ vec4 collision_clipspace = project_common_position_to_clipspace(position);
1279
+ return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
1320
1280
  }
1321
-
1322
1281
  float collision_match(vec2 tex, vec3 pickingColor) {
1323
- vec4 collision_pickingColor = texture(collision_texture, tex);
1324
- float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
1325
- float e = 0.001;
1326
- return step(delta, e);
1282
+ vec4 collision_pickingColor = texture(collision_texture, tex);
1283
+ float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));
1284
+ float e = 0.001;
1285
+ return step(delta, e);
1327
1286
  }
1328
-
1329
1287
  float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
1330
- if (!collision_enabled) {
1331
- return 1.0;
1332
- }
1333
-
1334
- // Visibility test, sample area of 5x5 pixels in order to fade in/out.
1335
- // Due to the locality, the lookups will be cached
1336
- // This reduces the flicker present when objects are shown/hidden
1337
- const int N = 2;
1338
- float accumulator = 0.0;
1339
- vec2 step = vec2(1.0 / project_uViewportSize);
1340
-
1341
- const float floatN = float(N);
1342
- vec2 delta = -floatN * step;
1343
- for(int i = -N; i <= N; i++) {
1344
- delta.x = -step.x * floatN;
1345
- for(int j = -N; j <= N; j++) {
1346
- accumulator += collision_match(texCoords + delta, pickingColor);
1347
- delta.x += step.x;
1348
- }
1349
- delta.y += step.y;
1350
- }
1351
-
1352
- float W = 2.0 * floatN + 1.0;
1353
- return pow(accumulator / (W * W), 2.2);
1288
+ if (!collision_enabled) {
1289
+ return 1.0;
1290
+ }
1291
+ const int N = 2;
1292
+ float accumulator = 0.0;
1293
+ vec2 step = vec2(1.0 / project_uViewportSize);
1294
+ const float floatN = float(N);
1295
+ vec2 delta = -floatN * step;
1296
+ for(int i = -N; i <= N; i++) {
1297
+ delta.x = -step.x * floatN;
1298
+ for(int j = -N; j <= N; j++) {
1299
+ accumulator += collision_match(texCoords + delta, pickingColor);
1300
+ delta.x += step.x;
1301
+ }
1302
+ delta.y += step.y;
1303
+ }
1304
+ float W = 2.0 * floatN + 1.0;
1305
+ return pow(accumulator / (W * W), 2.2);
1354
1306
  }
1355
1307
  `;
1356
1308
  var inject4 = {
1357
1309
  "vs:#decl": `
1358
- float collision_fade = 1.0;
1310
+ float collision_fade = 1.0;
1359
1311
  `,
1360
1312
  "vs:DECKGL_FILTER_GL_POSITION": `
1361
- if (collision_sort) {
1362
- #ifdef NON_INSTANCED_MODEL
1363
- float collisionPriority = collisionPriorities;
1364
- #else
1365
- float collisionPriority = instanceCollisionPriorities;
1366
- #endif
1367
- position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000
1368
- }
1369
-
1370
- if (collision_enabled) {
1371
- vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
1372
- vec2 collision_texCoords = collision_getCoords(collision_common_position);
1373
- collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
1374
- if (collision_fade < 0.0001) {
1375
- // Position outside clip space bounds to discard
1376
- position = vec4(0.0, 0.0, 2.0, 1.0);
1377
- }
1378
- }
1379
- `,
1313
+ if (collision_sort) {
1314
+ #ifdef NON_INSTANCED_MODEL
1315
+ float collisionPriority = collisionPriorities;
1316
+ #else
1317
+ float collisionPriority = instanceCollisionPriorities;
1318
+ #endif
1319
+ position.z = -0.001 * collisionPriority * position.w;
1320
+ }
1321
+ if (collision_enabled) {
1322
+ vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));
1323
+ vec2 collision_texCoords = collision_getCoords(collision_common_position);
1324
+ collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);
1325
+ if (collision_fade < 0.0001) {
1326
+ position = vec4(0.0, 0.0, 2.0, 1.0);
1327
+ }
1328
+ }
1329
+ `,
1380
1330
  "vs:DECKGL_FILTER_COLOR": `
1381
- color.a *= collision_fade;
1382
- `
1331
+ color.a *= collision_fade;
1332
+ `
1383
1333
  };
1384
1334
  var getCollisionUniforms = (opts, uniforms) => {
1385
1335
  if (!opts || !("dummyCollisionMap" in opts)) {
@@ -1434,7 +1384,7 @@ var import_core15 = require("@deck.gl/core");
1434
1384
  var import_core16 = require("@math.gl/core");
1435
1385
 
1436
1386
  // dist/mask/mask-pass.js
1437
- var import_constants3 = require("@luma.gl/constants");
1387
+ var import_constants2 = require("@luma.gl/constants");
1438
1388
  var import_core13 = require("@deck.gl/core");
1439
1389
  var MaskPass = class extends import_core13._LayersPass {
1440
1390
  constructor(device, props) {
@@ -1464,8 +1414,8 @@ var MaskPass = class extends import_core13._LayersPass {
1464
1414
  const clearColor = [255, 255, 255, 255];
1465
1415
  return this.device.withParametersWebGL({
1466
1416
  blend: true,
1467
- blendFunc: [import_constants3.GL.ZERO, import_constants3.GL.ONE],
1468
- blendEquation: import_constants3.GL.FUNC_SUBTRACT,
1417
+ blendFunc: [0, 1],
1418
+ blendEquation: 32778,
1469
1419
  colorMask,
1470
1420
  depthTest: false
1471
1421
  }, () => super.render({ ...options, clearColor, target: this.fbo, pass: "mask" }));
@@ -1981,7 +1931,7 @@ var vs4 = `
1981
1931
  uniform vec4 mask_bounds;
1982
1932
  uniform bool mask_maskByInstance;
1983
1933
  vec2 mask_getCoords(vec4 position) {
1984
- return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
1934
+ return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
1985
1935
  }
1986
1936
  `;
1987
1937
  var fs3 = `
@@ -1990,26 +1940,25 @@ uniform int mask_channel;
1990
1940
  uniform bool mask_enabled;
1991
1941
  uniform bool mask_inverted;
1992
1942
  bool mask_isInBounds(vec2 texCoords) {
1993
- if (!mask_enabled) {
1994
- return true;
1995
- }
1996
- vec4 maskColor = texture(mask_texture, texCoords);
1997
- float maskValue = 1.0;
1998
- if (mask_channel == 0) {
1999
- maskValue = maskColor.r;
2000
- } else if (mask_channel == 1) {
2001
- maskValue = maskColor.g;
2002
- } else if (mask_channel == 2) {
2003
- maskValue = maskColor.b;
2004
- } else if (mask_channel == 3) {
2005
- maskValue = maskColor.a;
2006
- }
2007
-
2008
- if (mask_inverted) {
2009
- return maskValue >= 0.5;
2010
- } else {
2011
- return maskValue < 0.5;
2012
- }
1943
+ if (!mask_enabled) {
1944
+ return true;
1945
+ }
1946
+ vec4 maskColor = texture(mask_texture, texCoords);
1947
+ float maskValue = 1.0;
1948
+ if (mask_channel == 0) {
1949
+ maskValue = maskColor.r;
1950
+ } else if (mask_channel == 1) {
1951
+ maskValue = maskColor.g;
1952
+ } else if (mask_channel == 2) {
1953
+ maskValue = maskColor.b;
1954
+ } else if (mask_channel == 3) {
1955
+ maskValue = maskColor.a;
1956
+ }
1957
+ if (mask_inverted) {
1958
+ return maskValue >= 0.5;
1959
+ } else {
1960
+ return maskValue < 0.5;
1961
+ }
2013
1962
  }
2014
1963
  `;
2015
1964
  var inject5 = {
@@ -2017,27 +1966,23 @@ var inject5 = {
2017
1966
  out vec2 mask_texCoords;
2018
1967
  `,
2019
1968
  "vs:#main-end": `
2020
- vec4 mask_common_position;
2021
- if (mask_maskByInstance) {
2022
- mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
2023
- } else {
2024
- mask_common_position = geometry.position;
2025
- }
2026
- mask_texCoords = mask_getCoords(mask_common_position);
1969
+ vec4 mask_common_position;
1970
+ if (mask_maskByInstance) {
1971
+ mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
1972
+ } else {
1973
+ mask_common_position = geometry.position;
1974
+ }
1975
+ mask_texCoords = mask_getCoords(mask_common_position);
2027
1976
  `,
2028
1977
  "fs:#decl": `
2029
1978
  in vec2 mask_texCoords;
2030
1979
  `,
2031
1980
  "fs:#main-start": `
2032
- if (mask_enabled) {
2033
- bool mask = mask_isInBounds(mask_texCoords);
2034
-
2035
- // Debug: show extent of render target
2036
- // fragColor = vec4(mask_texCoords, 0.0, 1.0);
2037
- fragColor = texture(mask_texture, mask_texCoords);
2038
-
2039
- if (!mask) discard;
2040
- }
1981
+ if (mask_enabled) {
1982
+ bool mask = mask_isInBounds(mask_texCoords);
1983
+ fragColor = texture(mask_texture, mask_texCoords);
1984
+ if (!mask) discard;
1985
+ }
2041
1986
  `
2042
1987
  };
2043
1988
  var getMaskUniforms = (opts) => {
@@ -2138,59 +2083,56 @@ uniform float terrain_mode;
2138
2083
  uniform sampler2D terrain_map;
2139
2084
  uniform vec4 terrain_bounds;
2140
2085
  out vec3 commonPos;
2141
- ${TERRAIN_MODE_CONSTANTS}
2142
- `,
2086
+ ` + TERRAIN_MODE_CONSTANTS,
2143
2087
  "vs:#main-start": `
2144
2088
  if (terrain_mode == TERRAIN_MODE_SKIP) {
2145
- gl_Position = vec4(0.0);
2146
- return;
2089
+ gl_Position = vec4(0.0);
2090
+ return;
2147
2091
  }
2148
2092
  `,
2149
2093
  "vs:DECKGL_FILTER_GL_POSITION": `
2150
2094
  commonPos = geometry.position.xyz;
2151
2095
  if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
2152
- vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
2153
- position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);
2154
- commonPos.z += project_uCommonOrigin.z;
2096
+ vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
2097
+ position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);
2098
+ commonPos.z += project_uCommonOrigin.z;
2155
2099
  }
2156
2100
  if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
2157
- vec3 anchor = geometry.worldPosition;
2158
- anchor.z = 0.0;
2159
- vec3 anchorCommon = project_position(anchor);
2160
- vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;
2161
- if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {
2162
- float terrainZ = texture(terrain_map, texCoords).r;
2163
- geometry.position.z += terrainZ;
2164
- position = project_common_position_to_clipspace(geometry.position);
2165
- }
2101
+ vec3 anchor = geometry.worldPosition;
2102
+ anchor.z = 0.0;
2103
+ vec3 anchorCommon = project_position(anchor);
2104
+ vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;
2105
+ if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {
2106
+ float terrainZ = texture(terrain_map, texCoords).r;
2107
+ geometry.position.z += terrainZ;
2108
+ position = project_common_position_to_clipspace(geometry.position);
2166
2109
  }
2167
- `,
2110
+ }
2111
+ `,
2168
2112
  "fs:#decl": `
2169
2113
  uniform float terrain_mode;
2170
2114
  uniform sampler2D terrain_map;
2171
2115
  uniform vec4 terrain_bounds;
2172
2116
  in vec3 commonPos;
2173
- ${TERRAIN_MODE_CONSTANTS}
2174
- `,
2117
+ ` + TERRAIN_MODE_CONSTANTS,
2175
2118
  "fs:#main-start": `
2176
2119
  if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
2177
- fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
2178
- return;
2120
+ fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
2121
+ return;
2179
2122
  }
2180
- `,
2123
+ `,
2181
2124
  "fs:DECKGL_FILTER_COLOR": `
2182
2125
  if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {
2183
- vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
2184
- vec4 pixel = texture(terrain_map, texCoords);
2185
- if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {
2186
- color = pixel;
2187
- } else {
2188
- // pixel is premultiplied
2189
- color = pixel + color * (1.0 - pixel.a);
2190
- }
2191
- return;
2126
+ vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;
2127
+ vec4 pixel = texture(terrain_map, texCoords);
2128
+ if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {
2129
+ color = pixel;
2130
+ } else {
2131
+ color = pixel + color * (1.0 - pixel.a);
2192
2132
  }
2193
- `
2133
+ return;
2134
+ }
2135
+ `
2194
2136
  },
2195
2137
  getUniforms: (opts = {}, uniforms) => {
2196
2138
  var _a;
@@ -2236,15 +2178,15 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
2236
2178
  };
2237
2179
 
2238
2180
  // dist/terrain/utils.js
2239
- var import_constants4 = require("@luma.gl/constants");
2181
+ var import_constants3 = require("@luma.gl/constants");
2240
2182
  function createRenderTarget(device, opts) {
2241
2183
  return device.createFramebuffer({
2242
2184
  id: opts.id,
2243
2185
  colorAttachments: [
2244
2186
  device.createTexture({
2245
2187
  ...opts.float && {
2246
- format: device.info.type === "webgl2" ? "rgba32float" : "rgba8unorm",
2247
- type: import_constants4.GL.FLOAT
2188
+ format: "rgba32float",
2189
+ type: 5126
2248
2190
  },
2249
2191
  mipmaps: false,
2250
2192
  sampler: {
@@ -2418,7 +2360,7 @@ function intersect(b1, b2) {
2418
2360
  }
2419
2361
 
2420
2362
  // dist/terrain/terrain-pass.js
2421
- var import_constants5 = require("@luma.gl/constants");
2363
+ var import_constants4 = require("@luma.gl/constants");
2422
2364
  var import_core23 = require("@deck.gl/core");
2423
2365
  var TerrainPass = class extends import_core23._LayersPass {
2424
2366
  getRenderableLayers(viewport, opts) {
@@ -2443,8 +2385,8 @@ var TerrainPass = class extends import_core23._LayersPass {
2443
2385
  this.device.withParametersWebGL({
2444
2386
  clearColor: [0, 0, 0, 0],
2445
2387
  blend: true,
2446
- blendFunc: [import_constants5.GL.ONE, import_constants5.GL.ONE],
2447
- blendEquation: import_constants5.GL.MAX,
2388
+ blendFunc: [1, 1],
2389
+ blendEquation: 32776,
2448
2390
  depthTest: false
2449
2391
  }, () => this.render({
2450
2392
  ...opts,