@deck.gl/extensions 9.4.0 → 9.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +98 -109
- package/dist/index.cjs +103 -94
- package/dist/index.cjs.map +1 -1
- package/dist/path-style/path-style-extension.d.ts.map +1 -1
- package/dist/path-style/path-style-extension.js +5 -2
- package/dist/path-style/path-style-extension.js.map +1 -1
- package/dist/path-style/shaders.glsl.d.ts +20 -9
- package/dist/path-style/shaders.glsl.d.ts.map +1 -1
- package/dist/path-style/shaders.glsl.js +76 -69
- package/dist/path-style/shaders.glsl.js.map +1 -1
- package/dist/utils/projection-utils.d.ts +28 -1
- package/dist/utils/projection-utils.d.ts.map +1 -1
- package/dist/utils/projection-utils.js +97 -1
- package/dist/utils/projection-utils.js.map +1 -1
- package/dist.min.js +108 -112
- package/package.json +4 -4
- package/src/path-style/path-style-extension.ts +5 -1
- package/src/path-style/shaders.glsl.ts +102 -115
- package/src/utils/projection-utils.ts +136 -2
package/dist/dist.dev.js
CHANGED
|
@@ -4272,52 +4272,38 @@ vec4 project_position_to_clipspace(
|
|
|
4272
4272
|
var import_core7 = __toESM(require_core(), 1);
|
|
4273
4273
|
|
|
4274
4274
|
// src/path-style/shaders.glsl.ts
|
|
4275
|
-
var
|
|
4275
|
+
var pathStylePipelineShaders = {
|
|
4276
4276
|
inject: {
|
|
4277
|
-
"vs:#
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4277
|
+
"vs:#main-end": `
|
|
4278
|
+
#ifdef PATH_STYLE_OFFSET
|
|
4279
|
+
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
4280
|
+
float offsetDir = sign(instanceOffsets);
|
|
4281
|
+
vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
|
|
4282
|
+
vPathPosition.y *= offsetWidth;
|
|
4283
|
+
vPathLength *= offsetWidth;
|
|
4284
|
+
#ifdef DASH_ENABLED
|
|
4285
|
+
vPathBounds *= offsetWidth;
|
|
4286
|
+
#endif
|
|
4282
4287
|
#endif
|
|
4283
|
-
out vec2 vDashArray;
|
|
4284
|
-
out float vDashOffset;
|
|
4285
|
-
out float vDashPathLength;
|
|
4286
4288
|
|
|
4287
|
-
|
|
4288
|
-
//
|
|
4289
|
-
//
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
} pathStyle;
|
|
4295
|
-
`,
|
|
4296
|
-
"vs:#main-end": `
|
|
4297
|
-
// How many screen pixels one unit of vPathPosition.y covers. The two extrusion branches of
|
|
4298
|
-
// the path layer leave this in different units, and both differences have to be undone here
|
|
4299
|
-
// for a billboarded path to dash like a flat one.
|
|
4300
|
-
//
|
|
4301
|
-
// Flat paths extrude in common space, so \`width\` is in common units and a unit of
|
|
4302
|
-
// vPathPosition.y is width.x * project.scale pixels.
|
|
4303
|
-
//
|
|
4304
|
-
// Billboarded paths extrude in clip space, so \`width\` is already in pixels at this point -
|
|
4305
|
-
// the clip-space conversion happens inside getLineJoinOffset. That conversion also folds in
|
|
4306
|
-
// project.focalDistance, which scales the half-width the segment delta is divided by but not
|
|
4307
|
-
// the delta itself, so a unit of vPathPosition.y ends up focalDistance pixels wider than the
|
|
4308
|
-
// stroke it is supposed to be relative to.
|
|
4309
|
-
float dashWidthPixels = path.billboard
|
|
4310
|
-
? width.x * project.focalDistance
|
|
4311
|
-
: width.x * project.scale;
|
|
4289
|
+
#ifdef DASH_ENABLED
|
|
4290
|
+
// DECKGL_FILTER_SIZE may have widened width for offset geometry. Dash coordinates are measured
|
|
4291
|
+
// against the pre-offset stroke, so recover its half-width before converting dash units.
|
|
4292
|
+
float strokeHalfWidth = width.x;
|
|
4293
|
+
#ifdef PATH_STYLE_OFFSET
|
|
4294
|
+
strokeHalfWidth /= offsetWidth;
|
|
4295
|
+
#endif
|
|
4312
4296
|
|
|
4313
|
-
//
|
|
4314
|
-
//
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4297
|
+
// How many screen pixels one unit of vPathPosition.y covers. Flat paths extrude in common space;
|
|
4298
|
+
// billboarded paths extrude in clip space, whose conversion also includes focalDistance.
|
|
4299
|
+
float dashWidthPixels = path.billboard
|
|
4300
|
+
? strokeHalfWidth * project.focalDistance
|
|
4301
|
+
: strokeHalfWidth * project.scale;
|
|
4302
|
+
float strokeHalfWidthPixels = path.billboard
|
|
4303
|
+
? strokeHalfWidth
|
|
4304
|
+
: strokeHalfWidth * project.scale;
|
|
4318
4305
|
|
|
4319
|
-
//
|
|
4320
|
-
// pixels per unit of vPathPosition.y, so the fragment shader needs no notion of units at all.
|
|
4306
|
+
// Convert every public dash unit to the half-width coordinate used by the fragment shader.
|
|
4321
4307
|
// Keep the cases in sync with DASH_UNITS in path-style-extension.ts.
|
|
4322
4308
|
float dashUnitPixels = strokeHalfWidthPixels;
|
|
4323
4309
|
if (pathStyle.dashUnits == 1) {
|
|
@@ -4349,6 +4335,67 @@ vDashOffset = dashPeriod > 0.0 ? mod(dashOffsetAndLength.x, dashPeriod) : 0.0;
|
|
|
4349
4335
|
vDashOffset = 0.0;
|
|
4350
4336
|
vDashPathLength = 0.0;
|
|
4351
4337
|
#endif
|
|
4338
|
+
#endif
|
|
4339
|
+
`,
|
|
4340
|
+
"fs:#main-end": `
|
|
4341
|
+
#ifdef DASH_ENABLED
|
|
4342
|
+
// PathLayer computes analytic-edge derivatives in its fragment body. A discard in
|
|
4343
|
+
// #main-start can remove helper invocations and make those derivatives undefined, so all
|
|
4344
|
+
// dash-related termination is deferred until the layer has completed that work.
|
|
4345
|
+
#ifdef ANTIALIASING
|
|
4346
|
+
if (inRoundedDashGap) {
|
|
4347
|
+
// The rounded dash cap and PathLayer silhouette are two geometric constraints on the
|
|
4348
|
+
// same fragment. Intersect their coverage instead of multiplying two edge ramps; at the
|
|
4349
|
+
// cap/body shoulder both ramps are half covered and multiplication would create a dark
|
|
4350
|
+
// quarter-covered notch. Keep the sub-pixel duty cycle separable from the path silhouette.
|
|
4351
|
+
float pathCoverage = smoothedge(0.0, edgePixels);
|
|
4352
|
+
float resolvedCapMultiplier =
|
|
4353
|
+
min(pathCoverage, roundedDashResolvedCoverage) / max(pathCoverage, 1e-6);
|
|
4354
|
+
dashCoverage = mix(
|
|
4355
|
+
resolvedCapMultiplier,
|
|
4356
|
+
roundedDashDutyCycle,
|
|
4357
|
+
roundedDashSubPixelBlend
|
|
4358
|
+
);
|
|
4359
|
+
}
|
|
4360
|
+
#endif
|
|
4361
|
+
if (shouldDiscardDash) {
|
|
4362
|
+
discard;
|
|
4363
|
+
}
|
|
4364
|
+
fragColor.a *= dashCoverage;
|
|
4365
|
+
#endif
|
|
4366
|
+
#ifdef PATH_STYLE_OFFSET
|
|
4367
|
+
#ifndef ANTIALIASING
|
|
4368
|
+
// With analytic antialiasing, PathLayer evaluates this boundary using the remapped
|
|
4369
|
+
// vPathPosition and retains the complete centered coverage ramp. The hard clip remains for
|
|
4370
|
+
// the original non-AA path.
|
|
4371
|
+
if (abs(vPathPosition.x) > 1.0) {
|
|
4372
|
+
discard;
|
|
4373
|
+
}
|
|
4374
|
+
#endif
|
|
4375
|
+
#endif
|
|
4376
|
+
`
|
|
4377
|
+
}
|
|
4378
|
+
};
|
|
4379
|
+
var dashShaders = {
|
|
4380
|
+
inject: {
|
|
4381
|
+
"vs:#decl": `
|
|
4382
|
+
in vec2 instanceDashArrays;
|
|
4383
|
+
#ifdef HIGH_PRECISION_DASH
|
|
4384
|
+
// [distance from the start of the path, total length of the path], in common space.
|
|
4385
|
+
in vec2 instanceDashOffsets;
|
|
4386
|
+
#endif
|
|
4387
|
+
out vec2 vDashArray;
|
|
4388
|
+
out float vDashOffset;
|
|
4389
|
+
out float vDashPathLength;
|
|
4390
|
+
|
|
4391
|
+
// Also declared in the fragment stage. The vertex stage needs dashAlignMode so that it can
|
|
4392
|
+
// reduce the dash phase modulo the same period the fragment stage will test against, and
|
|
4393
|
+
// dashUnits to scale the dash array into that period's units.
|
|
4394
|
+
layout(std140) uniform pathStyleUniforms {
|
|
4395
|
+
float dashAlignMode;
|
|
4396
|
+
bool dashGapPickable;
|
|
4397
|
+
highp int dashUnits;
|
|
4398
|
+
} pathStyle;
|
|
4352
4399
|
`,
|
|
4353
4400
|
"fs:#decl": `
|
|
4354
4401
|
layout(std140) uniform pathStyleUniforms {
|
|
@@ -4501,31 +4548,6 @@ float dashPatternCoverage(
|
|
|
4501
4548
|
// Fully transparent fragments would still write depth and occlude whatever is behind.
|
|
4502
4549
|
shouldDiscardDash = shouldDiscardDash || dashCoverage <= 0.0;
|
|
4503
4550
|
}
|
|
4504
|
-
`,
|
|
4505
|
-
"fs:#main-end": `
|
|
4506
|
-
// PathLayer computes analytic-edge derivatives in its fragment body. A discard in
|
|
4507
|
-
// #main-start can remove helper invocations and make those derivatives undefined, so all
|
|
4508
|
-
// dash-related termination is deferred until the layer has completed that work.
|
|
4509
|
-
#ifdef ANTIALIASING
|
|
4510
|
-
if (inRoundedDashGap) {
|
|
4511
|
-
// The rounded dash cap and PathLayer silhouette are two geometric constraints on the
|
|
4512
|
-
// same fragment. Intersect their coverage instead of multiplying two edge ramps; at the
|
|
4513
|
-
// cap/body shoulder both ramps are half covered and multiplication would create a dark
|
|
4514
|
-
// quarter-covered notch. Keep the sub-pixel duty cycle separable from the path silhouette.
|
|
4515
|
-
float pathCoverage = smoothedge(0.0, edgePixels);
|
|
4516
|
-
float resolvedCapMultiplier =
|
|
4517
|
-
min(pathCoverage, roundedDashResolvedCoverage) / max(pathCoverage, 1e-6);
|
|
4518
|
-
dashCoverage = mix(
|
|
4519
|
-
resolvedCapMultiplier,
|
|
4520
|
-
roundedDashDutyCycle,
|
|
4521
|
-
roundedDashSubPixelBlend
|
|
4522
|
-
);
|
|
4523
|
-
}
|
|
4524
|
-
#endif
|
|
4525
|
-
if (shouldDiscardDash) {
|
|
4526
|
-
discard;
|
|
4527
|
-
}
|
|
4528
|
-
fragColor.a *= dashCoverage;
|
|
4529
4551
|
`
|
|
4530
4552
|
}
|
|
4531
4553
|
};
|
|
@@ -4740,49 +4762,6 @@ in float instanceOffsets;
|
|
|
4740
4762
|
"vs:DECKGL_FILTER_SIZE": `
|
|
4741
4763
|
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
4742
4764
|
size *= offsetWidth;
|
|
4743
|
-
`,
|
|
4744
|
-
"vs:#main-end": `
|
|
4745
|
-
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
4746
|
-
float offsetDir = sign(instanceOffsets);
|
|
4747
|
-
vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
|
|
4748
|
-
vPathPosition.y *= offsetWidth;
|
|
4749
|
-
vPathLength *= offsetWidth;
|
|
4750
|
-
#ifdef DASH_ENABLED
|
|
4751
|
-
// DECKGL_FILTER_SIZE above widened the stroke by offsetWidth, so these rescalings restore
|
|
4752
|
-
// units of the original half-width. The dash block merges ahead of this one.
|
|
4753
|
-
if (pathStyle.dashUnits != 0) {
|
|
4754
|
-
// Absolute dash units must not inherit the artificial width used to build offset
|
|
4755
|
-
// geometry. Relative 'widths' units intentionally remain tied to the original stroke.
|
|
4756
|
-
vDashArray *= offsetWidth;
|
|
4757
|
-
}
|
|
4758
|
-
vPathBounds *= offsetWidth;
|
|
4759
|
-
#ifdef HIGH_PRECISION_DASH
|
|
4760
|
-
vDashPathLength *= offsetWidth;
|
|
4761
|
-
// The dash block reduced the CPU path offset modulo a period expressed in widened-width
|
|
4762
|
-
// units. Multiplying that remainder cannot recover the original phase after wrapping, so
|
|
4763
|
-
// redo the reduction with both the restored path offset and restored justified period.
|
|
4764
|
-
float restoredDashUnitLength = vDashArray.x + vDashArray.y;
|
|
4765
|
-
float restoredDashPeriod = pathStyle.dashAlignMode == 0.0
|
|
4766
|
-
? restoredDashUnitLength
|
|
4767
|
-
: vDashPathLength /
|
|
4768
|
-
max(round(vDashPathLength / max(restoredDashUnitLength, 0.0001)), 1.0);
|
|
4769
|
-
vDashOffset = restoredDashPeriod > 0.0
|
|
4770
|
-
? mod(dashOffsetAndLength.x * offsetWidth, restoredDashPeriod)
|
|
4771
|
-
: 0.0;
|
|
4772
|
-
#else
|
|
4773
|
-
vDashOffset *= offsetWidth;
|
|
4774
|
-
#endif
|
|
4775
|
-
#endif
|
|
4776
|
-
`,
|
|
4777
|
-
"fs:#main-end": `
|
|
4778
|
-
#ifndef ANTIALIASING
|
|
4779
|
-
// With analytic antialiasing, PathLayer evaluates this boundary using the remapped
|
|
4780
|
-
// vPathPosition and retains the complete centered coverage ramp. The hard clip remains for
|
|
4781
|
-
// the original non-AA path.
|
|
4782
|
-
if (abs(vPathPosition.x) > 1.0) {
|
|
4783
|
-
discard;
|
|
4784
|
-
}
|
|
4785
|
-
#endif
|
|
4786
4765
|
`
|
|
4787
4766
|
}
|
|
4788
4767
|
};
|
|
@@ -4949,6 +4928,9 @@ in float instanceOffsets;
|
|
|
4949
4928
|
return { modules: [pathStyle2] };
|
|
4950
4929
|
}
|
|
4951
4930
|
let result = {};
|
|
4931
|
+
if (extension.opts.dash || extension.opts.offset) {
|
|
4932
|
+
result = (0, import_core7._mergeShaders)(result, pathStylePipelineShaders);
|
|
4933
|
+
}
|
|
4952
4934
|
const defines = {};
|
|
4953
4935
|
if (extension.opts.dash) {
|
|
4954
4936
|
result = (0, import_core7._mergeShaders)(result, dashShaders);
|
|
@@ -6433,6 +6415,7 @@ in vec2 mask_texCoords;
|
|
|
6433
6415
|
|
|
6434
6416
|
// src/utils/projection-utils.ts
|
|
6435
6417
|
var import_core19 = __toESM(require_core(), 1);
|
|
6418
|
+
var GLOBE_METERS_TO_COMMON = 256 / 6370972;
|
|
6436
6419
|
var MERCATOR_REFERENCE_VIEWPORT = new import_core19.WebMercatorViewport({
|
|
6437
6420
|
width: 1,
|
|
6438
6421
|
height: 1,
|
|
@@ -6447,6 +6430,9 @@ in vec2 mask_texCoords;
|
|
|
6447
6430
|
function getMercatorReferenceViewport(viewport) {
|
|
6448
6431
|
return viewport.isGeospatial ? MERCATOR_REFERENCE_VIEWPORT : viewport;
|
|
6449
6432
|
}
|
|
6433
|
+
function isFlatViewport(viewport) {
|
|
6434
|
+
return !(viewport instanceof import_core19._GlobeViewport);
|
|
6435
|
+
}
|
|
6450
6436
|
function joinLayerBounds(layers, viewport) {
|
|
6451
6437
|
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
6452
6438
|
for (const layer of layers) {
|
|
@@ -6544,6 +6530,9 @@ in vec2 mask_texCoords;
|
|
|
6544
6530
|
if (!layerBounds) {
|
|
6545
6531
|
return [0, 0, 1, 1];
|
|
6546
6532
|
}
|
|
6533
|
+
if (!isFlatViewport(viewport)) {
|
|
6534
|
+
return layerBounds;
|
|
6535
|
+
}
|
|
6547
6536
|
const viewportBounds = getViewportBounds(viewport, zRange);
|
|
6548
6537
|
const paddedBounds = doubleBounds(viewportBounds);
|
|
6549
6538
|
if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) {
|
package/dist/index.cjs
CHANGED
|
@@ -1031,27 +1031,30 @@ var import_core6 = require("@deck.gl/core");
|
|
|
1031
1031
|
var import_core7 = require("@math.gl/core");
|
|
1032
1032
|
|
|
1033
1033
|
// dist/path-style/shaders.glsl.js
|
|
1034
|
-
var
|
|
1034
|
+
var pathStylePipelineShaders = {
|
|
1035
1035
|
inject: {
|
|
1036
|
-
"vs:#decl": `
|
|
1037
|
-
in vec2 instanceDashArrays;
|
|
1038
|
-
#ifdef HIGH_PRECISION_DASH
|
|
1039
|
-
in vec2 instanceDashOffsets;
|
|
1040
|
-
#endif
|
|
1041
|
-
out vec2 vDashArray;
|
|
1042
|
-
out float vDashOffset;
|
|
1043
|
-
out float vDashPathLength;
|
|
1044
|
-
layout(std140) uniform pathStyleUniforms {
|
|
1045
|
-
float dashAlignMode;
|
|
1046
|
-
bool dashGapPickable;
|
|
1047
|
-
highp int dashUnits;
|
|
1048
|
-
} pathStyle;
|
|
1049
|
-
`,
|
|
1050
1036
|
"vs:#main-end": `
|
|
1037
|
+
#ifdef PATH_STYLE_OFFSET
|
|
1038
|
+
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
1039
|
+
float offsetDir = sign(instanceOffsets);
|
|
1040
|
+
vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
|
|
1041
|
+
vPathPosition.y *= offsetWidth;
|
|
1042
|
+
vPathLength *= offsetWidth;
|
|
1043
|
+
#ifdef DASH_ENABLED
|
|
1044
|
+
vPathBounds *= offsetWidth;
|
|
1045
|
+
#endif
|
|
1046
|
+
#endif
|
|
1047
|
+
#ifdef DASH_ENABLED
|
|
1048
|
+
float strokeHalfWidth = width.x;
|
|
1049
|
+
#ifdef PATH_STYLE_OFFSET
|
|
1050
|
+
strokeHalfWidth /= offsetWidth;
|
|
1051
|
+
#endif
|
|
1051
1052
|
float dashWidthPixels = path.billboard
|
|
1052
|
-
?
|
|
1053
|
-
:
|
|
1054
|
-
float strokeHalfWidthPixels = path.billboard
|
|
1053
|
+
? strokeHalfWidth * project.focalDistance
|
|
1054
|
+
: strokeHalfWidth * project.scale;
|
|
1055
|
+
float strokeHalfWidthPixels = path.billboard
|
|
1056
|
+
? strokeHalfWidth
|
|
1057
|
+
: strokeHalfWidth * project.scale;
|
|
1055
1058
|
float dashUnitPixels = strokeHalfWidthPixels;
|
|
1056
1059
|
if (pathStyle.dashUnits == 1) {
|
|
1057
1060
|
dashUnitPixels = 1.0;
|
|
@@ -1073,6 +1076,52 @@ vDashOffset = dashPeriod > 0.0 ? mod(dashOffsetAndLength.x, dashPeriod) : 0.0;
|
|
|
1073
1076
|
vDashOffset = 0.0;
|
|
1074
1077
|
vDashPathLength = 0.0;
|
|
1075
1078
|
#endif
|
|
1079
|
+
#endif
|
|
1080
|
+
`,
|
|
1081
|
+
"fs:#main-end": `
|
|
1082
|
+
#ifdef DASH_ENABLED
|
|
1083
|
+
#ifdef ANTIALIASING
|
|
1084
|
+
if (inRoundedDashGap) {
|
|
1085
|
+
float pathCoverage = smoothedge(0.0, edgePixels);
|
|
1086
|
+
float resolvedCapMultiplier =
|
|
1087
|
+
min(pathCoverage, roundedDashResolvedCoverage) / max(pathCoverage, 1e-6);
|
|
1088
|
+
dashCoverage = mix(
|
|
1089
|
+
resolvedCapMultiplier,
|
|
1090
|
+
roundedDashDutyCycle,
|
|
1091
|
+
roundedDashSubPixelBlend
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
#endif
|
|
1095
|
+
if (shouldDiscardDash) {
|
|
1096
|
+
discard;
|
|
1097
|
+
}
|
|
1098
|
+
fragColor.a *= dashCoverage;
|
|
1099
|
+
#endif
|
|
1100
|
+
#ifdef PATH_STYLE_OFFSET
|
|
1101
|
+
#ifndef ANTIALIASING
|
|
1102
|
+
if (abs(vPathPosition.x) > 1.0) {
|
|
1103
|
+
discard;
|
|
1104
|
+
}
|
|
1105
|
+
#endif
|
|
1106
|
+
#endif
|
|
1107
|
+
`
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
var dashShaders = {
|
|
1111
|
+
inject: {
|
|
1112
|
+
"vs:#decl": `
|
|
1113
|
+
in vec2 instanceDashArrays;
|
|
1114
|
+
#ifdef HIGH_PRECISION_DASH
|
|
1115
|
+
in vec2 instanceDashOffsets;
|
|
1116
|
+
#endif
|
|
1117
|
+
out vec2 vDashArray;
|
|
1118
|
+
out float vDashOffset;
|
|
1119
|
+
out float vDashPathLength;
|
|
1120
|
+
layout(std140) uniform pathStyleUniforms {
|
|
1121
|
+
float dashAlignMode;
|
|
1122
|
+
bool dashGapPickable;
|
|
1123
|
+
highp int dashUnits;
|
|
1124
|
+
} pathStyle;
|
|
1076
1125
|
`,
|
|
1077
1126
|
"fs:#decl": `
|
|
1078
1127
|
layout(std140) uniform pathStyleUniforms {
|
|
@@ -1174,24 +1223,6 @@ dashCoverage = mix(dashCoverage, roundedDutyCycle, subPixelBlend);
|
|
|
1174
1223
|
dashCoverage = clamp(dashCoverage, 0.0, 1.0);
|
|
1175
1224
|
shouldDiscardDash = shouldDiscardDash || dashCoverage <= 0.0;
|
|
1176
1225
|
}
|
|
1177
|
-
`,
|
|
1178
|
-
"fs:#main-end": `
|
|
1179
|
-
#ifdef ANTIALIASING
|
|
1180
|
-
if (inRoundedDashGap) {
|
|
1181
|
-
float pathCoverage = smoothedge(0.0, edgePixels);
|
|
1182
|
-
float resolvedCapMultiplier =
|
|
1183
|
-
min(pathCoverage, roundedDashResolvedCoverage) / max(pathCoverage, 1e-6);
|
|
1184
|
-
dashCoverage = mix(
|
|
1185
|
-
resolvedCapMultiplier,
|
|
1186
|
-
roundedDashDutyCycle,
|
|
1187
|
-
roundedDashSubPixelBlend
|
|
1188
|
-
);
|
|
1189
|
-
}
|
|
1190
|
-
#endif
|
|
1191
|
-
if (shouldDiscardDash) {
|
|
1192
|
-
discard;
|
|
1193
|
-
}
|
|
1194
|
-
fragColor.a *= dashCoverage;
|
|
1195
1226
|
`
|
|
1196
1227
|
}
|
|
1197
1228
|
};
|
|
@@ -1385,39 +1416,6 @@ in float instanceOffsets;
|
|
|
1385
1416
|
"vs:DECKGL_FILTER_SIZE": `
|
|
1386
1417
|
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
1387
1418
|
size *= offsetWidth;
|
|
1388
|
-
`,
|
|
1389
|
-
"vs:#main-end": `
|
|
1390
|
-
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
1391
|
-
float offsetDir = sign(instanceOffsets);
|
|
1392
|
-
vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;
|
|
1393
|
-
vPathPosition.y *= offsetWidth;
|
|
1394
|
-
vPathLength *= offsetWidth;
|
|
1395
|
-
#ifdef DASH_ENABLED
|
|
1396
|
-
if (pathStyle.dashUnits != 0) {
|
|
1397
|
-
vDashArray *= offsetWidth;
|
|
1398
|
-
}
|
|
1399
|
-
vPathBounds *= offsetWidth;
|
|
1400
|
-
#ifdef HIGH_PRECISION_DASH
|
|
1401
|
-
vDashPathLength *= offsetWidth;
|
|
1402
|
-
float restoredDashUnitLength = vDashArray.x + vDashArray.y;
|
|
1403
|
-
float restoredDashPeriod = pathStyle.dashAlignMode == 0.0
|
|
1404
|
-
? restoredDashUnitLength
|
|
1405
|
-
: vDashPathLength /
|
|
1406
|
-
max(round(vDashPathLength / max(restoredDashUnitLength, 0.0001)), 1.0);
|
|
1407
|
-
vDashOffset = restoredDashPeriod > 0.0
|
|
1408
|
-
? mod(dashOffsetAndLength.x * offsetWidth, restoredDashPeriod)
|
|
1409
|
-
: 0.0;
|
|
1410
|
-
#else
|
|
1411
|
-
vDashOffset *= offsetWidth;
|
|
1412
|
-
#endif
|
|
1413
|
-
#endif
|
|
1414
|
-
`,
|
|
1415
|
-
"fs:#main-end": `
|
|
1416
|
-
#ifndef ANTIALIASING
|
|
1417
|
-
if (abs(vPathPosition.x) > 1.0) {
|
|
1418
|
-
discard;
|
|
1419
|
-
}
|
|
1420
|
-
#endif
|
|
1421
1419
|
`
|
|
1422
1420
|
}
|
|
1423
1421
|
};
|
|
@@ -1567,6 +1565,9 @@ var PathStyleExtension = class extends import_core6.LayerExtension {
|
|
|
1567
1565
|
return { modules: [pathStyle2] };
|
|
1568
1566
|
}
|
|
1569
1567
|
let result = {};
|
|
1568
|
+
if (extension.opts.dash || extension.opts.offset) {
|
|
1569
|
+
result = (0, import_core6._mergeShaders)(result, pathStylePipelineShaders);
|
|
1570
|
+
}
|
|
1570
1571
|
const defines = {};
|
|
1571
1572
|
if (extension.opts.dash) {
|
|
1572
1573
|
result = (0, import_core6._mergeShaders)(result, dashShaders);
|
|
@@ -2849,7 +2850,7 @@ CollisionFilterExtension.extensionName = "CollisionFilterExtension";
|
|
|
2849
2850
|
var collision_filter_extension_default = CollisionFilterExtension;
|
|
2850
2851
|
|
|
2851
2852
|
// dist/mask/mask-extension.js
|
|
2852
|
-
var
|
|
2853
|
+
var import_core22 = require("@deck.gl/core");
|
|
2853
2854
|
|
|
2854
2855
|
// dist/mask/shader-module.js
|
|
2855
2856
|
var import_core16 = require("@deck.gl/core");
|
|
@@ -2974,8 +2975,8 @@ var shader_module_default3 = {
|
|
|
2974
2975
|
};
|
|
2975
2976
|
|
|
2976
2977
|
// dist/mask/mask-effect.js
|
|
2977
|
-
var
|
|
2978
|
-
var
|
|
2978
|
+
var import_core20 = require("@deck.gl/core");
|
|
2979
|
+
var import_core21 = require("@math.gl/core");
|
|
2979
2980
|
|
|
2980
2981
|
// dist/mask/mask-pass.js
|
|
2981
2982
|
var import_core17 = require("@deck.gl/core");
|
|
@@ -3033,6 +3034,8 @@ var MaskPass = class extends import_core17._LayersPass {
|
|
|
3033
3034
|
|
|
3034
3035
|
// dist/utils/projection-utils.js
|
|
3035
3036
|
var import_core18 = require("@deck.gl/core");
|
|
3037
|
+
var import_core19 = require("@math.gl/core");
|
|
3038
|
+
var GLOBE_METERS_TO_COMMON = 256 / 6370972;
|
|
3036
3039
|
var MERCATOR_REFERENCE_VIEWPORT = new import_core18.WebMercatorViewport({
|
|
3037
3040
|
width: 1,
|
|
3038
3041
|
height: 1,
|
|
@@ -3047,6 +3050,9 @@ function lngLatToMercatorCommon(lngLat) {
|
|
|
3047
3050
|
function getMercatorReferenceViewport(viewport) {
|
|
3048
3051
|
return viewport.isGeospatial ? MERCATOR_REFERENCE_VIEWPORT : viewport;
|
|
3049
3052
|
}
|
|
3053
|
+
function isFlatViewport(viewport) {
|
|
3054
|
+
return !(viewport instanceof import_core18._GlobeViewport);
|
|
3055
|
+
}
|
|
3050
3056
|
function joinLayerBounds(layers, viewport) {
|
|
3051
3057
|
const bounds = [Infinity, Infinity, -Infinity, -Infinity];
|
|
3052
3058
|
for (const layer of layers) {
|
|
@@ -3144,6 +3150,9 @@ function getRenderBounds(layerBounds, viewport, zRange) {
|
|
|
3144
3150
|
if (!layerBounds) {
|
|
3145
3151
|
return [0, 0, 1, 1];
|
|
3146
3152
|
}
|
|
3153
|
+
if (!isFlatViewport(viewport)) {
|
|
3154
|
+
return layerBounds;
|
|
3155
|
+
}
|
|
3147
3156
|
const viewportBounds = getViewportBounds(viewport, zRange);
|
|
3148
3157
|
const paddedBounds = doubleBounds(viewportBounds);
|
|
3149
3158
|
if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) {
|
|
@@ -3198,7 +3207,7 @@ var MaskEffect = class {
|
|
|
3198
3207
|
const viewport = viewports[0];
|
|
3199
3208
|
const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport);
|
|
3200
3209
|
if (viewport.resolution !== void 0) {
|
|
3201
|
-
|
|
3210
|
+
import_core20.log.warn("MaskExtension is not supported in GlobeView")();
|
|
3202
3211
|
return { didRender };
|
|
3203
3212
|
}
|
|
3204
3213
|
for (const maskId in channelMap) {
|
|
@@ -3241,7 +3250,7 @@ var MaskEffect = class {
|
|
|
3241
3250
|
this.lastViewport = viewport;
|
|
3242
3251
|
const layerBounds = joinLayerBounds(channelInfo.layers, viewport);
|
|
3243
3252
|
channelInfo.bounds = layerBounds && getRenderBounds(layerBounds, viewport);
|
|
3244
|
-
if (maskChanged || !(0,
|
|
3253
|
+
if (maskChanged || !(0, import_core21.equals)(channelInfo.bounds, oldChannelInfo.bounds)) {
|
|
3245
3254
|
const { maskPass, maskMap } = this;
|
|
3246
3255
|
const maskViewport = layerBounds && makeViewport({
|
|
3247
3256
|
bounds: channelInfo.bounds,
|
|
@@ -3292,7 +3301,7 @@ var MaskEffect = class {
|
|
|
3292
3301
|
let channelInfo = channelMap[id];
|
|
3293
3302
|
if (!channelInfo) {
|
|
3294
3303
|
if (++channelCount > 4) {
|
|
3295
|
-
|
|
3304
|
+
import_core20.log.warn("Too many mask layers. The max supported is 4")();
|
|
3296
3305
|
continue;
|
|
3297
3306
|
}
|
|
3298
3307
|
channelInfo = {
|
|
@@ -3353,7 +3362,7 @@ var defaultProps7 = {
|
|
|
3353
3362
|
maskByInstance: void 0,
|
|
3354
3363
|
maskInverted: false
|
|
3355
3364
|
};
|
|
3356
|
-
var MaskExtension = class extends
|
|
3365
|
+
var MaskExtension = class extends import_core22.LayerExtension {
|
|
3357
3366
|
initializeState() {
|
|
3358
3367
|
var _a;
|
|
3359
3368
|
(_a = this.context.deck) == null ? void 0 : _a._addDefaultEffect(new MaskEffect());
|
|
@@ -3381,8 +3390,8 @@ var MaskExtension = class extends import_core21.LayerExtension {
|
|
|
3381
3390
|
maskProps.enabled = true;
|
|
3382
3391
|
maskProps.channel = index;
|
|
3383
3392
|
maskProps.inverted = maskInverted;
|
|
3384
|
-
if (fromCoordinateSystem ===
|
|
3385
|
-
fromCoordinateSystem = viewport.isGeospatial ?
|
|
3393
|
+
if (fromCoordinateSystem === import_core22.COORDINATE_SYSTEM.DEFAULT) {
|
|
3394
|
+
fromCoordinateSystem = viewport.isGeospatial ? import_core22.COORDINATE_SYSTEM.LNGLAT : import_core22.COORDINATE_SYSTEM.CARTESIAN;
|
|
3386
3395
|
}
|
|
3387
3396
|
const opts = { modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem };
|
|
3388
3397
|
const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
|
|
@@ -3390,7 +3399,7 @@ var MaskExtension = class extends import_core21.LayerExtension {
|
|
|
3390
3399
|
maskProps.bounds = [bl[0], bl[1], tr[0], tr[1]];
|
|
3391
3400
|
} else {
|
|
3392
3401
|
if (maskId) {
|
|
3393
|
-
|
|
3402
|
+
import_core22.log.warn(`Could not find a mask layer with id: ${maskId}`)();
|
|
3394
3403
|
}
|
|
3395
3404
|
maskProps.enabled = false;
|
|
3396
3405
|
}
|
|
@@ -3402,13 +3411,13 @@ MaskExtension.extensionName = "MaskExtension";
|
|
|
3402
3411
|
var mask_extension_default = MaskExtension;
|
|
3403
3412
|
|
|
3404
3413
|
// dist/terrain/terrain-extension.js
|
|
3405
|
-
var
|
|
3414
|
+
var import_core29 = require("@deck.gl/core");
|
|
3406
3415
|
|
|
3407
3416
|
// dist/terrain/terrain-effect.js
|
|
3408
|
-
var
|
|
3417
|
+
var import_core28 = require("@deck.gl/core");
|
|
3409
3418
|
|
|
3410
3419
|
// dist/terrain/shader-module.js
|
|
3411
|
-
var
|
|
3420
|
+
var import_core23 = require("@deck.gl/core");
|
|
3412
3421
|
var TERRAIN_MODE = {
|
|
3413
3422
|
NONE: 0,
|
|
3414
3423
|
/** A terrain layer rendering encoded ground elevation into the height map */
|
|
@@ -3437,7 +3446,7 @@ uniform sampler2D terrain_map;
|
|
|
3437
3446
|
);
|
|
3438
3447
|
var terrainModule = {
|
|
3439
3448
|
name: "terrain",
|
|
3440
|
-
dependencies: [
|
|
3449
|
+
dependencies: [import_core23.project],
|
|
3441
3450
|
vs: `${uniformBlock5}
|
|
3442
3451
|
out vec3 commonPos;
|
|
3443
3452
|
// In globe mode, absolute Mercator position for terrain FBO UV lookups
|
|
@@ -3535,7 +3544,7 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
3535
3544
|
}
|
|
3536
3545
|
if ("terrainSkipRender" in opts || "drawToTerrainHeightMap" in opts) {
|
|
3537
3546
|
const { drawToTerrainHeightMap, heightMap, heightMapBounds, dummyHeightMap, terrainCover, useTerrainHeightMap, terrainSkipRender } = opts;
|
|
3538
|
-
const projectUniforms =
|
|
3547
|
+
const projectUniforms = import_core23.project.getUniforms(opts.project);
|
|
3539
3548
|
const { commonOrigin } = projectUniforms;
|
|
3540
3549
|
let mode = terrainSkipRender ? TERRAIN_MODE.SKIP : TERRAIN_MODE.NONE;
|
|
3541
3550
|
let sampler = dummyHeightMap;
|
|
@@ -3586,7 +3595,7 @@ if ((terrain.mode == TERRAIN_MODE_USE_COVER) || (terrain.mode == TERRAIN_MODE_US
|
|
|
3586
3595
|
};
|
|
3587
3596
|
|
|
3588
3597
|
// dist/terrain/terrain-cover.js
|
|
3589
|
-
var
|
|
3598
|
+
var import_core24 = require("@deck.gl/core");
|
|
3590
3599
|
|
|
3591
3600
|
// dist/terrain/utils.js
|
|
3592
3601
|
var import_constants = require("@luma.gl/webgl/constants");
|
|
@@ -3703,7 +3712,7 @@ var TerrainCover = class {
|
|
|
3703
3712
|
} else {
|
|
3704
3713
|
const oldZoom = (_a = this.renderViewport) == null ? void 0 : _a.zoom;
|
|
3705
3714
|
shouldRedraw = shouldRedraw || newZoom !== oldZoom;
|
|
3706
|
-
const newBounds = viewport instanceof
|
|
3715
|
+
const newBounds = viewport instanceof import_core24._GlobeViewport ? this.targetBoundsCommon : getRenderBounds(this.targetBoundsCommon, viewport);
|
|
3707
3716
|
const oldBounds = this.bounds;
|
|
3708
3717
|
shouldRedraw = shouldRedraw || !oldBounds || newBounds.some((x, i) => x !== oldBounds[i]);
|
|
3709
3718
|
this.bounds = newBounds;
|
|
@@ -3780,7 +3789,7 @@ function intersect(b1, b2) {
|
|
|
3780
3789
|
}
|
|
3781
3790
|
|
|
3782
3791
|
// dist/terrain/terrain-pass.js
|
|
3783
|
-
var
|
|
3792
|
+
var import_core25 = require("@deck.gl/core");
|
|
3784
3793
|
var TERRAIN_BLENDING = {
|
|
3785
3794
|
blendColorOperation: "max",
|
|
3786
3795
|
blendColorSrcFactor: "one",
|
|
@@ -3789,7 +3798,7 @@ var TERRAIN_BLENDING = {
|
|
|
3789
3798
|
blendAlphaSrcFactor: "one",
|
|
3790
3799
|
blendAlphaDstFactor: "one"
|
|
3791
3800
|
};
|
|
3792
|
-
var TerrainPass = class extends
|
|
3801
|
+
var TerrainPass = class extends import_core25._LayersPass {
|
|
3793
3802
|
getRenderableLayers(viewport, opts) {
|
|
3794
3803
|
const { layers } = opts;
|
|
3795
3804
|
const result = [];
|
|
@@ -3854,8 +3863,8 @@ var TerrainPass = class extends import_core24._LayersPass {
|
|
|
3854
3863
|
};
|
|
3855
3864
|
|
|
3856
3865
|
// dist/terrain/terrain-picking-pass.js
|
|
3857
|
-
var
|
|
3858
|
-
var TerrainPickingPass = class extends
|
|
3866
|
+
var import_core26 = require("@deck.gl/core");
|
|
3867
|
+
var TerrainPickingPass = class extends import_core26._PickLayersPass {
|
|
3859
3868
|
constructor() {
|
|
3860
3869
|
super(...arguments);
|
|
3861
3870
|
this.drawParameters = {};
|
|
@@ -3926,7 +3935,7 @@ var TerrainPickingPass = class extends import_core25._PickLayersPass {
|
|
|
3926
3935
|
};
|
|
3927
3936
|
|
|
3928
3937
|
// dist/terrain/height-map-builder.js
|
|
3929
|
-
var
|
|
3938
|
+
var import_core27 = require("@deck.gl/core");
|
|
3930
3939
|
var MAP_MAX_SIZE = 2048;
|
|
3931
3940
|
var HeightMapBuilder = class {
|
|
3932
3941
|
static isSupported(device) {
|
|
@@ -3973,7 +3982,7 @@ var HeightMapBuilder = class {
|
|
|
3973
3982
|
if (!this.layersBoundsCommon) {
|
|
3974
3983
|
this.renderViewport = null;
|
|
3975
3984
|
} else if (layersChanged || viewportChanged) {
|
|
3976
|
-
const bounds = viewport instanceof
|
|
3985
|
+
const bounds = viewport instanceof import_core27._GlobeViewport ? this.layersBoundsCommon : getRenderBounds(this.layersBoundsCommon, viewport);
|
|
3977
3986
|
if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) {
|
|
3978
3987
|
this.renderViewport = null;
|
|
3979
3988
|
return false;
|
|
@@ -4031,7 +4040,7 @@ var TerrainEffect = class {
|
|
|
4031
4040
|
if (HeightMapBuilder.isSupported(device)) {
|
|
4032
4041
|
this.heightMap = new HeightMapBuilder(device);
|
|
4033
4042
|
} else {
|
|
4034
|
-
|
|
4043
|
+
import_core28.log.warn("Terrain offset mode is not supported by this browser")();
|
|
4035
4044
|
}
|
|
4036
4045
|
deck._addDefaultShaderModule(terrainModule);
|
|
4037
4046
|
}
|
|
@@ -4199,7 +4208,7 @@ var TerrainEffect = class {
|
|
|
4199
4208
|
var defaultProps8 = {
|
|
4200
4209
|
terrainDrawMode: void 0
|
|
4201
4210
|
};
|
|
4202
|
-
var TerrainExtension = class extends
|
|
4211
|
+
var TerrainExtension = class extends import_core29.LayerExtension {
|
|
4203
4212
|
getShaders() {
|
|
4204
4213
|
return {
|
|
4205
4214
|
modules: [terrainModule]
|