@luma.gl/shadertools 9.0.0-beta.2 → 9.0.0-beta.4
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 +87 -82
- package/dist/index.cjs +87 -82
- package/dist/lib/shader-module/shader-pass.d.ts +1 -1
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-pass.js.map +1 -1
- package/dist/modules/postprocessing/fxaa/fxaa.js +4 -4
- package/dist/modules/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +2 -2
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.js +2 -2
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.js +7 -7
- package/dist/modules/postprocessing/image-adjust-filters/denoise.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts +2 -2
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.js +5 -5
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.js +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.js +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.js +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts +2 -2
- package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.js +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts +5 -5
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.js +7 -7
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts +2 -2
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.js +9 -7
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.js.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts +2 -2
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.js +9 -7
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts +3 -3
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.js +13 -13
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts +3 -3
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.js +1 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts +2 -2
- package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/edgework.js +3 -3
- package/dist/modules/postprocessing/image-fun-filters/edgework.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +2 -2
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.js +3 -3
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.d.ts +1 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.js +6 -6
- package/dist/modules/postprocessing/image-fun-filters/ink.js.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts +5 -5
- package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/magnify.js +4 -4
- package/dist/modules/postprocessing/image-fun-filters/magnify.js.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts +3 -3
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.js +4 -4
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.js.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts +3 -3
- package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/swirl.js +3 -3
- package/dist/modules/postprocessing/image-warp-filters/swirl.js.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/warp.js +3 -2
- package/dist/modules/postprocessing/image-warp-filters/warp.js.map +1 -1
- package/dist.min.js +172 -166
- package/package.json +3 -3
- package/src/lib/shader-module/shader-pass.ts +1 -1
- package/src/modules/postprocessing/fxaa/fxaa.ts +4 -4
- package/src/modules/postprocessing/image-adjust-filters/brightnesscontrast.ts +4 -4
- package/src/modules/postprocessing/image-adjust-filters/denoise.ts +8 -8
- package/src/modules/postprocessing/image-adjust-filters/huesaturation.ts +7 -7
- package/src/modules/postprocessing/image-adjust-filters/noise.ts +2 -2
- package/src/modules/postprocessing/image-adjust-filters/sepia.ts +2 -2
- package/src/modules/postprocessing/image-adjust-filters/vibrance.ts +2 -2
- package/src/modules/postprocessing/image-adjust-filters/vignette.ts +3 -3
- package/src/modules/postprocessing/image-blur-filters/tiltshift.ts +12 -12
- package/src/modules/postprocessing/image-blur-filters/triangleblur.ts +11 -9
- package/src/modules/postprocessing/image-blur-filters/zoomblur.ts +11 -9
- package/src/modules/postprocessing/image-fun-filters/colorhalftone.ts +16 -16
- package/src/modules/postprocessing/image-fun-filters/dotscreen.ts +4 -4
- package/src/modules/postprocessing/image-fun-filters/edgework.ts +5 -5
- package/src/modules/postprocessing/image-fun-filters/hexagonalpixelate.ts +5 -5
- package/src/modules/postprocessing/image-fun-filters/ink.ts +7 -7
- package/src/modules/postprocessing/image-fun-filters/magnify.ts +9 -9
- package/src/modules/postprocessing/image-warp-filters/bulgepinch.ts +7 -7
- package/src/modules/postprocessing/image-warp-filters/swirl.ts +6 -6
- package/src/modules/postprocessing/image-warp-filters/warp.ts +3 -2
- package/src/.DS_Store +0 -0
- package/src/libs/.DS_Store +0 -0
package/dist/dist.dev.js
CHANGED
|
@@ -5435,14 +5435,14 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
5435
5435
|
// src/modules/postprocessing/image-adjust-filters/brightnesscontrast.ts
|
|
5436
5436
|
var fs4 = glsl`\
|
|
5437
5437
|
|
|
5438
|
-
uniform
|
|
5438
|
+
uniform brightnessContrastUniforms {
|
|
5439
5439
|
float brightness;
|
|
5440
5440
|
float contrast;
|
|
5441
5441
|
} brightnessContrast;
|
|
5442
5442
|
|
|
5443
5443
|
vec4 brightnessContrast_filterColor(vec4 color) {
|
|
5444
5444
|
color.rgb += brightnessContrast.brightness;
|
|
5445
|
-
if (contrast > 0.0) {
|
|
5445
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
5446
5446
|
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
5447
5447
|
} else {
|
|
5448
5448
|
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
@@ -5482,22 +5482,22 @@ vec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {
|
|
|
5482
5482
|
|
|
5483
5483
|
// src/modules/postprocessing/image-adjust-filters/denoise.ts
|
|
5484
5484
|
var fs5 = glsl`\
|
|
5485
|
-
uniform
|
|
5485
|
+
uniform denoiseUniforms {
|
|
5486
5486
|
float strength;
|
|
5487
5487
|
} noise;
|
|
5488
5488
|
|
|
5489
|
-
vec4 denoise_sampleColor(sampler2D
|
|
5489
|
+
vec4 denoise_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
5490
5490
|
float adjustedExponent = 3. + 200. * pow(1. - noise.strength, 4.);
|
|
5491
5491
|
|
|
5492
|
-
vec4 center =
|
|
5492
|
+
vec4 center = texture(source, texCoord);
|
|
5493
5493
|
vec4 color = vec4(0.0);
|
|
5494
5494
|
float total = 0.0;
|
|
5495
5495
|
for (float x = -4.0; x <= 4.0; x += 1.0) {
|
|
5496
5496
|
for (float y = -4.0; y <= 4.0; y += 1.0) {
|
|
5497
|
-
vec4
|
|
5498
|
-
float weight = 1.0 - abs(dot(
|
|
5497
|
+
vec4 offsetColor = texture(source, texCoord + vec2(x, y) / texSize);
|
|
5498
|
+
float weight = 1.0 - abs(dot(offsetColor.rgb - center.rgb, vec3(0.25)));
|
|
5499
5499
|
weight = pow(weight, adjustedExponent);
|
|
5500
|
-
color +=
|
|
5500
|
+
color += offsetColor * weight;
|
|
5501
5501
|
total += weight;
|
|
5502
5502
|
}
|
|
5503
5503
|
}
|
|
@@ -5515,7 +5515,7 @@ vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5515
5515
|
format: "f32",
|
|
5516
5516
|
value: 0.5,
|
|
5517
5517
|
min: 0,
|
|
5518
|
-
max:
|
|
5518
|
+
max: 1
|
|
5519
5519
|
}
|
|
5520
5520
|
},
|
|
5521
5521
|
fs: fs5,
|
|
@@ -5528,14 +5528,14 @@ vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5528
5528
|
|
|
5529
5529
|
// src/modules/postprocessing/image-adjust-filters/huesaturation.ts
|
|
5530
5530
|
var fs6 = glsl`\
|
|
5531
|
-
uniform
|
|
5531
|
+
uniform hueSaturationUniforms {
|
|
5532
5532
|
float hue;
|
|
5533
5533
|
float saturation;
|
|
5534
5534
|
} hueSaturation;
|
|
5535
5535
|
|
|
5536
5536
|
vec4 hueSaturation_filterColor(vec4 color) {
|
|
5537
5537
|
// hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]
|
|
5538
|
-
float angle = hue * 3.14159265;
|
|
5538
|
+
float angle = hueSaturation.hue * 3.14159265;
|
|
5539
5539
|
float s = sin(angle), c = cos(angle);
|
|
5540
5540
|
vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
|
|
5541
5541
|
float len = length(color.rgb);
|
|
@@ -5547,10 +5547,10 @@ vec4 hueSaturation_filterColor(vec4 color) {
|
|
|
5547
5547
|
|
|
5548
5548
|
// saturation adjustment
|
|
5549
5549
|
float average = (color.r + color.g + color.b) / 3.0;
|
|
5550
|
-
if (saturation > 0.0) {
|
|
5551
|
-
color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - saturation));
|
|
5550
|
+
if (hueSaturation.saturation > 0.0) {
|
|
5551
|
+
color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));
|
|
5552
5552
|
} else {
|
|
5553
|
-
color.rgb += (average - color.rgb) * (-saturation);
|
|
5553
|
+
color.rgb += (average - color.rgb) * (-hueSaturation.saturation);
|
|
5554
5554
|
}
|
|
5555
5555
|
|
|
5556
5556
|
return color;
|
|
@@ -5586,7 +5586,7 @@ vec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5586
5586
|
|
|
5587
5587
|
// src/modules/postprocessing/image-adjust-filters/noise.ts
|
|
5588
5588
|
var fs7 = glsl`\
|
|
5589
|
-
uniform
|
|
5589
|
+
uniform noiseUniforms {
|
|
5590
5590
|
float amount;
|
|
5591
5591
|
} noise;
|
|
5592
5592
|
|
|
@@ -5626,7 +5626,7 @@ vec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5626
5626
|
|
|
5627
5627
|
// src/modules/postprocessing/image-adjust-filters/sepia.ts
|
|
5628
5628
|
var fs8 = glsl`\
|
|
5629
|
-
uniform
|
|
5629
|
+
uniform sepiaUniforms {
|
|
5630
5630
|
float amount;
|
|
5631
5631
|
} sepia;
|
|
5632
5632
|
|
|
@@ -5667,7 +5667,7 @@ vec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5667
5667
|
|
|
5668
5668
|
// src/modules/postprocessing/image-adjust-filters/vibrance.ts
|
|
5669
5669
|
var fs9 = glsl`\
|
|
5670
|
-
uniform
|
|
5670
|
+
uniform vibranceUniforms {
|
|
5671
5671
|
float amount;
|
|
5672
5672
|
} vibrance;
|
|
5673
5673
|
|
|
@@ -5700,7 +5700,7 @@ vec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5700
5700
|
|
|
5701
5701
|
// src/modules/postprocessing/image-adjust-filters/vignette.ts
|
|
5702
5702
|
var fs10 = glsl`\
|
|
5703
|
-
uniform
|
|
5703
|
+
uniform vignetteUniforms {
|
|
5704
5704
|
float radius;
|
|
5705
5705
|
float amount;
|
|
5706
5706
|
} vignette;
|
|
@@ -5741,7 +5741,7 @@ vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5741
5741
|
|
|
5742
5742
|
// src/modules/postprocessing/image-blur-filters/tiltshift.ts
|
|
5743
5743
|
var fs11 = glsl`\
|
|
5744
|
-
uniform
|
|
5744
|
+
uniform tiltShiftUniforms {
|
|
5745
5745
|
float blurRadius;
|
|
5746
5746
|
float gradientRadius;
|
|
5747
5747
|
vec2 start;
|
|
@@ -5754,26 +5754,26 @@ vec2 tiltShift_getDelta(vec2 texSize) {
|
|
|
5754
5754
|
return tiltShift.invert ? vec2(-vector.y, vector.x) : vector;
|
|
5755
5755
|
}
|
|
5756
5756
|
|
|
5757
|
-
vec4 tiltShift_sampleColor(sampler2D
|
|
5757
|
+
vec4 tiltShift_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
5758
5758
|
vec4 color = vec4(0.0);
|
|
5759
5759
|
float total = 0.0;
|
|
5760
5760
|
|
|
5761
5761
|
/* randomize the lookup values to hide the fixed number of samples */
|
|
5762
5762
|
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
5763
5763
|
|
|
5764
|
-
vec2 normal = normalize(vec2((start.y - end.y) * texSize.y, (end.x - start.x) * texSize.x));
|
|
5764
|
+
vec2 normal = normalize(vec2((tiltShift.start.y - tiltShift.end.y) * texSize.y, (tiltShift.end.x - tiltShift.start.x) * texSize.x));
|
|
5765
5765
|
float radius = smoothstep(0.0, 1.0,
|
|
5766
|
-
abs(dot(texCoord * texSize - start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;
|
|
5766
|
+
abs(dot(texCoord * texSize - tiltShift.start * texSize, normal)) / tiltShift.gradientRadius) * tiltShift.blurRadius;
|
|
5767
5767
|
|
|
5768
5768
|
for (float t = -30.0; t <= 30.0; t++) {
|
|
5769
5769
|
float percent = (t + offset - 0.5) / 30.0;
|
|
5770
5770
|
float weight = 1.0 - abs(percent);
|
|
5771
|
-
vec4
|
|
5771
|
+
vec4 offsetColor = texture(source, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
|
|
5772
5772
|
|
|
5773
5773
|
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
5774
|
-
|
|
5774
|
+
offsetColor.rgb *= offsetColor.a;
|
|
5775
5775
|
|
|
5776
|
-
color +=
|
|
5776
|
+
color += offsetColor * weight;
|
|
5777
5777
|
total += weight;
|
|
5778
5778
|
}
|
|
5779
5779
|
|
|
@@ -5833,11 +5833,13 @@ vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5833
5833
|
|
|
5834
5834
|
// src/modules/postprocessing/image-blur-filters/triangleblur.ts
|
|
5835
5835
|
var fs12 = glsl`\
|
|
5836
|
-
uniform
|
|
5837
|
-
|
|
5836
|
+
uniform triangleBlurUniforms {
|
|
5837
|
+
float radius;
|
|
5838
|
+
vec2 delta;
|
|
5839
|
+
} triangleBlur;
|
|
5838
5840
|
|
|
5839
|
-
vec4 triangleBlur_sampleColor(sampler2D
|
|
5840
|
-
vec2 adjustedDelta = delta * radius / texSize;
|
|
5841
|
+
vec4 triangleBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
5842
|
+
vec2 adjustedDelta = triangleBlur.delta * triangleBlur.radius / texSize;
|
|
5841
5843
|
|
|
5842
5844
|
vec4 color = vec4(0.0);
|
|
5843
5845
|
float total = 0.0;
|
|
@@ -5848,12 +5850,12 @@ vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5848
5850
|
for (float t = -30.0; t <= 30.0; t++) {
|
|
5849
5851
|
float percent = (t + offset - 0.5) / 30.0;
|
|
5850
5852
|
float weight = 1.0 - abs(percent);
|
|
5851
|
-
vec4
|
|
5853
|
+
vec4 offsetColor = texture(source, texCoord + adjustedDelta * percent);
|
|
5852
5854
|
|
|
5853
5855
|
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
5854
|
-
|
|
5856
|
+
offsetColor.rgb *= offsetColor.a;
|
|
5855
5857
|
|
|
5856
|
-
color +=
|
|
5858
|
+
color += offsetColor * weight;
|
|
5857
5859
|
total += weight;
|
|
5858
5860
|
}
|
|
5859
5861
|
|
|
@@ -5899,13 +5901,15 @@ vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5899
5901
|
|
|
5900
5902
|
// src/modules/postprocessing/image-blur-filters/zoomblur.ts
|
|
5901
5903
|
var fs13 = `
|
|
5902
|
-
uniform
|
|
5903
|
-
|
|
5904
|
+
uniform zoomBlurUniforms {
|
|
5905
|
+
vec2 center;
|
|
5906
|
+
float strength;
|
|
5907
|
+
} zoomBlur;
|
|
5904
5908
|
|
|
5905
|
-
vec4 zoomBlur_sampleColor(sampler2D
|
|
5909
|
+
vec4 zoomBlur_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
5906
5910
|
vec4 color = vec4(0.0);
|
|
5907
5911
|
float total = 0.0;
|
|
5908
|
-
vec2 toCenter = center * texSize - texCoord * texSize;
|
|
5912
|
+
vec2 toCenter = zoomBlur.center * texSize - texCoord * texSize;
|
|
5909
5913
|
|
|
5910
5914
|
/* randomize the lookup values to hide the fixed number of samples */
|
|
5911
5915
|
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
|
|
@@ -5913,12 +5917,12 @@ vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5913
5917
|
for (float t = 0.0; t <= 40.0; t++) {
|
|
5914
5918
|
float percent = (t + offset) / 40.0;
|
|
5915
5919
|
float weight = 4.0 * (percent - percent * percent);
|
|
5916
|
-
vec4
|
|
5920
|
+
vec4 offsetColor = texture(source, texCoord + toCenter * percent * zoomBlur.strength / texSize);
|
|
5917
5921
|
|
|
5918
5922
|
/* switch to pre-multiplied alpha to correctly blur transparent images */
|
|
5919
|
-
|
|
5923
|
+
offsetColor.rgb *= offsetColor.a;
|
|
5920
5924
|
|
|
5921
|
-
color +=
|
|
5925
|
+
color += offsetColor * weight;
|
|
5922
5926
|
total += weight;
|
|
5923
5927
|
}
|
|
5924
5928
|
|
|
@@ -5955,16 +5959,14 @@ vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5955
5959
|
|
|
5956
5960
|
// src/modules/postprocessing/image-fun-filters/colorhalftone.ts
|
|
5957
5961
|
var fs14 = glsl`\
|
|
5958
|
-
uniform
|
|
5962
|
+
uniform colorHalftoneUniforms {
|
|
5959
5963
|
vec2 center;
|
|
5960
5964
|
float angle;
|
|
5961
5965
|
float size;
|
|
5962
5966
|
} colorHalftone;
|
|
5963
5967
|
|
|
5964
|
-
float scale
|
|
5965
|
-
|
|
5966
|
-
float pattern(float angle, vec2 texSize, vec2 texCoord) {
|
|
5967
|
-
float s = sin(colorHalftone.angle), c = cos(colorHalftone.angle);
|
|
5968
|
+
float pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {
|
|
5969
|
+
float s = sin(angle), c = cos(angle);
|
|
5968
5970
|
vec2 tex = texCoord * texSize - colorHalftone.center * texSize;
|
|
5969
5971
|
vec2 point = vec2(
|
|
5970
5972
|
c * tex.x - s * tex.y,
|
|
@@ -5974,19 +5976,21 @@ float pattern(float angle, vec2 texSize, vec2 texCoord) {
|
|
|
5974
5976
|
}
|
|
5975
5977
|
|
|
5976
5978
|
vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
5979
|
+
float scale = 3.1514 / colorHalftone.size;
|
|
5977
5980
|
vec3 cmy = 1.0 - color.rgb;
|
|
5978
5981
|
float k = min(cmy.x, min(cmy.y, cmy.z));
|
|
5982
|
+
|
|
5979
5983
|
cmy = (cmy - k) / (1.0 - k);
|
|
5980
5984
|
cmy = clamp(
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5985
|
+
cmy * 10.0 - 3.0 + vec3(
|
|
5986
|
+
pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),
|
|
5987
|
+
pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),
|
|
5988
|
+
pattern(colorHalftone.angle, scale, texSize, texCoord)
|
|
5989
|
+
),
|
|
5990
|
+
0.0,
|
|
5991
|
+
1.0
|
|
5988
5992
|
);
|
|
5989
|
-
k = clamp(k * 10.0 - 5.0 + pattern(angle + 0.78539, texSize, texCoord), 0.0, 1.0);
|
|
5993
|
+
k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);
|
|
5990
5994
|
return vec4(1.0 - cmy - k, color.a);
|
|
5991
5995
|
}
|
|
5992
5996
|
`;
|
|
@@ -6021,7 +6025,7 @@ vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
6021
6025
|
|
|
6022
6026
|
// src/modules/postprocessing/image-fun-filters/dotscreen.ts
|
|
6023
6027
|
var fs15 = glsl`\
|
|
6024
|
-
uniform
|
|
6028
|
+
uniform dotScreenUniforms {
|
|
6025
6029
|
vec2 center;
|
|
6026
6030
|
float angle;
|
|
6027
6031
|
float size;
|
|
@@ -6075,7 +6079,7 @@ vec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
6075
6079
|
|
|
6076
6080
|
// src/modules/postprocessing/image-fun-filters/edgework.ts
|
|
6077
6081
|
var fs16 = glsl`\
|
|
6078
|
-
uniform
|
|
6082
|
+
uniform edgeWorkUniforms {
|
|
6079
6083
|
float radius;
|
|
6080
6084
|
vec2 delta;
|
|
6081
6085
|
} edgeWork;
|
|
@@ -6092,7 +6096,7 @@ vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
6092
6096
|
for (float t = -30.0; t <= 30.0; t++) {
|
|
6093
6097
|
float percent = (t + offset - 0.5) / 30.0;
|
|
6094
6098
|
float weight = 1.0 - abs(percent);
|
|
6095
|
-
vec3 sampleColor =
|
|
6099
|
+
vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;
|
|
6096
6100
|
float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
|
|
6097
6101
|
color.x += average * weight;
|
|
6098
6102
|
total.x += weight;
|
|
@@ -6117,7 +6121,7 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
6117
6121
|
for (float t = -30.0; t <= 30.0; t++) {
|
|
6118
6122
|
float percent = (t + offset - 0.5) / 30.0;
|
|
6119
6123
|
float weight = 1.0 - abs(percent);
|
|
6120
|
-
vec2 sampleColor =
|
|
6124
|
+
vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;
|
|
6121
6125
|
color.x += sampleColor.x * weight;
|
|
6122
6126
|
total.x += weight;
|
|
6123
6127
|
if (abs(t) < 15.0) {
|
|
@@ -6160,12 +6164,12 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
6160
6164
|
|
|
6161
6165
|
// src/modules/postprocessing/image-fun-filters/hexagonalpixelate.ts
|
|
6162
6166
|
var fs17 = glsl`\
|
|
6163
|
-
uniform
|
|
6167
|
+
uniform hexagonalPixelateUniforms {
|
|
6164
6168
|
vec2 center;
|
|
6165
6169
|
float scale;
|
|
6166
6170
|
} hexagonalPixelate;
|
|
6167
6171
|
|
|
6168
|
-
vec4 hexagonalPixelate_sampleColor(sampler2D
|
|
6172
|
+
vec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
6169
6173
|
vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;
|
|
6170
6174
|
tex.y /= 0.866025404;
|
|
6171
6175
|
tex.x -= tex.y * 0.5;
|
|
@@ -6200,7 +6204,7 @@ vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoor
|
|
|
6200
6204
|
choice.y *= 0.866025404;
|
|
6201
6205
|
choice *= hexagonalPixelate.scale / texSize;
|
|
6202
6206
|
|
|
6203
|
-
return
|
|
6207
|
+
return texture(source, choice + hexagonalPixelate.center);
|
|
6204
6208
|
}
|
|
6205
6209
|
`;
|
|
6206
6210
|
var hexagonalPixelate = {
|
|
@@ -6229,25 +6233,25 @@ vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoor
|
|
|
6229
6233
|
|
|
6230
6234
|
// src/modules/postprocessing/image-fun-filters/ink.ts
|
|
6231
6235
|
var fs18 = glsl`\
|
|
6232
|
-
uniform
|
|
6236
|
+
uniform inkUniforms {
|
|
6233
6237
|
float strength;
|
|
6234
6238
|
} ink;
|
|
6235
6239
|
|
|
6236
|
-
vec4 ink_sampleColor(sampler2D
|
|
6240
|
+
vec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
6237
6241
|
vec2 dx = vec2(1.0 / texSize.x, 0.0);
|
|
6238
6242
|
vec2 dy = vec2(0.0, 1.0 / texSize.y);
|
|
6239
|
-
vec4 color =
|
|
6243
|
+
vec4 color = texture(source, texCoord);
|
|
6240
6244
|
float bigTotal = 0.0;
|
|
6241
6245
|
float smallTotal = 0.0;
|
|
6242
6246
|
vec3 bigAverage = vec3(0.0);
|
|
6243
6247
|
vec3 smallAverage = vec3(0.0);
|
|
6244
6248
|
for (float x = -2.0; x <= 2.0; x += 1.0) {
|
|
6245
6249
|
for (float y = -2.0; y <= 2.0; y += 1.0) {
|
|
6246
|
-
vec3
|
|
6247
|
-
bigAverage +=
|
|
6250
|
+
vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;
|
|
6251
|
+
bigAverage += offsetColor;
|
|
6248
6252
|
bigTotal += 1.0;
|
|
6249
6253
|
if (abs(x) + abs(y) < 2.0) {
|
|
6250
|
-
smallAverage +=
|
|
6254
|
+
smallAverage += offsetColor;
|
|
6251
6255
|
smallTotal += 1.0;
|
|
6252
6256
|
}
|
|
6253
6257
|
}
|
|
@@ -6277,7 +6281,7 @@ vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
6277
6281
|
|
|
6278
6282
|
// src/modules/postprocessing/image-fun-filters/magnify.ts
|
|
6279
6283
|
var fs19 = glsl`\
|
|
6280
|
-
uniform
|
|
6284
|
+
uniform magnifyUniforms {
|
|
6281
6285
|
vec2 screenXY;
|
|
6282
6286
|
float radiusPixels;
|
|
6283
6287
|
float zoom;
|
|
@@ -6285,17 +6289,17 @@ uniform Magnify {
|
|
|
6285
6289
|
vec4 borderColor;
|
|
6286
6290
|
} magnify;
|
|
6287
6291
|
|
|
6288
|
-
vec4 magnify_sampleColor(sampler2D
|
|
6292
|
+
vec4 magnify_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
6289
6293
|
vec2 pos = vec2(magnify.screenXY.x, 1.0 - magnify.screenXY.y);
|
|
6290
6294
|
float dist = distance(texCoord * texSize, pos * texSize);
|
|
6291
6295
|
if (dist < magnify.radiusPixels) {
|
|
6292
|
-
return
|
|
6296
|
+
return texture(source, (texCoord - pos) / magnify.zoom + pos);
|
|
6293
6297
|
}
|
|
6294
6298
|
|
|
6295
6299
|
if (dist <= magnify.radiusPixels + magnify.borderWidthPixels) {
|
|
6296
6300
|
return magnify.borderColor;
|
|
6297
6301
|
}
|
|
6298
|
-
return
|
|
6302
|
+
return texture(source, texCoord);
|
|
6299
6303
|
}
|
|
6300
6304
|
`;
|
|
6301
6305
|
var magnify = {
|
|
@@ -6326,8 +6330,8 @@ vec4 magnify_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
6326
6330
|
|
|
6327
6331
|
// src/modules/postprocessing/image-warp-filters/warp.ts
|
|
6328
6332
|
var fs20 = glsl`\
|
|
6329
|
-
vec4 warp_sampleColor(sampler2D
|
|
6330
|
-
vec4 color =
|
|
6333
|
+
vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {
|
|
6334
|
+
vec4 color = texture(source, coord / texSize);
|
|
6331
6335
|
vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
|
|
6332
6336
|
if (coord != clampedCoord) {
|
|
6333
6337
|
/* fade to transparent if we are outside the image */
|
|
@@ -6339,12 +6343,13 @@ vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
|
|
|
6339
6343
|
`;
|
|
6340
6344
|
var warp = {
|
|
6341
6345
|
name: "warp",
|
|
6346
|
+
passes: [],
|
|
6342
6347
|
fs: fs20
|
|
6343
6348
|
};
|
|
6344
6349
|
|
|
6345
6350
|
// src/modules/postprocessing/image-warp-filters/bulgepinch.ts
|
|
6346
6351
|
var fs21 = glsl`\
|
|
6347
|
-
uniform
|
|
6352
|
+
uniform bulgePinchUniforms {
|
|
6348
6353
|
float radius;
|
|
6349
6354
|
float strength;
|
|
6350
6355
|
vec2 center;
|
|
@@ -6355,7 +6360,7 @@ vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
|
|
|
6355
6360
|
float distance = length(coord);
|
|
6356
6361
|
if (distance < bulgePinch.radius) {
|
|
6357
6362
|
float percent = distance / bulgePinch.radius;
|
|
6358
|
-
if (strength > 0.0) {
|
|
6363
|
+
if (bulgePinch.strength > 0.0) {
|
|
6359
6364
|
coord *= mix(1.0, smoothstep(0.0, bulgePinch.radius / distance, percent), bulgePinch.strength * 0.75);
|
|
6360
6365
|
} else {
|
|
6361
6366
|
coord *= mix(1.0, pow(percent, 1.0 + bulgePinch.strength * 0.75) * bulgePinch.radius / distance, 1.0 - percent);
|
|
@@ -6365,11 +6370,11 @@ vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
|
|
|
6365
6370
|
return coord;
|
|
6366
6371
|
}
|
|
6367
6372
|
|
|
6368
|
-
vec4 bulgePinch_sampleColor(sampler2D
|
|
6373
|
+
vec4 bulgePinch_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
6369
6374
|
vec2 coord = texCoord * texSize;
|
|
6370
6375
|
coord = bulgePinch_warp(coord, bulgePinch.center * texSize);
|
|
6371
6376
|
|
|
6372
|
-
return warp_sampleColor(
|
|
6377
|
+
return warp_sampleColor(source, texSize, coord);
|
|
6373
6378
|
}
|
|
6374
6379
|
`;
|
|
6375
6380
|
var bulgePinch = {
|
|
@@ -6403,7 +6408,7 @@ vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
6403
6408
|
|
|
6404
6409
|
// src/modules/postprocessing/image-warp-filters/swirl.ts
|
|
6405
6410
|
var fs22 = glsl`\
|
|
6406
|
-
uniform
|
|
6411
|
+
uniform swirlUniforms {
|
|
6407
6412
|
float radius;
|
|
6408
6413
|
float angle;
|
|
6409
6414
|
vec2 center;
|
|
@@ -6426,11 +6431,11 @@ vec2 swirl_warp(vec2 coord, vec2 texCenter) {
|
|
|
6426
6431
|
return coord;
|
|
6427
6432
|
}
|
|
6428
6433
|
|
|
6429
|
-
vec4 swirl_sampleColor(sampler2D
|
|
6434
|
+
vec4 swirl_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
6430
6435
|
vec2 coord = texCoord * texSize;
|
|
6431
6436
|
coord = swirl_warp(coord, swirl.center * texSize);
|
|
6432
6437
|
|
|
6433
|
-
return warp_sampleColor(
|
|
6438
|
+
return warp_sampleColor(source, texSize, coord);
|
|
6434
6439
|
}
|
|
6435
6440
|
`;
|
|
6436
6441
|
var swirl = {
|
|
@@ -6651,8 +6656,8 @@ vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
6651
6656
|
#define FxaaTex sampler2D
|
|
6652
6657
|
|
|
6653
6658
|
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
|
6654
|
-
#define FxaaTexTop(t, p)
|
|
6655
|
-
#define FxaaTexOff(t, p, o, r)
|
|
6659
|
+
#define FxaaTexTop(t, p) texture(t, p)
|
|
6660
|
+
#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
|
|
6656
6661
|
|
|
6657
6662
|
FxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }
|
|
6658
6663
|
|
|
@@ -7029,14 +7034,14 @@ FxaaFloat4 FxaaPixelShader_(
|
|
|
7029
7034
|
return FxaaTexTop(tex, posM);
|
|
7030
7035
|
}
|
|
7031
7036
|
|
|
7032
|
-
vec4 fxaa_sampleColor(sampler2D
|
|
7037
|
+
vec4 fxaa_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
7033
7038
|
const float fxaa_QualitySubpix = 0.5;
|
|
7034
7039
|
const float fxaa_QualityEdgeThreshold = 0.125;
|
|
7035
7040
|
const float fxaa_QualityEdgeThresholdMin = 0.0833;
|
|
7036
7041
|
|
|
7037
7042
|
return FxaaPixelShader_(
|
|
7038
7043
|
texCoord,
|
|
7039
|
-
|
|
7044
|
+
source,
|
|
7040
7045
|
vec2(1.0) / texSize,
|
|
7041
7046
|
fxaa_QualitySubpix,
|
|
7042
7047
|
fxaa_QualityEdgeThreshold,
|