@tresjs/post-processing 2.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.
- package/dist/core/pmndrs/BarrelBlurPmndrs.vue.d.ts +26 -0
- package/dist/core/pmndrs/ChromaticAberrationPmndrs.vue.d.ts +27 -0
- package/dist/core/pmndrs/ColorAveragePmndrs.vue.d.ts +16 -0
- package/dist/core/pmndrs/DotScreenPmndrs.vue.d.ts +22 -0
- package/dist/core/pmndrs/HueSaturationPmndrs.vue.d.ts +22 -0
- package/dist/core/pmndrs/KuwaharaPmndrs.vue.d.ts +27 -0
- package/dist/core/pmndrs/LensDistortionPmndrs.vue.d.ts +25 -0
- package/dist/core/pmndrs/LinocutPmndrs.vue.d.ts +15 -0
- package/dist/core/pmndrs/NoisePmndrs.vue.d.ts +0 -1
- package/dist/core/pmndrs/ScanlinePmndrs.vue.d.ts +24 -0
- package/dist/core/pmndrs/SepiaPmndrs.vue.d.ts +16 -0
- package/dist/core/pmndrs/ShockWavePmndrs.vue.d.ts +29 -0
- package/dist/core/pmndrs/TiltShiftPmndrs.vue.d.ts +49 -0
- package/dist/core/pmndrs/ToneMappingPmndrs.vue.d.ts +36 -0
- package/dist/core/pmndrs/VignettePmndrs.vue.d.ts +4 -9
- package/dist/core/pmndrs/custom/barrel-blur/index.d.ts +36 -0
- package/dist/core/pmndrs/custom/kuwahara/index.d.ts +31 -0
- package/dist/core/pmndrs/custom/linocut/index.d.ts +27 -0
- package/dist/core/pmndrs/index.d.ts +14 -1
- package/dist/tres-post-processing.js +1099 -400
- package/dist/tres-post-processing.umd.cjs +213 -13
- package/package.json +18 -18
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version: v2.
|
|
3
|
+
* version: v2.1.0
|
|
4
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 { watch as
|
|
9
|
-
import { EffectComposer as
|
|
10
|
-
import { useTresContext as
|
|
11
|
-
import { HalfFloatType as
|
|
12
|
-
import { useDevicePixelRatio as
|
|
13
|
-
const
|
|
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
14
|
if (!e)
|
|
15
15
|
return;
|
|
16
|
-
const t = Array.isArray(e) ? e : e.match(
|
|
17
|
-
return t == null ? void 0 : t.reduce((
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
const t = { ...
|
|
23
|
-
return e.forEach((
|
|
24
|
-
},
|
|
25
|
-
var
|
|
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
26
|
if (e.value)
|
|
27
|
-
if (
|
|
28
|
-
const n =
|
|
29
|
-
|
|
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
30
|
} else
|
|
31
|
-
|
|
32
|
-
}, a),
|
|
33
|
-
|
|
31
|
+
xe(e.value, t, r());
|
|
32
|
+
}, a), g = (r, e, t) => r.map(([o, a]) => ee(
|
|
33
|
+
o,
|
|
34
34
|
e,
|
|
35
35
|
a,
|
|
36
36
|
t
|
|
37
|
-
)),
|
|
38
|
-
() =>
|
|
37
|
+
)), U = (r, e, t) => Object.keys(r).map((o) => ee(
|
|
38
|
+
() => r[o],
|
|
39
39
|
e,
|
|
40
|
-
|
|
40
|
+
o,
|
|
41
41
|
t
|
|
42
42
|
));
|
|
43
|
-
class
|
|
43
|
+
class be {
|
|
44
44
|
static isWebGL2Available() {
|
|
45
45
|
try {
|
|
46
46
|
const e = document.createElement("canvas");
|
|
@@ -51,8 +51,8 @@ class oe {
|
|
|
51
51
|
}
|
|
52
52
|
static isColorSpaceAvailable(e) {
|
|
53
53
|
try {
|
|
54
|
-
const t = document.createElement("canvas"),
|
|
55
|
-
return
|
|
54
|
+
const t = document.createElement("canvas"), o = window.WebGL2RenderingContext && t.getContext("webgl2");
|
|
55
|
+
return o.drawingBufferColorSpace = e, o.drawingBufferColorSpace === e;
|
|
56
56
|
} catch {
|
|
57
57
|
return !1;
|
|
58
58
|
}
|
|
@@ -64,13 +64,13 @@ class oe {
|
|
|
64
64
|
const t = {
|
|
65
65
|
1: "WebGL",
|
|
66
66
|
2: "WebGL 2"
|
|
67
|
-
},
|
|
67
|
+
}, o = {
|
|
68
68
|
1: window.WebGLRenderingContext,
|
|
69
69
|
2: window.WebGL2RenderingContext
|
|
70
70
|
};
|
|
71
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
|
|
73
|
-
return
|
|
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
74
|
}
|
|
75
75
|
// @deprecated, r168
|
|
76
76
|
static isWebGLAvailable() {
|
|
@@ -86,7 +86,7 @@ class oe {
|
|
|
86
86
|
return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."), this.getErrorMessage(1);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const Re = Symbol("effectComposerPmndrs"), Lt = /* @__PURE__ */ c({
|
|
90
90
|
__name: "EffectComposerPmndrs",
|
|
91
91
|
props: {
|
|
92
92
|
enabled: { type: Boolean, default: !0 },
|
|
@@ -96,65 +96,65 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
96
96
|
resolutionScale: {},
|
|
97
97
|
autoClear: { type: Boolean, default: !0 },
|
|
98
98
|
multisampling: { default: 0 },
|
|
99
|
-
frameBufferType: { default:
|
|
99
|
+
frameBufferType: { default: w }
|
|
100
100
|
},
|
|
101
101
|
emits: ["render"],
|
|
102
|
-
setup(
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
normalBuffer:
|
|
109
|
-
resolutionScale:
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
const
|
|
113
|
-
depthBuffer:
|
|
114
|
-
stencilBuffer:
|
|
115
|
-
multisampling:
|
|
116
|
-
frameBufferType:
|
|
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
117
|
};
|
|
118
|
-
return
|
|
119
|
-
}),
|
|
120
|
-
var
|
|
121
|
-
!n.value && !
|
|
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
122
|
};
|
|
123
|
-
|
|
124
|
-
!l.width.value || !l.height.value ||
|
|
125
|
-
}),
|
|
126
|
-
!
|
|
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
127
|
}, {
|
|
128
128
|
immediate: !0
|
|
129
129
|
});
|
|
130
|
-
const { render:
|
|
131
|
-
return
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
n.value.autoClear =
|
|
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
135
|
}
|
|
136
|
-
|
|
137
|
-
}),
|
|
138
|
-
var
|
|
139
|
-
(
|
|
140
|
-
}), (
|
|
141
|
-
}
|
|
142
|
-
}),
|
|
143
|
-
const t =
|
|
144
|
-
e &&
|
|
145
|
-
!
|
|
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
146
|
});
|
|
147
|
-
const l =
|
|
148
|
-
!
|
|
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
149
|
});
|
|
150
|
-
return
|
|
151
|
-
var
|
|
152
|
-
|
|
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
153
|
}), {
|
|
154
|
-
pass:
|
|
154
|
+
pass: o,
|
|
155
155
|
effect: a
|
|
156
156
|
};
|
|
157
|
-
},
|
|
157
|
+
}, Ot = /* @__PURE__ */ c({
|
|
158
158
|
__name: "BloomPmndrs",
|
|
159
159
|
props: {
|
|
160
160
|
blendFunction: {},
|
|
@@ -164,9 +164,9 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
164
164
|
luminanceSmoothing: {},
|
|
165
165
|
mipmapBlur: { type: Boolean, default: void 0 }
|
|
166
166
|
},
|
|
167
|
-
setup(
|
|
168
|
-
const t =
|
|
169
|
-
return e({ pass:
|
|
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
170
|
[
|
|
171
171
|
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
172
172
|
[() => t.intensity, "intensity"],
|
|
@@ -175,11 +175,11 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
175
175
|
[() => t.luminanceThreshold, "luminanceMaterial.threshold"]
|
|
176
176
|
],
|
|
177
177
|
a,
|
|
178
|
-
() => new
|
|
178
|
+
() => new ae()
|
|
179
179
|
), () => {
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
}),
|
|
182
|
+
}), Rt = /* @__PURE__ */ c({
|
|
183
183
|
__name: "DepthOfFieldPmndrs",
|
|
184
184
|
props: {
|
|
185
185
|
blendFunction: {},
|
|
@@ -192,9 +192,9 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
192
192
|
resolutionX: {},
|
|
193
193
|
resolutionY: {}
|
|
194
194
|
},
|
|
195
|
-
setup(
|
|
196
|
-
const t =
|
|
197
|
-
return e({ pass: a, effect:
|
|
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
198
|
[
|
|
199
199
|
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
200
200
|
[() => t.worldFocusDistance, "circleOfConfusionMaterial.worldFocusDistance"],
|
|
@@ -206,12 +206,12 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
206
206
|
[() => t.resolutionX, "resolution.width"],
|
|
207
207
|
[() => t.resolutionY, "resolution.height"]
|
|
208
208
|
],
|
|
209
|
-
|
|
210
|
-
() => new
|
|
209
|
+
s,
|
|
210
|
+
() => new se()
|
|
211
211
|
), () => {
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
}),
|
|
214
|
+
}), Bt = /* @__PURE__ */ c({
|
|
215
215
|
__name: "GlitchPmndrs",
|
|
216
216
|
props: {
|
|
217
217
|
blendFunction: {},
|
|
@@ -226,43 +226,43 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
226
226
|
perturbationMap: {},
|
|
227
227
|
dtSize: {}
|
|
228
228
|
},
|
|
229
|
-
setup(
|
|
230
|
-
const t =
|
|
231
|
-
e({ pass:
|
|
232
|
-
const { onBeforeRender:
|
|
233
|
-
return
|
|
234
|
-
const
|
|
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
235
|
if (t.mode !== void 0)
|
|
236
|
-
return t.active === !1 ?
|
|
237
|
-
const n = new
|
|
236
|
+
return t.active === !1 ? Xe.DISABLED : t.mode;
|
|
237
|
+
const n = new Y(), l = n.mode;
|
|
238
238
|
return n.dispose(), l;
|
|
239
239
|
};
|
|
240
|
-
a.value && (a.value.mode =
|
|
241
|
-
}),
|
|
242
|
-
|
|
240
|
+
a.value && (a.value.mode = i());
|
|
241
|
+
}), U(
|
|
242
|
+
$(t, ["active", "mode", "blendFunction"]),
|
|
243
243
|
a,
|
|
244
|
-
() => new
|
|
244
|
+
() => new Y()
|
|
245
245
|
), () => {
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
|
-
}),
|
|
248
|
+
}), Nt = /* @__PURE__ */ c({
|
|
249
249
|
__name: "NoisePmndrs",
|
|
250
250
|
props: {
|
|
251
|
-
premultiply: { type: Boolean, default:
|
|
252
|
-
blendFunction: {
|
|
251
|
+
premultiply: { type: Boolean, default: void 0 },
|
|
252
|
+
blendFunction: {}
|
|
253
253
|
},
|
|
254
|
-
setup(
|
|
255
|
-
const t =
|
|
256
|
-
e({ pass:
|
|
257
|
-
const { onBeforeRender:
|
|
258
|
-
return
|
|
259
|
-
|
|
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
260
|
a,
|
|
261
|
-
() => new
|
|
261
|
+
() => new re()
|
|
262
262
|
), () => {
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
-
}),
|
|
265
|
+
}), zt = /* @__PURE__ */ c({
|
|
266
266
|
__name: "OutlinePmndrs",
|
|
267
267
|
props: {
|
|
268
268
|
outlinedObjects: {},
|
|
@@ -281,8 +281,8 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
281
281
|
hiddenEdgeColor: {},
|
|
282
282
|
visibleEdgeColor: {}
|
|
283
283
|
},
|
|
284
|
-
setup(
|
|
285
|
-
const t =
|
|
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
286
|
blur: t.blur,
|
|
287
287
|
xRay: t.xRay,
|
|
288
288
|
kernelSize: t.kernelSize,
|
|
@@ -295,25 +295,25 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
295
295
|
multisampling: t.multisampling,
|
|
296
296
|
patternTexture: t.patternTexture,
|
|
297
297
|
resolutionScale: t.resolutionScale,
|
|
298
|
-
hiddenEdgeColor:
|
|
299
|
-
visibleEdgeColor:
|
|
300
|
-
}, { pass: n, effect: l } =
|
|
301
|
-
e({ pass: n, effect: l }),
|
|
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
302
|
[() => t.outlinedObjects, l],
|
|
303
303
|
// watchEffect is intentionally not used here as it would result in an endless loop
|
|
304
304
|
() => {
|
|
305
|
-
var
|
|
306
|
-
(
|
|
305
|
+
var u;
|
|
306
|
+
(u = l.value) == null || u.selection.set(t.outlinedObjects || []);
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
immediate: !0
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
|
-
const
|
|
313
|
-
hiddenEdgeColor: t.hiddenEdgeColor ?
|
|
314
|
-
visibleEdgeColor: t.visibleEdgeColor ?
|
|
312
|
+
const x = F(() => ({
|
|
313
|
+
hiddenEdgeColor: t.hiddenEdgeColor ? K(t.hiddenEdgeColor) : void 0,
|
|
314
|
+
visibleEdgeColor: t.visibleEdgeColor ? K(t.visibleEdgeColor) : void 0
|
|
315
315
|
}));
|
|
316
|
-
return
|
|
316
|
+
return g(
|
|
317
317
|
[
|
|
318
318
|
/* some properties are not updated because of different reasons:
|
|
319
319
|
resolutionX - has no setter in OutlineEffect
|
|
@@ -329,46 +329,732 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
329
329
|
[() => t.edgeStrength, "edgeStrength"],
|
|
330
330
|
[() => t.patternScale, "patternScale"],
|
|
331
331
|
[() => t.multisampling, "multisampling"],
|
|
332
|
-
[() =>
|
|
333
|
-
[() =>
|
|
332
|
+
[() => x.value.hiddenEdgeColor, "hiddenEdgeColor"],
|
|
333
|
+
[() => x.value.visibleEdgeColor, "visibleEdgeColor"]
|
|
334
334
|
],
|
|
335
335
|
l,
|
|
336
|
-
() => new
|
|
336
|
+
() => new ie()
|
|
337
337
|
), () => {
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
}),
|
|
340
|
+
}), Ft = /* @__PURE__ */ c({
|
|
341
341
|
__name: "PixelationPmndrs",
|
|
342
342
|
props: {
|
|
343
343
|
granularity: {}
|
|
344
344
|
},
|
|
345
|
-
setup(
|
|
346
|
-
const t =
|
|
347
|
-
return e({ pass:
|
|
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
348
|
t,
|
|
349
349
|
a,
|
|
350
|
-
() => new
|
|
350
|
+
() => new ne()
|
|
351
351
|
), () => {
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
}),
|
|
354
|
+
}), Wt = /* @__PURE__ */ c({
|
|
355
355
|
__name: "VignettePmndrs",
|
|
356
356
|
props: {
|
|
357
|
-
technique: {
|
|
358
|
-
blendFunction: {
|
|
359
|
-
offset: {
|
|
360
|
-
darkness: {
|
|
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: {}
|
|
361
1035
|
},
|
|
362
|
-
setup(
|
|
363
|
-
const t =
|
|
364
|
-
|
|
365
|
-
|
|
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
|
+
],
|
|
366
1052
|
a,
|
|
367
|
-
() => new
|
|
1053
|
+
() => new we()
|
|
368
1054
|
), () => {
|
|
369
1055
|
};
|
|
370
1056
|
}
|
|
371
|
-
}),
|
|
1057
|
+
}), Be = {
|
|
372
1058
|
name: "CopyShader",
|
|
373
1059
|
uniforms: {
|
|
374
1060
|
tDiffuse: { value: null },
|
|
@@ -406,7 +1092,7 @@ const ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
|
406
1092
|
}`
|
|
407
1093
|
)
|
|
408
1094
|
};
|
|
409
|
-
class
|
|
1095
|
+
class T {
|
|
410
1096
|
constructor() {
|
|
411
1097
|
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
412
1098
|
}
|
|
@@ -418,22 +1104,22 @@ class A {
|
|
|
418
1104
|
dispose() {
|
|
419
1105
|
}
|
|
420
1106
|
}
|
|
421
|
-
const
|
|
422
|
-
class
|
|
1107
|
+
const ht = new Ie(-1, 1, 1, -1, 0, 1);
|
|
1108
|
+
class pt extends je {
|
|
423
1109
|
constructor() {
|
|
424
|
-
super(), this.setAttribute("position", new
|
|
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));
|
|
425
1111
|
}
|
|
426
1112
|
}
|
|
427
|
-
const
|
|
428
|
-
class
|
|
1113
|
+
const mt = new pt();
|
|
1114
|
+
class L {
|
|
429
1115
|
constructor(e) {
|
|
430
|
-
this._mesh = new
|
|
1116
|
+
this._mesh = new Ve(mt, e);
|
|
431
1117
|
}
|
|
432
1118
|
dispose() {
|
|
433
1119
|
this._mesh.geometry.dispose();
|
|
434
1120
|
}
|
|
435
1121
|
render(e) {
|
|
436
|
-
e.render(this._mesh,
|
|
1122
|
+
e.render(this._mesh, ht);
|
|
437
1123
|
}
|
|
438
1124
|
get material() {
|
|
439
1125
|
return this._mesh.material;
|
|
@@ -442,35 +1128,35 @@ class C {
|
|
|
442
1128
|
this._mesh.material = e;
|
|
443
1129
|
}
|
|
444
1130
|
}
|
|
445
|
-
class
|
|
1131
|
+
class gt extends T {
|
|
446
1132
|
constructor(e, t) {
|
|
447
|
-
super(), this.textureID = t !== void 0 ? t : "tDiffuse", e instanceof
|
|
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({
|
|
448
1134
|
name: e.name !== void 0 ? e.name : "unspecified",
|
|
449
1135
|
defines: Object.assign({}, e.defines),
|
|
450
1136
|
uniforms: this.uniforms,
|
|
451
1137
|
vertexShader: e.vertexShader,
|
|
452
1138
|
fragmentShader: e.fragmentShader
|
|
453
|
-
})), this.fsQuad = new
|
|
1139
|
+
})), this.fsQuad = new L(this.material);
|
|
454
1140
|
}
|
|
455
|
-
render(e, t,
|
|
456
|
-
this.uniforms[this.textureID] && (this.uniforms[this.textureID].value =
|
|
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));
|
|
457
1143
|
}
|
|
458
1144
|
dispose() {
|
|
459
1145
|
this.material.dispose(), this.fsQuad.dispose();
|
|
460
1146
|
}
|
|
461
1147
|
}
|
|
462
|
-
class
|
|
1148
|
+
class Te extends T {
|
|
463
1149
|
constructor(e, t) {
|
|
464
1150
|
super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
|
|
465
1151
|
}
|
|
466
|
-
render(e, t,
|
|
467
|
-
const a = e.getContext(),
|
|
468
|
-
|
|
469
|
-
let
|
|
470
|
-
this.inverse ? (
|
|
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);
|
|
471
1157
|
}
|
|
472
1158
|
}
|
|
473
|
-
class
|
|
1159
|
+
class vt extends T {
|
|
474
1160
|
constructor() {
|
|
475
1161
|
super(), this.needsSwap = !1;
|
|
476
1162
|
}
|
|
@@ -478,14 +1164,14 @@ class st extends A {
|
|
|
478
1164
|
e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
|
|
479
1165
|
}
|
|
480
1166
|
}
|
|
481
|
-
class
|
|
1167
|
+
class xt {
|
|
482
1168
|
constructor(e, t) {
|
|
483
1169
|
if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
|
|
484
|
-
const
|
|
485
|
-
this._width =
|
|
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";
|
|
486
1172
|
} else
|
|
487
1173
|
this._width = t.width, this._height = t.height;
|
|
488
|
-
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
|
|
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();
|
|
489
1175
|
}
|
|
490
1176
|
swapBuffers() {
|
|
491
1177
|
const e = this.readBuffer;
|
|
@@ -510,35 +1196,35 @@ class at {
|
|
|
510
1196
|
render(e) {
|
|
511
1197
|
e === void 0 && (e = this.clock.getDelta());
|
|
512
1198
|
const t = this.renderer.getRenderTarget();
|
|
513
|
-
let
|
|
514
|
-
for (let a = 0,
|
|
515
|
-
const
|
|
516
|
-
if (
|
|
517
|
-
if (
|
|
518
|
-
if (
|
|
1199
|
+
let o = !1;
|
|
1200
|
+
for (let a = 0, s = this.passes.length; a < s; a++) {
|
|
1201
|
+
const i = this.passes[a];
|
|
1202
|
+
if (i.enabled !== !1) {
|
|
1203
|
+
if (i.renderToScreen = this.renderToScreen && this.isLastEnabledPass(a), i.render(this.renderer, this.writeBuffer, this.readBuffer, e, o), i.needsSwap) {
|
|
1204
|
+
if (o) {
|
|
519
1205
|
const n = this.renderer.getContext(), l = this.renderer.state.buffers.stencil;
|
|
520
1206
|
l.setFunc(n.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), l.setFunc(n.EQUAL, 1, 4294967295);
|
|
521
1207
|
}
|
|
522
1208
|
this.swapBuffers();
|
|
523
1209
|
}
|
|
524
|
-
|
|
1210
|
+
Te !== void 0 && (i instanceof Te ? o = !0 : i instanceof vt && (o = !1));
|
|
525
1211
|
}
|
|
526
1212
|
}
|
|
527
1213
|
this.renderer.setRenderTarget(t);
|
|
528
1214
|
}
|
|
529
1215
|
reset(e) {
|
|
530
1216
|
if (e === void 0) {
|
|
531
|
-
const t = this.renderer.getSize(new
|
|
1217
|
+
const t = this.renderer.getSize(new d());
|
|
532
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);
|
|
533
1219
|
}
|
|
534
1220
|
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
|
|
535
1221
|
}
|
|
536
1222
|
setSize(e, t) {
|
|
537
1223
|
this._width = e, this._height = t;
|
|
538
|
-
const
|
|
539
|
-
this.renderTarget1.setSize(
|
|
540
|
-
for (let
|
|
541
|
-
this.passes[
|
|
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);
|
|
542
1228
|
}
|
|
543
1229
|
setPixelRatio(e) {
|
|
544
1230
|
this._pixelRatio = e, this.setSize(this._width, this._height);
|
|
@@ -547,61 +1233,61 @@ class at {
|
|
|
547
1233
|
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
|
|
548
1234
|
}
|
|
549
1235
|
}
|
|
550
|
-
class
|
|
551
|
-
constructor(e, t,
|
|
552
|
-
super(), this.scene = e, this.camera = t, this.overrideMaterial =
|
|
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();
|
|
553
1239
|
}
|
|
554
|
-
render(e, t,
|
|
1240
|
+
render(e, t, o) {
|
|
555
1241
|
const a = e.autoClear;
|
|
556
1242
|
e.autoClear = !1;
|
|
557
|
-
let
|
|
558
|
-
this.overrideMaterial !== null && (
|
|
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;
|
|
559
1245
|
}
|
|
560
1246
|
}
|
|
561
|
-
const
|
|
1247
|
+
const Ne = Symbol("effectComposerThree"), Zt = /* @__PURE__ */ c({
|
|
562
1248
|
__name: "EffectComposer",
|
|
563
1249
|
props: {
|
|
564
1250
|
enabled: { type: Boolean, default: !0 },
|
|
565
1251
|
withoutRenderPass: { type: Boolean }
|
|
566
1252
|
},
|
|
567
|
-
setup(
|
|
568
|
-
const t =
|
|
569
|
-
|
|
570
|
-
const { renderer: a, sizes:
|
|
571
|
-
|
|
572
|
-
var
|
|
573
|
-
(
|
|
574
|
-
}),
|
|
575
|
-
var
|
|
576
|
-
const { width:
|
|
577
|
-
|
|
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));
|
|
578
1264
|
});
|
|
579
|
-
const { pixelRatio:
|
|
580
|
-
|
|
581
|
-
var
|
|
582
|
-
(
|
|
583
|
-
}), t.withoutRenderPass ||
|
|
584
|
-
n.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));
|
|
585
1271
|
});
|
|
586
|
-
const { render:
|
|
587
|
-
return
|
|
588
|
-
l.frames.value > 0 &&
|
|
589
|
-
}),
|
|
590
|
-
var
|
|
591
|
-
(
|
|
592
|
-
}), (
|
|
593
|
-
}
|
|
594
|
-
}),
|
|
595
|
-
const t =
|
|
596
|
-
e &&
|
|
597
|
-
const
|
|
598
|
-
!(t != null && t.value) || !a.height.value || !a.width.value || (t.value.addPass(
|
|
1272
|
+
const { render: p } = W();
|
|
1273
|
+
return p(() => {
|
|
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()));
|
|
599
1285
|
});
|
|
600
|
-
return
|
|
1286
|
+
return V(() => {
|
|
601
1287
|
var n;
|
|
602
|
-
(n = t == null ? void 0 : t.value) == null || n.removePass(
|
|
603
|
-
}), { pass:
|
|
604
|
-
},
|
|
1288
|
+
(n = t == null ? void 0 : t.value) == null || n.removePass(o.value), o.value.dispose();
|
|
1289
|
+
}), { pass: o };
|
|
1290
|
+
}, St = {
|
|
605
1291
|
uniforms: {
|
|
606
1292
|
tDiffuse: { value: null },
|
|
607
1293
|
//diffuse texture
|
|
@@ -696,53 +1382,53 @@ const be = Symbol("effectComposerThree"), wt = /* @__PURE__ */ p({
|
|
|
696
1382
|
}`
|
|
697
1383
|
)
|
|
698
1384
|
};
|
|
699
|
-
class
|
|
1385
|
+
class ye extends T {
|
|
700
1386
|
constructor(e = 64) {
|
|
701
1387
|
super();
|
|
702
|
-
const t =
|
|
703
|
-
this.uniforms =
|
|
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({
|
|
704
1390
|
uniforms: this.uniforms,
|
|
705
1391
|
vertexShader: t.vertexShader,
|
|
706
1392
|
fragmentShader: t.fragmentShader
|
|
707
|
-
}), this.fsQuad = new
|
|
1393
|
+
}), this.fsQuad = new L(this.material), this.goWild = !1, this.curF = 0, this.generateTrigger();
|
|
708
1394
|
}
|
|
709
|
-
render(e, t,
|
|
710
|
-
this.uniforms.tDiffuse.value =
|
|
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));
|
|
711
1397
|
}
|
|
712
1398
|
generateTrigger() {
|
|
713
|
-
this.randX =
|
|
1399
|
+
this.randX = b.randInt(120, 240);
|
|
714
1400
|
}
|
|
715
1401
|
generateHeightmap(e) {
|
|
716
|
-
const t = new Float32Array(e * e),
|
|
717
|
-
for (let
|
|
718
|
-
const
|
|
719
|
-
t[
|
|
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;
|
|
720
1406
|
}
|
|
721
|
-
const a = new
|
|
1407
|
+
const a = new ke(t, e, e, Qe, Ke);
|
|
722
1408
|
return a.needsUpdate = !0, a;
|
|
723
1409
|
}
|
|
724
1410
|
dispose() {
|
|
725
1411
|
this.material.dispose(), this.heightMap.dispose(), this.fsQuad.dispose();
|
|
726
1412
|
}
|
|
727
1413
|
}
|
|
728
|
-
const
|
|
1414
|
+
const _t = /* @__PURE__ */ c({
|
|
729
1415
|
__name: "Glitch",
|
|
730
1416
|
props: {
|
|
731
1417
|
dtSize: {},
|
|
732
1418
|
goWild: { type: Boolean }
|
|
733
1419
|
},
|
|
734
|
-
setup(
|
|
735
|
-
const t =
|
|
736
|
-
e({ pass:
|
|
737
|
-
const { onBeforeRender: a } =
|
|
738
|
-
return a(({ invalidate:
|
|
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(
|
|
739
1425
|
[[() => t.goWild, "goWild"]],
|
|
740
|
-
|
|
741
|
-
() => new
|
|
1426
|
+
o,
|
|
1427
|
+
() => new ye()
|
|
742
1428
|
), () => {
|
|
743
1429
|
};
|
|
744
1430
|
}
|
|
745
|
-
}),
|
|
1431
|
+
}), I = {
|
|
746
1432
|
name: "HalftoneShader",
|
|
747
1433
|
uniforms: {
|
|
748
1434
|
tDiffuse: { value: null },
|
|
@@ -1046,19 +1732,19 @@ const Mt = /* @__PURE__ */ p({
|
|
|
1046
1732
|
}`
|
|
1047
1733
|
)
|
|
1048
1734
|
};
|
|
1049
|
-
class
|
|
1050
|
-
constructor(e, t,
|
|
1051
|
-
super(), this.uniforms =
|
|
1735
|
+
class At extends T {
|
|
1736
|
+
constructor(e, t, o) {
|
|
1737
|
+
super(), this.uniforms = M.clone(I.uniforms), this.material = new S({
|
|
1052
1738
|
uniforms: this.uniforms,
|
|
1053
|
-
fragmentShader:
|
|
1054
|
-
vertexShader:
|
|
1739
|
+
fragmentShader: I.fragmentShader,
|
|
1740
|
+
vertexShader: I.vertexShader
|
|
1055
1741
|
}), this.uniforms.width.value = e, this.uniforms.height.value = t;
|
|
1056
|
-
for (const a in
|
|
1057
|
-
|
|
1058
|
-
this.fsQuad = new
|
|
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);
|
|
1059
1745
|
}
|
|
1060
|
-
render(e, t,
|
|
1061
|
-
this.material.uniforms.tDiffuse.value =
|
|
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));
|
|
1062
1748
|
}
|
|
1063
1749
|
setSize(e, t) {
|
|
1064
1750
|
this.uniforms.width.value = e, this.uniforms.height.value = t;
|
|
@@ -1067,7 +1753,7 @@ class it extends A {
|
|
|
1067
1753
|
this.material.dispose(), this.fsQuad.dispose();
|
|
1068
1754
|
}
|
|
1069
1755
|
}
|
|
1070
|
-
const
|
|
1756
|
+
const $t = /* @__PURE__ */ c({
|
|
1071
1757
|
__name: "Halftone",
|
|
1072
1758
|
props: {
|
|
1073
1759
|
shape: {},
|
|
@@ -1080,55 +1766,55 @@ const yt = /* @__PURE__ */ p({
|
|
|
1080
1766
|
greyscale: { type: Boolean },
|
|
1081
1767
|
blendingMode: {}
|
|
1082
1768
|
},
|
|
1083
|
-
setup(
|
|
1084
|
-
const t =
|
|
1769
|
+
setup(r, { expose: e }) {
|
|
1770
|
+
const t = r, { sizes: o } = A(), a = F(
|
|
1085
1771
|
() => Object.fromEntries(
|
|
1086
|
-
Object.entries(t).filter(([
|
|
1772
|
+
Object.entries(t).filter(([i, n]) => n !== void 0)
|
|
1087
1773
|
)
|
|
1088
|
-
), { pass:
|
|
1089
|
-
|
|
1090
|
-
|
|
1774
|
+
), { pass: s } = B(() => new At(
|
|
1775
|
+
o.width.value,
|
|
1776
|
+
o.height.value,
|
|
1091
1777
|
a.value
|
|
1092
1778
|
), t);
|
|
1093
|
-
return e({ pass:
|
|
1094
|
-
|
|
1095
|
-
}),
|
|
1096
|
-
Object.entries(t).forEach(([
|
|
1097
|
-
|
|
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);
|
|
1098
1784
|
});
|
|
1099
1785
|
}), () => {
|
|
1100
1786
|
};
|
|
1101
1787
|
}
|
|
1102
1788
|
});
|
|
1103
|
-
class
|
|
1104
|
-
constructor(e, t,
|
|
1105
|
-
super(), this.pixelSize = e, this.resolution = new
|
|
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;
|
|
1106
1792
|
}
|
|
1107
1793
|
dispose() {
|
|
1108
1794
|
this.beautyRenderTarget.dispose(), this.normalRenderTarget.dispose(), this.pixelatedMaterial.dispose(), this.normalMaterial.dispose(), this.fsQuad.dispose();
|
|
1109
1795
|
}
|
|
1110
1796
|
setSize(e, t) {
|
|
1111
1797
|
this.resolution.set(e, t), this.renderResolution.set(e / this.pixelSize | 0, t / this.pixelSize | 0);
|
|
1112
|
-
const { x:
|
|
1113
|
-
this.beautyRenderTarget.setSize(
|
|
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);
|
|
1114
1800
|
}
|
|
1115
1801
|
setPixelSize(e) {
|
|
1116
1802
|
this.pixelSize = e, this.setSize(this.resolution.x, this.resolution.y);
|
|
1117
1803
|
}
|
|
1118
1804
|
render(e, t) {
|
|
1119
|
-
const
|
|
1120
|
-
|
|
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);
|
|
1121
1807
|
const a = this.scene.overrideMaterial;
|
|
1122
|
-
e.setRenderTarget(this.normalRenderTarget), this.scene.overrideMaterial = this.normalMaterial, e.render(this.scene, this.camera), this.scene.overrideMaterial = a,
|
|
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);
|
|
1123
1809
|
}
|
|
1124
1810
|
createPixelatedMaterial() {
|
|
1125
|
-
return new
|
|
1811
|
+
return new S({
|
|
1126
1812
|
uniforms: {
|
|
1127
1813
|
tDiffuse: { value: null },
|
|
1128
1814
|
tDepth: { value: null },
|
|
1129
1815
|
tNormal: { value: null },
|
|
1130
1816
|
resolution: {
|
|
1131
|
-
value: new
|
|
1817
|
+
value: new _e(
|
|
1132
1818
|
this.renderResolution.x,
|
|
1133
1819
|
this.renderResolution.y,
|
|
1134
1820
|
1 / this.renderResolution.x,
|
|
@@ -1247,28 +1933,28 @@ class le extends A {
|
|
|
1247
1933
|
});
|
|
1248
1934
|
}
|
|
1249
1935
|
}
|
|
1250
|
-
const
|
|
1936
|
+
const eo = /* @__PURE__ */ c({
|
|
1251
1937
|
__name: "Pixelation",
|
|
1252
1938
|
props: {
|
|
1253
1939
|
pixelSize: {},
|
|
1254
1940
|
depthEdgeStrength: {},
|
|
1255
1941
|
normalEdgeStrength: {}
|
|
1256
1942
|
},
|
|
1257
|
-
setup(
|
|
1258
|
-
const t =
|
|
1259
|
-
return e({ pass:
|
|
1260
|
-
|
|
1261
|
-
}),
|
|
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(
|
|
1262
1948
|
[
|
|
1263
1949
|
[() => t.depthEdgeStrength, "depthEdgeStrength"],
|
|
1264
1950
|
[() => t.normalEdgeStrength, "normalEdgeStrength"]
|
|
1265
1951
|
],
|
|
1266
|
-
|
|
1267
|
-
() => new
|
|
1952
|
+
s,
|
|
1953
|
+
() => new Me(1, o.value, a.value)
|
|
1268
1954
|
), () => {
|
|
1269
1955
|
};
|
|
1270
1956
|
}
|
|
1271
|
-
}),
|
|
1957
|
+
}), wt = {
|
|
1272
1958
|
name: "OutputShader",
|
|
1273
1959
|
uniforms: {
|
|
1274
1960
|
tDiffuse: { value: null },
|
|
@@ -1350,39 +2036,39 @@ const Ct = /* @__PURE__ */ p({
|
|
|
1350
2036
|
}`
|
|
1351
2037
|
)
|
|
1352
2038
|
};
|
|
1353
|
-
class
|
|
2039
|
+
class Tt extends T {
|
|
1354
2040
|
constructor() {
|
|
1355
2041
|
super();
|
|
1356
|
-
const e =
|
|
1357
|
-
this.uniforms =
|
|
2042
|
+
const e = wt;
|
|
2043
|
+
this.uniforms = M.clone(e.uniforms), this.material = new $e({
|
|
1358
2044
|
name: e.name,
|
|
1359
2045
|
uniforms: this.uniforms,
|
|
1360
2046
|
vertexShader: e.vertexShader,
|
|
1361
2047
|
fragmentShader: e.fragmentShader
|
|
1362
|
-
}), this.fsQuad = new
|
|
2048
|
+
}), this.fsQuad = new L(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
1363
2049
|
}
|
|
1364
|
-
render(e, t,
|
|
1365
|
-
this.uniforms.tDiffuse.value =
|
|
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));
|
|
1366
2052
|
}
|
|
1367
2053
|
dispose() {
|
|
1368
2054
|
this.material.dispose(), this.fsQuad.dispose();
|
|
1369
2055
|
}
|
|
1370
2056
|
}
|
|
1371
|
-
const
|
|
2057
|
+
const to = /* @__PURE__ */ c({
|
|
1372
2058
|
__name: "Output",
|
|
1373
|
-
setup(
|
|
1374
|
-
const { pass: t } =
|
|
2059
|
+
setup(r, { expose: e }) {
|
|
2060
|
+
const { pass: t } = B(() => new Tt());
|
|
1375
2061
|
return e({ pass: t }), () => {
|
|
1376
2062
|
};
|
|
1377
2063
|
}
|
|
1378
|
-
}),
|
|
2064
|
+
}), G = {
|
|
1379
2065
|
name: "SMAAEdgesShader",
|
|
1380
2066
|
defines: {
|
|
1381
2067
|
SMAA_THRESHOLD: "0.1"
|
|
1382
2068
|
},
|
|
1383
2069
|
uniforms: {
|
|
1384
2070
|
tDiffuse: { value: null },
|
|
1385
|
-
resolution: { value: new
|
|
2071
|
+
resolution: { value: new d(1 / 1024, 1 / 512) }
|
|
1386
2072
|
},
|
|
1387
2073
|
vertexShader: (
|
|
1388
2074
|
/* glsl */
|
|
@@ -1476,7 +2162,7 @@ const Et = /* @__PURE__ */ p({
|
|
|
1476
2162
|
|
|
1477
2163
|
}`
|
|
1478
2164
|
)
|
|
1479
|
-
},
|
|
2165
|
+
}, X = {
|
|
1480
2166
|
name: "SMAAWeightsShader",
|
|
1481
2167
|
defines: {
|
|
1482
2168
|
SMAA_MAX_SEARCH_STEPS: "8",
|
|
@@ -1488,7 +2174,7 @@ const Et = /* @__PURE__ */ p({
|
|
|
1488
2174
|
tDiffuse: { value: null },
|
|
1489
2175
|
tArea: { value: null },
|
|
1490
2176
|
tSearch: { value: null },
|
|
1491
|
-
resolution: { value: new
|
|
2177
|
+
resolution: { value: new d(1 / 1024, 1 / 512) }
|
|
1492
2178
|
},
|
|
1493
2179
|
vertexShader: (
|
|
1494
2180
|
/* glsl */
|
|
@@ -1726,12 +2412,12 @@ const Et = /* @__PURE__ */ p({
|
|
|
1726
2412
|
|
|
1727
2413
|
}`
|
|
1728
2414
|
)
|
|
1729
|
-
},
|
|
2415
|
+
}, J = {
|
|
1730
2416
|
name: "SMAABlendShader",
|
|
1731
2417
|
uniforms: {
|
|
1732
2418
|
tDiffuse: { value: null },
|
|
1733
2419
|
tColor: { value: null },
|
|
1734
|
-
resolution: { value: new
|
|
2420
|
+
resolution: { value: new d(1 / 1024, 1 / 512) }
|
|
1735
2421
|
},
|
|
1736
2422
|
vertexShader: (
|
|
1737
2423
|
/* glsl */
|
|
@@ -1816,40 +2502,40 @@ const Et = /* @__PURE__ */ p({
|
|
|
1816
2502
|
}`
|
|
1817
2503
|
)
|
|
1818
2504
|
};
|
|
1819
|
-
class
|
|
2505
|
+
class yt extends T {
|
|
1820
2506
|
constructor(e, t) {
|
|
1821
|
-
super(), this.edgesRT = new
|
|
2507
|
+
super(), this.edgesRT = new D(e, t, {
|
|
1822
2508
|
depthBuffer: !1,
|
|
1823
|
-
type:
|
|
1824
|
-
}), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new
|
|
2509
|
+
type: w
|
|
2510
|
+
}), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new D(e, t, {
|
|
1825
2511
|
depthBuffer: !1,
|
|
1826
|
-
type:
|
|
2512
|
+
type: w
|
|
1827
2513
|
}), this.weightsRT.texture.name = "SMAAPass.weights";
|
|
1828
|
-
const
|
|
2514
|
+
const o = this, a = new Image();
|
|
1829
2515
|
a.src = this.getAreaTexture(), a.onload = function() {
|
|
1830
|
-
|
|
1831
|
-
}, this.areaTexture = new
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
}, this.searchTexture = new
|
|
1836
|
-
defines: Object.assign({},
|
|
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),
|
|
1837
2523
|
uniforms: this.uniformsEdges,
|
|
1838
|
-
vertexShader:
|
|
1839
|
-
fragmentShader:
|
|
1840
|
-
}), this.uniformsWeights =
|
|
1841
|
-
defines: Object.assign({},
|
|
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),
|
|
1842
2528
|
uniforms: this.uniformsWeights,
|
|
1843
|
-
vertexShader:
|
|
1844
|
-
fragmentShader:
|
|
1845
|
-
}), this.uniformsBlend =
|
|
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({
|
|
1846
2532
|
uniforms: this.uniformsBlend,
|
|
1847
|
-
vertexShader:
|
|
1848
|
-
fragmentShader:
|
|
1849
|
-
}), this.fsQuad = new
|
|
2533
|
+
vertexShader: J.vertexShader,
|
|
2534
|
+
fragmentShader: J.fragmentShader
|
|
2535
|
+
}), this.fsQuad = new L(null);
|
|
1850
2536
|
}
|
|
1851
|
-
render(e, t,
|
|
1852
|
-
this.uniformsEdges.tDiffuse.value =
|
|
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));
|
|
1853
2539
|
}
|
|
1854
2540
|
setSize(e, t) {
|
|
1855
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);
|
|
@@ -1864,27 +2550,27 @@ class dt extends A {
|
|
|
1864
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();
|
|
1865
2551
|
}
|
|
1866
2552
|
}
|
|
1867
|
-
const
|
|
2553
|
+
const oo = /* @__PURE__ */ c({
|
|
1868
2554
|
__name: "SMAA",
|
|
1869
2555
|
props: {
|
|
1870
2556
|
width: {},
|
|
1871
2557
|
height: {}
|
|
1872
2558
|
},
|
|
1873
|
-
setup(
|
|
1874
|
-
const t =
|
|
1875
|
-
return e({ pass: n }),
|
|
1876
|
-
n.value.setSize(
|
|
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);
|
|
1877
2563
|
}), () => {
|
|
1878
2564
|
};
|
|
1879
2565
|
}
|
|
1880
|
-
}),
|
|
2566
|
+
}), ze = {
|
|
1881
2567
|
name: "LuminosityHighPassShader",
|
|
1882
2568
|
shaderID: "luminosityHighPass",
|
|
1883
2569
|
uniforms: {
|
|
1884
2570
|
tDiffuse: { value: null },
|
|
1885
2571
|
luminosityThreshold: { value: 1 },
|
|
1886
2572
|
smoothWidth: { value: 1 },
|
|
1887
|
-
defaultColor: { value: new
|
|
2573
|
+
defaultColor: { value: new j(0) },
|
|
1888
2574
|
defaultOpacity: { value: 0 }
|
|
1889
2575
|
},
|
|
1890
2576
|
vertexShader: (
|
|
@@ -1928,40 +2614,40 @@ const Dt = /* @__PURE__ */ p({
|
|
|
1928
2614
|
}`
|
|
1929
2615
|
)
|
|
1930
2616
|
};
|
|
1931
|
-
class
|
|
1932
|
-
constructor(e, t,
|
|
1933
|
-
super(), this.strength = t !== void 0 ? t : 1, this.radius =
|
|
1934
|
-
let
|
|
1935
|
-
this.renderTargetBright = new
|
|
1936
|
-
for (let
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
const
|
|
1940
|
-
|
|
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;
|
|
2622
|
+
for (let p = 0; p < this.nMips; p++) {
|
|
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);
|
|
1941
2627
|
}
|
|
1942
|
-
const n =
|
|
1943
|
-
this.highPassUniforms =
|
|
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({
|
|
1944
2630
|
uniforms: this.highPassUniforms,
|
|
1945
2631
|
vertexShader: n.vertexShader,
|
|
1946
2632
|
fragmentShader: n.fragmentShader
|
|
1947
2633
|
}), this.separableBlurMaterials = [];
|
|
1948
2634
|
const l = [3, 5, 7, 9, 11];
|
|
1949
|
-
|
|
1950
|
-
for (let
|
|
1951
|
-
this.separableBlurMaterials.push(this.getSeparableBlurMaterial(l[
|
|
2635
|
+
s = Math.round(this.resolution.x / 2), i = Math.round(this.resolution.y / 2);
|
|
2636
|
+
for (let p = 0; p < this.nMips; p++)
|
|
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);
|
|
1952
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;
|
|
1953
|
-
const
|
|
1954
|
-
this.compositeMaterial.uniforms.bloomFactors.value =
|
|
1955
|
-
const
|
|
1956
|
-
this.copyUniforms =
|
|
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({
|
|
1957
2643
|
uniforms: this.copyUniforms,
|
|
1958
|
-
vertexShader:
|
|
1959
|
-
fragmentShader:
|
|
1960
|
-
blending:
|
|
2644
|
+
vertexShader: u.vertexShader,
|
|
2645
|
+
fragmentShader: u.fragmentShader,
|
|
2646
|
+
blending: ut,
|
|
1961
2647
|
depthTest: !1,
|
|
1962
2648
|
depthWrite: !1,
|
|
1963
2649
|
transparent: !0
|
|
1964
|
-
}), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new
|
|
2650
|
+
}), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new j(), this.oldClearAlpha = 1, this.basic = new ct(), this.fsQuad = new L(null);
|
|
1965
2651
|
}
|
|
1966
2652
|
dispose() {
|
|
1967
2653
|
for (let e = 0; e < this.renderTargetsHorizontal.length; e++)
|
|
@@ -1974,33 +2660,33 @@ class L extends A {
|
|
|
1974
2660
|
this.compositeMaterial.dispose(), this.blendMaterial.dispose(), this.basic.dispose(), this.fsQuad.dispose();
|
|
1975
2661
|
}
|
|
1976
2662
|
setSize(e, t) {
|
|
1977
|
-
let
|
|
1978
|
-
this.renderTargetBright.setSize(
|
|
1979
|
-
for (let
|
|
1980
|
-
this.renderTargetsHorizontal[
|
|
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);
|
|
1981
2667
|
}
|
|
1982
|
-
render(e, t,
|
|
2668
|
+
render(e, t, o, a, s) {
|
|
1983
2669
|
e.getClearColor(this._oldClearColor), this.oldClearAlpha = e.getClearAlpha();
|
|
1984
|
-
const
|
|
1985
|
-
e.autoClear = !1, e.setClearColor(this.clearColor, 0),
|
|
2670
|
+
const i = e.autoClear;
|
|
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);
|
|
1986
2672
|
let n = this.renderTargetBright;
|
|
1987
2673
|
for (let l = 0; l < this.nMips; l++)
|
|
1988
|
-
this.fsQuad.material = this.separableBlurMaterials[l], this.separableBlurMaterials[l].uniforms.colorTexture.value = n.texture, this.separableBlurMaterials[l].uniforms.direction.value =
|
|
1989
|
-
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,
|
|
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;
|
|
1990
2676
|
}
|
|
1991
2677
|
getSeparableBlurMaterial(e) {
|
|
1992
2678
|
const t = [];
|
|
1993
|
-
for (let
|
|
1994
|
-
t.push(0.39894 * Math.exp(-0.5 *
|
|
1995
|
-
return new
|
|
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({
|
|
1996
2682
|
defines: {
|
|
1997
2683
|
KERNEL_RADIUS: e
|
|
1998
2684
|
},
|
|
1999
2685
|
uniforms: {
|
|
2000
2686
|
colorTexture: { value: null },
|
|
2001
|
-
invSize: { value: new
|
|
2687
|
+
invSize: { value: new d(0.5, 0.5) },
|
|
2002
2688
|
// inverse texture size
|
|
2003
|
-
direction: { value: new
|
|
2689
|
+
direction: { value: new d(0.5, 0.5) },
|
|
2004
2690
|
gaussianCoefficients: { value: t }
|
|
2005
2691
|
// precomputed Gaussian coefficients
|
|
2006
2692
|
},
|
|
@@ -2033,7 +2719,7 @@ class L extends A {
|
|
|
2033
2719
|
});
|
|
2034
2720
|
}
|
|
2035
2721
|
getCompositeMaterial(e) {
|
|
2036
|
-
return new
|
|
2722
|
+
return new S({
|
|
2037
2723
|
defines: {
|
|
2038
2724
|
NUM_MIPS: e
|
|
2039
2725
|
},
|
|
@@ -2079,51 +2765,64 @@ class L extends A {
|
|
|
2079
2765
|
});
|
|
2080
2766
|
}
|
|
2081
2767
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
const
|
|
2768
|
+
R.BlurDirectionX = new d(1, 0);
|
|
2769
|
+
R.BlurDirectionY = new d(0, 1);
|
|
2770
|
+
const ao = /* @__PURE__ */ c({
|
|
2085
2771
|
__name: "UnrealBloom",
|
|
2086
2772
|
props: {
|
|
2087
2773
|
radius: { default: 0 },
|
|
2088
2774
|
strength: { default: 1 },
|
|
2089
2775
|
threshold: { default: 0 }
|
|
2090
2776
|
},
|
|
2091
|
-
setup(
|
|
2092
|
-
const t =
|
|
2093
|
-
new
|
|
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),
|
|
2094
2780
|
t.radius,
|
|
2095
2781
|
t.strength,
|
|
2096
2782
|
t.threshold
|
|
2097
2783
|
), t);
|
|
2098
|
-
return e({ pass: a }),
|
|
2099
|
-
var
|
|
2100
|
-
a.value.radius = t.radius ?? ((
|
|
2101
|
-
}),
|
|
2102
|
-
var
|
|
2103
|
-
a.value.strength = t.strength ?? ((
|
|
2104
|
-
}),
|
|
2105
|
-
var
|
|
2106
|
-
a.value.threshold = t.threshold ?? ((
|
|
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;
|
|
2107
2793
|
}), () => {
|
|
2108
2794
|
};
|
|
2109
2795
|
}
|
|
2110
2796
|
});
|
|
2111
2797
|
export {
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
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
|
|
2129
2828
|
};
|