chunk-2UEXES4O.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import {
  2. a,
  3. a3 as a2,
  4. e,
  5. e2,
  6. f as f2,
  7. i,
  8. n as n2,
  9. n2 as n3,
  10. o,
  11. o2,
  12. o3,
  13. t2 as t
  14. } from "./chunk-FQZKJNXZ.js";
  15. import {
  16. f,
  17. n
  18. } from "./chunk-K7B6OWCU.js";
  19. import {
  20. r as r2
  21. } from "./chunk-E3G7BRZB.js";
  22. import {
  23. x
  24. } from "./chunk-DW42UVIT.js";
  25. import {
  26. r
  27. } from "./chunk-YXWMMD76.js";
  28. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js
  29. var o4 = class extends i {
  30. constructor(r3, o5) {
  31. super(r3, "vec2", a.Draw, (e3, s, t2, i2) => e3.setUniform2fv(r3, o5(s, t2, i2)));
  32. }
  33. };
  34. // node_modules/@arcgis/core/views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js
  35. var f3 = class extends i {
  36. constructor(r3, e3) {
  37. super(r3, "sampler2D", a.Draw, (o5, s, t2) => o5.bindTexture(r3, e3(s, t2)));
  38. }
  39. };
  40. function u(s, c2, p = e2.None) {
  41. const u3 = [new f3(s, c2)];
  42. if (p & e2.Size) {
  43. const i2 = s + t;
  44. u3.push(new o4(i2, (s2, t2) => {
  45. const i3 = c2(s2, t2);
  46. return r(i3) ? r2(a3, i3.descriptor.width, i3.descriptor.height) : f;
  47. }));
  48. }
  49. if (p & e2.InvSize) {
  50. const t2 = s + n3;
  51. u3.push(new o4(t2, (s2, t3) => {
  52. const i2 = c2(s2, t3);
  53. return r(i2) ? r2(a3, 1 / i2.descriptor.width, 1 / i2.descriptor.height) : f;
  54. }));
  55. }
  56. return u3;
  57. }
  58. var a3 = n();
  59. // node_modules/@arcgis/core/chunks/SSAOBlur.glsl.js
  60. var f4 = 4;
  61. function c() {
  62. const c2 = new o2(), u3 = c2.fragment;
  63. c2.include(o);
  64. const m = (f4 + 1) / 2, p = 1 / (2 * m * m);
  65. return u3.include(a2), u3.uniforms.add([new f2("depthMap", (e3) => e3.depthTexture), new f3("tex", (e3) => e3.colorTexture), new o4("blurSize", (e3) => e3.blurSize), new o3("projScale", (r3, o5) => {
  66. const t2 = x(o5.camera.eye, o5.camera.center);
  67. return t2 > 5e4 ? Math.max(0, r3.projScale - (t2 - 5e4)) : r3.projScale;
  68. }), new e("nearFar", (e3, r3) => r3.camera.nearFar)]), u3.code.add(n2`
  69. void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
  70. float c = texture2D(tex, uv).r;
  71. float d = linearDepthFromTexture(depthMap, uv, nearFar);
  72. float ddiff = d - center_d;
  73. float w = exp(-r * r * ${n2.float(p)} - ddiff * ddiff * sharpness);
  74. wTotal += w;
  75. bTotal += w * c;
  76. }
  77. `), u3.code.add(n2`
  78. void main(void) {
  79. float b = 0.0;
  80. float w_total = 0.0;
  81. float center_d = linearDepthFromTexture(depthMap, uv, nearFar);
  82. float sharpness = -0.05 * projScale / center_d;
  83. for (int r = -${n2.int(f4)}; r <= ${n2.int(f4)}; ++r) {
  84. float rf = float(r);
  85. vec2 uvOffset = uv + rf * blurSize;
  86. blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
  87. }
  88. gl_FragColor = vec4(b / w_total);
  89. }
  90. `), c2;
  91. }
  92. var u2 = Object.freeze(Object.defineProperty({ __proto__: null, build: c }, Symbol.toStringTag, { value: "Module" }));
  93. export {
  94. u,
  95. c,
  96. u2
  97. };
  98. //# sourceMappingURL=chunk-2UEXES4O.js.map