@deck.gl/extensions 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/brushing/shader-module.d.ts.map +1 -1
- package/dist/brushing/shader-module.js +52 -57
- package/dist/clip/clip-extension.d.ts.map +1 -1
- package/dist/clip/clip-extension.js +6 -6
- package/dist/collision-filter/shader-module.d.ts.map +1 -1
- package/dist/collision-filter/shader-module.js +46 -56
- package/dist/data-filter/aggregator.d.ts.map +1 -1
- package/dist/data-filter/aggregator.js +11 -14
- package/dist/data-filter/data-filter-extension.d.ts.map +1 -1
- package/dist/data-filter/data-filter-extension.js +2 -5
- package/dist/data-filter/shader-module.d.ts.map +1 -1
- package/dist/data-filter/shader-module.js +70 -78
- package/dist/dist.dev.js +286 -300
- package/dist/fill-style/fill-style-extension.js +1 -1
- package/dist/fill-style/{shaders.glsl.d.ts → shader-module.d.ts} +1 -1
- package/dist/fill-style/shader-module.d.ts.map +1 -0
- package/dist/fill-style/{shaders.glsl.js → shader-module.js} +27 -33
- package/dist/fp64/project64.glsl.js +41 -60
- package/dist/index.cjs +363 -430
- package/dist/index.cjs.map +4 -4
- package/dist/mask/mask-pass.js +2 -2
- package/dist/mask/shader-module.d.ts.map +1 -1
- package/dist/mask/shader-module.js +33 -37
- package/dist/path-style/shaders.glsl.js +42 -47
- package/dist/terrain/shader-module.d.ts.map +1 -1
- package/dist/terrain/shader-module.js +30 -32
- package/dist/terrain/terrain-pass.js +2 -2
- package/dist/terrain/utils.js +2 -2
- package/dist/utils/syntax-tags.d.ts +6 -0
- package/dist/utils/syntax-tags.d.ts.map +1 -0
- package/dist/utils/syntax-tags.js +5 -0
- package/dist.min.js +364 -431
- package/package.json +8 -8
- package/src/brushing/shader-module.ts +4 -3
- package/src/clip/clip-extension.ts +10 -9
- package/src/collision-filter/shader-module.ts +6 -4
- package/src/data-filter/aggregator.ts +8 -13
- package/src/data-filter/data-filter-extension.ts +2 -5
- package/src/data-filter/shader-module.ts +7 -6
- package/src/fill-style/fill-style-extension.ts +1 -1
- package/src/fill-style/{shaders.glsl.ts → shader-module.ts} +6 -5
- package/src/mask/shader-module.ts +7 -6
- package/src/terrain/shader-module.ts +11 -10
- package/src/terrain/utils.ts +1 -1
- package/src/utils/syntax-tags.ts +5 -0
- 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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
76
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
#define DATAFILTER_ATTRIB filterValues
|
|
206
|
+
#define DATAFILTER_ATTRIB_64LOW filterValues64Low
|
|
207
|
+
#define DATACATEGORY_ATTRIB filterCategoryValues
|
|
216
208
|
#else
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
|
|
222
|
+
return value;
|
|
235
223
|
}
|
|
236
224
|
float dataFilter_reduceValue(vec2 value) {
|
|
237
|
-
|
|
225
|
+
return min(value.x, value.y);
|
|
238
226
|
}
|
|
239
227
|
float dataFilter_reduceValue(vec3 value) {
|
|
240
|
-
|
|
228
|
+
return min(min(value.x, value.y), value.z);
|
|
241
229
|
}
|
|
242
230
|
float dataFilter_reduceValue(vec4 value) {
|
|
243
|
-
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
336
|
+
if (dataFilter_value == 0.0) {
|
|
337
|
+
gl_Position = vec4(0.);
|
|
338
|
+
}
|
|
339
|
+
`,
|
|
356
340
|
"vs:DECKGL_FILTER_SIZE": `
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
341
|
+
if (filter_transformSize) {
|
|
342
|
+
size = size * dataFilter_value;
|
|
343
|
+
}
|
|
344
|
+
`,
|
|
361
345
|
"fs:DECKGL_FILTER_COLOR": `
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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
|
-
|
|
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:
|
|
445
|
-
type:
|
|
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:
|
|
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:
|
|
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: [
|
|
475
|
-
blendEquation: [
|
|
461
|
+
blendFunc: [1, 1, 1, 1],
|
|
462
|
+
blendEquation: [32774, 32774],
|
|
476
463
|
depthTest: false
|
|
477
464
|
};
|
|
478
465
|
|
|
@@ -523,7 +510,7 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
|
|
|
523
510
|
attributeManager.add({
|
|
524
511
|
filterValues: {
|
|
525
512
|
size: filterSize,
|
|
526
|
-
type: fp642 ?
|
|
513
|
+
type: fp642 ? "float64" : "float32",
|
|
527
514
|
accessor: "getFilterValue",
|
|
528
515
|
shaderAttributes: {
|
|
529
516
|
filterValues: {
|
|
@@ -536,7 +523,6 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
|
|
|
536
523
|
},
|
|
537
524
|
filterCategoryValues: {
|
|
538
525
|
size: categorySize,
|
|
539
|
-
type: import_constants2.GL.FLOAT,
|
|
540
526
|
accessor: "getFilterCategory",
|
|
541
527
|
transform: categorySize === 1 ? (d) => extension._getCategoryKey.call(this, d, 0) : (d) => d.map((x, i) => extension._getCategoryKey.call(this, x, i)),
|
|
542
528
|
shaderAttributes: {
|
|
@@ -557,8 +543,7 @@ var _DataFilterExtension = class extends import_core3.LayerExtension {
|
|
|
557
543
|
filterIndices: {
|
|
558
544
|
size: useFloatTarget ? 1 : 2,
|
|
559
545
|
vertexOffset: 1,
|
|
560
|
-
type:
|
|
561
|
-
normalized: true,
|
|
546
|
+
type: "unorm8",
|
|
562
547
|
accessor: (object, { index }) => {
|
|
563
548
|
const i = object && object.__source ? object.__source.index : index;
|
|
564
549
|
return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];
|
|
@@ -689,84 +674,65 @@ var import_shadertools = require("@luma.gl/shadertools");
|
|
|
689
674
|
var import_core4 = require("@deck.gl/core");
|
|
690
675
|
|
|
691
676
|
// dist/fp64/project64.glsl.js
|
|
692
|
-
var project64_glsl_default = `
|
|
693
|
-
const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
694
|
-
|
|
677
|
+
var project64_glsl_default = `const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);
|
|
695
678
|
uniform vec2 project_uViewProjectionMatrixFP64[16];
|
|
696
|
-
|
|
697
|
-
// longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw
|
|
698
679
|
void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {
|
|
699
|
-
|
|
700
680
|
#if defined(NVIDIA_FP64_WORKAROUND)
|
|
701
|
-
|
|
681
|
+
out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);
|
|
702
682
|
#else
|
|
703
|
-
|
|
683
|
+
out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);
|
|
704
684
|
#endif
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
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;
|
|
708
688
|
}
|
|
709
|
-
|
|
710
689
|
void project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
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;
|
|
717
695
|
}
|
|
718
|
-
|
|
719
696
|
void project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
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);
|
|
725
701
|
}
|
|
726
|
-
|
|
727
702
|
vec4 project_common_position_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
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
|
+
);
|
|
737
712
|
}
|
|
738
|
-
|
|
739
713
|
vec4 project_position_to_clipspace(
|
|
740
|
-
|
|
714
|
+
vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition
|
|
741
715
|
) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]);
|
|
755
|
-
commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0));
|
|
756
|
-
commonPosition64[3] = vec2(1.0, 0.0);
|
|
757
|
-
|
|
758
|
-
commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0);
|
|
759
|
-
|
|
760
|
-
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);
|
|
761
728
|
}
|
|
762
|
-
|
|
763
729
|
vec4 project_position_to_clipspace(
|
|
764
|
-
|
|
730
|
+
vec3 position, vec3 position64xyLow, vec3 offset
|
|
765
731
|
) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
732
|
+
vec4 commonPosition;
|
|
733
|
+
return project_position_to_clipspace(
|
|
734
|
+
position, position64xyLow, offset, commonPosition
|
|
735
|
+
);
|
|
770
736
|
}
|
|
771
737
|
`;
|
|
772
738
|
|
|
@@ -838,41 +804,36 @@ in vec2 vDashArray;
|
|
|
838
804
|
in float vDashOffset;
|
|
839
805
|
`,
|
|
840
806
|
"fs:#main-start": `
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
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
|
+
}
|
|
876
837
|
`
|
|
877
838
|
}
|
|
878
839
|
};
|
|
@@ -882,22 +843,22 @@ var offsetShaders = {
|
|
|
882
843
|
in float instanceOffsets;
|
|
883
844
|
`,
|
|
884
845
|
"vs:DECKGL_FILTER_SIZE": `
|
|
885
|
-
|
|
886
|
-
|
|
846
|
+
float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
|
|
847
|
+
size *= offsetWidth;
|
|
887
848
|
`,
|
|
888
849
|
"vs:#main-end": `
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
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;
|
|
894
855
|
`,
|
|
895
856
|
"fs:#main-start": `
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
857
|
+
float isInside;
|
|
858
|
+
isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
|
|
859
|
+
if (isInside == 0.0) {
|
|
860
|
+
discard;
|
|
861
|
+
}
|
|
901
862
|
`
|
|
902
863
|
}
|
|
903
864
|
};
|
|
@@ -997,26 +958,23 @@ var PathStyleExtension = _PathStyleExtension;
|
|
|
997
958
|
// dist/fill-style/fill-style-extension.js
|
|
998
959
|
var import_core9 = require("@deck.gl/core");
|
|
999
960
|
|
|
1000
|
-
// dist/fill-style/
|
|
961
|
+
// dist/fill-style/shader-module.js
|
|
1001
962
|
var import_core8 = require("@deck.gl/core");
|
|
1002
963
|
var patternVs = `
|
|
1003
964
|
#ifdef NON_INSTANCED_MODEL
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
965
|
+
#define FILL_PATTERN_FRAME_ATTRIB fillPatternFrames
|
|
966
|
+
#define FILL_PATTERN_SCALE_ATTRIB fillPatternScales
|
|
967
|
+
#define FILL_PATTERN_OFFSET_ATTRIB fillPatternOffsets
|
|
1007
968
|
#else
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
969
|
+
#define FILL_PATTERN_FRAME_ATTRIB instanceFillPatternFrames
|
|
970
|
+
#define FILL_PATTERN_SCALE_ATTRIB instanceFillPatternScales
|
|
971
|
+
#define FILL_PATTERN_OFFSET_ATTRIB instanceFillPatternOffsets
|
|
1011
972
|
#endif
|
|
1012
|
-
|
|
1013
973
|
in vec4 FILL_PATTERN_FRAME_ATTRIB;
|
|
1014
974
|
in float FILL_PATTERN_SCALE_ATTRIB;
|
|
1015
975
|
in vec2 FILL_PATTERN_OFFSET_ATTRIB;
|
|
1016
|
-
|
|
1017
976
|
uniform bool fill_patternEnabled;
|
|
1018
977
|
uniform vec2 fill_patternTextureSize;
|
|
1019
|
-
|
|
1020
978
|
out vec2 fill_uv;
|
|
1021
979
|
out vec4 fill_patternBounds;
|
|
1022
980
|
out vec4 fill_patternPlacement;
|
|
@@ -1027,39 +985,35 @@ uniform bool fill_patternMask;
|
|
|
1027
985
|
uniform sampler2D fill_patternTexture;
|
|
1028
986
|
uniform vec2 fill_uvCoordinateOrigin;
|
|
1029
987
|
uniform vec2 fill_uvCoordinateOrigin64Low;
|
|
1030
|
-
|
|
1031
988
|
in vec4 fill_patternBounds;
|
|
1032
989
|
in vec4 fill_patternPlacement;
|
|
1033
990
|
in vec2 fill_uv;
|
|
1034
|
-
|
|
1035
991
|
const float FILL_UV_SCALE = 512.0 / 40000000.0;
|
|
1036
992
|
`;
|
|
1037
993
|
var inject3 = {
|
|
1038
994
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
1039
|
-
|
|
1040
|
-
|
|
995
|
+
fill_uv = geometry.position.xy;
|
|
996
|
+
`,
|
|
1041
997
|
"vs:DECKGL_FILTER_COLOR": `
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
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
|
+
`,
|
|
1048
1004
|
"fs:DECKGL_FILTER_COLOR": `
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
`
|
|
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
|
+
`
|
|
1063
1017
|
};
|
|
1064
1018
|
function getPatternUniforms(opts, uniforms) {
|
|
1065
1019
|
if (!opts) {
|
|
@@ -1227,9 +1181,8 @@ var defaultProps5 = {
|
|
|
1227
1181
|
};
|
|
1228
1182
|
var shaderFunction = `
|
|
1229
1183
|
uniform vec4 clip_bounds;
|
|
1230
|
-
|
|
1231
1184
|
bool clip_isInBounds(vec2 position) {
|
|
1232
|
-
|
|
1185
|
+
return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];
|
|
1233
1186
|
}
|
|
1234
1187
|
`;
|
|
1235
1188
|
var shaderModuleVs = {
|
|
@@ -1241,13 +1194,13 @@ var injectionVs = {
|
|
|
1241
1194
|
out float clip_isVisible;
|
|
1242
1195
|
`,
|
|
1243
1196
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
1244
|
-
|
|
1197
|
+
clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));
|
|
1245
1198
|
`,
|
|
1246
1199
|
"fs:#decl": `
|
|
1247
1200
|
in float clip_isVisible;
|
|
1248
1201
|
`,
|
|
1249
1202
|
"fs:DECKGL_FILTER_COLOR": `
|
|
1250
|
-
|
|
1203
|
+
if (clip_isVisible < 0.5) discard;
|
|
1251
1204
|
`
|
|
1252
1205
|
};
|
|
1253
1206
|
var shaderModuleFs = {
|
|
@@ -1259,13 +1212,13 @@ var injectionFs = {
|
|
|
1259
1212
|
out vec2 clip_commonPosition;
|
|
1260
1213
|
`,
|
|
1261
1214
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
1262
|
-
|
|
1215
|
+
clip_commonPosition = geometry.position.xy;
|
|
1263
1216
|
`,
|
|
1264
1217
|
"fs:#decl": `
|
|
1265
1218
|
in vec2 clip_commonPosition;
|
|
1266
1219
|
`,
|
|
1267
1220
|
"fs:DECKGL_FILTER_COLOR": `
|
|
1268
|
-
|
|
1221
|
+
if (!clip_isInBounds(clip_commonPosition)) discard;
|
|
1269
1222
|
`
|
|
1270
1223
|
};
|
|
1271
1224
|
var _ClipExtension = class extends import_core10.LayerExtension {
|
|
@@ -1318,77 +1271,65 @@ in float collisionPriorities;
|
|
|
1318
1271
|
#else
|
|
1319
1272
|
in float instanceCollisionPriorities;
|
|
1320
1273
|
#endif
|
|
1321
|
-
|
|
1322
1274
|
uniform sampler2D collision_texture;
|
|
1323
1275
|
uniform bool collision_sort;
|
|
1324
1276
|
uniform bool collision_enabled;
|
|
1325
|
-
|
|
1326
1277
|
vec2 collision_getCoords(vec4 position) {
|
|
1327
|
-
|
|
1328
|
-
|
|
1278
|
+
vec4 collision_clipspace = project_common_position_to_clipspace(position);
|
|
1279
|
+
return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;
|
|
1329
1280
|
}
|
|
1330
|
-
|
|
1331
1281
|
float collision_match(vec2 tex, vec3 pickingColor) {
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
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);
|
|
1336
1286
|
}
|
|
1337
|
-
|
|
1338
1287
|
float collision_isVisible(vec2 texCoords, vec3 pickingColor) {
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
}
|
|
1358
|
-
delta.y += step.y;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
float W = 2.0 * floatN + 1.0;
|
|
1362
|
-
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);
|
|
1363
1306
|
}
|
|
1364
1307
|
`;
|
|
1365
1308
|
var inject4 = {
|
|
1366
1309
|
"vs:#decl": `
|
|
1367
|
-
|
|
1310
|
+
float collision_fade = 1.0;
|
|
1368
1311
|
`,
|
|
1369
1312
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
}
|
|
1388
|
-
`,
|
|
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
|
+
`,
|
|
1389
1330
|
"vs:DECKGL_FILTER_COLOR": `
|
|
1390
|
-
|
|
1391
|
-
|
|
1331
|
+
color.a *= collision_fade;
|
|
1332
|
+
`
|
|
1392
1333
|
};
|
|
1393
1334
|
var getCollisionUniforms = (opts, uniforms) => {
|
|
1394
1335
|
if (!opts || !("dummyCollisionMap" in opts)) {
|
|
@@ -1443,7 +1384,7 @@ var import_core15 = require("@deck.gl/core");
|
|
|
1443
1384
|
var import_core16 = require("@math.gl/core");
|
|
1444
1385
|
|
|
1445
1386
|
// dist/mask/mask-pass.js
|
|
1446
|
-
var
|
|
1387
|
+
var import_constants2 = require("@luma.gl/constants");
|
|
1447
1388
|
var import_core13 = require("@deck.gl/core");
|
|
1448
1389
|
var MaskPass = class extends import_core13._LayersPass {
|
|
1449
1390
|
constructor(device, props) {
|
|
@@ -1473,8 +1414,8 @@ var MaskPass = class extends import_core13._LayersPass {
|
|
|
1473
1414
|
const clearColor = [255, 255, 255, 255];
|
|
1474
1415
|
return this.device.withParametersWebGL({
|
|
1475
1416
|
blend: true,
|
|
1476
|
-
blendFunc: [
|
|
1477
|
-
blendEquation:
|
|
1417
|
+
blendFunc: [0, 1],
|
|
1418
|
+
blendEquation: 32778,
|
|
1478
1419
|
colorMask,
|
|
1479
1420
|
depthTest: false
|
|
1480
1421
|
}, () => super.render({ ...options, clearColor, target: this.fbo, pass: "mask" }));
|
|
@@ -1990,7 +1931,7 @@ var vs4 = `
|
|
|
1990
1931
|
uniform vec4 mask_bounds;
|
|
1991
1932
|
uniform bool mask_maskByInstance;
|
|
1992
1933
|
vec2 mask_getCoords(vec4 position) {
|
|
1993
|
-
|
|
1934
|
+
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
1994
1935
|
}
|
|
1995
1936
|
`;
|
|
1996
1937
|
var fs3 = `
|
|
@@ -1999,26 +1940,25 @@ uniform int mask_channel;
|
|
|
1999
1940
|
uniform bool mask_enabled;
|
|
2000
1941
|
uniform bool mask_inverted;
|
|
2001
1942
|
bool mask_isInBounds(vec2 texCoords) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
}
|
|
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
|
+
}
|
|
2022
1962
|
}
|
|
2023
1963
|
`;
|
|
2024
1964
|
var inject5 = {
|
|
@@ -2026,27 +1966,23 @@ var inject5 = {
|
|
|
2026
1966
|
out vec2 mask_texCoords;
|
|
2027
1967
|
`,
|
|
2028
1968
|
"vs:#main-end": `
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
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);
|
|
2036
1976
|
`,
|
|
2037
1977
|
"fs:#decl": `
|
|
2038
1978
|
in vec2 mask_texCoords;
|
|
2039
1979
|
`,
|
|
2040
1980
|
"fs:#main-start": `
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
fragColor = texture(mask_texture, mask_texCoords);
|
|
2047
|
-
|
|
2048
|
-
if (!mask) discard;
|
|
2049
|
-
}
|
|
1981
|
+
if (mask_enabled) {
|
|
1982
|
+
bool mask = mask_isInBounds(mask_texCoords);
|
|
1983
|
+
fragColor = texture(mask_texture, mask_texCoords);
|
|
1984
|
+
if (!mask) discard;
|
|
1985
|
+
}
|
|
2050
1986
|
`
|
|
2051
1987
|
};
|
|
2052
1988
|
var getMaskUniforms = (opts) => {
|
|
@@ -2147,59 +2083,56 @@ uniform float terrain_mode;
|
|
|
2147
2083
|
uniform sampler2D terrain_map;
|
|
2148
2084
|
uniform vec4 terrain_bounds;
|
|
2149
2085
|
out vec3 commonPos;
|
|
2150
|
-
|
|
2151
|
-
`,
|
|
2086
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
2152
2087
|
"vs:#main-start": `
|
|
2153
2088
|
if (terrain_mode == TERRAIN_MODE_SKIP) {
|
|
2154
|
-
|
|
2155
|
-
|
|
2089
|
+
gl_Position = vec4(0.0);
|
|
2090
|
+
return;
|
|
2156
2091
|
}
|
|
2157
2092
|
`,
|
|
2158
2093
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
2159
2094
|
commonPos = geometry.position.xyz;
|
|
2160
2095
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
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;
|
|
2164
2099
|
}
|
|
2165
2100
|
if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
}
|
|
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);
|
|
2175
2109
|
}
|
|
2176
|
-
|
|
2110
|
+
}
|
|
2111
|
+
`,
|
|
2177
2112
|
"fs:#decl": `
|
|
2178
2113
|
uniform float terrain_mode;
|
|
2179
2114
|
uniform sampler2D terrain_map;
|
|
2180
2115
|
uniform vec4 terrain_bounds;
|
|
2181
2116
|
in vec3 commonPos;
|
|
2182
|
-
|
|
2183
|
-
`,
|
|
2117
|
+
` + TERRAIN_MODE_CONSTANTS,
|
|
2184
2118
|
"fs:#main-start": `
|
|
2185
2119
|
if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {
|
|
2186
|
-
|
|
2187
|
-
|
|
2120
|
+
fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);
|
|
2121
|
+
return;
|
|
2188
2122
|
}
|
|
2189
|
-
|
|
2123
|
+
`,
|
|
2190
2124
|
"fs:DECKGL_FILTER_COLOR": `
|
|
2191
2125
|
if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
color = pixel + color * (1.0 - pixel.a);
|
|
2199
|
-
}
|
|
2200
|
-
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);
|
|
2201
2132
|
}
|
|
2202
|
-
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
`
|
|
2203
2136
|
},
|
|
2204
2137
|
getUniforms: (opts = {}, uniforms) => {
|
|
2205
2138
|
var _a;
|
|
@@ -2245,15 +2178,15 @@ if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_US
|
|
|
2245
2178
|
};
|
|
2246
2179
|
|
|
2247
2180
|
// dist/terrain/utils.js
|
|
2248
|
-
var
|
|
2181
|
+
var import_constants3 = require("@luma.gl/constants");
|
|
2249
2182
|
function createRenderTarget(device, opts) {
|
|
2250
2183
|
return device.createFramebuffer({
|
|
2251
2184
|
id: opts.id,
|
|
2252
2185
|
colorAttachments: [
|
|
2253
2186
|
device.createTexture({
|
|
2254
2187
|
...opts.float && {
|
|
2255
|
-
format:
|
|
2256
|
-
type:
|
|
2188
|
+
format: "rgba32float",
|
|
2189
|
+
type: 5126
|
|
2257
2190
|
},
|
|
2258
2191
|
mipmaps: false,
|
|
2259
2192
|
sampler: {
|
|
@@ -2427,7 +2360,7 @@ function intersect(b1, b2) {
|
|
|
2427
2360
|
}
|
|
2428
2361
|
|
|
2429
2362
|
// dist/terrain/terrain-pass.js
|
|
2430
|
-
var
|
|
2363
|
+
var import_constants4 = require("@luma.gl/constants");
|
|
2431
2364
|
var import_core23 = require("@deck.gl/core");
|
|
2432
2365
|
var TerrainPass = class extends import_core23._LayersPass {
|
|
2433
2366
|
getRenderableLayers(viewport, opts) {
|
|
@@ -2452,8 +2385,8 @@ var TerrainPass = class extends import_core23._LayersPass {
|
|
|
2452
2385
|
this.device.withParametersWebGL({
|
|
2453
2386
|
clearColor: [0, 0, 0, 0],
|
|
2454
2387
|
blend: true,
|
|
2455
|
-
blendFunc: [
|
|
2456
|
-
blendEquation:
|
|
2388
|
+
blendFunc: [1, 1],
|
|
2389
|
+
blendEquation: 32776,
|
|
2457
2390
|
depthTest: false
|
|
2458
2391
|
}, () => this.render({
|
|
2459
2392
|
...opts,
|