@tresjs/post-processing 1.0.0 → 2.1.0

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.
Files changed (36) hide show
  1. package/dist/core/pmndrs/BarrelBlurPmndrs.vue.d.ts +26 -0
  2. package/dist/core/pmndrs/{Bloom.vue.d.ts → BloomPmndrs.vue.d.ts} +8 -8
  3. package/dist/core/pmndrs/ChromaticAberrationPmndrs.vue.d.ts +27 -0
  4. package/dist/core/pmndrs/ColorAveragePmndrs.vue.d.ts +16 -0
  5. package/dist/core/pmndrs/{DepthOfField.vue.d.ts → DepthOfFieldPmndrs.vue.d.ts} +3 -3
  6. package/dist/core/pmndrs/DotScreenPmndrs.vue.d.ts +22 -0
  7. package/dist/core/pmndrs/{EffectComposer.vue.d.ts → EffectComposerPmndrs.vue.d.ts} +3 -3
  8. package/dist/core/pmndrs/{Glitch.vue.d.ts → GlitchPmndrs.vue.d.ts} +3 -3
  9. package/dist/core/pmndrs/HueSaturationPmndrs.vue.d.ts +22 -0
  10. package/dist/core/pmndrs/KuwaharaPmndrs.vue.d.ts +27 -0
  11. package/dist/core/pmndrs/LensDistortionPmndrs.vue.d.ts +25 -0
  12. package/dist/core/pmndrs/LinocutPmndrs.vue.d.ts +15 -0
  13. package/dist/core/pmndrs/{Noise.vue.d.ts → NoisePmndrs.vue.d.ts} +3 -4
  14. package/dist/core/pmndrs/{Outline.vue.d.ts → OutlinePmndrs.vue.d.ts} +3 -3
  15. package/dist/core/pmndrs/{Pixelation.vue.d.ts → PixelationPmndrs.vue.d.ts} +3 -3
  16. package/dist/core/pmndrs/ScanlinePmndrs.vue.d.ts +24 -0
  17. package/dist/core/pmndrs/SepiaPmndrs.vue.d.ts +16 -0
  18. package/dist/core/pmndrs/ShockWavePmndrs.vue.d.ts +29 -0
  19. package/dist/core/pmndrs/TiltShiftPmndrs.vue.d.ts +49 -0
  20. package/dist/core/pmndrs/ToneMappingPmndrs.vue.d.ts +36 -0
  21. package/dist/core/pmndrs/{Vignette.vue.d.ts → VignettePmndrs.vue.d.ts} +6 -11
  22. package/dist/core/pmndrs/composables/{useEffect.d.ts → useEffectPmndrs.d.ts} +1 -1
  23. package/dist/core/pmndrs/custom/barrel-blur/index.d.ts +36 -0
  24. package/dist/core/pmndrs/custom/kuwahara/index.d.ts +31 -0
  25. package/dist/core/pmndrs/custom/linocut/index.d.ts +27 -0
  26. package/dist/core/pmndrs/index.d.ts +23 -10
  27. package/dist/core/three/UnrealBloom.vue.d.ts +1 -1
  28. package/dist/index.d.ts +2 -0
  29. package/dist/tres-post-processing.d.ts +2 -0
  30. package/dist/{three.js → tres-post-processing.js} +1324 -258
  31. package/dist/tres-post-processing.umd.cjs +1209 -0
  32. package/package.json +24 -27
  33. package/dist/pmndrs.d.ts +0 -2
  34. package/dist/pmndrs.js +0 -352
  35. package/dist/prop-BjrXLDuj.js +0 -43
  36. package/dist/three.d.ts +0 -2
@@ -1,16 +1,1060 @@
1
1
  /**
2
2
  * name: @tresjs/post-processing
3
- * version: v1.0.0
4
- * (c) 2024
3
+ * version: v2.1.0
4
+ * (c) 2025
5
5
  * description: Post-processing library for TresJS
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- import { useTresContext as w, useLoop as G } from "@tresjs/core";
9
- import { defineComponent as S, shallowRef as I, provide as k, watchEffect as f, onUnmounted as j, renderSlot as Z, inject as J, watch as _, nextTick as $, computed as O } from "vue";
10
- import { useDevicePixelRatio as V } from "@vueuse/core";
11
- import { OrthographicCamera as ee, BufferGeometry as te, Float32BufferAttribute as W, Mesh as se, ShaderMaterial as c, UniformsUtils as g, Vector2 as u, WebGLRenderTarget as v, HalfFloatType as x, NoBlending as re, Clock as ae, Color as N, MathUtils as h, DataTexture as ie, RedFormat as oe, FloatType as le, MeshNormalMaterial as ne, NearestFilter as A, DepthTexture as de, Vector4 as ue, RawShaderMaterial as he, ColorManagement as fe, SRGBTransfer as ce, LinearToneMapping as pe, ReinhardToneMapping as me, CineonToneMapping as ge, ACESFilmicToneMapping as ve, AgXToneMapping as xe, NeutralToneMapping as be, Texture as F, LinearFilter as Se, Vector3 as C, AdditiveBlending as Te, MeshBasicMaterial as Ae } from "three";
12
- import { m as Y } from "./prop-BjrXLDuj.js";
13
- const Q = {
8
+ import { watch as C, defineComponent as c, shallowRef as z, provide as Ce, computed as F, onUnmounted as V, renderSlot as Ee, inject as De, watchEffect as v, nextTick as Pe } from "vue";
9
+ import { EffectComposer as oe, RenderPass as We, NormalPass as Ue, DepthDownsamplingPass as He, EffectPass as Ge, BloomEffect as ae, DepthOfFieldEffect as se, GlitchEffect as Y, GlitchMode as Xe, NoiseEffect as re, OutlineEffect as ie, PixelationEffect as ne, VignetteEffect as le, Effect as Z, BlendFunction as _, ToneMappingEffect as ue, ChromaticAberrationEffect as q, HueSaturationEffect as ce, ScanlineEffect as k, ColorAverageEffect as Q, LensDistortionEffect as de, ShockWaveEffect as fe, TiltShiftEffect as he, DotScreenEffect as pe, SepiaEffect as me } from "postprocessing";
10
+ import { useTresContext as A, useLoop as W, normalizeColor as K } from "@tresjs/core";
11
+ import { HalfFloatType as w, Uniform as E, Vector2 as d, Vector3 as P, OrthographicCamera as Ie, BufferGeometry as je, Float32BufferAttribute as ge, Mesh as Ve, ShaderMaterial as S, UniformsUtils as M, WebGLRenderTarget as D, NoBlending as Ye, Clock as qe, Color as j, MathUtils as b, DataTexture as ke, RedFormat as Qe, FloatType as Ke, MeshNormalMaterial as Je, NearestFilter as O, DepthTexture as Ze, Vector4 as _e, RawShaderMaterial as $e, ColorManagement as et, SRGBTransfer as tt, LinearToneMapping as ot, ReinhardToneMapping as at, CineonToneMapping as st, ACESFilmicToneMapping as rt, AgXToneMapping as it, NeutralToneMapping as nt, Texture as ve, LinearFilter as lt, AdditiveBlending as ut, MeshBasicMaterial as ct } from "three";
12
+ import { useDevicePixelRatio as Le } from "@vueuse/core";
13
+ const Oe = /([^[.\]])+/g, dt = (r, e) => {
14
+ if (!e)
15
+ return;
16
+ const t = Array.isArray(e) ? e : e.match(Oe);
17
+ return t == null ? void 0 : t.reduce((o, a) => o && o[a], r);
18
+ }, xe = (r, e, t) => {
19
+ const o = Array.isArray(e) ? e : e.match(Oe);
20
+ o && o.reduce((a, s, i) => (a[s] === void 0 && (a[s] = {}), i === o.length - 1 && (a[s] = t), a[s]), r);
21
+ }, $ = (r, e) => {
22
+ const t = { ...r };
23
+ return e.forEach((o) => delete t[o]), t;
24
+ }, ee = (r, e, t, o, a = {}) => C(r, (s) => {
25
+ var i;
26
+ if (e.value)
27
+ if (s === void 0) {
28
+ const n = o();
29
+ xe(e.value, t, dt(n, t)), (i = n.dispose) == null || i.call(n);
30
+ } else
31
+ xe(e.value, t, r());
32
+ }, a), g = (r, e, t) => r.map(([o, a]) => ee(
33
+ o,
34
+ e,
35
+ a,
36
+ t
37
+ )), U = (r, e, t) => Object.keys(r).map((o) => ee(
38
+ () => r[o],
39
+ e,
40
+ o,
41
+ t
42
+ ));
43
+ class be {
44
+ static isWebGL2Available() {
45
+ try {
46
+ const e = document.createElement("canvas");
47
+ return !!(window.WebGL2RenderingContext && e.getContext("webgl2"));
48
+ } catch {
49
+ return !1;
50
+ }
51
+ }
52
+ static isColorSpaceAvailable(e) {
53
+ try {
54
+ const t = document.createElement("canvas"), o = window.WebGL2RenderingContext && t.getContext("webgl2");
55
+ return o.drawingBufferColorSpace = e, o.drawingBufferColorSpace === e;
56
+ } catch {
57
+ return !1;
58
+ }
59
+ }
60
+ static getWebGL2ErrorMessage() {
61
+ return this.getErrorMessage(2);
62
+ }
63
+ static getErrorMessage(e) {
64
+ const t = {
65
+ 1: "WebGL",
66
+ 2: "WebGL 2"
67
+ }, o = {
68
+ 1: window.WebGLRenderingContext,
69
+ 2: window.WebGL2RenderingContext
70
+ };
71
+ let a = 'Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';
72
+ const s = document.createElement("div");
73
+ return s.id = "webglmessage", s.style.fontFamily = "monospace", s.style.fontSize = "13px", s.style.fontWeight = "normal", s.style.textAlign = "center", s.style.background = "#fff", s.style.color = "#000", s.style.padding = "1.5em", s.style.width = "400px", s.style.margin = "5em auto 0", o[e] ? a = a.replace("$0", "graphics card") : a = a.replace("$0", "browser"), a = a.replace("$1", t[e]), s.innerHTML = a, s;
74
+ }
75
+ // @deprecated, r168
76
+ static isWebGLAvailable() {
77
+ console.warn("isWebGLAvailable() has been deprecated and will be removed in r178. Use isWebGL2Available() instead.");
78
+ try {
79
+ const e = document.createElement("canvas");
80
+ return !!(window.WebGLRenderingContext && (e.getContext("webgl") || e.getContext("experimental-webgl")));
81
+ } catch {
82
+ return !1;
83
+ }
84
+ }
85
+ static getWebGLErrorMessage() {
86
+ return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."), this.getErrorMessage(1);
87
+ }
88
+ }
89
+ const Re = Symbol("effectComposerPmndrs"), Lt = /* @__PURE__ */ c({
90
+ __name: "EffectComposerPmndrs",
91
+ props: {
92
+ enabled: { type: Boolean, default: !0 },
93
+ depthBuffer: { type: Boolean, default: void 0 },
94
+ disableNormalPass: { type: Boolean, default: !1 },
95
+ stencilBuffer: { type: Boolean, default: void 0 },
96
+ resolutionScale: {},
97
+ autoClear: { type: Boolean, default: !0 },
98
+ multisampling: { default: 0 },
99
+ frameBufferType: { default: w }
100
+ },
101
+ emits: ["render"],
102
+ setup(r, { expose: e, emit: t }) {
103
+ const o = r, a = t, { scene: s, camera: i, renderer: n, sizes: l, render: x } = A(), u = z(null);
104
+ let p = null, f = null;
105
+ Ce(Re, u), e({ composer: u });
106
+ const y = () => {
107
+ u.value && (f = new Ue(s.value, i.value), f.enabled = !1, u.value.addPass(f), o.resolutionScale !== void 0 && be.isWebGL2Available() && (p = new He({
108
+ normalBuffer: f.texture,
109
+ resolutionScale: o.resolutionScale
110
+ }), p.enabled = !1, u.value.addPass(p)));
111
+ }, H = F(() => {
112
+ const m = new oe(), N = {
113
+ depthBuffer: o.depthBuffer !== void 0 ? o.depthBuffer : m.inputBuffer.depthBuffer,
114
+ stencilBuffer: o.stencilBuffer !== void 0 ? o.stencilBuffer : m.inputBuffer.stencilBuffer,
115
+ multisampling: be.isWebGL2Available() ? o.multisampling !== void 0 ? o.multisampling : m.multisampling : 0,
116
+ frameBufferType: o.frameBufferType !== void 0 ? o.frameBufferType : w
117
+ };
118
+ return m.dispose(), N;
119
+ }), te = () => {
120
+ var m;
121
+ !n.value && !s.value && !i.value || ((m = u.value) == null || m.dispose(), u.value = new oe(n.value, H.value), u.value.addPass(new We(s.value, i.value)), o.disableNormalPass || y());
122
+ };
123
+ C([n, s, i, () => o.disableNormalPass], () => {
124
+ !l.width.value || !l.height.value || te();
125
+ }), C(() => [l.width.value, l.height.value], ([m, N]) => {
126
+ !m && !N || (u.value ? u.value.setSize(m, N) : te());
127
+ }, {
128
+ immediate: !0
129
+ });
130
+ const { render: Fe } = W();
131
+ return Fe(() => {
132
+ if (o.enabled && n.value && u.value && l.width.value && l.height.value && x.frames.value > 0) {
133
+ const m = n.value.autoClear;
134
+ n.value.autoClear = o.autoClear, o.stencilBuffer && !o.autoClear && n.value.clearStencil(), u.value.render(), a("render", u.value), n.value.autoClear = m;
135
+ }
136
+ x.frames.value = x.mode.value === "always" ? 1 : Math.max(0, x.frames.value - 1);
137
+ }), V(() => {
138
+ var m;
139
+ (m = u.value) == null || m.dispose();
140
+ }), (m, N) => Ee(m.$slots, "default");
141
+ }
142
+ }), h = (r, e) => {
143
+ const t = De(Re), o = z(null), a = z(null), { scene: s, camera: i, invalidate: n } = A();
144
+ e && C(e, () => n()), v(() => {
145
+ !i.value || !(a != null && a.value) || (a.value.mainCamera = i.value);
146
+ });
147
+ const l = v(() => {
148
+ !i.value || !(t != null && t.value) || !s.value || (Pe(() => l()), !a.value && (a.value = r(), o.value = new Ge(i.value, a.value), t.value.addPass(o.value)));
149
+ });
150
+ return V(() => {
151
+ var x, u, p;
152
+ o.value && ((x = t == null ? void 0 : t.value) == null || x.removePass(o.value)), (u = a.value) == null || u.dispose(), (p = o.value) == null || p.dispose();
153
+ }), {
154
+ pass: o,
155
+ effect: a
156
+ };
157
+ }, Ot = /* @__PURE__ */ c({
158
+ __name: "BloomPmndrs",
159
+ props: {
160
+ blendFunction: {},
161
+ intensity: {},
162
+ kernelSize: {},
163
+ luminanceThreshold: {},
164
+ luminanceSmoothing: {},
165
+ mipmapBlur: { type: Boolean, default: void 0 }
166
+ },
167
+ setup(r, { expose: e }) {
168
+ const t = r, { pass: o, effect: a } = h(() => new ae(t), t);
169
+ return e({ pass: o, effect: a }), g(
170
+ [
171
+ // blendFunction is not updated, because it has no setter in BloomEffect
172
+ [() => t.intensity, "intensity"],
173
+ [() => t.kernelSize, "kernelSize"],
174
+ [() => t.luminanceSmoothing, "luminanceMaterial.smoothing"],
175
+ [() => t.luminanceThreshold, "luminanceMaterial.threshold"]
176
+ ],
177
+ a,
178
+ () => new ae()
179
+ ), () => {
180
+ };
181
+ }
182
+ }), Rt = /* @__PURE__ */ c({
183
+ __name: "DepthOfFieldPmndrs",
184
+ props: {
185
+ blendFunction: {},
186
+ worldFocusDistance: {},
187
+ worldFocusRange: {},
188
+ focusDistance: {},
189
+ focusRange: {},
190
+ bokehScale: {},
191
+ resolutionScale: {},
192
+ resolutionX: {},
193
+ resolutionY: {}
194
+ },
195
+ setup(r, { expose: e }) {
196
+ const t = r, { camera: o } = A(), { pass: a, effect: s } = h(() => new se(o.value, t), t);
197
+ return e({ pass: a, effect: s }), g(
198
+ [
199
+ // blendFunction is not updated, because it has no setter in BloomEffect
200
+ [() => t.worldFocusDistance, "circleOfConfusionMaterial.worldFocusDistance"],
201
+ [() => t.focusDistance, "circleOfConfusionMaterial.focusDistance"],
202
+ [() => t.worldFocusRange, "circleOfConfusionMaterial.worldFocusRange"],
203
+ [() => t.focusRange, "circleOfConfusionMaterial.focusRange"],
204
+ [() => t.bokehScale, "bokehScale"],
205
+ [() => t.resolutionScale, "blurPass.resolution.scale"],
206
+ [() => t.resolutionX, "resolution.width"],
207
+ [() => t.resolutionY, "resolution.height"]
208
+ ],
209
+ s,
210
+ () => new se()
211
+ ), () => {
212
+ };
213
+ }
214
+ }), Bt = /* @__PURE__ */ c({
215
+ __name: "GlitchPmndrs",
216
+ props: {
217
+ blendFunction: {},
218
+ delay: {},
219
+ duration: {},
220
+ strength: {},
221
+ mode: {},
222
+ active: { type: Boolean },
223
+ ratio: {},
224
+ columns: {},
225
+ chromaticAberrationOffset: {},
226
+ perturbationMap: {},
227
+ dtSize: {}
228
+ },
229
+ setup(r, { expose: e }) {
230
+ const t = r, { pass: o, effect: a } = h(() => new Y(t), t);
231
+ e({ pass: o, effect: a });
232
+ const { onBeforeRender: s } = W();
233
+ return s(({ invalidate: i }) => i()), v(() => {
234
+ const i = () => {
235
+ if (t.mode !== void 0)
236
+ return t.active === !1 ? Xe.DISABLED : t.mode;
237
+ const n = new Y(), l = n.mode;
238
+ return n.dispose(), l;
239
+ };
240
+ a.value && (a.value.mode = i());
241
+ }), U(
242
+ $(t, ["active", "mode", "blendFunction"]),
243
+ a,
244
+ () => new Y()
245
+ ), () => {
246
+ };
247
+ }
248
+ }), Nt = /* @__PURE__ */ c({
249
+ __name: "NoisePmndrs",
250
+ props: {
251
+ premultiply: { type: Boolean, default: void 0 },
252
+ blendFunction: {}
253
+ },
254
+ setup(r, { expose: e }) {
255
+ const t = r, { pass: o, effect: a } = h(() => new re(t), t);
256
+ e({ pass: o, effect: a });
257
+ const { onBeforeRender: s } = W();
258
+ return s(({ invalidate: i }) => i()), U(
259
+ $(t, ["blendFunction"]),
260
+ a,
261
+ () => new re()
262
+ ), () => {
263
+ };
264
+ }
265
+ }), zt = /* @__PURE__ */ c({
266
+ __name: "OutlinePmndrs",
267
+ props: {
268
+ outlinedObjects: {},
269
+ blur: { type: Boolean, default: void 0 },
270
+ xRay: { type: Boolean, default: void 0 },
271
+ kernelSize: {},
272
+ pulseSpeed: {},
273
+ resolutionX: {},
274
+ resolutionY: {},
275
+ edgeStrength: {},
276
+ patternScale: {},
277
+ multisampling: {},
278
+ blendFunction: {},
279
+ patternTexture: {},
280
+ resolutionScale: {},
281
+ hiddenEdgeColor: {},
282
+ visibleEdgeColor: {}
283
+ },
284
+ setup(r, { expose: e }) {
285
+ const t = r, o = (u) => u !== void 0 ? K(u).getHex() : void 0, { camera: a, scene: s } = A(), i = {
286
+ blur: t.blur,
287
+ xRay: t.xRay,
288
+ kernelSize: t.kernelSize,
289
+ pulseSpeed: t.pulseSpeed,
290
+ resolutionX: t.resolutionX,
291
+ resolutionY: t.resolutionY,
292
+ patternScale: t.patternScale,
293
+ edgeStrength: t.edgeStrength,
294
+ blendFunction: t.blendFunction,
295
+ multisampling: t.multisampling,
296
+ patternTexture: t.patternTexture,
297
+ resolutionScale: t.resolutionScale,
298
+ hiddenEdgeColor: o(t.hiddenEdgeColor),
299
+ visibleEdgeColor: o(t.visibleEdgeColor)
300
+ }, { pass: n, effect: l } = h(() => new ie(s.value, a.value, i), t);
301
+ e({ pass: n, effect: l }), C(
302
+ [() => t.outlinedObjects, l],
303
+ // watchEffect is intentionally not used here as it would result in an endless loop
304
+ () => {
305
+ var u;
306
+ (u = l.value) == null || u.selection.set(t.outlinedObjects || []);
307
+ },
308
+ {
309
+ immediate: !0
310
+ }
311
+ );
312
+ const x = F(() => ({
313
+ hiddenEdgeColor: t.hiddenEdgeColor ? K(t.hiddenEdgeColor) : void 0,
314
+ visibleEdgeColor: t.visibleEdgeColor ? K(t.visibleEdgeColor) : void 0
315
+ }));
316
+ return g(
317
+ [
318
+ /* some properties are not updated because of different reasons:
319
+ resolutionX - has no setter in OutlineEffect
320
+ resolutionY - has no setter in OutlineEffect
321
+ blendFunction - has no setter in OutlineEffect
322
+ patternTexture - different type in constructor and in setter
323
+ resolutionScale - has no setter in OutlineEffect
324
+ */
325
+ [() => t.blur, "blur"],
326
+ [() => t.xRay, "xRay"],
327
+ [() => t.pulseSpeed, "pulseSpeed"],
328
+ [() => t.kernelSize, "kernelSize"],
329
+ [() => t.edgeStrength, "edgeStrength"],
330
+ [() => t.patternScale, "patternScale"],
331
+ [() => t.multisampling, "multisampling"],
332
+ [() => x.value.hiddenEdgeColor, "hiddenEdgeColor"],
333
+ [() => x.value.visibleEdgeColor, "visibleEdgeColor"]
334
+ ],
335
+ l,
336
+ () => new ie()
337
+ ), () => {
338
+ };
339
+ }
340
+ }), Ft = /* @__PURE__ */ c({
341
+ __name: "PixelationPmndrs",
342
+ props: {
343
+ granularity: {}
344
+ },
345
+ setup(r, { expose: e }) {
346
+ const t = r, { pass: o, effect: a } = h(() => new ne(t.granularity), t);
347
+ return e({ pass: o, effect: a }), U(
348
+ t,
349
+ a,
350
+ () => new ne()
351
+ ), () => {
352
+ };
353
+ }
354
+ }), Wt = /* @__PURE__ */ c({
355
+ __name: "VignettePmndrs",
356
+ props: {
357
+ technique: {},
358
+ blendFunction: {},
359
+ offset: {},
360
+ darkness: {}
361
+ },
362
+ setup(r, { expose: e }) {
363
+ const t = r, { pass: o, effect: a } = h(() => new le(t), t);
364
+ return e({ pass: o, effect: a }), U(
365
+ $(t, ["blendFunction"]),
366
+ a,
367
+ () => new le()
368
+ ), () => {
369
+ };
370
+ }
371
+ });
372
+ class Se extends Z {
373
+ /**
374
+ * Creates a new BarrelBlurEffect instance.
375
+ *
376
+ * @param {object} [options] - Configuration options for the effect.
377
+ * @param {BlendFunction} [options.blendFunction] - Blend mode.
378
+ * @param {number} [options.amount] - Intensity of the barrel distortion (0 to 1).
379
+ * @param {Vector2} [options.offset] - Offset of the barrel distortion center (0 to 1 for both x and y). This allows you to change the position of the distortion effect.
380
+ *
381
+ */
382
+ constructor({ blendFunction: e = _.NORMAL, amount: t = 0.15, offset: o = new d(0.5, 0.5) } = {}) {
383
+ super("BarrelBlurEffect", `
384
+ uniform float amount;
385
+ uniform vec2 offset;
386
+
387
+ #define NUM_ITER 16
388
+ #define RECIP_NUM_ITER 0.0625
389
+ #define GAMMA 1.0
390
+
391
+ vec3 spectrum_offset(float t) {
392
+ float lo = step(t, 0.5);
393
+ float hi = 1.0 - lo;
394
+ float w = 1.0 - abs(2.0 * t - 1.0);
395
+ return pow(vec3(lo, 1.0, hi) * vec3(1.0 - w, w, 1.0 - w), vec3(1.0 / GAMMA));
396
+ }
397
+
398
+ vec2 barrelDistortion(vec2 p, float amt) {
399
+ p = p - offset;
400
+ float theta = atan(p.y, p.x);
401
+ float radius = pow(length(p), 1.0 + 3.0 * amt);
402
+ return vec2(cos(theta), sin(theta)) * radius + offset;
403
+ }
404
+
405
+ void mainUv(inout vec2 uv) {
406
+ uv = barrelDistortion(uv, amount * 0.5);
407
+ }
408
+
409
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
410
+ vec3 sumcol = vec3(0.0);
411
+ vec3 sumw = vec3(0.0);
412
+
413
+ for (int i = 0; i < NUM_ITER; ++i) {
414
+ float t = float(i) * RECIP_NUM_ITER;
415
+ vec3 w = spectrum_offset(t);
416
+ vec2 distortedUV = barrelDistortion(uv, amount * t);
417
+ sumcol += w * texture(inputBuffer, distortedUV).rgb;
418
+ sumw += w;
419
+ }
420
+
421
+ vec3 outcol = pow(sumcol / sumw, vec3(1.0 / GAMMA));
422
+
423
+ outcol = clamp(outcol, 0.0, 1.0); // Ensures normalized color values
424
+
425
+ outputColor = vec4(outcol, inputColor.a); // Preserves original alpha
426
+ }
427
+ `, {
428
+ blendFunction: e,
429
+ uniforms: /* @__PURE__ */ new Map([
430
+ ["amount", new E(t)],
431
+ // Uniform controlling the intensity of distortion
432
+ ["offset", new E(o)]
433
+ // Uniform controlling the offset of distortion
434
+ ])
435
+ });
436
+ }
437
+ /**
438
+ * The amount.
439
+ *
440
+ * @type {number}
441
+ */
442
+ get amount() {
443
+ var e;
444
+ return (e = this.uniforms.get("amount")) == null ? void 0 : e.value;
445
+ }
446
+ set amount(e) {
447
+ this.uniforms.get("amount").value = e;
448
+ }
449
+ /**
450
+ * The offset.
451
+ *
452
+ * @type {Vector2}
453
+ */
454
+ get offset() {
455
+ var e;
456
+ return (e = this.uniforms.get("offset")) == null ? void 0 : e.value;
457
+ }
458
+ set offset(e) {
459
+ this.uniforms.get("offset").value = e;
460
+ }
461
+ }
462
+ const Ut = /* @__PURE__ */ c({
463
+ __name: "BarrelBlurPmndrs",
464
+ props: {
465
+ blendFunction: {},
466
+ amount: {},
467
+ offset: {}
468
+ },
469
+ setup(r, { expose: e }) {
470
+ const t = r, { pass: o, effect: a } = h(
471
+ () => new Se({
472
+ ...t,
473
+ offset: Array.isArray(t.offset) ? new d(...t.offset) : t.offset
474
+ }),
475
+ t
476
+ );
477
+ return e({ pass: o, effect: a }), g(
478
+ [
479
+ [() => t.blendFunction, "blendMode.blendFunction"],
480
+ [() => t.amount, "amount"],
481
+ [() => t.offset, "offset"]
482
+ ],
483
+ a,
484
+ () => new Se()
485
+ ), () => {
486
+ };
487
+ }
488
+ }), Ht = /* @__PURE__ */ c({
489
+ __name: "ToneMappingPmndrs",
490
+ props: {
491
+ mode: {},
492
+ blendFunction: {},
493
+ resolution: {},
494
+ averageLuminance: {},
495
+ middleGrey: {},
496
+ minLuminance: {},
497
+ whitePoint: {}
498
+ },
499
+ setup(r, { expose: e }) {
500
+ const t = r, { pass: o, effect: a } = h(() => new ue(t), t);
501
+ return e({ pass: o, effect: a }), g(
502
+ [
503
+ [() => t.mode, "mode"],
504
+ [() => t.blendFunction, "blendMode.blendFunction"],
505
+ [() => t.resolution, "resolution"],
506
+ [() => t.averageLuminance, "averageLuminance"],
507
+ [() => t.middleGrey, "middleGrey"],
508
+ [() => t.minLuminance, "adaptiveLuminanceMaterial.minLuminance"],
509
+ [() => t.whitePoint, "whitePoint"]
510
+ ],
511
+ a,
512
+ () => new ue()
513
+ ), () => {
514
+ };
515
+ }
516
+ }), Gt = /* @__PURE__ */ c({
517
+ __name: "ChromaticAberrationPmndrs",
518
+ props: {
519
+ blendFunction: {},
520
+ offset: {},
521
+ radialModulation: { type: Boolean, default: void 0 },
522
+ modulationOffset: {}
523
+ },
524
+ setup(r, { expose: e }) {
525
+ const t = r, o = new q(), { pass: a, effect: s } = h(() => new q({
526
+ ...t,
527
+ // Unfortunately, these defaults must be set this way as the type in postprocessing is not correct.
528
+ // The arguments are optional in the actual constructor, but not in the type.
529
+ radialModulation: t.radialModulation ?? o.radialModulation,
530
+ modulationOffset: t.modulationOffset ?? o.modulationOffset
531
+ }), t);
532
+ return o.dispose(), e({ pass: a, effect: s }), g(
533
+ [
534
+ [() => t.blendFunction, "blendMode.blendFunction"],
535
+ [() => t.offset, "offset"],
536
+ [() => t.radialModulation, "radialModulation"],
537
+ [() => t.modulationOffset, "modulationOffset"]
538
+ ],
539
+ s,
540
+ () => new q()
541
+ ), () => {
542
+ };
543
+ }
544
+ }), Xt = /* @__PURE__ */ c({
545
+ __name: "HueSaturationPmndrs",
546
+ props: {
547
+ saturation: {},
548
+ hue: {},
549
+ blendFunction: {}
550
+ },
551
+ setup(r, { expose: e }) {
552
+ const t = r, { pass: o, effect: a } = h(() => new ce(t), t);
553
+ return e({ pass: o, effect: a }), g(
554
+ [
555
+ [() => t.blendFunction, "blendMode.blendFunction"],
556
+ [() => t.hue, "hue"],
557
+ [() => t.saturation, "saturation"]
558
+ ],
559
+ a,
560
+ () => new ce()
561
+ ), () => {
562
+ };
563
+ }
564
+ }), It = /* @__PURE__ */ c({
565
+ __name: "ScanlinePmndrs",
566
+ props: {
567
+ blendFunction: {},
568
+ density: {},
569
+ scrollSpeed: {},
570
+ opacity: {}
571
+ },
572
+ setup(r, { expose: e }) {
573
+ const t = r, { pass: o, effect: a } = h(() => new k(t), t);
574
+ return e({ pass: o, effect: a }), g(
575
+ [
576
+ [() => t.blendFunction, "blendMode.blendFunction"],
577
+ [() => t.density, "density"],
578
+ [() => t.scrollSpeed, "scrollSpeed"]
579
+ ],
580
+ a,
581
+ () => new k()
582
+ ), C(
583
+ [() => t.opacity],
584
+ () => {
585
+ var s, i;
586
+ if (t.opacity !== void 0)
587
+ (s = a.value) == null || s.blendMode.setOpacity(t.opacity);
588
+ else {
589
+ const n = new k();
590
+ (i = a.value) == null || i.blendMode.setOpacity(n.blendMode.getOpacity()), n.dispose();
591
+ }
592
+ },
593
+ {
594
+ immediate: !0
595
+ }
596
+ ), () => {
597
+ };
598
+ }
599
+ }), ft = `
600
+ uniform float radius;
601
+ uniform int sectorCount;
602
+
603
+ const int MAX_SECTOR_COUNT = 8;
604
+
605
+ float polynomialWeight(float x, float y, float eta, float lambda) {
606
+ float polyValue = (x + eta) - lambda * (y * y);
607
+ return max(0.0, polyValue * polyValue);
608
+ }
609
+
610
+ void getSectorVarianceAndAverageColor(mat2 anisotropyMat, float angle, float radius, out vec3 avgColor, out float variance) {
611
+ vec3 weightedColorSum = vec3(0.0);
612
+ vec3 weightedSquaredColorSum = vec3(0.0);
613
+ float totalWeight = 0.0;
614
+
615
+ float eta = 0.1;
616
+ float lambda = 0.5;
617
+ float angleStep = 0.196349; // Precompute angle step
618
+ float halfAngleRange = 0.392699; // Precompute half angle range
619
+
620
+ float cosAngle = cos(angle);
621
+ float sinAngle = sin(angle);
622
+
623
+ for (float r = 1.0; r <= radius; r += 1.0) {
624
+ float rCosAngle = r * cosAngle;
625
+ float rSinAngle = r * sinAngle;
626
+ for (float a = -halfAngleRange; a <= halfAngleRange; a += angleStep) {
627
+ float cosA = cos(a);
628
+ float sinA = sin(a);
629
+ vec2 sampleOffset = vec2(rCosAngle * cosA - rSinAngle * sinA, rCosAngle * sinA + rSinAngle * cosA) / resolution;
630
+ sampleOffset *= anisotropyMat;
631
+
632
+ vec3 color = texture2D(inputBuffer, vUv + sampleOffset).rgb;
633
+ float weight = polynomialWeight(sampleOffset.x, sampleOffset.y, eta, lambda);
634
+
635
+ weightedColorSum += color * weight;
636
+ weightedSquaredColorSum += color * color * weight;
637
+ totalWeight += weight;
638
+ }
639
+ }
640
+
641
+ // Calculate average color and variance
642
+ avgColor = weightedColorSum / totalWeight;
643
+ vec3 varianceRes = (weightedSquaredColorSum / totalWeight) - (avgColor * avgColor);
644
+ variance = dot(varianceRes, vec3(0.299, 0.587, 0.114)); // Convert to luminance
645
+ }
646
+
647
+ vec4 getDominantOrientation(vec4 structureTensor) {
648
+ float Jxx = structureTensor.r;
649
+ float Jyy = structureTensor.g;
650
+ float Jxy = structureTensor.b;
651
+
652
+ float trace = Jxx + Jyy;
653
+ float det = Jxx * Jyy - Jxy * Jxy;
654
+ float lambda1 = 0.5 * (trace + sqrt(trace * trace - 4.0 * det));
655
+ float lambda2 = 0.5 * (trace - sqrt(trace * trace - 4.0 * det));
656
+
657
+ float dominantOrientation = atan(2.0 * Jxy, Jxx - Jyy) / 2.0;
658
+ return vec4(dominantOrientation, lambda1, lambda2, 0.0);
659
+ }
660
+
661
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
662
+ vec4 structureTensor = texture2D(inputBuffer, uv);
663
+
664
+ vec3 sectorAvgColors[MAX_SECTOR_COUNT];
665
+ float sectorVariances[MAX_SECTOR_COUNT];
666
+
667
+ vec4 orientationAndAnisotropy = getDominantOrientation(structureTensor);
668
+ vec2 orientation = orientationAndAnisotropy.xy;
669
+
670
+ float anisotropy = (orientationAndAnisotropy.z - orientationAndAnisotropy.w) / (orientationAndAnisotropy.z + orientationAndAnisotropy.w + 1e-7);
671
+
672
+ float alpha = 25.0;
673
+ float scaleX = alpha / (anisotropy + alpha);
674
+ float scaleY = (anisotropy + alpha) / alpha;
675
+
676
+ mat2 anisotropyMat = mat2(orientation.x, -orientation.y, orientation.y, orientation.x) * mat2(scaleX, 0.0, 0.0, scaleY);
677
+
678
+ for (int i = 0; i < sectorCount; i++) {
679
+ float angle = float(i) * 6.28318 / float(sectorCount); // 2π / sectorCount
680
+ getSectorVarianceAndAverageColor(anisotropyMat, angle, float(radius), sectorAvgColors[i], sectorVariances[i]);
681
+ }
682
+
683
+ float minVariance = sectorVariances[0];
684
+ vec3 finalColor = sectorAvgColors[0];
685
+
686
+ for (int i = 1; i < sectorCount; i++) {
687
+ if (sectorVariances[i] < minVariance) {
688
+ minVariance = sectorVariances[i];
689
+ finalColor = sectorAvgColors[i];
690
+ }
691
+ }
692
+
693
+ outputColor = vec4(finalColor, inputColor.a);
694
+ }
695
+ `;
696
+ class Ae extends Z {
697
+ /**
698
+ * Creates a new KuwaharaEffect instance.
699
+ *
700
+ * @param {object} [options] - Configuration options for the effect.
701
+ * @param {BlendFunction} [options.blendFunction] - Blend mode.
702
+ * @param {number} [options.radius] - Intensity of the effect.
703
+ * @param {number} [options.sectorCount] - Number of sectors.
704
+ *
705
+ */
706
+ constructor({ blendFunction: e = _.NORMAL, radius: t = 1, sectorCount: o = 4 } = {}) {
707
+ super("KuwaharaEffect", ft, {
708
+ blendFunction: e,
709
+ uniforms: /* @__PURE__ */ new Map([
710
+ ["radius", new E(t)],
711
+ ["sectorCount", new E(o)]
712
+ ])
713
+ });
714
+ }
715
+ /**
716
+ * The radius.
717
+ *
718
+ * @type {number}
719
+ */
720
+ get radius() {
721
+ var e;
722
+ return (e = this.uniforms.get("radius")) == null ? void 0 : e.value;
723
+ }
724
+ set radius(e) {
725
+ this.uniforms.get("radius").value = e;
726
+ }
727
+ /**
728
+ * The sector count.
729
+ *
730
+ * @type {number}
731
+ */
732
+ get sectorCount() {
733
+ var e;
734
+ return (e = this.uniforms.get("sectorCount")) == null ? void 0 : e.value;
735
+ }
736
+ set sectorCount(e) {
737
+ this.uniforms.get("sectorCount").value = e;
738
+ }
739
+ }
740
+ const jt = /* @__PURE__ */ c({
741
+ __name: "KuwaharaPmndrs",
742
+ props: {
743
+ blendFunction: {},
744
+ radius: {},
745
+ sectorCount: {}
746
+ },
747
+ setup(r, { expose: e }) {
748
+ const t = r, { pass: o, effect: a } = h(
749
+ () => new Ae(t),
750
+ t
751
+ );
752
+ return e({ pass: o, effect: a }), g(
753
+ [
754
+ [() => t.blendFunction, "blendMode.blendFunction"],
755
+ [() => t.radius, "radius"],
756
+ [() => t.sectorCount, "sectorCount"]
757
+ ],
758
+ a,
759
+ () => new Ae()
760
+ ), () => {
761
+ };
762
+ }
763
+ }), Vt = /* @__PURE__ */ c({
764
+ __name: "ColorAveragePmndrs",
765
+ props: {
766
+ blendFunction: {},
767
+ opacity: {}
768
+ },
769
+ setup(r, { expose: e }) {
770
+ const t = r, { pass: o, effect: a } = h(() => new Q(t.blendFunction), t);
771
+ return e({ pass: o, effect: a }), ee(
772
+ () => t.blendFunction,
773
+ a,
774
+ "blendMode.blendFunction",
775
+ () => new Q()
776
+ ), C(
777
+ [a, () => t.opacity],
778
+ () => {
779
+ var s, i;
780
+ if (a.value)
781
+ if (t.opacity !== void 0)
782
+ (s = a.value) == null || s.blendMode.setOpacity(t.opacity);
783
+ else {
784
+ const n = new Q();
785
+ (i = a.value) == null || i.blendMode.setOpacity(n.blendMode.getOpacity()), n.dispose();
786
+ }
787
+ }
788
+ ), () => {
789
+ };
790
+ }
791
+ }), Yt = /* @__PURE__ */ c({
792
+ __name: "LensDistortionPmndrs",
793
+ props: {
794
+ distortion: {},
795
+ principalPoint: {},
796
+ focalLength: {},
797
+ skew: {}
798
+ },
799
+ setup(r, { expose: e }) {
800
+ const t = r, { pass: o, effect: a } = h(
801
+ () => new de({
802
+ ...t,
803
+ distortion: t.distortion ? Array.isArray(t.distortion) ? new d(...t.distortion) : t.distortion : new d(),
804
+ principalPoint: t.principalPoint ? Array.isArray(t.principalPoint) ? new d(...t.principalPoint) : t.principalPoint : new d(),
805
+ focalLength: t.focalLength ? Array.isArray(t.focalLength) ? new d(...t.focalLength) : t.focalLength : new d()
806
+ }),
807
+ t
808
+ );
809
+ return e({ pass: o, effect: a }), U(
810
+ t,
811
+ a,
812
+ () => new de()
813
+ ), () => {
814
+ };
815
+ }
816
+ }), qt = /* @__PURE__ */ c({
817
+ __name: "ShockWavePmndrs",
818
+ props: {
819
+ position: {},
820
+ amplitude: {},
821
+ speed: {},
822
+ maxRadius: {},
823
+ waveSize: {}
824
+ },
825
+ setup(r, { expose: e }) {
826
+ const t = r, { camera: o } = A(), { pass: a, effect: s } = h(
827
+ () => new fe(o.value, Array.isArray(t.position) ? new P(...t.position) : t.position, t),
828
+ t
829
+ );
830
+ return e({ pass: a, effect: s }), C(
831
+ () => t.position,
832
+ (i) => {
833
+ s.value && (Array.isArray(i) ? s.value.position.set(...i) : i instanceof P && s.value.position.copy(i));
834
+ },
835
+ { immediate: !0 }
836
+ ), g(
837
+ [
838
+ [() => t.amplitude, "amplitude"],
839
+ [() => t.waveSize, "waveSize"],
840
+ [() => t.maxRadius, "maxRadius"],
841
+ [() => t.speed, "speed"]
842
+ ],
843
+ s,
844
+ () => new fe()
845
+ ), () => {
846
+ };
847
+ }
848
+ }), kt = /* @__PURE__ */ c({
849
+ __name: "TiltShiftPmndrs",
850
+ props: {
851
+ blendFunction: {},
852
+ offset: {},
853
+ rotation: {},
854
+ focusArea: {},
855
+ feather: {},
856
+ kernelSize: {},
857
+ resolutionScale: {},
858
+ resolutionX: {},
859
+ resolutionY: {}
860
+ },
861
+ setup(r, { expose: e }) {
862
+ const t = r, { pass: o, effect: a } = h(() => new he(t), t);
863
+ return e({ pass: o, effect: a }), g(
864
+ [
865
+ [() => t.blendFunction, "blendMode.blendFunction"],
866
+ [() => t.offset, "offset"],
867
+ [() => t.rotation, "rotation"],
868
+ [() => t.focusArea, "focusArea"],
869
+ [() => t.feather, "feather"],
870
+ [() => t.kernelSize, "kernelSize"],
871
+ [() => t.resolutionScale, "resolution.scale"],
872
+ [() => t.resolutionX, "resolution.width"],
873
+ [() => t.resolutionY, "resolution.height"]
874
+ ],
875
+ a,
876
+ () => new he()
877
+ ), () => {
878
+ };
879
+ }
880
+ }), Qt = /* @__PURE__ */ c({
881
+ __name: "DotScreenPmndrs",
882
+ props: {
883
+ angle: {},
884
+ scale: {},
885
+ blendFunction: {}
886
+ },
887
+ setup(r, { expose: e }) {
888
+ const t = r, { pass: o, effect: a } = h(() => new pe(t), t);
889
+ return e({ pass: o, effect: a }), g(
890
+ [
891
+ [() => t.blendFunction, "blendMode.blendFunction"],
892
+ [() => t.angle, "angle"],
893
+ [() => t.scale, "scale"]
894
+ ],
895
+ a,
896
+ () => new pe()
897
+ ), () => {
898
+ };
899
+ }
900
+ }), Kt = /* @__PURE__ */ c({
901
+ __name: "SepiaPmndrs",
902
+ props: {
903
+ blendFunction: {},
904
+ intensity: {}
905
+ },
906
+ setup(r, { expose: e }) {
907
+ const t = r, { pass: o, effect: a } = h(() => new me(t), t);
908
+ return e({ pass: o, effect: a }), g(
909
+ [
910
+ [() => t.blendFunction, "blendMode.blendFunction"],
911
+ [() => t.intensity, "intensity"]
912
+ ],
913
+ a,
914
+ () => new me()
915
+ ), () => {
916
+ };
917
+ }
918
+ });
919
+ class we extends Z {
920
+ /**
921
+ * Creates a new LinocutEffect instance.
922
+ *
923
+ * @param {LinocutPmndrsProps} [options] - Configuration options for the effect.
924
+ *
925
+ */
926
+ constructor({ blendFunction: e = _.NORMAL, scale: t = 0.85, noiseScale: o = 0, center: a = [0.5, 0.5], rotation: s = 0 } = {}) {
927
+ const i = Array.isArray(a) ? new d().fromArray(a) : a;
928
+ super("LinocutEffect", `
929
+ uniform float scale;
930
+ uniform float noiseScale;
931
+ uniform vec2 center;
932
+ uniform float rotation;
933
+
934
+ float luma(vec3 color) {
935
+ return dot(color, vec3(0.299, 0.587, 0.114));
936
+ }
937
+
938
+ float luma(vec4 color) {
939
+ return dot(color.rgb, vec3(0.299, 0.587, 0.114));
940
+ }
941
+
942
+ // Simple pseudo-random noise function
943
+ float noise(vec2 p) {
944
+ return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453123);
945
+ }
946
+
947
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
948
+ // Calculate the center based on center
949
+ vec2 fragCoord = uv * resolution.xy;
950
+
951
+ // Apply rotation to the coordinates
952
+ vec2 d = fragCoord - center * resolution.xy;
953
+ mat2 rotMat = mat2(cos(rotation), -sin(rotation), sin(rotation), cos(rotation));
954
+ vec2 rotatedD = d * rotMat;
955
+
956
+ // Calculate radial distance and angle
957
+ float r = length(rotatedD) / (1000.0 / max(scale, 0.01)); // Normalization to avoid artifacts
958
+ float a = atan(rotatedD.y, rotatedD.x) + scale * (0.5 - r) / 0.5;
959
+
960
+ // Calculate transformed coordinates
961
+ vec2 uvt = center * resolution.xy + r * vec2(cos(a), sin(a));
962
+
963
+ // Normalize UV coordinates
964
+ vec2 uv2 = fragCoord / resolution.xy;
965
+
966
+ // Generate sinusoidal line patterns
967
+ float c = (0.75 + 0.25 * sin(uvt.x * 1000.0 * max(scale, 0.01))); // Prevent excessive distortions
968
+
969
+ // Load the texture and convert to grayscale
970
+ vec4 color = texture(inputBuffer, uv2);
971
+ color.rgb = color.rgb * color.rgb; // Convert from sRGB to linear
972
+ float l = luma(color);
973
+
974
+ // Add noise based on noiseScale
975
+ float n = noise(uv2 * 10.0); // Generate noise
976
+ l += noiseScale * (n - 0.5); // Apply noise as a perturbation
977
+
978
+ // Apply smoothing to achieve the linocut effect
979
+ float f = smoothstep(0.5 * c, c, l);
980
+ f = smoothstep(0.0, 0.5, f);
981
+
982
+ // Convert the final value back to sRGB
983
+ f = sqrt(f);
984
+
985
+ // Output the final color in black and white
986
+ outputColor = vec4(vec3(f), 1.0);
987
+ }
988
+ `, {
989
+ blendFunction: e,
990
+ uniforms: /* @__PURE__ */ new Map([
991
+ ["scale", new E(t)],
992
+ ["noiseScale", new E(o)],
993
+ ["center", new E(i)],
994
+ ["rotation", new E(s)]
995
+ ])
996
+ });
997
+ }
998
+ get scale() {
999
+ var e;
1000
+ return (e = this.uniforms.get("scale")) == null ? void 0 : e.value;
1001
+ }
1002
+ set scale(e) {
1003
+ this.uniforms.get("scale").value = e;
1004
+ }
1005
+ get noiseScale() {
1006
+ var e;
1007
+ return (e = this.uniforms.get("noiseScale")) == null ? void 0 : e.value;
1008
+ }
1009
+ set noiseScale(e) {
1010
+ this.uniforms.get("noiseScale").value = e;
1011
+ }
1012
+ get center() {
1013
+ var e;
1014
+ return (e = this.uniforms.get("center")) == null ? void 0 : e.value;
1015
+ }
1016
+ set center(e) {
1017
+ this.uniforms.get("center").value = Array.isArray(e) ? new d().fromArray(e) : e;
1018
+ }
1019
+ get rotation() {
1020
+ var e;
1021
+ return (e = this.uniforms.get("rotation")) == null ? void 0 : e.value;
1022
+ }
1023
+ set rotation(e) {
1024
+ this.uniforms.get("rotation").value = e;
1025
+ }
1026
+ }
1027
+ const Jt = /* @__PURE__ */ c({
1028
+ __name: "LinocutPmndrs",
1029
+ props: {
1030
+ blendFunction: {},
1031
+ scale: {},
1032
+ noiseScale: {},
1033
+ center: {},
1034
+ rotation: {}
1035
+ },
1036
+ setup(r, { expose: e }) {
1037
+ const t = r, { pass: o, effect: a } = h(
1038
+ () => new we({
1039
+ ...t,
1040
+ center: t.center instanceof d ? [t.center.x, t.center.y] : t.center
1041
+ }),
1042
+ t
1043
+ );
1044
+ return e({ pass: o, effect: a }), g(
1045
+ [
1046
+ [() => t.blendFunction, "blendMode.blendFunction"],
1047
+ [() => t.scale, "scale"],
1048
+ [() => t.noiseScale, "noiseScale"],
1049
+ [() => t.center, "center"],
1050
+ [() => t.rotation, "rotation"]
1051
+ ],
1052
+ a,
1053
+ () => new we()
1054
+ ), () => {
1055
+ };
1056
+ }
1057
+ }), Be = {
14
1058
  name: "CopyShader",
15
1059
  uniforms: {
16
1060
  tDiffuse: { value: null },
@@ -48,7 +1092,7 @@ const Q = {
48
1092
  }`
49
1093
  )
50
1094
  };
51
- class m {
1095
+ class T {
52
1096
  constructor() {
53
1097
  this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
54
1098
  }
@@ -60,22 +1104,22 @@ class m {
60
1104
  dispose() {
61
1105
  }
62
1106
  }
63
- const Me = new ee(-1, 1, 1, -1, 0, 1);
64
- class we extends te {
1107
+ const ht = new Ie(-1, 1, 1, -1, 0, 1);
1108
+ class pt extends je {
65
1109
  constructor() {
66
- super(), this.setAttribute("position", new W([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new W([0, 2, 0, 0, 2, 0], 2));
1110
+ super(), this.setAttribute("position", new ge([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new ge([0, 2, 0, 0, 2, 0], 2));
67
1111
  }
68
1112
  }
69
- const ye = new we();
70
- class T {
1113
+ const mt = new pt();
1114
+ class L {
71
1115
  constructor(e) {
72
- this._mesh = new se(ye, e);
1116
+ this._mesh = new Ve(mt, e);
73
1117
  }
74
1118
  dispose() {
75
1119
  this._mesh.geometry.dispose();
76
1120
  }
77
1121
  render(e) {
78
- e.render(this._mesh, Me);
1122
+ e.render(this._mesh, ht);
79
1123
  }
80
1124
  get material() {
81
1125
  return this._mesh.material;
@@ -84,35 +1128,35 @@ class T {
84
1128
  this._mesh.material = e;
85
1129
  }
86
1130
  }
87
- class De extends m {
1131
+ class gt extends T {
88
1132
  constructor(e, t) {
89
- super(), this.textureID = t !== void 0 ? t : "tDiffuse", e instanceof c ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = g.clone(e.uniforms), this.material = new c({
1133
+ super(), this.textureID = t !== void 0 ? t : "tDiffuse", e instanceof S ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = M.clone(e.uniforms), this.material = new S({
90
1134
  name: e.name !== void 0 ? e.name : "unspecified",
91
1135
  defines: Object.assign({}, e.defines),
92
1136
  uniforms: this.uniforms,
93
1137
  vertexShader: e.vertexShader,
94
1138
  fragmentShader: e.fragmentShader
95
- })), this.fsQuad = new T(this.material);
1139
+ })), this.fsQuad = new L(this.material);
96
1140
  }
97
- render(e, t, s) {
98
- this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = s.texture), this.fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
1141
+ render(e, t, o) {
1142
+ this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = o.texture), this.fsQuad.material = this.material, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
99
1143
  }
100
1144
  dispose() {
101
1145
  this.material.dispose(), this.fsQuad.dispose();
102
1146
  }
103
1147
  }
104
- class U extends m {
1148
+ class Te extends T {
105
1149
  constructor(e, t) {
106
1150
  super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
107
1151
  }
108
- render(e, t, s) {
109
- const a = e.getContext(), r = e.state;
110
- r.buffers.color.setMask(!1), r.buffers.depth.setMask(!1), r.buffers.color.setLocked(!0), r.buffers.depth.setLocked(!0);
111
- let i, l;
112
- this.inverse ? (i = 0, l = 1) : (i = 1, l = 0), r.buffers.stencil.setTest(!0), r.buffers.stencil.setOp(a.REPLACE, a.REPLACE, a.REPLACE), r.buffers.stencil.setFunc(a.ALWAYS, i, 4294967295), r.buffers.stencil.setClear(l), r.buffers.stencil.setLocked(!0), e.setRenderTarget(s), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), r.buffers.color.setLocked(!1), r.buffers.depth.setLocked(!1), r.buffers.color.setMask(!0), r.buffers.depth.setMask(!0), r.buffers.stencil.setLocked(!1), r.buffers.stencil.setFunc(a.EQUAL, 1, 4294967295), r.buffers.stencil.setOp(a.KEEP, a.KEEP, a.KEEP), r.buffers.stencil.setLocked(!0);
1152
+ render(e, t, o) {
1153
+ const a = e.getContext(), s = e.state;
1154
+ s.buffers.color.setMask(!1), s.buffers.depth.setMask(!1), s.buffers.color.setLocked(!0), s.buffers.depth.setLocked(!0);
1155
+ let i, n;
1156
+ this.inverse ? (i = 0, n = 1) : (i = 1, n = 0), s.buffers.stencil.setTest(!0), s.buffers.stencil.setOp(a.REPLACE, a.REPLACE, a.REPLACE), s.buffers.stencil.setFunc(a.ALWAYS, i, 4294967295), s.buffers.stencil.setClear(n), s.buffers.stencil.setLocked(!0), e.setRenderTarget(o), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), s.buffers.color.setLocked(!1), s.buffers.depth.setLocked(!1), s.buffers.color.setMask(!0), s.buffers.depth.setMask(!0), s.buffers.stencil.setLocked(!1), s.buffers.stencil.setFunc(a.EQUAL, 1, 4294967295), s.buffers.stencil.setOp(a.KEEP, a.KEEP, a.KEEP), s.buffers.stencil.setLocked(!0);
113
1157
  }
114
1158
  }
115
- class Ce extends m {
1159
+ class vt extends T {
116
1160
  constructor() {
117
1161
  super(), this.needsSwap = !1;
118
1162
  }
@@ -120,14 +1164,14 @@ class Ce extends m {
120
1164
  e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
121
1165
  }
122
1166
  }
123
- class Ee {
1167
+ class xt {
124
1168
  constructor(e, t) {
125
1169
  if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
126
- const s = e.getSize(new u());
127
- this._width = s.width, this._height = s.height, t = new v(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: x }), t.texture.name = "EffectComposer.rt1";
1170
+ const o = e.getSize(new d());
1171
+ this._width = o.width, this._height = o.height, t = new D(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: w }), t.texture.name = "EffectComposer.rt1";
128
1172
  } else
129
1173
  this._width = t.width, this._height = t.height;
130
- this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new De(Q), this.copyPass.material.blending = re, this.clock = new ae();
1174
+ this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.renderToScreen = !0, this.passes = [], this.copyPass = new gt(Be), this.copyPass.material.blending = Ye, this.clock = new qe();
131
1175
  }
132
1176
  swapBuffers() {
133
1177
  const e = this.readBuffer;
@@ -152,35 +1196,35 @@ class Ee {
152
1196
  render(e) {
153
1197
  e === void 0 && (e = this.clock.getDelta());
154
1198
  const t = this.renderer.getRenderTarget();
155
- let s = !1;
156
- for (let a = 0, r = this.passes.length; a < r; a++) {
1199
+ let o = !1;
1200
+ for (let a = 0, s = this.passes.length; a < s; a++) {
157
1201
  const i = this.passes[a];
158
1202
  if (i.enabled !== !1) {
159
- if (i.renderToScreen = this.renderToScreen && this.isLastEnabledPass(a), i.render(this.renderer, this.writeBuffer, this.readBuffer, e, s), i.needsSwap) {
160
- if (s) {
161
- const l = this.renderer.getContext(), n = this.renderer.state.buffers.stencil;
162
- n.setFunc(l.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), n.setFunc(l.EQUAL, 1, 4294967295);
1203
+ if (i.renderToScreen = this.renderToScreen && this.isLastEnabledPass(a), i.render(this.renderer, this.writeBuffer, this.readBuffer, e, o), i.needsSwap) {
1204
+ if (o) {
1205
+ const n = this.renderer.getContext(), l = this.renderer.state.buffers.stencil;
1206
+ l.setFunc(n.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), l.setFunc(n.EQUAL, 1, 4294967295);
163
1207
  }
164
1208
  this.swapBuffers();
165
1209
  }
166
- U !== void 0 && (i instanceof U ? s = !0 : i instanceof Ce && (s = !1));
1210
+ Te !== void 0 && (i instanceof Te ? o = !0 : i instanceof vt && (o = !1));
167
1211
  }
168
1212
  }
169
1213
  this.renderer.setRenderTarget(t);
170
1214
  }
171
1215
  reset(e) {
172
1216
  if (e === void 0) {
173
- const t = this.renderer.getSize(new u());
1217
+ const t = this.renderer.getSize(new d());
174
1218
  this._pixelRatio = this.renderer.getPixelRatio(), this._width = t.width, this._height = t.height, e = this.renderTarget1.clone(), e.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio);
175
1219
  }
176
1220
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
177
1221
  }
178
1222
  setSize(e, t) {
179
1223
  this._width = e, this._height = t;
180
- const s = this._width * this._pixelRatio, a = this._height * this._pixelRatio;
181
- this.renderTarget1.setSize(s, a), this.renderTarget2.setSize(s, a);
182
- for (let r = 0; r < this.passes.length; r++)
183
- this.passes[r].setSize(s, a);
1224
+ const o = this._width * this._pixelRatio, a = this._height * this._pixelRatio;
1225
+ this.renderTarget1.setSize(o, a), this.renderTarget2.setSize(o, a);
1226
+ for (let s = 0; s < this.passes.length; s++)
1227
+ this.passes[s].setSize(o, a);
184
1228
  }
185
1229
  setPixelRatio(e) {
186
1230
  this._pixelRatio = e, this.setSize(this._width, this._height);
@@ -189,61 +1233,61 @@ class Ee {
189
1233
  this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
190
1234
  }
191
1235
  }
192
- class Le extends m {
193
- constructor(e, t, s = null, a = null, r = null) {
194
- super(), this.scene = e, this.camera = t, this.overrideMaterial = s, this.clearColor = a, this.clearAlpha = r, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this._oldClearColor = new N();
1236
+ class bt extends T {
1237
+ constructor(e, t, o = null, a = null, s = null) {
1238
+ super(), this.scene = e, this.camera = t, this.overrideMaterial = o, this.clearColor = a, this.clearAlpha = s, this.clear = !0, this.clearDepth = !1, this.needsSwap = !1, this._oldClearColor = new j();
195
1239
  }
196
- render(e, t, s) {
1240
+ render(e, t, o) {
197
1241
  const a = e.autoClear;
198
1242
  e.autoClear = !1;
199
- let r, i;
200
- this.overrideMaterial !== null && (i = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (r = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == !0 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : s), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(r), this.overrideMaterial !== null && (this.scene.overrideMaterial = i), e.autoClear = a;
1243
+ let s, i;
1244
+ this.overrideMaterial !== null && (i = this.scene.overrideMaterial, this.scene.overrideMaterial = this.overrideMaterial), this.clearColor !== null && (e.getClearColor(this._oldClearColor), e.setClearColor(this.clearColor, e.getClearAlpha())), this.clearAlpha !== null && (s = e.getClearAlpha(), e.setClearAlpha(this.clearAlpha)), this.clearDepth == !0 && e.clearDepth(), e.setRenderTarget(this.renderToScreen ? null : o), this.clear === !0 && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), e.render(this.scene, this.camera), this.clearColor !== null && e.setClearColor(this._oldClearColor), this.clearAlpha !== null && e.setClearAlpha(s), this.overrideMaterial !== null && (this.scene.overrideMaterial = i), e.autoClear = a;
201
1245
  }
202
1246
  }
203
- const q = Symbol("effectComposerThree"), Xe = /* @__PURE__ */ S({
1247
+ const Ne = Symbol("effectComposerThree"), Zt = /* @__PURE__ */ c({
204
1248
  __name: "EffectComposer",
205
1249
  props: {
206
1250
  enabled: { type: Boolean, default: !0 },
207
1251
  withoutRenderPass: { type: Boolean }
208
1252
  },
209
- setup(o, { expose: e }) {
210
- const t = o, s = I(null);
211
- k(q, s), e({ composer: s });
212
- const { renderer: a, sizes: r, scene: i, camera: l, render: n } = w();
213
- f(() => {
214
- var d;
215
- (d = s.value) == null || d.dispose(), s.value = new Ee(a.value);
216
- }), f(() => {
217
- var B;
218
- const { width: d, height: b } = r;
219
- b.value && d.value && ((B = s.value) == null || B.setSize(d.value, b.value));
1253
+ setup(r, { expose: e }) {
1254
+ const t = r, o = z(null);
1255
+ Ce(Ne, o), e({ composer: o });
1256
+ const { renderer: a, sizes: s, scene: i, camera: n, render: l } = A();
1257
+ v(() => {
1258
+ var f;
1259
+ (f = o.value) == null || f.dispose(), o.value = new xt(a.value);
1260
+ }), v(() => {
1261
+ var H;
1262
+ const { width: f, height: y } = s;
1263
+ y.value && f.value && ((H = o.value) == null || H.setSize(f.value, y.value));
220
1264
  });
221
- const { pixelRatio: D } = V();
222
- f(() => {
223
- var d;
224
- (d = s.value) == null || d.setPixelRatio(D.value);
225
- }), t.withoutRenderPass || f(() => {
226
- l.value && i.value && s.value && s.value.addPass(new Le(i.value, l.value));
1265
+ const { pixelRatio: u } = Le();
1266
+ v(() => {
1267
+ var f;
1268
+ (f = o.value) == null || f.setPixelRatio(u.value);
1269
+ }), t.withoutRenderPass || v(() => {
1270
+ n.value && i.value && o.value && o.value.addPass(new bt(i.value, n.value));
227
1271
  });
228
- const { render: p } = G();
1272
+ const { render: p } = W();
229
1273
  return p(() => {
230
- n.frames.value > 0 && s.value && t.enabled && s.value.render(), n.frames.value = n.mode.value === "always" ? 1 : Math.max(0, n.frames.value - 1);
231
- }), j(() => {
232
- var d;
233
- (d = s.value) == null || d.dispose();
234
- }), (d, b) => Z(d.$slots, "default");
235
- }
236
- }), y = (o, e) => {
237
- const t = J(q), s = I(o()), { sizes: a, invalidate: r } = w();
238
- e && _(e, () => r());
239
- const i = f(() => {
240
- !(t != null && t.value) || !a.height.value || !a.width.value || (t.value.addPass(s.value), $(() => i()));
1274
+ l.frames.value > 0 && o.value && t.enabled && o.value.render(), l.frames.value = l.mode.value === "always" ? 1 : Math.max(0, l.frames.value - 1);
1275
+ }), V(() => {
1276
+ var f;
1277
+ (f = o.value) == null || f.dispose();
1278
+ }), (f, y) => Ee(f.$slots, "default");
1279
+ }
1280
+ }), B = (r, e) => {
1281
+ const t = De(Ne), o = z(r()), { sizes: a, invalidate: s } = A();
1282
+ e && C(e, () => s());
1283
+ const i = v(() => {
1284
+ !(t != null && t.value) || !a.height.value || !a.width.value || (t.value.addPass(o.value), Pe(() => i()));
241
1285
  });
242
- return j(() => {
243
- var l;
244
- (l = t == null ? void 0 : t.value) == null || l.removePass(s.value), s.value.dispose();
245
- }), { pass: s };
246
- }, Pe = {
1286
+ return V(() => {
1287
+ var n;
1288
+ (n = t == null ? void 0 : t.value) == null || n.removePass(o.value), o.value.dispose();
1289
+ }), { pass: o };
1290
+ }, St = {
247
1291
  uniforms: {
248
1292
  tDiffuse: { value: null },
249
1293
  //diffuse texture
@@ -338,53 +1382,53 @@ const q = Symbol("effectComposerThree"), Xe = /* @__PURE__ */ S({
338
1382
  }`
339
1383
  )
340
1384
  };
341
- class H extends m {
1385
+ class ye extends T {
342
1386
  constructor(e = 64) {
343
1387
  super();
344
- const t = Pe;
345
- this.uniforms = g.clone(t.uniforms), this.heightMap = this.generateHeightmap(e), this.uniforms.tDisp.value = this.heightMap, this.material = new c({
1388
+ const t = St;
1389
+ this.uniforms = M.clone(t.uniforms), this.heightMap = this.generateHeightmap(e), this.uniforms.tDisp.value = this.heightMap, this.material = new S({
346
1390
  uniforms: this.uniforms,
347
1391
  vertexShader: t.vertexShader,
348
1392
  fragmentShader: t.fragmentShader
349
- }), this.fsQuad = new T(this.material), this.goWild = !1, this.curF = 0, this.generateTrigger();
1393
+ }), this.fsQuad = new L(this.material), this.goWild = !1, this.curF = 0, this.generateTrigger();
350
1394
  }
351
- render(e, t, s) {
352
- this.uniforms.tDiffuse.value = s.texture, this.uniforms.seed.value = Math.random(), this.uniforms.byp.value = 0, this.curF % this.randX == 0 || this.goWild == !0 ? (this.uniforms.amount.value = Math.random() / 30, this.uniforms.angle.value = h.randFloat(-Math.PI, Math.PI), this.uniforms.seed_x.value = h.randFloat(-1, 1), this.uniforms.seed_y.value = h.randFloat(-1, 1), this.uniforms.distortion_x.value = h.randFloat(0, 1), this.uniforms.distortion_y.value = h.randFloat(0, 1), this.curF = 0, this.generateTrigger()) : this.curF % this.randX < this.randX / 5 ? (this.uniforms.amount.value = Math.random() / 90, this.uniforms.angle.value = h.randFloat(-Math.PI, Math.PI), this.uniforms.distortion_x.value = h.randFloat(0, 1), this.uniforms.distortion_y.value = h.randFloat(0, 1), this.uniforms.seed_x.value = h.randFloat(-0.3, 0.3), this.uniforms.seed_y.value = h.randFloat(-0.3, 0.3)) : this.goWild == !1 && (this.uniforms.byp.value = 1), this.curF++, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
1395
+ render(e, t, o) {
1396
+ this.uniforms.tDiffuse.value = o.texture, this.uniforms.seed.value = Math.random(), this.uniforms.byp.value = 0, this.curF % this.randX == 0 || this.goWild == !0 ? (this.uniforms.amount.value = Math.random() / 30, this.uniforms.angle.value = b.randFloat(-Math.PI, Math.PI), this.uniforms.seed_x.value = b.randFloat(-1, 1), this.uniforms.seed_y.value = b.randFloat(-1, 1), this.uniforms.distortion_x.value = b.randFloat(0, 1), this.uniforms.distortion_y.value = b.randFloat(0, 1), this.curF = 0, this.generateTrigger()) : this.curF % this.randX < this.randX / 5 ? (this.uniforms.amount.value = Math.random() / 90, this.uniforms.angle.value = b.randFloat(-Math.PI, Math.PI), this.uniforms.distortion_x.value = b.randFloat(0, 1), this.uniforms.distortion_y.value = b.randFloat(0, 1), this.uniforms.seed_x.value = b.randFloat(-0.3, 0.3), this.uniforms.seed_y.value = b.randFloat(-0.3, 0.3)) : this.goWild == !1 && (this.uniforms.byp.value = 1), this.curF++, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
353
1397
  }
354
1398
  generateTrigger() {
355
- this.randX = h.randInt(120, 240);
1399
+ this.randX = b.randInt(120, 240);
356
1400
  }
357
1401
  generateHeightmap(e) {
358
- const t = new Float32Array(e * e), s = e * e;
359
- for (let r = 0; r < s; r++) {
360
- const i = h.randFloat(0, 1);
361
- t[r] = i;
1402
+ const t = new Float32Array(e * e), o = e * e;
1403
+ for (let s = 0; s < o; s++) {
1404
+ const i = b.randFloat(0, 1);
1405
+ t[s] = i;
362
1406
  }
363
- const a = new ie(t, e, e, oe, le);
1407
+ const a = new ke(t, e, e, Qe, Ke);
364
1408
  return a.needsUpdate = !0, a;
365
1409
  }
366
1410
  dispose() {
367
1411
  this.material.dispose(), this.heightMap.dispose(), this.fsQuad.dispose();
368
1412
  }
369
1413
  }
370
- const Ge = /* @__PURE__ */ S({
1414
+ const _t = /* @__PURE__ */ c({
371
1415
  __name: "Glitch",
372
1416
  props: {
373
1417
  dtSize: {},
374
1418
  goWild: { type: Boolean }
375
1419
  },
376
- setup(o, { expose: e }) {
377
- const t = o, { pass: s } = y(() => new H(t.dtSize), t);
378
- e({ pass: s });
379
- const { onBeforeRender: a } = G();
380
- return a(({ invalidate: r }) => r()), Y(
1420
+ setup(r, { expose: e }) {
1421
+ const t = r, { pass: o } = B(() => new ye(t.dtSize), t);
1422
+ e({ pass: o });
1423
+ const { onBeforeRender: a } = W();
1424
+ return a(({ invalidate: s }) => s()), g(
381
1425
  [[() => t.goWild, "goWild"]],
382
- s,
383
- () => new H()
1426
+ o,
1427
+ () => new ye()
384
1428
  ), () => {
385
1429
  };
386
1430
  }
387
- }), P = {
1431
+ }), I = {
388
1432
  name: "HalftoneShader",
389
1433
  uniforms: {
390
1434
  tDiffuse: { value: null },
@@ -688,19 +1732,19 @@ const Ge = /* @__PURE__ */ S({
688
1732
  }`
689
1733
  )
690
1734
  };
691
- class Ne extends m {
692
- constructor(e, t, s) {
693
- super(), this.uniforms = g.clone(P.uniforms), this.material = new c({
1735
+ class At extends T {
1736
+ constructor(e, t, o) {
1737
+ super(), this.uniforms = M.clone(I.uniforms), this.material = new S({
694
1738
  uniforms: this.uniforms,
695
- fragmentShader: P.fragmentShader,
696
- vertexShader: P.vertexShader
1739
+ fragmentShader: I.fragmentShader,
1740
+ vertexShader: I.vertexShader
697
1741
  }), this.uniforms.width.value = e, this.uniforms.height.value = t;
698
- for (const a in s)
699
- s.hasOwnProperty(a) && this.uniforms.hasOwnProperty(a) && (this.uniforms[a].value = s[a]);
700
- this.fsQuad = new T(this.material);
1742
+ for (const a in o)
1743
+ o.hasOwnProperty(a) && this.uniforms.hasOwnProperty(a) && (this.uniforms[a].value = o[a]);
1744
+ this.fsQuad = new L(this.material);
701
1745
  }
702
- render(e, t, s) {
703
- this.material.uniforms.tDiffuse.value = s.texture, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
1746
+ render(e, t, o) {
1747
+ this.material.uniforms.tDiffuse.value = o.texture, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
704
1748
  }
705
1749
  setSize(e, t) {
706
1750
  this.uniforms.width.value = e, this.uniforms.height.value = t;
@@ -709,7 +1753,7 @@ class Ne extends m {
709
1753
  this.material.dispose(), this.fsQuad.dispose();
710
1754
  }
711
1755
  }
712
- const Ie = /* @__PURE__ */ S({
1756
+ const $t = /* @__PURE__ */ c({
713
1757
  __name: "Halftone",
714
1758
  props: {
715
1759
  shape: {},
@@ -722,55 +1766,55 @@ const Ie = /* @__PURE__ */ S({
722
1766
  greyscale: { type: Boolean },
723
1767
  blendingMode: {}
724
1768
  },
725
- setup(o, { expose: e }) {
726
- const t = o, { sizes: s } = w(), a = O(
1769
+ setup(r, { expose: e }) {
1770
+ const t = r, { sizes: o } = A(), a = F(
727
1771
  () => Object.fromEntries(
728
- Object.entries(t).filter(([i, l]) => l !== void 0)
1772
+ Object.entries(t).filter(([i, n]) => n !== void 0)
729
1773
  )
730
- ), { pass: r } = y(() => new Ne(
731
- s.width.value,
732
- s.height.value,
1774
+ ), { pass: s } = B(() => new At(
1775
+ o.width.value,
1776
+ o.height.value,
733
1777
  a.value
734
1778
  ), t);
735
- return e({ pass: r }), f(() => {
736
- r.value.setSize(s.width.value, s.height.value);
737
- }), f(() => {
738
- Object.entries(t).forEach(([i, l]) => {
739
- i in r.value.uniforms && (r.value.uniforms[i].value = l ?? P.uniforms[i].value);
1779
+ return e({ pass: s }), v(() => {
1780
+ s.value.setSize(o.width.value, o.height.value);
1781
+ }), v(() => {
1782
+ Object.entries(t).forEach(([i, n]) => {
1783
+ i in s.value.uniforms && (s.value.uniforms[i].value = n ?? I.uniforms[i].value);
740
1784
  });
741
1785
  }), () => {
742
1786
  };
743
1787
  }
744
1788
  });
745
- class X extends m {
746
- constructor(e, t, s, a = {}) {
747
- super(), this.pixelSize = e, this.resolution = new u(), this.renderResolution = new u(), this.pixelatedMaterial = this.createPixelatedMaterial(), this.normalMaterial = new ne(), this.fsQuad = new T(this.pixelatedMaterial), this.scene = t, this.camera = s, this.normalEdgeStrength = a.normalEdgeStrength || 0.3, this.depthEdgeStrength = a.depthEdgeStrength || 0.4, this.beautyRenderTarget = new v(), this.beautyRenderTarget.texture.minFilter = A, this.beautyRenderTarget.texture.magFilter = A, this.beautyRenderTarget.texture.type = x, this.beautyRenderTarget.depthTexture = new de(), this.normalRenderTarget = new v(), this.normalRenderTarget.texture.minFilter = A, this.normalRenderTarget.texture.magFilter = A, this.normalRenderTarget.texture.type = x;
1789
+ class Me extends T {
1790
+ constructor(e, t, o, a = {}) {
1791
+ super(), this.pixelSize = e, this.resolution = new d(), this.renderResolution = new d(), this.pixelatedMaterial = this.createPixelatedMaterial(), this.normalMaterial = new Je(), this.fsQuad = new L(this.pixelatedMaterial), this.scene = t, this.camera = o, this.normalEdgeStrength = a.normalEdgeStrength || 0.3, this.depthEdgeStrength = a.depthEdgeStrength || 0.4, this.beautyRenderTarget = new D(), this.beautyRenderTarget.texture.minFilter = O, this.beautyRenderTarget.texture.magFilter = O, this.beautyRenderTarget.texture.type = w, this.beautyRenderTarget.depthTexture = new Ze(), this.normalRenderTarget = new D(), this.normalRenderTarget.texture.minFilter = O, this.normalRenderTarget.texture.magFilter = O, this.normalRenderTarget.texture.type = w;
748
1792
  }
749
1793
  dispose() {
750
1794
  this.beautyRenderTarget.dispose(), this.normalRenderTarget.dispose(), this.pixelatedMaterial.dispose(), this.normalMaterial.dispose(), this.fsQuad.dispose();
751
1795
  }
752
1796
  setSize(e, t) {
753
1797
  this.resolution.set(e, t), this.renderResolution.set(e / this.pixelSize | 0, t / this.pixelSize | 0);
754
- const { x: s, y: a } = this.renderResolution;
755
- this.beautyRenderTarget.setSize(s, a), this.normalRenderTarget.setSize(s, a), this.fsQuad.material.uniforms.resolution.value.set(s, a, 1 / s, 1 / a);
1798
+ const { x: o, y: a } = this.renderResolution;
1799
+ this.beautyRenderTarget.setSize(o, a), this.normalRenderTarget.setSize(o, a), this.fsQuad.material.uniforms.resolution.value.set(o, a, 1 / o, 1 / a);
756
1800
  }
757
1801
  setPixelSize(e) {
758
1802
  this.pixelSize = e, this.setSize(this.resolution.x, this.resolution.y);
759
1803
  }
760
1804
  render(e, t) {
761
- const s = this.fsQuad.material.uniforms;
762
- s.normalEdgeStrength.value = this.normalEdgeStrength, s.depthEdgeStrength.value = this.depthEdgeStrength, e.setRenderTarget(this.beautyRenderTarget), e.render(this.scene, this.camera);
1805
+ const o = this.fsQuad.material.uniforms;
1806
+ o.normalEdgeStrength.value = this.normalEdgeStrength, o.depthEdgeStrength.value = this.depthEdgeStrength, e.setRenderTarget(this.beautyRenderTarget), e.render(this.scene, this.camera);
763
1807
  const a = this.scene.overrideMaterial;
764
- e.setRenderTarget(this.normalRenderTarget), this.scene.overrideMaterial = this.normalMaterial, e.render(this.scene, this.camera), this.scene.overrideMaterial = a, s.tDiffuse.value = this.beautyRenderTarget.texture, s.tDepth.value = this.beautyRenderTarget.depthTexture, s.tNormal.value = this.normalRenderTarget.texture, this.renderToScreen ? e.setRenderTarget(null) : (e.setRenderTarget(t), this.clear && e.clear()), this.fsQuad.render(e);
1808
+ e.setRenderTarget(this.normalRenderTarget), this.scene.overrideMaterial = this.normalMaterial, e.render(this.scene, this.camera), this.scene.overrideMaterial = a, o.tDiffuse.value = this.beautyRenderTarget.texture, o.tDepth.value = this.beautyRenderTarget.depthTexture, o.tNormal.value = this.normalRenderTarget.texture, this.renderToScreen ? e.setRenderTarget(null) : (e.setRenderTarget(t), this.clear && e.clear()), this.fsQuad.render(e);
765
1809
  }
766
1810
  createPixelatedMaterial() {
767
- return new c({
1811
+ return new S({
768
1812
  uniforms: {
769
1813
  tDiffuse: { value: null },
770
1814
  tDepth: { value: null },
771
1815
  tNormal: { value: null },
772
1816
  resolution: {
773
- value: new ue(
1817
+ value: new _e(
774
1818
  this.renderResolution.x,
775
1819
  this.renderResolution.y,
776
1820
  1 / this.renderResolution.x,
@@ -889,28 +1933,28 @@ class X extends m {
889
1933
  });
890
1934
  }
891
1935
  }
892
- const je = /* @__PURE__ */ S({
1936
+ const eo = /* @__PURE__ */ c({
893
1937
  __name: "Pixelation",
894
1938
  props: {
895
1939
  pixelSize: {},
896
1940
  depthEdgeStrength: {},
897
1941
  normalEdgeStrength: {}
898
1942
  },
899
- setup(o, { expose: e }) {
900
- const t = o, { scene: s, camera: a } = w(), { pass: r } = y(() => new X(t.pixelSize, s.value, a.value), t);
901
- return e({ pass: r }), f(() => {
902
- r.value.setPixelSize(t.pixelSize);
903
- }), Y(
1943
+ setup(r, { expose: e }) {
1944
+ const t = r, { scene: o, camera: a } = A(), { pass: s } = B(() => new Me(t.pixelSize, o.value, a.value), t);
1945
+ return e({ pass: s }), v(() => {
1946
+ s.value.setPixelSize(t.pixelSize);
1947
+ }), g(
904
1948
  [
905
1949
  [() => t.depthEdgeStrength, "depthEdgeStrength"],
906
1950
  [() => t.normalEdgeStrength, "normalEdgeStrength"]
907
1951
  ],
908
- r,
909
- () => new X(1, s.value, a.value)
1952
+ s,
1953
+ () => new Me(1, o.value, a.value)
910
1954
  ), () => {
911
1955
  };
912
1956
  }
913
- }), Re = {
1957
+ }), wt = {
914
1958
  name: "OutputShader",
915
1959
  uniforms: {
916
1960
  tDiffuse: { value: null },
@@ -992,39 +2036,39 @@ const je = /* @__PURE__ */ S({
992
2036
  }`
993
2037
  )
994
2038
  };
995
- class Oe extends m {
2039
+ class Tt extends T {
996
2040
  constructor() {
997
2041
  super();
998
- const e = Re;
999
- this.uniforms = g.clone(e.uniforms), this.material = new he({
2042
+ const e = wt;
2043
+ this.uniforms = M.clone(e.uniforms), this.material = new $e({
1000
2044
  name: e.name,
1001
2045
  uniforms: this.uniforms,
1002
2046
  vertexShader: e.vertexShader,
1003
2047
  fragmentShader: e.fragmentShader
1004
- }), this.fsQuad = new T(this.material), this._outputColorSpace = null, this._toneMapping = null;
2048
+ }), this.fsQuad = new L(this.material), this._outputColorSpace = null, this._toneMapping = null;
1005
2049
  }
1006
- render(e, t, s) {
1007
- this.uniforms.tDiffuse.value = s.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {}, fe.getTransfer(this._outputColorSpace) === ce && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === pe ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === me ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === ge ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === ve ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === xe ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === be && (this.material.defines.NEUTRAL_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
2050
+ render(e, t, o) {
2051
+ this.uniforms.tDiffuse.value = o.texture, this.uniforms.toneMappingExposure.value = e.toneMappingExposure, (this._outputColorSpace !== e.outputColorSpace || this._toneMapping !== e.toneMapping) && (this._outputColorSpace = e.outputColorSpace, this._toneMapping = e.toneMapping, this.material.defines = {}, et.getTransfer(this._outputColorSpace) === tt && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === ot ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === at ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === st ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === rt ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === it ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === nt && (this.material.defines.NEUTRAL_TONE_MAPPING = ""), this.material.needsUpdate = !0), this.renderToScreen === !0 ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), this.fsQuad.render(e));
1008
2052
  }
1009
2053
  dispose() {
1010
2054
  this.material.dispose(), this.fsQuad.dispose();
1011
2055
  }
1012
2056
  }
1013
- const Ve = /* @__PURE__ */ S({
2057
+ const to = /* @__PURE__ */ c({
1014
2058
  __name: "Output",
1015
- setup(o, { expose: e }) {
1016
- const { pass: t } = y(() => new Oe());
2059
+ setup(r, { expose: e }) {
2060
+ const { pass: t } = B(() => new Tt());
1017
2061
  return e({ pass: t }), () => {
1018
2062
  };
1019
2063
  }
1020
- }), E = {
2064
+ }), G = {
1021
2065
  name: "SMAAEdgesShader",
1022
2066
  defines: {
1023
2067
  SMAA_THRESHOLD: "0.1"
1024
2068
  },
1025
2069
  uniforms: {
1026
2070
  tDiffuse: { value: null },
1027
- resolution: { value: new u(1 / 1024, 1 / 512) }
2071
+ resolution: { value: new d(1 / 1024, 1 / 512) }
1028
2072
  },
1029
2073
  vertexShader: (
1030
2074
  /* glsl */
@@ -1118,7 +2162,7 @@ const Ve = /* @__PURE__ */ S({
1118
2162
 
1119
2163
  }`
1120
2164
  )
1121
- }, L = {
2165
+ }, X = {
1122
2166
  name: "SMAAWeightsShader",
1123
2167
  defines: {
1124
2168
  SMAA_MAX_SEARCH_STEPS: "8",
@@ -1130,7 +2174,7 @@ const Ve = /* @__PURE__ */ S({
1130
2174
  tDiffuse: { value: null },
1131
2175
  tArea: { value: null },
1132
2176
  tSearch: { value: null },
1133
- resolution: { value: new u(1 / 1024, 1 / 512) }
2177
+ resolution: { value: new d(1 / 1024, 1 / 512) }
1134
2178
  },
1135
2179
  vertexShader: (
1136
2180
  /* glsl */
@@ -1368,12 +2412,12 @@ const Ve = /* @__PURE__ */ S({
1368
2412
 
1369
2413
  }`
1370
2414
  )
1371
- }, R = {
2415
+ }, J = {
1372
2416
  name: "SMAABlendShader",
1373
2417
  uniforms: {
1374
2418
  tDiffuse: { value: null },
1375
2419
  tColor: { value: null },
1376
- resolution: { value: new u(1 / 1024, 1 / 512) }
2420
+ resolution: { value: new d(1 / 1024, 1 / 512) }
1377
2421
  },
1378
2422
  vertexShader: (
1379
2423
  /* glsl */
@@ -1458,40 +2502,40 @@ const Ve = /* @__PURE__ */ S({
1458
2502
  }`
1459
2503
  )
1460
2504
  };
1461
- class ze extends m {
2505
+ class yt extends T {
1462
2506
  constructor(e, t) {
1463
- super(), this.edgesRT = new v(e, t, {
2507
+ super(), this.edgesRT = new D(e, t, {
1464
2508
  depthBuffer: !1,
1465
- type: x
1466
- }), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new v(e, t, {
2509
+ type: w
2510
+ }), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new D(e, t, {
1467
2511
  depthBuffer: !1,
1468
- type: x
2512
+ type: w
1469
2513
  }), this.weightsRT.texture.name = "SMAAPass.weights";
1470
- const s = this, a = new Image();
2514
+ const o = this, a = new Image();
1471
2515
  a.src = this.getAreaTexture(), a.onload = function() {
1472
- s.areaTexture.needsUpdate = !0;
1473
- }, this.areaTexture = new F(), this.areaTexture.name = "SMAAPass.area", this.areaTexture.image = a, this.areaTexture.minFilter = Se, this.areaTexture.generateMipmaps = !1, this.areaTexture.flipY = !1;
1474
- const r = new Image();
1475
- r.src = this.getSearchTexture(), r.onload = function() {
1476
- s.searchTexture.needsUpdate = !0;
1477
- }, this.searchTexture = new F(), this.searchTexture.name = "SMAAPass.search", this.searchTexture.image = r, this.searchTexture.magFilter = A, this.searchTexture.minFilter = A, this.searchTexture.generateMipmaps = !1, this.searchTexture.flipY = !1, this.uniformsEdges = g.clone(E.uniforms), this.uniformsEdges.resolution.value.set(1 / e, 1 / t), this.materialEdges = new c({
1478
- defines: Object.assign({}, E.defines),
2516
+ o.areaTexture.needsUpdate = !0;
2517
+ }, this.areaTexture = new ve(), this.areaTexture.name = "SMAAPass.area", this.areaTexture.image = a, this.areaTexture.minFilter = lt, this.areaTexture.generateMipmaps = !1, this.areaTexture.flipY = !1;
2518
+ const s = new Image();
2519
+ s.src = this.getSearchTexture(), s.onload = function() {
2520
+ o.searchTexture.needsUpdate = !0;
2521
+ }, this.searchTexture = new ve(), this.searchTexture.name = "SMAAPass.search", this.searchTexture.image = s, this.searchTexture.magFilter = O, this.searchTexture.minFilter = O, this.searchTexture.generateMipmaps = !1, this.searchTexture.flipY = !1, this.uniformsEdges = M.clone(G.uniforms), this.uniformsEdges.resolution.value.set(1 / e, 1 / t), this.materialEdges = new S({
2522
+ defines: Object.assign({}, G.defines),
1479
2523
  uniforms: this.uniformsEdges,
1480
- vertexShader: E.vertexShader,
1481
- fragmentShader: E.fragmentShader
1482
- }), this.uniformsWeights = g.clone(L.uniforms), this.uniformsWeights.resolution.value.set(1 / e, 1 / t), this.uniformsWeights.tDiffuse.value = this.edgesRT.texture, this.uniformsWeights.tArea.value = this.areaTexture, this.uniformsWeights.tSearch.value = this.searchTexture, this.materialWeights = new c({
1483
- defines: Object.assign({}, L.defines),
2524
+ vertexShader: G.vertexShader,
2525
+ fragmentShader: G.fragmentShader
2526
+ }), this.uniformsWeights = M.clone(X.uniforms), this.uniformsWeights.resolution.value.set(1 / e, 1 / t), this.uniformsWeights.tDiffuse.value = this.edgesRT.texture, this.uniformsWeights.tArea.value = this.areaTexture, this.uniformsWeights.tSearch.value = this.searchTexture, this.materialWeights = new S({
2527
+ defines: Object.assign({}, X.defines),
1484
2528
  uniforms: this.uniformsWeights,
1485
- vertexShader: L.vertexShader,
1486
- fragmentShader: L.fragmentShader
1487
- }), this.uniformsBlend = g.clone(R.uniforms), this.uniformsBlend.resolution.value.set(1 / e, 1 / t), this.uniformsBlend.tDiffuse.value = this.weightsRT.texture, this.materialBlend = new c({
2529
+ vertexShader: X.vertexShader,
2530
+ fragmentShader: X.fragmentShader
2531
+ }), this.uniformsBlend = M.clone(J.uniforms), this.uniformsBlend.resolution.value.set(1 / e, 1 / t), this.uniformsBlend.tDiffuse.value = this.weightsRT.texture, this.materialBlend = new S({
1488
2532
  uniforms: this.uniformsBlend,
1489
- vertexShader: R.vertexShader,
1490
- fragmentShader: R.fragmentShader
1491
- }), this.fsQuad = new T(null);
2533
+ vertexShader: J.vertexShader,
2534
+ fragmentShader: J.fragmentShader
2535
+ }), this.fsQuad = new L(null);
1492
2536
  }
1493
- render(e, t, s) {
1494
- this.uniformsEdges.tDiffuse.value = s.texture, this.fsQuad.material = this.materialEdges, e.setRenderTarget(this.edgesRT), this.clear && e.clear(), this.fsQuad.render(e), this.fsQuad.material = this.materialWeights, e.setRenderTarget(this.weightsRT), this.clear && e.clear(), this.fsQuad.render(e), this.uniformsBlend.tColor.value = s.texture, this.fsQuad.material = this.materialBlend, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
2537
+ render(e, t, o) {
2538
+ this.uniformsEdges.tDiffuse.value = o.texture, this.fsQuad.material = this.materialEdges, e.setRenderTarget(this.edgesRT), this.clear && e.clear(), this.fsQuad.render(e), this.fsQuad.material = this.materialWeights, e.setRenderTarget(this.weightsRT), this.clear && e.clear(), this.fsQuad.render(e), this.uniformsBlend.tColor.value = o.texture, this.fsQuad.material = this.materialBlend, this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(t), this.clear && e.clear(), this.fsQuad.render(e));
1495
2539
  }
1496
2540
  setSize(e, t) {
1497
2541
  this.edgesRT.setSize(e, t), this.weightsRT.setSize(e, t), this.materialEdges.uniforms.resolution.value.set(1 / e, 1 / t), this.materialWeights.uniforms.resolution.value.set(1 / e, 1 / t), this.materialBlend.uniforms.resolution.value.set(1 / e, 1 / t);
@@ -1506,27 +2550,27 @@ class ze extends m {
1506
2550
  this.edgesRT.dispose(), this.weightsRT.dispose(), this.areaTexture.dispose(), this.searchTexture.dispose(), this.materialEdges.dispose(), this.materialWeights.dispose(), this.materialBlend.dispose(), this.fsQuad.dispose();
1507
2551
  }
1508
2552
  }
1509
- const Ye = /* @__PURE__ */ S({
2553
+ const oo = /* @__PURE__ */ c({
1510
2554
  __name: "SMAA",
1511
2555
  props: {
1512
2556
  width: {},
1513
2557
  height: {}
1514
2558
  },
1515
- setup(o, { expose: e }) {
1516
- const t = o, { sizes: s } = w(), { pixelRatio: a } = V(), r = O(() => t.width ?? s.width.value * a.value), i = O(() => t.height ?? s.height.value * a.value), { pass: l } = y(() => new ze(r.value, i.value), t);
1517
- return e({ pass: l }), f(() => {
1518
- l.value.setSize(r.value, i.value);
2559
+ setup(r, { expose: e }) {
2560
+ const t = r, { sizes: o } = A(), { pixelRatio: a } = Le(), s = F(() => t.width ?? o.width.value * a.value), i = F(() => t.height ?? o.height.value * a.value), { pass: n } = B(() => new yt(s.value, i.value), t);
2561
+ return e({ pass: n }), v(() => {
2562
+ n.value.setSize(s.value, i.value);
1519
2563
  }), () => {
1520
2564
  };
1521
2565
  }
1522
- }), K = {
2566
+ }), ze = {
1523
2567
  name: "LuminosityHighPassShader",
1524
2568
  shaderID: "luminosityHighPass",
1525
2569
  uniforms: {
1526
2570
  tDiffuse: { value: null },
1527
2571
  luminosityThreshold: { value: 1 },
1528
2572
  smoothWidth: { value: 1 },
1529
- defaultColor: { value: new N(0) },
2573
+ defaultColor: { value: new j(0) },
1530
2574
  defaultOpacity: { value: 0 }
1531
2575
  },
1532
2576
  vertexShader: (
@@ -1570,40 +2614,40 @@ const Ye = /* @__PURE__ */ S({
1570
2614
  }`
1571
2615
  )
1572
2616
  };
1573
- class M extends m {
1574
- constructor(e, t, s, a) {
1575
- super(), this.strength = t !== void 0 ? t : 1, this.radius = s, this.threshold = a, this.resolution = e !== void 0 ? new u(e.x, e.y) : new u(256, 256), this.clearColor = new N(0, 0, 0), this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
1576
- let r = Math.round(this.resolution.x / 2), i = Math.round(this.resolution.y / 2);
1577
- this.renderTargetBright = new v(r, i, { type: x }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
2617
+ class R extends T {
2618
+ constructor(e, t, o, a) {
2619
+ super(), this.strength = t !== void 0 ? t : 1, this.radius = o, this.threshold = a, this.resolution = e !== void 0 ? new d(e.x, e.y) : new d(256, 256), this.clearColor = new j(0, 0, 0), this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
2620
+ let s = Math.round(this.resolution.x / 2), i = Math.round(this.resolution.y / 2);
2621
+ this.renderTargetBright = new D(s, i, { type: w }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
1578
2622
  for (let p = 0; p < this.nMips; p++) {
1579
- const d = new v(r, i, { type: x });
1580
- d.texture.name = "UnrealBloomPass.h" + p, d.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(d);
1581
- const b = new v(r, i, { type: x });
1582
- b.texture.name = "UnrealBloomPass.v" + p, b.texture.generateMipmaps = !1, this.renderTargetsVertical.push(b), r = Math.round(r / 2), i = Math.round(i / 2);
2623
+ const f = new D(s, i, { type: w });
2624
+ f.texture.name = "UnrealBloomPass.h" + p, f.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(f);
2625
+ const y = new D(s, i, { type: w });
2626
+ y.texture.name = "UnrealBloomPass.v" + p, y.texture.generateMipmaps = !1, this.renderTargetsVertical.push(y), s = Math.round(s / 2), i = Math.round(i / 2);
1583
2627
  }
1584
- const l = K;
1585
- this.highPassUniforms = g.clone(l.uniforms), this.highPassUniforms.luminosityThreshold.value = a, this.highPassUniforms.smoothWidth.value = 0.01, this.materialHighPassFilter = new c({
2628
+ const n = ze;
2629
+ this.highPassUniforms = M.clone(n.uniforms), this.highPassUniforms.luminosityThreshold.value = a, this.highPassUniforms.smoothWidth.value = 0.01, this.materialHighPassFilter = new S({
1586
2630
  uniforms: this.highPassUniforms,
1587
- vertexShader: l.vertexShader,
1588
- fragmentShader: l.fragmentShader
2631
+ vertexShader: n.vertexShader,
2632
+ fragmentShader: n.fragmentShader
1589
2633
  }), this.separableBlurMaterials = [];
1590
- const n = [3, 5, 7, 9, 11];
1591
- r = Math.round(this.resolution.x / 2), i = Math.round(this.resolution.y / 2);
2634
+ const l = [3, 5, 7, 9, 11];
2635
+ s = Math.round(this.resolution.x / 2), i = Math.round(this.resolution.y / 2);
1592
2636
  for (let p = 0; p < this.nMips; p++)
1593
- this.separableBlurMaterials.push(this.getSeperableBlurMaterial(n[p])), this.separableBlurMaterials[p].uniforms.invSize.value = new u(1 / r, 1 / i), r = Math.round(r / 2), i = Math.round(i / 2);
2637
+ this.separableBlurMaterials.push(this.getSeparableBlurMaterial(l[p])), this.separableBlurMaterials[p].uniforms.invSize.value = new d(1 / s, 1 / i), s = Math.round(s / 2), i = Math.round(i / 2);
1594
2638
  this.compositeMaterial = this.getCompositeMaterial(this.nMips), this.compositeMaterial.uniforms.blurTexture1.value = this.renderTargetsVertical[0].texture, this.compositeMaterial.uniforms.blurTexture2.value = this.renderTargetsVertical[1].texture, this.compositeMaterial.uniforms.blurTexture3.value = this.renderTargetsVertical[2].texture, this.compositeMaterial.uniforms.blurTexture4.value = this.renderTargetsVertical[3].texture, this.compositeMaterial.uniforms.blurTexture5.value = this.renderTargetsVertical[4].texture, this.compositeMaterial.uniforms.bloomStrength.value = t, this.compositeMaterial.uniforms.bloomRadius.value = 0.1;
1595
- const z = [1, 0.8, 0.6, 0.4, 0.2];
1596
- this.compositeMaterial.uniforms.bloomFactors.value = z, this.bloomTintColors = [new C(1, 1, 1), new C(1, 1, 1), new C(1, 1, 1), new C(1, 1, 1), new C(1, 1, 1)], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors;
1597
- const D = Q;
1598
- this.copyUniforms = g.clone(D.uniforms), this.blendMaterial = new c({
2639
+ const x = [1, 0.8, 0.6, 0.4, 0.2];
2640
+ this.compositeMaterial.uniforms.bloomFactors.value = x, this.bloomTintColors = [new P(1, 1, 1), new P(1, 1, 1), new P(1, 1, 1), new P(1, 1, 1), new P(1, 1, 1)], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors;
2641
+ const u = Be;
2642
+ this.copyUniforms = M.clone(u.uniforms), this.blendMaterial = new S({
1599
2643
  uniforms: this.copyUniforms,
1600
- vertexShader: D.vertexShader,
1601
- fragmentShader: D.fragmentShader,
1602
- blending: Te,
2644
+ vertexShader: u.vertexShader,
2645
+ fragmentShader: u.fragmentShader,
2646
+ blending: ut,
1603
2647
  depthTest: !1,
1604
2648
  depthWrite: !1,
1605
2649
  transparent: !0
1606
- }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new N(), this.oldClearAlpha = 1, this.basic = new Ae(), this.fsQuad = new T(null);
2650
+ }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new j(), this.oldClearAlpha = 1, this.basic = new ct(), this.fsQuad = new L(null);
1607
2651
  }
1608
2652
  dispose() {
1609
2653
  for (let e = 0; e < this.renderTargetsHorizontal.length; e++)
@@ -1616,33 +2660,33 @@ class M extends m {
1616
2660
  this.compositeMaterial.dispose(), this.blendMaterial.dispose(), this.basic.dispose(), this.fsQuad.dispose();
1617
2661
  }
1618
2662
  setSize(e, t) {
1619
- let s = Math.round(e / 2), a = Math.round(t / 2);
1620
- this.renderTargetBright.setSize(s, a);
1621
- for (let r = 0; r < this.nMips; r++)
1622
- this.renderTargetsHorizontal[r].setSize(s, a), this.renderTargetsVertical[r].setSize(s, a), this.separableBlurMaterials[r].uniforms.invSize.value = new u(1 / s, 1 / a), s = Math.round(s / 2), a = Math.round(a / 2);
2663
+ let o = Math.round(e / 2), a = Math.round(t / 2);
2664
+ this.renderTargetBright.setSize(o, a);
2665
+ for (let s = 0; s < this.nMips; s++)
2666
+ this.renderTargetsHorizontal[s].setSize(o, a), this.renderTargetsVertical[s].setSize(o, a), this.separableBlurMaterials[s].uniforms.invSize.value = new d(1 / o, 1 / a), o = Math.round(o / 2), a = Math.round(a / 2);
1623
2667
  }
1624
- render(e, t, s, a, r) {
2668
+ render(e, t, o, a, s) {
1625
2669
  e.getClearColor(this._oldClearColor), this.oldClearAlpha = e.getClearAlpha();
1626
2670
  const i = e.autoClear;
1627
- e.autoClear = !1, e.setClearColor(this.clearColor, 0), r && e.state.buffers.stencil.setTest(!1), this.renderToScreen && (this.fsQuad.material = this.basic, this.basic.map = s.texture, e.setRenderTarget(null), e.clear(), this.fsQuad.render(e)), this.highPassUniforms.tDiffuse.value = s.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this.fsQuad.material = this.materialHighPassFilter, e.setRenderTarget(this.renderTargetBright), e.clear(), this.fsQuad.render(e);
1628
- let l = this.renderTargetBright;
1629
- for (let n = 0; n < this.nMips; n++)
1630
- this.fsQuad.material = this.separableBlurMaterials[n], this.separableBlurMaterials[n].uniforms.colorTexture.value = l.texture, this.separableBlurMaterials[n].uniforms.direction.value = M.BlurDirectionX, e.setRenderTarget(this.renderTargetsHorizontal[n]), e.clear(), this.fsQuad.render(e), this.separableBlurMaterials[n].uniforms.colorTexture.value = this.renderTargetsHorizontal[n].texture, this.separableBlurMaterials[n].uniforms.direction.value = M.BlurDirectionY, e.setRenderTarget(this.renderTargetsVertical[n]), e.clear(), this.fsQuad.render(e), l = this.renderTargetsVertical[n];
1631
- this.fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, e.setRenderTarget(this.renderTargetsHorizontal[0]), e.clear(), this.fsQuad.render(e), this.fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, r && e.state.buffers.stencil.setTest(!0), this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(s), this.fsQuad.render(e)), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = i;
2671
+ e.autoClear = !1, e.setClearColor(this.clearColor, 0), s && e.state.buffers.stencil.setTest(!1), this.renderToScreen && (this.fsQuad.material = this.basic, this.basic.map = o.texture, e.setRenderTarget(null), e.clear(), this.fsQuad.render(e)), this.highPassUniforms.tDiffuse.value = o.texture, this.highPassUniforms.luminosityThreshold.value = this.threshold, this.fsQuad.material = this.materialHighPassFilter, e.setRenderTarget(this.renderTargetBright), e.clear(), this.fsQuad.render(e);
2672
+ let n = this.renderTargetBright;
2673
+ for (let l = 0; l < this.nMips; l++)
2674
+ this.fsQuad.material = this.separableBlurMaterials[l], this.separableBlurMaterials[l].uniforms.colorTexture.value = n.texture, this.separableBlurMaterials[l].uniforms.direction.value = R.BlurDirectionX, e.setRenderTarget(this.renderTargetsHorizontal[l]), e.clear(), this.fsQuad.render(e), this.separableBlurMaterials[l].uniforms.colorTexture.value = this.renderTargetsHorizontal[l].texture, this.separableBlurMaterials[l].uniforms.direction.value = R.BlurDirectionY, e.setRenderTarget(this.renderTargetsVertical[l]), e.clear(), this.fsQuad.render(e), n = this.renderTargetsVertical[l];
2675
+ this.fsQuad.material = this.compositeMaterial, this.compositeMaterial.uniforms.bloomStrength.value = this.strength, this.compositeMaterial.uniforms.bloomRadius.value = this.radius, this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors, e.setRenderTarget(this.renderTargetsHorizontal[0]), e.clear(), this.fsQuad.render(e), this.fsQuad.material = this.blendMaterial, this.copyUniforms.tDiffuse.value = this.renderTargetsHorizontal[0].texture, s && e.state.buffers.stencil.setTest(!0), this.renderToScreen ? (e.setRenderTarget(null), this.fsQuad.render(e)) : (e.setRenderTarget(o), this.fsQuad.render(e)), e.setClearColor(this._oldClearColor, this.oldClearAlpha), e.autoClear = i;
1632
2676
  }
1633
- getSeperableBlurMaterial(e) {
2677
+ getSeparableBlurMaterial(e) {
1634
2678
  const t = [];
1635
- for (let s = 0; s < e; s++)
1636
- t.push(0.39894 * Math.exp(-0.5 * s * s / (e * e)) / e);
1637
- return new c({
2679
+ for (let o = 0; o < e; o++)
2680
+ t.push(0.39894 * Math.exp(-0.5 * o * o / (e * e)) / e);
2681
+ return new S({
1638
2682
  defines: {
1639
2683
  KERNEL_RADIUS: e
1640
2684
  },
1641
2685
  uniforms: {
1642
2686
  colorTexture: { value: null },
1643
- invSize: { value: new u(0.5, 0.5) },
2687
+ invSize: { value: new d(0.5, 0.5) },
1644
2688
  // inverse texture size
1645
- direction: { value: new u(0.5, 0.5) },
2689
+ direction: { value: new d(0.5, 0.5) },
1646
2690
  gaussianCoefficients: { value: t }
1647
2691
  // precomputed Gaussian coefficients
1648
2692
  },
@@ -1675,7 +2719,7 @@ class M extends m {
1675
2719
  });
1676
2720
  }
1677
2721
  getCompositeMaterial(e) {
1678
- return new c({
2722
+ return new S({
1679
2723
  defines: {
1680
2724
  NUM_MIPS: e
1681
2725
  },
@@ -1721,42 +2765,64 @@ class M extends m {
1721
2765
  });
1722
2766
  }
1723
2767
  }
1724
- M.BlurDirectionX = new u(1, 0);
1725
- M.BlurDirectionY = new u(0, 1);
1726
- const Qe = /* @__PURE__ */ S({
2768
+ R.BlurDirectionX = new d(1, 0);
2769
+ R.BlurDirectionY = new d(0, 1);
2770
+ const ao = /* @__PURE__ */ c({
1727
2771
  __name: "UnrealBloom",
1728
2772
  props: {
1729
2773
  radius: { default: 0 },
1730
2774
  strength: { default: 1 },
1731
2775
  threshold: { default: 0 }
1732
2776
  },
1733
- setup(o, { expose: e }) {
1734
- const t = o, { sizes: s } = w(), { pass: a } = y(() => new M(
1735
- new u(s.width.value, s.height.value),
2777
+ setup(r, { expose: e }) {
2778
+ const t = r, { sizes: o } = A(), { pass: a } = B(() => new R(
2779
+ new d(o.width.value, o.height.value),
1736
2780
  t.radius,
1737
2781
  t.strength,
1738
2782
  t.threshold
1739
2783
  ), t);
1740
- return e({ pass: a }), f(() => {
1741
- var r;
1742
- a.value.radius = t.radius ?? ((r = a.value.getCompositeMaterial().uniforms.bloomRadius) == null ? void 0 : r.value) ?? 0.1;
1743
- }), f(() => {
1744
- var r;
1745
- a.value.strength = t.strength ?? ((r = a.value.getCompositeMaterial().uniforms.bloomStrength) == null ? void 0 : r.value) ?? 1;
1746
- }), f(() => {
1747
- var r;
1748
- a.value.threshold = t.threshold ?? ((r = K.uniforms.luminosityThreshold) == null ? void 0 : r.value) ?? 1;
2784
+ return e({ pass: a }), v(() => {
2785
+ var s;
2786
+ a.value.radius = t.radius ?? ((s = a.value.getCompositeMaterial().uniforms.bloomRadius) == null ? void 0 : s.value) ?? 0.1;
2787
+ }), v(() => {
2788
+ var s;
2789
+ a.value.strength = t.strength ?? ((s = a.value.getCompositeMaterial().uniforms.bloomStrength) == null ? void 0 : s.value) ?? 1;
2790
+ }), v(() => {
2791
+ var s;
2792
+ a.value.threshold = t.threshold ?? ((s = ze.uniforms.luminosityThreshold) == null ? void 0 : s.value) ?? 1;
1749
2793
  }), () => {
1750
2794
  };
1751
2795
  }
1752
2796
  });
1753
2797
  export {
1754
- Xe as EffectComposer,
1755
- Ge as Glitch,
1756
- Ie as Halftone,
1757
- Ve as Output,
1758
- je as Pixelation,
1759
- Ye as SMAA,
1760
- Qe as UnrealBloom,
1761
- y as useEffect
2798
+ Ut as BarrelBlurPmndrs,
2799
+ Ot as BloomPmndrs,
2800
+ Gt as ChromaticAberrationPmndrs,
2801
+ Vt as ColorAveragePmndrs,
2802
+ Rt as DepthOfFieldPmndrs,
2803
+ Qt as DotScreenPmndrs,
2804
+ Zt as EffectComposer,
2805
+ Lt as EffectComposerPmndrs,
2806
+ _t as Glitch,
2807
+ Bt as GlitchPmndrs,
2808
+ $t as Halftone,
2809
+ Xt as HueSaturationPmndrs,
2810
+ jt as KuwaharaPmndrs,
2811
+ Yt as LensDistortionPmndrs,
2812
+ Jt as LinocutPmndrs,
2813
+ Nt as NoisePmndrs,
2814
+ zt as OutlinePmndrs,
2815
+ to as Output,
2816
+ eo as Pixelation,
2817
+ Ft as PixelationPmndrs,
2818
+ oo as SMAA,
2819
+ It as ScanlinePmndrs,
2820
+ Kt as SepiaPmndrs,
2821
+ qt as ShockWavePmndrs,
2822
+ kt as TiltShiftPmndrs,
2823
+ Ht as ToneMappingPmndrs,
2824
+ ao as UnrealBloom,
2825
+ Wt as VignettePmndrs,
2826
+ B as useEffect,
2827
+ h as useEffectPmndrs
1762
2828
  };