@tresjs/post-processing 1.0.0 → 2.0.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/{Bloom.vue.d.ts → BloomPmndrs.vue.d.ts} +8 -8
- package/dist/core/pmndrs/{DepthOfField.vue.d.ts → DepthOfFieldPmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{EffectComposer.vue.d.ts → EffectComposerPmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{Glitch.vue.d.ts → GlitchPmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{Noise.vue.d.ts → NoisePmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{Outline.vue.d.ts → OutlinePmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{Pixelation.vue.d.ts → PixelationPmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/{Vignette.vue.d.ts → VignettePmndrs.vue.d.ts} +3 -3
- package/dist/core/pmndrs/composables/{useEffect.d.ts → useEffectPmndrs.d.ts} +1 -1
- package/dist/core/pmndrs/index.d.ts +10 -10
- package/dist/core/three/UnrealBloom.vue.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/tres-post-processing.d.ts +2 -0
- package/dist/{three.js → tres-post-processing.js} +572 -205
- package/dist/tres-post-processing.umd.cjs +1009 -0
- package/package.json +18 -21
- package/dist/pmndrs.d.ts +0 -2
- package/dist/pmndrs.js +0 -352
- package/dist/prop-BjrXLDuj.js +0 -43
- package/dist/three.d.ts +0 -2
|
@@ -1,16 +1,374 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version:
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v2.0.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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { OrthographicCamera as
|
|
12
|
-
import {
|
|
13
|
-
const
|
|
8
|
+
import { watch as D, defineComponent as p, shallowRef as N, provide as de, computed as O, onUnmounted as j, renderSlot as ue, inject as ce, watchEffect as m, nextTick as fe } from "vue";
|
|
9
|
+
import { EffectComposer as K, RenderPass as Te, NormalPass as we, DepthDownsamplingPass as Me, EffectPass as ye, BloomEffect as Z, DepthOfFieldEffect as J, GlitchEffect as V, GlitchMode as Ce, BlendFunction as he, NoiseEffect as _, OutlineEffect as $, PixelationEffect as ee, VignetteTechnique as Ee, VignetteEffect as te } from "postprocessing";
|
|
10
|
+
import { useTresContext as S, useLoop as z, normalizeColor as Y } from "@tresjs/core";
|
|
11
|
+
import { HalfFloatType as b, OrthographicCamera as De, BufferGeometry as Le, Float32BufferAttribute as se, Mesh as Pe, ShaderMaterial as x, UniformsUtils as w, Vector2 as h, WebGLRenderTarget as M, NoBlending as Be, Clock as Re, Color as X, MathUtils as v, DataTexture as Ne, RedFormat as Oe, FloatType as ze, MeshNormalMaterial as Fe, NearestFilter as E, DepthTexture as We, Vector4 as Ue, RawShaderMaterial as He, ColorManagement as Ge, SRGBTransfer as Xe, LinearToneMapping as je, ReinhardToneMapping as Ie, CineonToneMapping as Ve, ACESFilmicToneMapping as Ye, AgXToneMapping as Qe, NeutralToneMapping as qe, Texture as ae, LinearFilter as ke, Vector3 as R, AdditiveBlending as Ke, MeshBasicMaterial as Ze } from "three";
|
|
12
|
+
import { useDevicePixelRatio as me } from "@vueuse/core";
|
|
13
|
+
const pe = /([^[.\]])+/g, Je = (i, e) => {
|
|
14
|
+
if (!e)
|
|
15
|
+
return;
|
|
16
|
+
const t = Array.isArray(e) ? e : e.match(pe);
|
|
17
|
+
return t == null ? void 0 : t.reduce((s, a) => s && s[a], i);
|
|
18
|
+
}, re = (i, e, t) => {
|
|
19
|
+
const s = Array.isArray(e) ? e : e.match(pe);
|
|
20
|
+
s && s.reduce((a, r, o) => (a[r] === void 0 && (a[r] = {}), o === s.length - 1 && (a[r] = t), a[r]), i);
|
|
21
|
+
}, q = (i, e) => {
|
|
22
|
+
const t = { ...i };
|
|
23
|
+
return e.forEach((s) => delete t[s]), t;
|
|
24
|
+
}, ge = (i, e, t, s, a = {}) => D(i, (r) => {
|
|
25
|
+
var o;
|
|
26
|
+
if (e.value)
|
|
27
|
+
if (r === void 0) {
|
|
28
|
+
const n = s();
|
|
29
|
+
re(e.value, t, Je(n, t)), (o = n.dispose) == null || o.call(n);
|
|
30
|
+
} else
|
|
31
|
+
re(e.value, t, i());
|
|
32
|
+
}, a), F = (i, e, t) => i.map(([s, a]) => ge(
|
|
33
|
+
s,
|
|
34
|
+
e,
|
|
35
|
+
a,
|
|
36
|
+
t
|
|
37
|
+
)), I = (i, e, t) => Object.keys(i).map((s) => ge(
|
|
38
|
+
() => i[s],
|
|
39
|
+
e,
|
|
40
|
+
s,
|
|
41
|
+
t
|
|
42
|
+
));
|
|
43
|
+
class oe {
|
|
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"), s = window.WebGL2RenderingContext && t.getContext("webgl2");
|
|
55
|
+
return s.drawingBufferColorSpace = e, s.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
|
+
}, s = {
|
|
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 r = document.createElement("div");
|
|
73
|
+
return r.id = "webglmessage", r.style.fontFamily = "monospace", r.style.fontSize = "13px", r.style.fontWeight = "normal", r.style.textAlign = "center", r.style.background = "#fff", r.style.color = "#000", r.style.padding = "1.5em", r.style.width = "400px", r.style.margin = "5em auto 0", s[e] ? a = a.replace("$0", "graphics card") : a = a.replace("$0", "browser"), a = a.replace("$1", t[e]), r.innerHTML = a, r;
|
|
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 ve = Symbol("effectComposerPmndrs"), pt = /* @__PURE__ */ p({
|
|
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: b }
|
|
100
|
+
},
|
|
101
|
+
emits: ["render"],
|
|
102
|
+
setup(i, { expose: e, emit: t }) {
|
|
103
|
+
const s = i, a = t, { scene: r, camera: o, renderer: n, sizes: l, render: g } = S(), d = N(null);
|
|
104
|
+
let c = null, u = null;
|
|
105
|
+
de(ve, d), e({ composer: d });
|
|
106
|
+
const T = () => {
|
|
107
|
+
d.value && (u = new we(r.value, o.value), u.enabled = !1, d.value.addPass(u), s.resolutionScale !== void 0 && oe.isWebGL2Available() && (c = new Me({
|
|
108
|
+
normalBuffer: u.texture,
|
|
109
|
+
resolutionScale: s.resolutionScale
|
|
110
|
+
}), c.enabled = !1, d.value.addPass(c)));
|
|
111
|
+
}, W = O(() => {
|
|
112
|
+
const f = new K(), B = {
|
|
113
|
+
depthBuffer: s.depthBuffer !== void 0 ? s.depthBuffer : f.inputBuffer.depthBuffer,
|
|
114
|
+
stencilBuffer: s.stencilBuffer !== void 0 ? s.stencilBuffer : f.inputBuffer.stencilBuffer,
|
|
115
|
+
multisampling: oe.isWebGL2Available() ? s.multisampling !== void 0 ? s.multisampling : f.multisampling : 0,
|
|
116
|
+
frameBufferType: s.frameBufferType !== void 0 ? s.frameBufferType : b
|
|
117
|
+
};
|
|
118
|
+
return f.dispose(), B;
|
|
119
|
+
}), k = () => {
|
|
120
|
+
var f;
|
|
121
|
+
!n.value && !r.value && !o.value || ((f = d.value) == null || f.dispose(), d.value = new K(n.value, W.value), d.value.addPass(new Te(r.value, o.value)), s.disableNormalPass || T());
|
|
122
|
+
};
|
|
123
|
+
D([n, r, o, () => s.disableNormalPass], () => {
|
|
124
|
+
!l.width.value || !l.height.value || k();
|
|
125
|
+
}), D(() => [l.width.value, l.height.value], ([f, B]) => {
|
|
126
|
+
!f && !B || (d.value ? d.value.setSize(f, B) : k());
|
|
127
|
+
}, {
|
|
128
|
+
immediate: !0
|
|
129
|
+
});
|
|
130
|
+
const { render: Ae } = z();
|
|
131
|
+
return Ae(() => {
|
|
132
|
+
if (s.enabled && n.value && d.value && l.width.value && l.height.value && g.frames.value > 0) {
|
|
133
|
+
const f = n.value.autoClear;
|
|
134
|
+
n.value.autoClear = s.autoClear, s.stencilBuffer && !s.autoClear && n.value.clearStencil(), d.value.render(), a("render", d.value), n.value.autoClear = f;
|
|
135
|
+
}
|
|
136
|
+
g.frames.value = g.mode.value === "always" ? 1 : Math.max(0, g.frames.value - 1);
|
|
137
|
+
}), j(() => {
|
|
138
|
+
var f;
|
|
139
|
+
(f = d.value) == null || f.dispose();
|
|
140
|
+
}), (f, B) => ue(f.$slots, "default");
|
|
141
|
+
}
|
|
142
|
+
}), y = (i, e) => {
|
|
143
|
+
const t = ce(ve), s = N(null), a = N(null), { scene: r, camera: o, invalidate: n } = S();
|
|
144
|
+
e && D(e, () => n()), m(() => {
|
|
145
|
+
!o.value || !(a != null && a.value) || (a.value.mainCamera = o.value);
|
|
146
|
+
});
|
|
147
|
+
const l = m(() => {
|
|
148
|
+
!o.value || !(t != null && t.value) || !r.value || (fe(() => l()), !a.value && (a.value = i(), s.value = new ye(o.value, a.value), t.value.addPass(s.value)));
|
|
149
|
+
});
|
|
150
|
+
return j(() => {
|
|
151
|
+
var g, d, c;
|
|
152
|
+
s.value && ((g = t == null ? void 0 : t.value) == null || g.removePass(s.value)), (d = a.value) == null || d.dispose(), (c = s.value) == null || c.dispose();
|
|
153
|
+
}), {
|
|
154
|
+
pass: s,
|
|
155
|
+
effect: a
|
|
156
|
+
};
|
|
157
|
+
}, gt = /* @__PURE__ */ p({
|
|
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(i, { expose: e }) {
|
|
168
|
+
const t = i, { pass: s, effect: a } = y(() => new Z(t), t);
|
|
169
|
+
return e({ pass: s, effect: a }), F(
|
|
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 Z()
|
|
179
|
+
), () => {
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}), vt = /* @__PURE__ */ p({
|
|
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(i, { expose: e }) {
|
|
196
|
+
const t = i, { camera: s } = S(), { pass: a, effect: r } = y(() => new J(s.value, t), t);
|
|
197
|
+
return e({ pass: a, effect: r }), F(
|
|
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
|
+
r,
|
|
210
|
+
() => new J()
|
|
211
|
+
), () => {
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}), xt = /* @__PURE__ */ p({
|
|
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(i, { expose: e }) {
|
|
230
|
+
const t = i, { pass: s, effect: a } = y(() => new V(t), t);
|
|
231
|
+
e({ pass: s, effect: a });
|
|
232
|
+
const { onBeforeRender: r } = z();
|
|
233
|
+
return r(({ invalidate: o }) => o()), m(() => {
|
|
234
|
+
const o = () => {
|
|
235
|
+
if (t.mode !== void 0)
|
|
236
|
+
return t.active === !1 ? Ce.DISABLED : t.mode;
|
|
237
|
+
const n = new V(), l = n.mode;
|
|
238
|
+
return n.dispose(), l;
|
|
239
|
+
};
|
|
240
|
+
a.value && (a.value.mode = o());
|
|
241
|
+
}), I(
|
|
242
|
+
q(t, ["active", "mode", "blendFunction"]),
|
|
243
|
+
a,
|
|
244
|
+
() => new V()
|
|
245
|
+
), () => {
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}), bt = /* @__PURE__ */ p({
|
|
249
|
+
__name: "NoisePmndrs",
|
|
250
|
+
props: {
|
|
251
|
+
premultiply: { type: Boolean, default: !1 },
|
|
252
|
+
blendFunction: { default: he.SCREEN }
|
|
253
|
+
},
|
|
254
|
+
setup(i, { expose: e }) {
|
|
255
|
+
const t = i, { pass: s, effect: a } = y(() => new _(t), t);
|
|
256
|
+
e({ pass: s, effect: a });
|
|
257
|
+
const { onBeforeRender: r } = z();
|
|
258
|
+
return r(({ invalidate: o }) => o()), I(
|
|
259
|
+
q(t, ["blendFunction"]),
|
|
260
|
+
a,
|
|
261
|
+
() => new _()
|
|
262
|
+
), () => {
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}), St = /* @__PURE__ */ p({
|
|
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(i, { expose: e }) {
|
|
285
|
+
const t = i, s = (d) => d !== void 0 ? Y(d).getHex() : void 0, { camera: a, scene: r } = S(), o = {
|
|
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: s(t.hiddenEdgeColor),
|
|
299
|
+
visibleEdgeColor: s(t.visibleEdgeColor)
|
|
300
|
+
}, { pass: n, effect: l } = y(() => new $(r.value, a.value, o), t);
|
|
301
|
+
e({ pass: n, effect: l }), D(
|
|
302
|
+
[() => t.outlinedObjects, l],
|
|
303
|
+
// watchEffect is intentionally not used here as it would result in an endless loop
|
|
304
|
+
() => {
|
|
305
|
+
var d;
|
|
306
|
+
(d = l.value) == null || d.selection.set(t.outlinedObjects || []);
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
immediate: !0
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
const g = O(() => ({
|
|
313
|
+
hiddenEdgeColor: t.hiddenEdgeColor ? Y(t.hiddenEdgeColor) : void 0,
|
|
314
|
+
visibleEdgeColor: t.visibleEdgeColor ? Y(t.visibleEdgeColor) : void 0
|
|
315
|
+
}));
|
|
316
|
+
return F(
|
|
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
|
+
[() => g.value.hiddenEdgeColor, "hiddenEdgeColor"],
|
|
333
|
+
[() => g.value.visibleEdgeColor, "visibleEdgeColor"]
|
|
334
|
+
],
|
|
335
|
+
l,
|
|
336
|
+
() => new $()
|
|
337
|
+
), () => {
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}), At = /* @__PURE__ */ p({
|
|
341
|
+
__name: "PixelationPmndrs",
|
|
342
|
+
props: {
|
|
343
|
+
granularity: {}
|
|
344
|
+
},
|
|
345
|
+
setup(i, { expose: e }) {
|
|
346
|
+
const t = i, { pass: s, effect: a } = y(() => new ee(t.granularity), t);
|
|
347
|
+
return e({ pass: s, effect: a }), I(
|
|
348
|
+
t,
|
|
349
|
+
a,
|
|
350
|
+
() => new ee()
|
|
351
|
+
), () => {
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}), Tt = /* @__PURE__ */ p({
|
|
355
|
+
__name: "VignettePmndrs",
|
|
356
|
+
props: {
|
|
357
|
+
technique: { default: Ee.DEFAULT },
|
|
358
|
+
blendFunction: { default: he.NORMAL },
|
|
359
|
+
offset: { default: 0.5 },
|
|
360
|
+
darkness: { default: 0.5 }
|
|
361
|
+
},
|
|
362
|
+
setup(i, { expose: e }) {
|
|
363
|
+
const t = i, { pass: s, effect: a } = y(() => new te(t), t);
|
|
364
|
+
return e({ pass: s, effect: a }), I(
|
|
365
|
+
q(t, ["blendFunction"]),
|
|
366
|
+
a,
|
|
367
|
+
() => new te()
|
|
368
|
+
), () => {
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
}), xe = {
|
|
14
372
|
name: "CopyShader",
|
|
15
373
|
uniforms: {
|
|
16
374
|
tDiffuse: { value: null },
|
|
@@ -48,7 +406,7 @@ const Q = {
|
|
|
48
406
|
}`
|
|
49
407
|
)
|
|
50
408
|
};
|
|
51
|
-
class
|
|
409
|
+
class A {
|
|
52
410
|
constructor() {
|
|
53
411
|
this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
|
|
54
412
|
}
|
|
@@ -60,22 +418,22 @@ class m {
|
|
|
60
418
|
dispose() {
|
|
61
419
|
}
|
|
62
420
|
}
|
|
63
|
-
const
|
|
64
|
-
class
|
|
421
|
+
const _e = new De(-1, 1, 1, -1, 0, 1);
|
|
422
|
+
class $e extends Le {
|
|
65
423
|
constructor() {
|
|
66
|
-
super(), this.setAttribute("position", new
|
|
424
|
+
super(), this.setAttribute("position", new se([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new se([0, 2, 0, 0, 2, 0], 2));
|
|
67
425
|
}
|
|
68
426
|
}
|
|
69
|
-
const
|
|
70
|
-
class
|
|
427
|
+
const et = new $e();
|
|
428
|
+
class C {
|
|
71
429
|
constructor(e) {
|
|
72
|
-
this._mesh = new
|
|
430
|
+
this._mesh = new Pe(et, e);
|
|
73
431
|
}
|
|
74
432
|
dispose() {
|
|
75
433
|
this._mesh.geometry.dispose();
|
|
76
434
|
}
|
|
77
435
|
render(e) {
|
|
78
|
-
e.render(this._mesh,
|
|
436
|
+
e.render(this._mesh, _e);
|
|
79
437
|
}
|
|
80
438
|
get material() {
|
|
81
439
|
return this._mesh.material;
|
|
@@ -84,15 +442,15 @@ class T {
|
|
|
84
442
|
this._mesh.material = e;
|
|
85
443
|
}
|
|
86
444
|
}
|
|
87
|
-
class
|
|
445
|
+
class tt extends A {
|
|
88
446
|
constructor(e, t) {
|
|
89
|
-
super(), this.textureID = t !== void 0 ? t : "tDiffuse", e instanceof
|
|
447
|
+
super(), this.textureID = t !== void 0 ? t : "tDiffuse", e instanceof x ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = w.clone(e.uniforms), this.material = new x({
|
|
90
448
|
name: e.name !== void 0 ? e.name : "unspecified",
|
|
91
449
|
defines: Object.assign({}, e.defines),
|
|
92
450
|
uniforms: this.uniforms,
|
|
93
451
|
vertexShader: e.vertexShader,
|
|
94
452
|
fragmentShader: e.fragmentShader
|
|
95
|
-
})), this.fsQuad = new
|
|
453
|
+
})), this.fsQuad = new C(this.material);
|
|
96
454
|
}
|
|
97
455
|
render(e, t, s) {
|
|
98
456
|
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));
|
|
@@ -101,18 +459,18 @@ class De extends m {
|
|
|
101
459
|
this.material.dispose(), this.fsQuad.dispose();
|
|
102
460
|
}
|
|
103
461
|
}
|
|
104
|
-
class
|
|
462
|
+
class ie extends A {
|
|
105
463
|
constructor(e, t) {
|
|
106
464
|
super(), this.scene = e, this.camera = t, this.clear = !0, this.needsSwap = !1, this.inverse = !1;
|
|
107
465
|
}
|
|
108
466
|
render(e, t, s) {
|
|
109
467
|
const a = e.getContext(), r = e.state;
|
|
110
468
|
r.buffers.color.setMask(!1), r.buffers.depth.setMask(!1), r.buffers.color.setLocked(!0), r.buffers.depth.setLocked(!0);
|
|
111
|
-
let
|
|
112
|
-
this.inverse ? (
|
|
469
|
+
let o, n;
|
|
470
|
+
this.inverse ? (o = 0, n = 1) : (o = 1, n = 0), r.buffers.stencil.setTest(!0), r.buffers.stencil.setOp(a.REPLACE, a.REPLACE, a.REPLACE), r.buffers.stencil.setFunc(a.ALWAYS, o, 4294967295), r.buffers.stencil.setClear(n), 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);
|
|
113
471
|
}
|
|
114
472
|
}
|
|
115
|
-
class
|
|
473
|
+
class st extends A {
|
|
116
474
|
constructor() {
|
|
117
475
|
super(), this.needsSwap = !1;
|
|
118
476
|
}
|
|
@@ -120,14 +478,14 @@ class Ce extends m {
|
|
|
120
478
|
e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1);
|
|
121
479
|
}
|
|
122
480
|
}
|
|
123
|
-
class
|
|
481
|
+
class at {
|
|
124
482
|
constructor(e, t) {
|
|
125
483
|
if (this.renderer = e, this._pixelRatio = e.getPixelRatio(), t === void 0) {
|
|
126
|
-
const s = e.getSize(new
|
|
127
|
-
this._width = s.width, this._height = s.height, t = new
|
|
484
|
+
const s = e.getSize(new h());
|
|
485
|
+
this._width = s.width, this._height = s.height, t = new M(this._width * this._pixelRatio, this._height * this._pixelRatio, { type: b }), t.texture.name = "EffectComposer.rt1";
|
|
128
486
|
} else
|
|
129
487
|
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
|
|
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 tt(xe), this.copyPass.material.blending = Be, this.clock = new Re();
|
|
131
489
|
}
|
|
132
490
|
swapBuffers() {
|
|
133
491
|
const e = this.readBuffer;
|
|
@@ -154,23 +512,23 @@ class Ee {
|
|
|
154
512
|
const t = this.renderer.getRenderTarget();
|
|
155
513
|
let s = !1;
|
|
156
514
|
for (let a = 0, r = this.passes.length; a < r; a++) {
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
515
|
+
const o = this.passes[a];
|
|
516
|
+
if (o.enabled !== !1) {
|
|
517
|
+
if (o.renderToScreen = this.renderToScreen && this.isLastEnabledPass(a), o.render(this.renderer, this.writeBuffer, this.readBuffer, e, s), o.needsSwap) {
|
|
160
518
|
if (s) {
|
|
161
|
-
const
|
|
162
|
-
|
|
519
|
+
const n = this.renderer.getContext(), l = this.renderer.state.buffers.stencil;
|
|
520
|
+
l.setFunc(n.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, e), l.setFunc(n.EQUAL, 1, 4294967295);
|
|
163
521
|
}
|
|
164
522
|
this.swapBuffers();
|
|
165
523
|
}
|
|
166
|
-
|
|
524
|
+
ie !== void 0 && (o instanceof ie ? s = !0 : o instanceof st && (s = !1));
|
|
167
525
|
}
|
|
168
526
|
}
|
|
169
527
|
this.renderer.setRenderTarget(t);
|
|
170
528
|
}
|
|
171
529
|
reset(e) {
|
|
172
530
|
if (e === void 0) {
|
|
173
|
-
const t = this.renderer.getSize(new
|
|
531
|
+
const t = this.renderer.getSize(new h());
|
|
174
532
|
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
533
|
}
|
|
176
534
|
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2;
|
|
@@ -189,61 +547,61 @@ class Ee {
|
|
|
189
547
|
this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.copyPass.dispose();
|
|
190
548
|
}
|
|
191
549
|
}
|
|
192
|
-
class
|
|
550
|
+
class rt extends A {
|
|
193
551
|
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
|
|
552
|
+
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 X();
|
|
195
553
|
}
|
|
196
554
|
render(e, t, s) {
|
|
197
555
|
const a = e.autoClear;
|
|
198
556
|
e.autoClear = !1;
|
|
199
|
-
let r,
|
|
200
|
-
this.overrideMaterial !== null && (
|
|
557
|
+
let r, o;
|
|
558
|
+
this.overrideMaterial !== null && (o = 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 = o), e.autoClear = a;
|
|
201
559
|
}
|
|
202
560
|
}
|
|
203
|
-
const
|
|
561
|
+
const be = Symbol("effectComposerThree"), wt = /* @__PURE__ */ p({
|
|
204
562
|
__name: "EffectComposer",
|
|
205
563
|
props: {
|
|
206
564
|
enabled: { type: Boolean, default: !0 },
|
|
207
565
|
withoutRenderPass: { type: Boolean }
|
|
208
566
|
},
|
|
209
|
-
setup(
|
|
210
|
-
const t =
|
|
211
|
-
|
|
212
|
-
const { renderer: a, sizes: r, scene:
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
(
|
|
216
|
-
}),
|
|
217
|
-
var
|
|
218
|
-
const { width:
|
|
219
|
-
|
|
567
|
+
setup(i, { expose: e }) {
|
|
568
|
+
const t = i, s = N(null);
|
|
569
|
+
de(be, s), e({ composer: s });
|
|
570
|
+
const { renderer: a, sizes: r, scene: o, camera: n, render: l } = S();
|
|
571
|
+
m(() => {
|
|
572
|
+
var u;
|
|
573
|
+
(u = s.value) == null || u.dispose(), s.value = new at(a.value);
|
|
574
|
+
}), m(() => {
|
|
575
|
+
var W;
|
|
576
|
+
const { width: u, height: T } = r;
|
|
577
|
+
T.value && u.value && ((W = s.value) == null || W.setSize(u.value, T.value));
|
|
220
578
|
});
|
|
221
|
-
const { pixelRatio:
|
|
222
|
-
|
|
223
|
-
var
|
|
224
|
-
(
|
|
225
|
-
}), t.withoutRenderPass ||
|
|
226
|
-
|
|
579
|
+
const { pixelRatio: d } = me();
|
|
580
|
+
m(() => {
|
|
581
|
+
var u;
|
|
582
|
+
(u = s.value) == null || u.setPixelRatio(d.value);
|
|
583
|
+
}), t.withoutRenderPass || m(() => {
|
|
584
|
+
n.value && o.value && s.value && s.value.addPass(new rt(o.value, n.value));
|
|
227
585
|
});
|
|
228
|
-
const { render:
|
|
229
|
-
return
|
|
230
|
-
|
|
586
|
+
const { render: c } = z();
|
|
587
|
+
return c(() => {
|
|
588
|
+
l.frames.value > 0 && s.value && t.enabled && s.value.render(), l.frames.value = l.mode.value === "always" ? 1 : Math.max(0, l.frames.value - 1);
|
|
231
589
|
}), j(() => {
|
|
232
|
-
var
|
|
233
|
-
(
|
|
234
|
-
}), (
|
|
235
|
-
}
|
|
236
|
-
}),
|
|
237
|
-
const t =
|
|
238
|
-
e &&
|
|
239
|
-
const
|
|
240
|
-
!(t != null && t.value) || !a.height.value || !a.width.value || (t.value.addPass(s.value),
|
|
590
|
+
var u;
|
|
591
|
+
(u = s.value) == null || u.dispose();
|
|
592
|
+
}), (u, T) => ue(u.$slots, "default");
|
|
593
|
+
}
|
|
594
|
+
}), P = (i, e) => {
|
|
595
|
+
const t = ce(be), s = N(i()), { sizes: a, invalidate: r } = S();
|
|
596
|
+
e && D(e, () => r());
|
|
597
|
+
const o = m(() => {
|
|
598
|
+
!(t != null && t.value) || !a.height.value || !a.width.value || (t.value.addPass(s.value), fe(() => o()));
|
|
241
599
|
});
|
|
242
600
|
return j(() => {
|
|
243
|
-
var
|
|
244
|
-
(
|
|
601
|
+
var n;
|
|
602
|
+
(n = t == null ? void 0 : t.value) == null || n.removePass(s.value), s.value.dispose();
|
|
245
603
|
}), { pass: s };
|
|
246
|
-
},
|
|
604
|
+
}, ot = {
|
|
247
605
|
uniforms: {
|
|
248
606
|
tDiffuse: { value: null },
|
|
249
607
|
//diffuse texture
|
|
@@ -338,53 +696,53 @@ const q = Symbol("effectComposerThree"), Xe = /* @__PURE__ */ S({
|
|
|
338
696
|
}`
|
|
339
697
|
)
|
|
340
698
|
};
|
|
341
|
-
class
|
|
699
|
+
class ne extends A {
|
|
342
700
|
constructor(e = 64) {
|
|
343
701
|
super();
|
|
344
|
-
const t =
|
|
345
|
-
this.uniforms =
|
|
702
|
+
const t = ot;
|
|
703
|
+
this.uniforms = w.clone(t.uniforms), this.heightMap = this.generateHeightmap(e), this.uniforms.tDisp.value = this.heightMap, this.material = new x({
|
|
346
704
|
uniforms: this.uniforms,
|
|
347
705
|
vertexShader: t.vertexShader,
|
|
348
706
|
fragmentShader: t.fragmentShader
|
|
349
|
-
}), this.fsQuad = new
|
|
707
|
+
}), this.fsQuad = new C(this.material), this.goWild = !1, this.curF = 0, this.generateTrigger();
|
|
350
708
|
}
|
|
351
709
|
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 =
|
|
710
|
+
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 = v.randFloat(-Math.PI, Math.PI), this.uniforms.seed_x.value = v.randFloat(-1, 1), this.uniforms.seed_y.value = v.randFloat(-1, 1), this.uniforms.distortion_x.value = v.randFloat(0, 1), this.uniforms.distortion_y.value = v.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 = v.randFloat(-Math.PI, Math.PI), this.uniforms.distortion_x.value = v.randFloat(0, 1), this.uniforms.distortion_y.value = v.randFloat(0, 1), this.uniforms.seed_x.value = v.randFloat(-0.3, 0.3), this.uniforms.seed_y.value = v.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
711
|
}
|
|
354
712
|
generateTrigger() {
|
|
355
|
-
this.randX =
|
|
713
|
+
this.randX = v.randInt(120, 240);
|
|
356
714
|
}
|
|
357
715
|
generateHeightmap(e) {
|
|
358
716
|
const t = new Float32Array(e * e), s = e * e;
|
|
359
717
|
for (let r = 0; r < s; r++) {
|
|
360
|
-
const
|
|
361
|
-
t[r] =
|
|
718
|
+
const o = v.randFloat(0, 1);
|
|
719
|
+
t[r] = o;
|
|
362
720
|
}
|
|
363
|
-
const a = new
|
|
721
|
+
const a = new Ne(t, e, e, Oe, ze);
|
|
364
722
|
return a.needsUpdate = !0, a;
|
|
365
723
|
}
|
|
366
724
|
dispose() {
|
|
367
725
|
this.material.dispose(), this.heightMap.dispose(), this.fsQuad.dispose();
|
|
368
726
|
}
|
|
369
727
|
}
|
|
370
|
-
const
|
|
728
|
+
const Mt = /* @__PURE__ */ p({
|
|
371
729
|
__name: "Glitch",
|
|
372
730
|
props: {
|
|
373
731
|
dtSize: {},
|
|
374
732
|
goWild: { type: Boolean }
|
|
375
733
|
},
|
|
376
|
-
setup(
|
|
377
|
-
const t =
|
|
734
|
+
setup(i, { expose: e }) {
|
|
735
|
+
const t = i, { pass: s } = P(() => new ne(t.dtSize), t);
|
|
378
736
|
e({ pass: s });
|
|
379
|
-
const { onBeforeRender: a } =
|
|
380
|
-
return a(({ invalidate: r }) => r()),
|
|
737
|
+
const { onBeforeRender: a } = z();
|
|
738
|
+
return a(({ invalidate: r }) => r()), F(
|
|
381
739
|
[[() => t.goWild, "goWild"]],
|
|
382
740
|
s,
|
|
383
|
-
() => new
|
|
741
|
+
() => new ne()
|
|
384
742
|
), () => {
|
|
385
743
|
};
|
|
386
744
|
}
|
|
387
|
-
}),
|
|
745
|
+
}), G = {
|
|
388
746
|
name: "HalftoneShader",
|
|
389
747
|
uniforms: {
|
|
390
748
|
tDiffuse: { value: null },
|
|
@@ -688,16 +1046,16 @@ const Ge = /* @__PURE__ */ S({
|
|
|
688
1046
|
}`
|
|
689
1047
|
)
|
|
690
1048
|
};
|
|
691
|
-
class
|
|
1049
|
+
class it extends A {
|
|
692
1050
|
constructor(e, t, s) {
|
|
693
|
-
super(), this.uniforms =
|
|
1051
|
+
super(), this.uniforms = w.clone(G.uniforms), this.material = new x({
|
|
694
1052
|
uniforms: this.uniforms,
|
|
695
|
-
fragmentShader:
|
|
696
|
-
vertexShader:
|
|
1053
|
+
fragmentShader: G.fragmentShader,
|
|
1054
|
+
vertexShader: G.vertexShader
|
|
697
1055
|
}), this.uniforms.width.value = e, this.uniforms.height.value = t;
|
|
698
1056
|
for (const a in s)
|
|
699
1057
|
s.hasOwnProperty(a) && this.uniforms.hasOwnProperty(a) && (this.uniforms[a].value = s[a]);
|
|
700
|
-
this.fsQuad = new
|
|
1058
|
+
this.fsQuad = new C(this.material);
|
|
701
1059
|
}
|
|
702
1060
|
render(e, t, s) {
|
|
703
1061
|
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));
|
|
@@ -709,7 +1067,7 @@ class Ne extends m {
|
|
|
709
1067
|
this.material.dispose(), this.fsQuad.dispose();
|
|
710
1068
|
}
|
|
711
1069
|
}
|
|
712
|
-
const
|
|
1070
|
+
const yt = /* @__PURE__ */ p({
|
|
713
1071
|
__name: "Halftone",
|
|
714
1072
|
props: {
|
|
715
1073
|
shape: {},
|
|
@@ -722,29 +1080,29 @@ const Ie = /* @__PURE__ */ S({
|
|
|
722
1080
|
greyscale: { type: Boolean },
|
|
723
1081
|
blendingMode: {}
|
|
724
1082
|
},
|
|
725
|
-
setup(
|
|
726
|
-
const t =
|
|
1083
|
+
setup(i, { expose: e }) {
|
|
1084
|
+
const t = i, { sizes: s } = S(), a = O(
|
|
727
1085
|
() => Object.fromEntries(
|
|
728
|
-
Object.entries(t).filter(([
|
|
1086
|
+
Object.entries(t).filter(([o, n]) => n !== void 0)
|
|
729
1087
|
)
|
|
730
|
-
), { pass: r } =
|
|
1088
|
+
), { pass: r } = P(() => new it(
|
|
731
1089
|
s.width.value,
|
|
732
1090
|
s.height.value,
|
|
733
1091
|
a.value
|
|
734
1092
|
), t);
|
|
735
|
-
return e({ pass: r }),
|
|
1093
|
+
return e({ pass: r }), m(() => {
|
|
736
1094
|
r.value.setSize(s.width.value, s.height.value);
|
|
737
|
-
}),
|
|
738
|
-
Object.entries(t).forEach(([
|
|
739
|
-
|
|
1095
|
+
}), m(() => {
|
|
1096
|
+
Object.entries(t).forEach(([o, n]) => {
|
|
1097
|
+
o in r.value.uniforms && (r.value.uniforms[o].value = n ?? G.uniforms[o].value);
|
|
740
1098
|
});
|
|
741
1099
|
}), () => {
|
|
742
1100
|
};
|
|
743
1101
|
}
|
|
744
1102
|
});
|
|
745
|
-
class
|
|
1103
|
+
class le extends A {
|
|
746
1104
|
constructor(e, t, s, a = {}) {
|
|
747
|
-
super(), this.pixelSize = e, this.resolution = new
|
|
1105
|
+
super(), this.pixelSize = e, this.resolution = new h(), this.renderResolution = new h(), this.pixelatedMaterial = this.createPixelatedMaterial(), this.normalMaterial = new Fe(), this.fsQuad = new C(this.pixelatedMaterial), this.scene = t, this.camera = s, this.normalEdgeStrength = a.normalEdgeStrength || 0.3, this.depthEdgeStrength = a.depthEdgeStrength || 0.4, this.beautyRenderTarget = new M(), this.beautyRenderTarget.texture.minFilter = E, this.beautyRenderTarget.texture.magFilter = E, this.beautyRenderTarget.texture.type = b, this.beautyRenderTarget.depthTexture = new We(), this.normalRenderTarget = new M(), this.normalRenderTarget.texture.minFilter = E, this.normalRenderTarget.texture.magFilter = E, this.normalRenderTarget.texture.type = b;
|
|
748
1106
|
}
|
|
749
1107
|
dispose() {
|
|
750
1108
|
this.beautyRenderTarget.dispose(), this.normalRenderTarget.dispose(), this.pixelatedMaterial.dispose(), this.normalMaterial.dispose(), this.fsQuad.dispose();
|
|
@@ -764,13 +1122,13 @@ class X extends m {
|
|
|
764
1122
|
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);
|
|
765
1123
|
}
|
|
766
1124
|
createPixelatedMaterial() {
|
|
767
|
-
return new
|
|
1125
|
+
return new x({
|
|
768
1126
|
uniforms: {
|
|
769
1127
|
tDiffuse: { value: null },
|
|
770
1128
|
tDepth: { value: null },
|
|
771
1129
|
tNormal: { value: null },
|
|
772
1130
|
resolution: {
|
|
773
|
-
value: new
|
|
1131
|
+
value: new Ue(
|
|
774
1132
|
this.renderResolution.x,
|
|
775
1133
|
this.renderResolution.y,
|
|
776
1134
|
1 / this.renderResolution.x,
|
|
@@ -889,28 +1247,28 @@ class X extends m {
|
|
|
889
1247
|
});
|
|
890
1248
|
}
|
|
891
1249
|
}
|
|
892
|
-
const
|
|
1250
|
+
const Ct = /* @__PURE__ */ p({
|
|
893
1251
|
__name: "Pixelation",
|
|
894
1252
|
props: {
|
|
895
1253
|
pixelSize: {},
|
|
896
1254
|
depthEdgeStrength: {},
|
|
897
1255
|
normalEdgeStrength: {}
|
|
898
1256
|
},
|
|
899
|
-
setup(
|
|
900
|
-
const t =
|
|
901
|
-
return e({ pass: r }),
|
|
1257
|
+
setup(i, { expose: e }) {
|
|
1258
|
+
const t = i, { scene: s, camera: a } = S(), { pass: r } = P(() => new le(t.pixelSize, s.value, a.value), t);
|
|
1259
|
+
return e({ pass: r }), m(() => {
|
|
902
1260
|
r.value.setPixelSize(t.pixelSize);
|
|
903
|
-
}),
|
|
1261
|
+
}), F(
|
|
904
1262
|
[
|
|
905
1263
|
[() => t.depthEdgeStrength, "depthEdgeStrength"],
|
|
906
1264
|
[() => t.normalEdgeStrength, "normalEdgeStrength"]
|
|
907
1265
|
],
|
|
908
1266
|
r,
|
|
909
|
-
() => new
|
|
1267
|
+
() => new le(1, s.value, a.value)
|
|
910
1268
|
), () => {
|
|
911
1269
|
};
|
|
912
1270
|
}
|
|
913
|
-
}),
|
|
1271
|
+
}), nt = {
|
|
914
1272
|
name: "OutputShader",
|
|
915
1273
|
uniforms: {
|
|
916
1274
|
tDiffuse: { value: null },
|
|
@@ -992,39 +1350,39 @@ const je = /* @__PURE__ */ S({
|
|
|
992
1350
|
}`
|
|
993
1351
|
)
|
|
994
1352
|
};
|
|
995
|
-
class
|
|
1353
|
+
class lt extends A {
|
|
996
1354
|
constructor() {
|
|
997
1355
|
super();
|
|
998
|
-
const e =
|
|
999
|
-
this.uniforms =
|
|
1356
|
+
const e = nt;
|
|
1357
|
+
this.uniforms = w.clone(e.uniforms), this.material = new He({
|
|
1000
1358
|
name: e.name,
|
|
1001
1359
|
uniforms: this.uniforms,
|
|
1002
1360
|
vertexShader: e.vertexShader,
|
|
1003
1361
|
fragmentShader: e.fragmentShader
|
|
1004
|
-
}), this.fsQuad = new
|
|
1362
|
+
}), this.fsQuad = new C(this.material), this._outputColorSpace = null, this._toneMapping = null;
|
|
1005
1363
|
}
|
|
1006
1364
|
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 = {},
|
|
1365
|
+
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 = {}, Ge.getTransfer(this._outputColorSpace) === Xe && (this.material.defines.SRGB_TRANSFER = ""), this._toneMapping === je ? this.material.defines.LINEAR_TONE_MAPPING = "" : this._toneMapping === Ie ? this.material.defines.REINHARD_TONE_MAPPING = "" : this._toneMapping === Ve ? this.material.defines.CINEON_TONE_MAPPING = "" : this._toneMapping === Ye ? this.material.defines.ACES_FILMIC_TONE_MAPPING = "" : this._toneMapping === Qe ? this.material.defines.AGX_TONE_MAPPING = "" : this._toneMapping === qe && (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
1366
|
}
|
|
1009
1367
|
dispose() {
|
|
1010
1368
|
this.material.dispose(), this.fsQuad.dispose();
|
|
1011
1369
|
}
|
|
1012
1370
|
}
|
|
1013
|
-
const
|
|
1371
|
+
const Et = /* @__PURE__ */ p({
|
|
1014
1372
|
__name: "Output",
|
|
1015
|
-
setup(
|
|
1016
|
-
const { pass: t } =
|
|
1373
|
+
setup(i, { expose: e }) {
|
|
1374
|
+
const { pass: t } = P(() => new lt());
|
|
1017
1375
|
return e({ pass: t }), () => {
|
|
1018
1376
|
};
|
|
1019
1377
|
}
|
|
1020
|
-
}),
|
|
1378
|
+
}), U = {
|
|
1021
1379
|
name: "SMAAEdgesShader",
|
|
1022
1380
|
defines: {
|
|
1023
1381
|
SMAA_THRESHOLD: "0.1"
|
|
1024
1382
|
},
|
|
1025
1383
|
uniforms: {
|
|
1026
1384
|
tDiffuse: { value: null },
|
|
1027
|
-
resolution: { value: new
|
|
1385
|
+
resolution: { value: new h(1 / 1024, 1 / 512) }
|
|
1028
1386
|
},
|
|
1029
1387
|
vertexShader: (
|
|
1030
1388
|
/* glsl */
|
|
@@ -1118,7 +1476,7 @@ const Ve = /* @__PURE__ */ S({
|
|
|
1118
1476
|
|
|
1119
1477
|
}`
|
|
1120
1478
|
)
|
|
1121
|
-
},
|
|
1479
|
+
}, H = {
|
|
1122
1480
|
name: "SMAAWeightsShader",
|
|
1123
1481
|
defines: {
|
|
1124
1482
|
SMAA_MAX_SEARCH_STEPS: "8",
|
|
@@ -1130,7 +1488,7 @@ const Ve = /* @__PURE__ */ S({
|
|
|
1130
1488
|
tDiffuse: { value: null },
|
|
1131
1489
|
tArea: { value: null },
|
|
1132
1490
|
tSearch: { value: null },
|
|
1133
|
-
resolution: { value: new
|
|
1491
|
+
resolution: { value: new h(1 / 1024, 1 / 512) }
|
|
1134
1492
|
},
|
|
1135
1493
|
vertexShader: (
|
|
1136
1494
|
/* glsl */
|
|
@@ -1368,12 +1726,12 @@ const Ve = /* @__PURE__ */ S({
|
|
|
1368
1726
|
|
|
1369
1727
|
}`
|
|
1370
1728
|
)
|
|
1371
|
-
},
|
|
1729
|
+
}, Q = {
|
|
1372
1730
|
name: "SMAABlendShader",
|
|
1373
1731
|
uniforms: {
|
|
1374
1732
|
tDiffuse: { value: null },
|
|
1375
1733
|
tColor: { value: null },
|
|
1376
|
-
resolution: { value: new
|
|
1734
|
+
resolution: { value: new h(1 / 1024, 1 / 512) }
|
|
1377
1735
|
},
|
|
1378
1736
|
vertexShader: (
|
|
1379
1737
|
/* glsl */
|
|
@@ -1458,37 +1816,37 @@ const Ve = /* @__PURE__ */ S({
|
|
|
1458
1816
|
}`
|
|
1459
1817
|
)
|
|
1460
1818
|
};
|
|
1461
|
-
class
|
|
1819
|
+
class dt extends A {
|
|
1462
1820
|
constructor(e, t) {
|
|
1463
|
-
super(), this.edgesRT = new
|
|
1821
|
+
super(), this.edgesRT = new M(e, t, {
|
|
1464
1822
|
depthBuffer: !1,
|
|
1465
|
-
type:
|
|
1466
|
-
}), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new
|
|
1823
|
+
type: b
|
|
1824
|
+
}), this.edgesRT.texture.name = "SMAAPass.edges", this.weightsRT = new M(e, t, {
|
|
1467
1825
|
depthBuffer: !1,
|
|
1468
|
-
type:
|
|
1826
|
+
type: b
|
|
1469
1827
|
}), this.weightsRT.texture.name = "SMAAPass.weights";
|
|
1470
1828
|
const s = this, a = new Image();
|
|
1471
1829
|
a.src = this.getAreaTexture(), a.onload = function() {
|
|
1472
1830
|
s.areaTexture.needsUpdate = !0;
|
|
1473
|
-
}, this.areaTexture = new
|
|
1831
|
+
}, this.areaTexture = new ae(), this.areaTexture.name = "SMAAPass.area", this.areaTexture.image = a, this.areaTexture.minFilter = ke, this.areaTexture.generateMipmaps = !1, this.areaTexture.flipY = !1;
|
|
1474
1832
|
const r = new Image();
|
|
1475
1833
|
r.src = this.getSearchTexture(), r.onload = function() {
|
|
1476
1834
|
s.searchTexture.needsUpdate = !0;
|
|
1477
|
-
}, this.searchTexture = new
|
|
1478
|
-
defines: Object.assign({},
|
|
1835
|
+
}, this.searchTexture = new ae(), this.searchTexture.name = "SMAAPass.search", this.searchTexture.image = r, this.searchTexture.magFilter = E, this.searchTexture.minFilter = E, this.searchTexture.generateMipmaps = !1, this.searchTexture.flipY = !1, this.uniformsEdges = w.clone(U.uniforms), this.uniformsEdges.resolution.value.set(1 / e, 1 / t), this.materialEdges = new x({
|
|
1836
|
+
defines: Object.assign({}, U.defines),
|
|
1479
1837
|
uniforms: this.uniformsEdges,
|
|
1480
|
-
vertexShader:
|
|
1481
|
-
fragmentShader:
|
|
1482
|
-
}), this.uniformsWeights =
|
|
1483
|
-
defines: Object.assign({},
|
|
1838
|
+
vertexShader: U.vertexShader,
|
|
1839
|
+
fragmentShader: U.fragmentShader
|
|
1840
|
+
}), this.uniformsWeights = w.clone(H.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 x({
|
|
1841
|
+
defines: Object.assign({}, H.defines),
|
|
1484
1842
|
uniforms: this.uniformsWeights,
|
|
1485
|
-
vertexShader:
|
|
1486
|
-
fragmentShader:
|
|
1487
|
-
}), this.uniformsBlend =
|
|
1843
|
+
vertexShader: H.vertexShader,
|
|
1844
|
+
fragmentShader: H.fragmentShader
|
|
1845
|
+
}), this.uniformsBlend = w.clone(Q.uniforms), this.uniformsBlend.resolution.value.set(1 / e, 1 / t), this.uniformsBlend.tDiffuse.value = this.weightsRT.texture, this.materialBlend = new x({
|
|
1488
1846
|
uniforms: this.uniformsBlend,
|
|
1489
|
-
vertexShader:
|
|
1490
|
-
fragmentShader:
|
|
1491
|
-
}), this.fsQuad = new
|
|
1847
|
+
vertexShader: Q.vertexShader,
|
|
1848
|
+
fragmentShader: Q.fragmentShader
|
|
1849
|
+
}), this.fsQuad = new C(null);
|
|
1492
1850
|
}
|
|
1493
1851
|
render(e, t, s) {
|
|
1494
1852
|
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));
|
|
@@ -1506,27 +1864,27 @@ class ze extends m {
|
|
|
1506
1864
|
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
1865
|
}
|
|
1508
1866
|
}
|
|
1509
|
-
const
|
|
1867
|
+
const Dt = /* @__PURE__ */ p({
|
|
1510
1868
|
__name: "SMAA",
|
|
1511
1869
|
props: {
|
|
1512
1870
|
width: {},
|
|
1513
1871
|
height: {}
|
|
1514
1872
|
},
|
|
1515
|
-
setup(
|
|
1516
|
-
const t =
|
|
1517
|
-
return e({ pass:
|
|
1518
|
-
|
|
1873
|
+
setup(i, { expose: e }) {
|
|
1874
|
+
const t = i, { sizes: s } = S(), { pixelRatio: a } = me(), r = O(() => t.width ?? s.width.value * a.value), o = O(() => t.height ?? s.height.value * a.value), { pass: n } = P(() => new dt(r.value, o.value), t);
|
|
1875
|
+
return e({ pass: n }), m(() => {
|
|
1876
|
+
n.value.setSize(r.value, o.value);
|
|
1519
1877
|
}), () => {
|
|
1520
1878
|
};
|
|
1521
1879
|
}
|
|
1522
|
-
}),
|
|
1880
|
+
}), Se = {
|
|
1523
1881
|
name: "LuminosityHighPassShader",
|
|
1524
1882
|
shaderID: "luminosityHighPass",
|
|
1525
1883
|
uniforms: {
|
|
1526
1884
|
tDiffuse: { value: null },
|
|
1527
1885
|
luminosityThreshold: { value: 1 },
|
|
1528
1886
|
smoothWidth: { value: 1 },
|
|
1529
|
-
defaultColor: { value: new
|
|
1887
|
+
defaultColor: { value: new X(0) },
|
|
1530
1888
|
defaultOpacity: { value: 0 }
|
|
1531
1889
|
},
|
|
1532
1890
|
vertexShader: (
|
|
@@ -1570,40 +1928,40 @@ const Ye = /* @__PURE__ */ S({
|
|
|
1570
1928
|
}`
|
|
1571
1929
|
)
|
|
1572
1930
|
};
|
|
1573
|
-
class
|
|
1931
|
+
class L extends A {
|
|
1574
1932
|
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
|
|
1576
|
-
let r = Math.round(this.resolution.x / 2),
|
|
1577
|
-
this.renderTargetBright = new
|
|
1578
|
-
for (let
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1933
|
+
super(), this.strength = t !== void 0 ? t : 1, this.radius = s, this.threshold = a, this.resolution = e !== void 0 ? new h(e.x, e.y) : new h(256, 256), this.clearColor = new X(0, 0, 0), this.renderTargetsHorizontal = [], this.renderTargetsVertical = [], this.nMips = 5;
|
|
1934
|
+
let r = Math.round(this.resolution.x / 2), o = Math.round(this.resolution.y / 2);
|
|
1935
|
+
this.renderTargetBright = new M(r, o, { type: b }), this.renderTargetBright.texture.name = "UnrealBloomPass.bright", this.renderTargetBright.texture.generateMipmaps = !1;
|
|
1936
|
+
for (let c = 0; c < this.nMips; c++) {
|
|
1937
|
+
const u = new M(r, o, { type: b });
|
|
1938
|
+
u.texture.name = "UnrealBloomPass.h" + c, u.texture.generateMipmaps = !1, this.renderTargetsHorizontal.push(u);
|
|
1939
|
+
const T = new M(r, o, { type: b });
|
|
1940
|
+
T.texture.name = "UnrealBloomPass.v" + c, T.texture.generateMipmaps = !1, this.renderTargetsVertical.push(T), r = Math.round(r / 2), o = Math.round(o / 2);
|
|
1583
1941
|
}
|
|
1584
|
-
const
|
|
1585
|
-
this.highPassUniforms =
|
|
1942
|
+
const n = Se;
|
|
1943
|
+
this.highPassUniforms = w.clone(n.uniforms), this.highPassUniforms.luminosityThreshold.value = a, this.highPassUniforms.smoothWidth.value = 0.01, this.materialHighPassFilter = new x({
|
|
1586
1944
|
uniforms: this.highPassUniforms,
|
|
1587
|
-
vertexShader:
|
|
1588
|
-
fragmentShader:
|
|
1945
|
+
vertexShader: n.vertexShader,
|
|
1946
|
+
fragmentShader: n.fragmentShader
|
|
1589
1947
|
}), this.separableBlurMaterials = [];
|
|
1590
|
-
const
|
|
1591
|
-
r = Math.round(this.resolution.x / 2),
|
|
1592
|
-
for (let
|
|
1593
|
-
this.separableBlurMaterials.push(this.
|
|
1948
|
+
const l = [3, 5, 7, 9, 11];
|
|
1949
|
+
r = Math.round(this.resolution.x / 2), o = Math.round(this.resolution.y / 2);
|
|
1950
|
+
for (let c = 0; c < this.nMips; c++)
|
|
1951
|
+
this.separableBlurMaterials.push(this.getSeparableBlurMaterial(l[c])), this.separableBlurMaterials[c].uniforms.invSize.value = new h(1 / r, 1 / o), r = Math.round(r / 2), o = Math.round(o / 2);
|
|
1594
1952
|
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
|
|
1596
|
-
this.compositeMaterial.uniforms.bloomFactors.value =
|
|
1597
|
-
const
|
|
1598
|
-
this.copyUniforms =
|
|
1953
|
+
const g = [1, 0.8, 0.6, 0.4, 0.2];
|
|
1954
|
+
this.compositeMaterial.uniforms.bloomFactors.value = g, this.bloomTintColors = [new R(1, 1, 1), new R(1, 1, 1), new R(1, 1, 1), new R(1, 1, 1), new R(1, 1, 1)], this.compositeMaterial.uniforms.bloomTintColors.value = this.bloomTintColors;
|
|
1955
|
+
const d = xe;
|
|
1956
|
+
this.copyUniforms = w.clone(d.uniforms), this.blendMaterial = new x({
|
|
1599
1957
|
uniforms: this.copyUniforms,
|
|
1600
|
-
vertexShader:
|
|
1601
|
-
fragmentShader:
|
|
1602
|
-
blending:
|
|
1958
|
+
vertexShader: d.vertexShader,
|
|
1959
|
+
fragmentShader: d.fragmentShader,
|
|
1960
|
+
blending: Ke,
|
|
1603
1961
|
depthTest: !1,
|
|
1604
1962
|
depthWrite: !1,
|
|
1605
1963
|
transparent: !0
|
|
1606
|
-
}), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new
|
|
1964
|
+
}), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new X(), this.oldClearAlpha = 1, this.basic = new Ze(), this.fsQuad = new C(null);
|
|
1607
1965
|
}
|
|
1608
1966
|
dispose() {
|
|
1609
1967
|
for (let e = 0; e < this.renderTargetsHorizontal.length; e++)
|
|
@@ -1619,30 +1977,30 @@ class M extends m {
|
|
|
1619
1977
|
let s = Math.round(e / 2), a = Math.round(t / 2);
|
|
1620
1978
|
this.renderTargetBright.setSize(s, a);
|
|
1621
1979
|
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
|
|
1980
|
+
this.renderTargetsHorizontal[r].setSize(s, a), this.renderTargetsVertical[r].setSize(s, a), this.separableBlurMaterials[r].uniforms.invSize.value = new h(1 / s, 1 / a), s = Math.round(s / 2), a = Math.round(a / 2);
|
|
1623
1981
|
}
|
|
1624
1982
|
render(e, t, s, a, r) {
|
|
1625
1983
|
e.getClearColor(this._oldClearColor), this.oldClearAlpha = e.getClearAlpha();
|
|
1626
|
-
const
|
|
1984
|
+
const o = e.autoClear;
|
|
1627
1985
|
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
|
|
1629
|
-
for (let
|
|
1630
|
-
this.fsQuad.material = this.separableBlurMaterials[
|
|
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 =
|
|
1986
|
+
let n = this.renderTargetBright;
|
|
1987
|
+
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 = L.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 = L.BlurDirectionY, e.setRenderTarget(this.renderTargetsVertical[l]), e.clear(), this.fsQuad.render(e), n = this.renderTargetsVertical[l];
|
|
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, 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 = o;
|
|
1632
1990
|
}
|
|
1633
|
-
|
|
1991
|
+
getSeparableBlurMaterial(e) {
|
|
1634
1992
|
const t = [];
|
|
1635
1993
|
for (let s = 0; s < e; s++)
|
|
1636
1994
|
t.push(0.39894 * Math.exp(-0.5 * s * s / (e * e)) / e);
|
|
1637
|
-
return new
|
|
1995
|
+
return new x({
|
|
1638
1996
|
defines: {
|
|
1639
1997
|
KERNEL_RADIUS: e
|
|
1640
1998
|
},
|
|
1641
1999
|
uniforms: {
|
|
1642
2000
|
colorTexture: { value: null },
|
|
1643
|
-
invSize: { value: new
|
|
2001
|
+
invSize: { value: new h(0.5, 0.5) },
|
|
1644
2002
|
// inverse texture size
|
|
1645
|
-
direction: { value: new
|
|
2003
|
+
direction: { value: new h(0.5, 0.5) },
|
|
1646
2004
|
gaussianCoefficients: { value: t }
|
|
1647
2005
|
// precomputed Gaussian coefficients
|
|
1648
2006
|
},
|
|
@@ -1675,7 +2033,7 @@ class M extends m {
|
|
|
1675
2033
|
});
|
|
1676
2034
|
}
|
|
1677
2035
|
getCompositeMaterial(e) {
|
|
1678
|
-
return new
|
|
2036
|
+
return new x({
|
|
1679
2037
|
defines: {
|
|
1680
2038
|
NUM_MIPS: e
|
|
1681
2039
|
},
|
|
@@ -1721,42 +2079,51 @@ class M extends m {
|
|
|
1721
2079
|
});
|
|
1722
2080
|
}
|
|
1723
2081
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
const
|
|
2082
|
+
L.BlurDirectionX = new h(1, 0);
|
|
2083
|
+
L.BlurDirectionY = new h(0, 1);
|
|
2084
|
+
const Lt = /* @__PURE__ */ p({
|
|
1727
2085
|
__name: "UnrealBloom",
|
|
1728
2086
|
props: {
|
|
1729
2087
|
radius: { default: 0 },
|
|
1730
2088
|
strength: { default: 1 },
|
|
1731
2089
|
threshold: { default: 0 }
|
|
1732
2090
|
},
|
|
1733
|
-
setup(
|
|
1734
|
-
const t =
|
|
1735
|
-
new
|
|
2091
|
+
setup(i, { expose: e }) {
|
|
2092
|
+
const t = i, { sizes: s } = S(), { pass: a } = P(() => new L(
|
|
2093
|
+
new h(s.width.value, s.height.value),
|
|
1736
2094
|
t.radius,
|
|
1737
2095
|
t.strength,
|
|
1738
2096
|
t.threshold
|
|
1739
2097
|
), t);
|
|
1740
|
-
return e({ pass: a }),
|
|
2098
|
+
return e({ pass: a }), m(() => {
|
|
1741
2099
|
var r;
|
|
1742
2100
|
a.value.radius = t.radius ?? ((r = a.value.getCompositeMaterial().uniforms.bloomRadius) == null ? void 0 : r.value) ?? 0.1;
|
|
1743
|
-
}),
|
|
2101
|
+
}), m(() => {
|
|
1744
2102
|
var r;
|
|
1745
2103
|
a.value.strength = t.strength ?? ((r = a.value.getCompositeMaterial().uniforms.bloomStrength) == null ? void 0 : r.value) ?? 1;
|
|
1746
|
-
}),
|
|
2104
|
+
}), m(() => {
|
|
1747
2105
|
var r;
|
|
1748
|
-
a.value.threshold = t.threshold ?? ((r =
|
|
2106
|
+
a.value.threshold = t.threshold ?? ((r = Se.uniforms.luminosityThreshold) == null ? void 0 : r.value) ?? 1;
|
|
1749
2107
|
}), () => {
|
|
1750
2108
|
};
|
|
1751
2109
|
}
|
|
1752
2110
|
});
|
|
1753
2111
|
export {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
2112
|
+
gt as BloomPmndrs,
|
|
2113
|
+
vt as DepthOfFieldPmndrs,
|
|
2114
|
+
wt as EffectComposer,
|
|
2115
|
+
pt as EffectComposerPmndrs,
|
|
2116
|
+
Mt as Glitch,
|
|
2117
|
+
xt as GlitchPmndrs,
|
|
2118
|
+
yt as Halftone,
|
|
2119
|
+
bt as NoisePmndrs,
|
|
2120
|
+
St as OutlinePmndrs,
|
|
2121
|
+
Et as Output,
|
|
2122
|
+
Ct as Pixelation,
|
|
2123
|
+
At as PixelationPmndrs,
|
|
2124
|
+
Dt as SMAA,
|
|
2125
|
+
Lt as UnrealBloom,
|
|
2126
|
+
Tt as VignettePmndrs,
|
|
2127
|
+
P as useEffect,
|
|
2128
|
+
y as useEffectPmndrs
|
|
1762
2129
|
};
|