@luma.gl/effects 9.2.0-alpha.3 → 9.2.0-alpha.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/dist.dev.js +24 -8
- package/dist/dist.min.js +5 -5
- package/dist/index.cjs +42 -58
- package/dist/index.cjs.map +3 -3
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +2 -1
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +16 -3
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +0 -15
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +0 -16
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
- package/package.json +2 -2
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +17 -4
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +0 -15
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +0 -16
package/dist/index.cjs
CHANGED
|
@@ -455,7 +455,7 @@ var vibrance = {
|
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
// dist/passes/postprocessing/image-adjust-filters/vignette.js
|
|
458
|
-
var
|
|
458
|
+
var source7 = (
|
|
459
459
|
/* wgsl */
|
|
460
460
|
`struct vignetteUniforms {
|
|
461
461
|
radius: f32,
|
|
@@ -479,10 +479,26 @@ fn vignette_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) ->vec
|
|
|
479
479
|
}
|
|
480
480
|
`
|
|
481
481
|
);
|
|
482
|
+
var fs7 = (
|
|
483
|
+
/* glsl */
|
|
484
|
+
`uniform vignetteUniforms {
|
|
485
|
+
float radius;
|
|
486
|
+
float amount;
|
|
487
|
+
} vignette;
|
|
488
|
+
|
|
489
|
+
vec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
490
|
+
float dist = distance(texCoord, vec2(0.5, 0.5));
|
|
491
|
+
float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));
|
|
492
|
+
return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
|
|
493
|
+
}
|
|
494
|
+
`
|
|
495
|
+
);
|
|
482
496
|
var vignette = {
|
|
483
497
|
props: {},
|
|
484
498
|
uniforms: {},
|
|
485
499
|
name: "vignette",
|
|
500
|
+
source: source7,
|
|
501
|
+
fs: fs7,
|
|
486
502
|
uniformTypes: {
|
|
487
503
|
radius: "f32",
|
|
488
504
|
amount: "f32"
|
|
@@ -495,13 +511,12 @@ var vignette = {
|
|
|
495
511
|
radius: { value: 0.5, min: 0, max: 1 },
|
|
496
512
|
amount: { value: 0.5, min: 0, max: 1 }
|
|
497
513
|
},
|
|
498
|
-
passes: [{ filter: true }]
|
|
499
|
-
fs: fs7
|
|
514
|
+
passes: [{ filter: true }]
|
|
500
515
|
};
|
|
501
516
|
|
|
502
517
|
// dist/passes/postprocessing/image-blur-filters/tiltshift.js
|
|
503
518
|
var import_shadertools = require("@luma.gl/shadertools");
|
|
504
|
-
var
|
|
519
|
+
var source8 = (
|
|
505
520
|
/* wgsl */
|
|
506
521
|
`uniform tiltShiftUniforms {
|
|
507
522
|
blurRadius: f32,
|
|
@@ -534,18 +549,11 @@ fn tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f
|
|
|
534
549
|
float weight = 1.0 - abs(percent);
|
|
535
550
|
vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
|
|
536
551
|
|
|
537
|
-
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
538
|
-
offsetColor.rgb *= offsetColor.a;
|
|
539
|
-
|
|
540
552
|
color += offsetColor * weight;
|
|
541
553
|
total += weight;
|
|
542
554
|
}
|
|
543
555
|
|
|
544
556
|
color = color / total;
|
|
545
|
-
|
|
546
|
-
/* switch back from pre-multiplied alpha */
|
|
547
|
-
color.rgb /= color.a + 0.00001;
|
|
548
|
-
|
|
549
557
|
return color;
|
|
550
558
|
}
|
|
551
559
|
`
|
|
@@ -580,19 +588,11 @@ vec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
580
588
|
float percent = (t + offset - 0.5) / 30.0;
|
|
581
589
|
float weight = 1.0 - abs(percent);
|
|
582
590
|
vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
|
|
583
|
-
|
|
584
|
-
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
585
|
-
offsetColor.rgb *= offsetColor.a;
|
|
586
|
-
|
|
587
591
|
color += offsetColor * weight;
|
|
588
592
|
total += weight;
|
|
589
593
|
}
|
|
590
594
|
|
|
591
595
|
color = color / total;
|
|
592
|
-
|
|
593
|
-
/* switch back from pre-multiplied alpha */
|
|
594
|
-
color.rgb /= color.a + 0.00001;
|
|
595
|
-
|
|
596
596
|
return color;
|
|
597
597
|
}
|
|
598
598
|
`
|
|
@@ -600,7 +600,7 @@ vec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
600
600
|
var tiltShift = {
|
|
601
601
|
name: "tiltShift",
|
|
602
602
|
dependencies: [import_shadertools.random],
|
|
603
|
-
source:
|
|
603
|
+
source: source8,
|
|
604
604
|
fs: fs8,
|
|
605
605
|
props: {},
|
|
606
606
|
uniforms: {},
|
|
@@ -626,7 +626,7 @@ var tiltShift = {
|
|
|
626
626
|
|
|
627
627
|
// dist/passes/postprocessing/image-blur-filters/triangleblur.js
|
|
628
628
|
var import_shadertools2 = require("@luma.gl/shadertools");
|
|
629
|
-
var
|
|
629
|
+
var source9 = (
|
|
630
630
|
/* wgsl */
|
|
631
631
|
`uniform triangleBlurUniforms {
|
|
632
632
|
radius: f32,
|
|
@@ -705,7 +705,7 @@ vec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
705
705
|
var triangleBlur = {
|
|
706
706
|
name: "triangleBlur",
|
|
707
707
|
dependencies: [import_shadertools2.random],
|
|
708
|
-
source:
|
|
708
|
+
source: source9,
|
|
709
709
|
fs: fs9,
|
|
710
710
|
props: {},
|
|
711
711
|
uniforms: {},
|
|
@@ -725,7 +725,7 @@ var triangleBlur = {
|
|
|
725
725
|
|
|
726
726
|
// dist/passes/postprocessing/image-blur-filters/zoomblur.js
|
|
727
727
|
var import_shadertools3 = require("@luma.gl/shadertools");
|
|
728
|
-
var
|
|
728
|
+
var source10 = (
|
|
729
729
|
/* wgsl */
|
|
730
730
|
`
|
|
731
731
|
uniform zoomBlurUniforms {
|
|
@@ -748,19 +748,11 @@ fn zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f
|
|
|
748
748
|
float percent = (t + offset) / 40.0;
|
|
749
749
|
float weight = 4.0 * (percent - percent * percent);
|
|
750
750
|
vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);
|
|
751
|
-
|
|
752
|
-
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
753
|
-
offsetColor.rgb *= offsetColor.a;
|
|
754
|
-
|
|
755
751
|
color += offsetColor * weight;
|
|
756
752
|
total += weight;
|
|
757
753
|
}
|
|
758
754
|
|
|
759
755
|
color = color / total;
|
|
760
|
-
|
|
761
|
-
/* switch back from pre-multiplied alpha */
|
|
762
|
-
color.rgb /= color.a + 0.00001;
|
|
763
|
-
|
|
764
756
|
return color;
|
|
765
757
|
}
|
|
766
758
|
`
|
|
@@ -785,19 +777,11 @@ vec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
785
777
|
float percent = (t + offset) / 40.0;
|
|
786
778
|
float weight = 4.0 * (percent - percent * percent);
|
|
787
779
|
vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);
|
|
788
|
-
|
|
789
|
-
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
790
|
-
offsetColor.rgb *= offsetColor.a;
|
|
791
|
-
|
|
792
780
|
color += offsetColor * weight;
|
|
793
781
|
total += weight;
|
|
794
782
|
}
|
|
795
783
|
|
|
796
784
|
color = color / total;
|
|
797
|
-
|
|
798
|
-
/* switch back from pre-multiplied alpha */
|
|
799
|
-
color.rgb /= color.a + 0.00001;
|
|
800
|
-
|
|
801
785
|
return color;
|
|
802
786
|
}
|
|
803
787
|
`
|
|
@@ -805,7 +789,7 @@ vec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
805
789
|
var zoomBlur = {
|
|
806
790
|
name: "zoomBlur",
|
|
807
791
|
dependencies: [import_shadertools3.random],
|
|
808
|
-
source:
|
|
792
|
+
source: source10,
|
|
809
793
|
fs: fs10,
|
|
810
794
|
props: {},
|
|
811
795
|
uniforms: {},
|
|
@@ -821,7 +805,7 @@ var zoomBlur = {
|
|
|
821
805
|
};
|
|
822
806
|
|
|
823
807
|
// dist/passes/postprocessing/image-fun-filters/colorhalftone.js
|
|
824
|
-
var
|
|
808
|
+
var source11 = (
|
|
825
809
|
/* wgsl */
|
|
826
810
|
`struct colorHalftoneUniforms {
|
|
827
811
|
center: vec2f,
|
|
@@ -901,7 +885,7 @@ vec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
901
885
|
);
|
|
902
886
|
var colorHalftone = {
|
|
903
887
|
name: "colorHalftone",
|
|
904
|
-
source:
|
|
888
|
+
source: source11,
|
|
905
889
|
fs: fs11,
|
|
906
890
|
props: {},
|
|
907
891
|
uniforms: {},
|
|
@@ -919,7 +903,7 @@ var colorHalftone = {
|
|
|
919
903
|
};
|
|
920
904
|
|
|
921
905
|
// dist/passes/postprocessing/image-fun-filters/dotscreen.js
|
|
922
|
-
var
|
|
906
|
+
var source12 = (
|
|
923
907
|
/* wgsl */
|
|
924
908
|
`uniform dotScreenUniforms {
|
|
925
909
|
center: vec2f,
|
|
@@ -975,7 +959,7 @@ vec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
975
959
|
);
|
|
976
960
|
var dotScreen = {
|
|
977
961
|
name: "dotScreen",
|
|
978
|
-
source:
|
|
962
|
+
source: source12,
|
|
979
963
|
fs: fs12,
|
|
980
964
|
props: {},
|
|
981
965
|
uniforms: {},
|
|
@@ -994,7 +978,7 @@ var dotScreen = {
|
|
|
994
978
|
|
|
995
979
|
// dist/passes/postprocessing/image-fun-filters/edgework.js
|
|
996
980
|
var import_shadertools4 = require("@luma.gl/shadertools");
|
|
997
|
-
var
|
|
981
|
+
var source13 = (
|
|
998
982
|
/* wgsl */
|
|
999
983
|
`struct edgeWorkUniforms {
|
|
1000
984
|
radius: f32,
|
|
@@ -1100,7 +1084,7 @@ vec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
1100
1084
|
var edgeWork = {
|
|
1101
1085
|
name: "edgeWork",
|
|
1102
1086
|
dependencies: [import_shadertools4.random],
|
|
1103
|
-
source:
|
|
1087
|
+
source: source13,
|
|
1104
1088
|
fs: fs13,
|
|
1105
1089
|
props: {},
|
|
1106
1090
|
uniforms: {},
|
|
@@ -1125,7 +1109,7 @@ var edgeWork = {
|
|
|
1125
1109
|
};
|
|
1126
1110
|
|
|
1127
1111
|
// dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js
|
|
1128
|
-
var
|
|
1112
|
+
var source14 = (
|
|
1129
1113
|
/* wgsl */
|
|
1130
1114
|
`struct hexagonalPixelateUniforms {
|
|
1131
1115
|
center: vec2f,
|
|
@@ -1221,7 +1205,7 @@ vec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord
|
|
|
1221
1205
|
);
|
|
1222
1206
|
var hexagonalPixelate = {
|
|
1223
1207
|
name: "hexagonalPixelate",
|
|
1224
|
-
source:
|
|
1208
|
+
source: source14,
|
|
1225
1209
|
fs: fs14,
|
|
1226
1210
|
props: {},
|
|
1227
1211
|
uniforms: {},
|
|
@@ -1237,7 +1221,7 @@ var hexagonalPixelate = {
|
|
|
1237
1221
|
};
|
|
1238
1222
|
|
|
1239
1223
|
// dist/passes/postprocessing/image-fun-filters/ink.js
|
|
1240
|
-
var
|
|
1224
|
+
var source15 = (
|
|
1241
1225
|
/* wgsl */
|
|
1242
1226
|
`uniform inkUniforms {
|
|
1243
1227
|
strength: f32,
|
|
@@ -1303,7 +1287,7 @@ vec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
1303
1287
|
);
|
|
1304
1288
|
var ink = {
|
|
1305
1289
|
name: "ink",
|
|
1306
|
-
source:
|
|
1290
|
+
source: source15,
|
|
1307
1291
|
fs: fs15,
|
|
1308
1292
|
props: {},
|
|
1309
1293
|
uniforms: {},
|
|
@@ -1317,7 +1301,7 @@ var ink = {
|
|
|
1317
1301
|
};
|
|
1318
1302
|
|
|
1319
1303
|
// dist/passes/postprocessing/image-fun-filters/magnify.js
|
|
1320
|
-
var
|
|
1304
|
+
var source16 = (
|
|
1321
1305
|
/* wgsl */
|
|
1322
1306
|
`uniform magnifyUniforms {
|
|
1323
1307
|
screenXY: vec2f;
|
|
@@ -1369,7 +1353,7 @@ vec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
1369
1353
|
);
|
|
1370
1354
|
var magnify = {
|
|
1371
1355
|
name: "magnify",
|
|
1372
|
-
source:
|
|
1356
|
+
source: source16,
|
|
1373
1357
|
fs: fs16,
|
|
1374
1358
|
uniformTypes: {
|
|
1375
1359
|
screenXY: "vec2<f32>",
|
|
@@ -1390,7 +1374,7 @@ var magnify = {
|
|
|
1390
1374
|
};
|
|
1391
1375
|
|
|
1392
1376
|
// dist/passes/postprocessing/image-warp-filters/warp.js
|
|
1393
|
-
var
|
|
1377
|
+
var source17 = (
|
|
1394
1378
|
/* wgsl */
|
|
1395
1379
|
`vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {
|
|
1396
1380
|
vec4 color = texture(source, coord / texSize);
|
|
@@ -1418,13 +1402,13 @@ var fs17 = (
|
|
|
1418
1402
|
);
|
|
1419
1403
|
var warp = {
|
|
1420
1404
|
name: "warp",
|
|
1421
|
-
source:
|
|
1405
|
+
source: source17,
|
|
1422
1406
|
fs: fs17,
|
|
1423
1407
|
passes: []
|
|
1424
1408
|
};
|
|
1425
1409
|
|
|
1426
1410
|
// dist/passes/postprocessing/image-warp-filters/bulgepinch.js
|
|
1427
|
-
var
|
|
1411
|
+
var source18 = (
|
|
1428
1412
|
/* wgsl */
|
|
1429
1413
|
`uniform bulgePinchUniforms {
|
|
1430
1414
|
radius: f32,
|
|
@@ -1490,7 +1474,7 @@ vec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
1490
1474
|
var bulgePinch = {
|
|
1491
1475
|
name: "bulgePinch",
|
|
1492
1476
|
dependencies: [warp],
|
|
1493
|
-
source:
|
|
1477
|
+
source: source18,
|
|
1494
1478
|
fs: fs18,
|
|
1495
1479
|
props: {},
|
|
1496
1480
|
uniforms: {},
|
|
@@ -1508,7 +1492,7 @@ var bulgePinch = {
|
|
|
1508
1492
|
};
|
|
1509
1493
|
|
|
1510
1494
|
// dist/passes/postprocessing/image-warp-filters/swirl.js
|
|
1511
|
-
var
|
|
1495
|
+
var source19 = (
|
|
1512
1496
|
/* wgsl */
|
|
1513
1497
|
`uniform swirlUniforms {
|
|
1514
1498
|
radius: f32,
|
|
@@ -1578,7 +1562,7 @@ vec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
1578
1562
|
var swirl = {
|
|
1579
1563
|
name: "swirl",
|
|
1580
1564
|
dependencies: [warp],
|
|
1581
|
-
source:
|
|
1565
|
+
source: source19,
|
|
1582
1566
|
fs: fs19,
|
|
1583
1567
|
props: {},
|
|
1584
1568
|
uniforms: {},
|