@needle-tools/engine 4.1.0-experimental.12 → 4.1.0-experimental.13

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.
@@ -1754,15 +1754,15 @@ function oC() {
1754
1754
  return n || null;
1755
1755
  }
1756
1756
  const w0 = S("debugdefines");
1757
- fo('if(!globalThis[""4.1.0-experimental.12""]) globalThis[""4.1.0-experimental.12""] = "0.0.0";');
1757
+ fo('if(!globalThis[""4.1.0-experimental.13""]) globalThis[""4.1.0-experimental.13""] = "0.0.0";');
1758
1758
  fo('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
1759
- fo('if(!globalThis[""Mon Jan 20 2025 16:50:27 GMT+0100 (Central European Standard Time)""]) globalThis[""Mon Jan 20 2025 16:50:27 GMT+0100 (Central European Standard Time)""] = "unknown";');
1759
+ fo('if(!globalThis[""Mon Jan 20 2025 16:55:26 GMT+0100 (Central European Standard Time)""]) globalThis[""Mon Jan 20 2025 16:55:26 GMT+0100 (Central European Standard Time)""] = "unknown";');
1760
1760
  fo('if(!globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""]) globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""] = "unknown";');
1761
- fo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.1.0-experimental.12";');
1761
+ fo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.1.0-experimental.13";');
1762
1762
  fo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
1763
- fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Jan 20 2025 16:50:27 GMT+0100 (Central European Standard Time)";');
1763
+ fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Jan 20 2025 16:55:26 GMT+0100 (Central European Standard Time)";');
1764
1764
  fo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9";');
1765
- const zs = "4.1.0-experimental.12", Wm = "undefined", x0 = "Mon Jan 20 2025 16:50:27 GMT+0100 (Central European Standard Time)";
1765
+ const zs = "4.1.0-experimental.13", Wm = "undefined", x0 = "Mon Jan 20 2025 16:55:26 GMT+0100 (Central European Standard Time)";
1766
1766
  w0 && console.log(`Engine version: ${zs} (generator: ${Wm})
1767
1767
  Project built at ${x0}`);
1768
1768
  const Wh = "npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9", Jn = "needle_isActiveInHierarchy", zr = "builtin_components", Vh = "needle_editor_guid";
@@ -32522,10 +32522,55 @@ ww([
32522
32522
  f()
32523
32523
  ], qg.prototype, "radius", 1);
32524
32524
  function mA() {
32525
- class n extends B.POSTPROCESSING.MODULE.Effect {
32525
+ const n = `
32526
+ void mainSupport() {
32527
+ vUv = uv;
32528
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
32529
+ }
32530
+ `, t = `
32531
+ uniform sampler2D tDiffuse;
32532
+ uniform float amount;
32533
+ uniform float radius;
32534
+
32535
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
32536
+ float tx = 1.0 / resolution.x;
32537
+ float ty = 1.0 / resolution.y;
32538
+ vec2 texelSize = vec2(tx, ty);
32539
+
32540
+ vec4 blurred = vec4(0.0);
32541
+ float total = 0.0;
32542
+
32543
+ for (float x = -radius; x <= radius; x++) {
32544
+ for (float y = -radius; y <= radius; y++) {
32545
+ vec2 offset = vec2(x, y) * texelSize;
32546
+ vec4 diffuse = texture2D(tDiffuse, uv + offset);
32547
+ float weight = exp(-length(offset) * amount);
32548
+ blurred += diffuse * weight;
32549
+ total += weight;
32550
+ }
32551
+ }
32552
+
32553
+ if (total > 0.0) {
32554
+ blurred /= total;
32555
+ }
32556
+
32557
+ // Calculate the sharpened color using inputColor
32558
+ vec4 sharp = inputColor + clamp(inputColor - blurred, 0.0, 1.0) * amount;
32559
+ // Keep original alpha
32560
+ sharp.a = inputColor.a;
32561
+
32562
+ // Ensure the sharp color does not go below 0 or above 1
32563
+ // This means: sharpening must happen AFTER tonemapping.
32564
+ sharp = clamp(sharp, 0.0, 1.0);
32565
+
32566
+ outputColor = sharp;
32567
+ }
32568
+
32569
+ `;
32570
+ class e extends B.POSTPROCESSING.MODULE.Effect {
32526
32571
  constructor() {
32527
- super("Sharpening", e, {
32528
- vertexShader: t,
32572
+ super("Sharpening", t, {
32573
+ vertexShader: n,
32529
32574
  blendFunction: B.POSTPROCESSING.MODULE.BlendFunction.NORMAL,
32530
32575
  uniforms: /* @__PURE__ */ new Map([
32531
32576
  ["amount", new Qn(1)],
@@ -32535,7 +32580,7 @@ function mA() {
32535
32580
  });
32536
32581
  }
32537
32582
  }
32538
- return n;
32583
+ return e;
32539
32584
  }
32540
32585
  var gA = Object.defineProperty, yA = Object.getOwnPropertyDescriptor, Ga = (n, t, e, i) => {
32541
32586
  for (var s = i > 1 ? void 0 : i ? yA(t, e) : t, o = n.length - 1, a; o >= 0; o--)
@@ -1754,15 +1754,15 @@ function oC() {
1754
1754
  return n || null;
1755
1755
  }
1756
1756
  const w0 = S("debugdefines");
1757
- fo('if(!globalThis[""4.1.0-experimental.12""]) globalThis[""4.1.0-experimental.12""] = "0.0.0";');
1757
+ fo('if(!globalThis[""4.1.0-experimental.13""]) globalThis[""4.1.0-experimental.13""] = "0.0.0";');
1758
1758
  fo('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
1759
- fo('if(!globalThis[""Mon Jan 20 2025 16:50:38 GMT+0100 (Central European Standard Time)""]) globalThis[""Mon Jan 20 2025 16:50:38 GMT+0100 (Central European Standard Time)""] = "unknown";');
1759
+ fo('if(!globalThis[""Mon Jan 20 2025 16:55:38 GMT+0100 (Central European Standard Time)""]) globalThis[""Mon Jan 20 2025 16:55:38 GMT+0100 (Central European Standard Time)""] = "unknown";');
1760
1760
  fo('if(!globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""]) globalThis[""npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9""] = "unknown";');
1761
- fo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.1.0-experimental.12";');
1761
+ fo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.1.0-experimental.13";');
1762
1762
  fo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
1763
- fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Jan 20 2025 16:50:38 GMT+0100 (Central European Standard Time)";');
1763
+ fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Jan 20 2025 16:55:38 GMT+0100 (Central European Standard Time)";');
1764
1764
  fo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9";');
1765
- const zs = "4.1.0-experimental.12", Wm = "undefined", x0 = "Mon Jan 20 2025 16:50:38 GMT+0100 (Central European Standard Time)";
1765
+ const zs = "4.1.0-experimental.13", Wm = "undefined", x0 = "Mon Jan 20 2025 16:55:38 GMT+0100 (Central European Standard Time)";
1766
1766
  w0 && console.log(`Engine version: ${zs} (generator: ${Wm})
1767
1767
  Project built at ${x0}`);
1768
1768
  const Wh = "npk_74222a9fbd1b42572cdd3bf7f639eeb17a07d07f40a6185fac5f722e8fd34df9", Jn = "needle_isActiveInHierarchy", zr = "builtin_components", Vh = "needle_editor_guid";
@@ -32522,10 +32522,55 @@ ww([
32522
32522
  f()
32523
32523
  ], qg.prototype, "radius", 1);
32524
32524
  function mA() {
32525
- class n extends F.POSTPROCESSING.MODULE.Effect {
32525
+ const n = `
32526
+ void mainSupport() {
32527
+ vUv = uv;
32528
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
32529
+ }
32530
+ `, t = `
32531
+ uniform sampler2D tDiffuse;
32532
+ uniform float amount;
32533
+ uniform float radius;
32534
+
32535
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
32536
+ float tx = 1.0 / resolution.x;
32537
+ float ty = 1.0 / resolution.y;
32538
+ vec2 texelSize = vec2(tx, ty);
32539
+
32540
+ vec4 blurred = vec4(0.0);
32541
+ float total = 0.0;
32542
+
32543
+ for (float x = -radius; x <= radius; x++) {
32544
+ for (float y = -radius; y <= radius; y++) {
32545
+ vec2 offset = vec2(x, y) * texelSize;
32546
+ vec4 diffuse = texture2D(tDiffuse, uv + offset);
32547
+ float weight = exp(-length(offset) * amount);
32548
+ blurred += diffuse * weight;
32549
+ total += weight;
32550
+ }
32551
+ }
32552
+
32553
+ if (total > 0.0) {
32554
+ blurred /= total;
32555
+ }
32556
+
32557
+ // Calculate the sharpened color using inputColor
32558
+ vec4 sharp = inputColor + clamp(inputColor - blurred, 0.0, 1.0) * amount;
32559
+ // Keep original alpha
32560
+ sharp.a = inputColor.a;
32561
+
32562
+ // Ensure the sharp color does not go below 0 or above 1
32563
+ // This means: sharpening must happen AFTER tonemapping.
32564
+ sharp = clamp(sharp, 0.0, 1.0);
32565
+
32566
+ outputColor = sharp;
32567
+ }
32568
+
32569
+ `;
32570
+ class e extends F.POSTPROCESSING.MODULE.Effect {
32526
32571
  constructor() {
32527
- super("Sharpening", e, {
32528
- vertexShader: t,
32572
+ super("Sharpening", t, {
32573
+ vertexShader: n,
32529
32574
  blendFunction: F.POSTPROCESSING.MODULE.BlendFunction.NORMAL,
32530
32575
  uniforms: /* @__PURE__ */ new Map([
32531
32576
  ["amount", new Qn(1)],
@@ -32535,7 +32580,7 @@ function mA() {
32535
32580
  });
32536
32581
  }
32537
32582
  }
32538
- return n;
32583
+ return e;
32539
32584
  }
32540
32585
  var gA = Object.defineProperty, yA = Object.getOwnPropertyDescriptor, Ga = (n, t, e, i) => {
32541
32586
  for (var s = i > 1 ? void 0 : i ? yA(t, e) : t, o = n.length - 1, a; o >= 0; o--)