@tresjs/post-processing 1.0.0-next.0 → 1.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/README.md +0 -4
- package/dist/core/pmndrs/Bloom.vue.d.ts +61 -0
- package/dist/core/pmndrs/DepthOfField.vue.d.ts +35 -0
- package/dist/core/pmndrs/EffectComposer.vue.d.ts +36 -0
- package/dist/core/pmndrs/Glitch.vue.d.ts +51 -0
- package/dist/core/pmndrs/Noise.vue.d.ts +16 -0
- package/dist/core/pmndrs/Outline.vue.d.ts +46 -0
- package/dist/core/pmndrs/Pixelation.vue.d.ts +12 -0
- package/dist/core/pmndrs/Vignette.vue.d.ts +20 -0
- package/dist/core/pmndrs/composables/useEffect.d.ts +6 -0
- package/dist/core/pmndrs/index.d.ts +10 -0
- package/dist/core/three/EffectComposer.vue.d.ts +20 -0
- package/dist/core/three/Glitch.vue.d.ts +15 -0
- package/dist/core/three/Halftone.vue.d.ts +23 -0
- package/dist/core/three/Output.vue.d.ts +5 -0
- package/dist/core/three/Pixelation.vue.d.ts +10 -0
- package/dist/core/three/SMAA.vue.d.ts +9 -0
- package/dist/core/three/UnrealBloom.vue.d.ts +14 -0
- package/dist/core/three/composables/useEffect.d.ts +9 -0
- package/dist/core/three/index.d.ts +9 -0
- package/dist/pmndrs.d.ts +2 -0
- package/dist/pmndrs.js +352 -0
- package/dist/prop-BjrXLDuj.js +43 -0
- package/dist/three.d.ts +2 -0
- package/dist/three.js +1762 -0
- package/dist/util/prop.d.ts +7 -7
- package/package.json +41 -32
- package/dist/core/EffectComposer.vue.d.ts +0 -70
- package/dist/core/composables/effect.d.ts +0 -6
- package/dist/core/effects/Bloom.vue.d.ts +0 -83
- package/dist/core/effects/DepthOfField.vue.d.ts +0 -45
- package/dist/core/effects/Glitch.vue.d.ts +0 -105
- package/dist/core/effects/Noise.vue.d.ts +0 -39
- package/dist/core/effects/Outline.vue.d.ts +0 -70
- package/dist/core/effects/Pixelation.vue.d.ts +0 -21
- package/dist/core/effects/Vignette.vue.d.ts +0 -47
- package/dist/core/injectionKeys.d.ts +0 -3
- package/dist/index.d.ts +0 -10
- package/dist/tres-postprocessing.js +0 -338
- package/dist/tres-postprocessing.umd.cjs +0 -8
package/dist/pmndrs.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @tresjs/post-processing
|
|
3
|
+
* version: v1.0.0
|
|
4
|
+
* (c) 2024
|
|
5
|
+
* description: Post-processing library for TresJS
|
|
6
|
+
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as f, shallowRef as E, provide as U, computed as z, watch as b, onUnmounted as A, renderSlot as X, inject as V, watchEffect as y, nextTick as H } from "vue";
|
|
9
|
+
import { EffectComposer as G, RenderPass as I, NormalPass as q, DepthDownsamplingPass as K, EffectPass as J, BloomEffect as L, DepthOfFieldEffect as P, GlitchEffect as C, GlitchMode as Q, BlendFunction as D, NoiseEffect as R, OutlineEffect as W, PixelationEffect as M, VignetteTechnique as Z, VignetteEffect as k } from "postprocessing";
|
|
10
|
+
import { m as x, a as h, o as B } from "./prop-BjrXLDuj.js";
|
|
11
|
+
import { useTresContext as w, useLoop as _, normalizeColor as S } from "@tresjs/core";
|
|
12
|
+
import { HalfFloatType as T } from "three";
|
|
13
|
+
class O {
|
|
14
|
+
static isWebGL2Available() {
|
|
15
|
+
try {
|
|
16
|
+
const o = document.createElement("canvas");
|
|
17
|
+
return !!(window.WebGL2RenderingContext && o.getContext("webgl2"));
|
|
18
|
+
} catch {
|
|
19
|
+
return !1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static isColorSpaceAvailable(o) {
|
|
23
|
+
try {
|
|
24
|
+
const e = document.createElement("canvas"), t = window.WebGL2RenderingContext && e.getContext("webgl2");
|
|
25
|
+
return t.drawingBufferColorSpace = o, t.drawingBufferColorSpace === o;
|
|
26
|
+
} catch {
|
|
27
|
+
return !1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static getWebGL2ErrorMessage() {
|
|
31
|
+
return this.getErrorMessage(2);
|
|
32
|
+
}
|
|
33
|
+
static getErrorMessage(o) {
|
|
34
|
+
const e = {
|
|
35
|
+
1: "WebGL",
|
|
36
|
+
2: "WebGL 2"
|
|
37
|
+
}, t = {
|
|
38
|
+
1: window.WebGLRenderingContext,
|
|
39
|
+
2: window.WebGL2RenderingContext
|
|
40
|
+
};
|
|
41
|
+
let n = 'Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';
|
|
42
|
+
const a = document.createElement("div");
|
|
43
|
+
return a.id = "webglmessage", a.style.fontFamily = "monospace", a.style.fontSize = "13px", a.style.fontWeight = "normal", a.style.textAlign = "center", a.style.background = "#fff", a.style.color = "#000", a.style.padding = "1.5em", a.style.width = "400px", a.style.margin = "5em auto 0", t[o] ? n = n.replace("$0", "graphics card") : n = n.replace("$0", "browser"), n = n.replace("$1", e[o]), a.innerHTML = n, a;
|
|
44
|
+
}
|
|
45
|
+
// @deprecated, r168
|
|
46
|
+
static isWebGLAvailable() {
|
|
47
|
+
console.warn("isWebGLAvailable() has been deprecated and will be removed in r178. Use isWebGL2Available() instead.");
|
|
48
|
+
try {
|
|
49
|
+
const o = document.createElement("canvas");
|
|
50
|
+
return !!(window.WebGLRenderingContext && (o.getContext("webgl") || o.getContext("experimental-webgl")));
|
|
51
|
+
} catch {
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static getWebGLErrorMessage() {
|
|
56
|
+
return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."), this.getErrorMessage(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const $ = Symbol("effectComposer"), le = /* @__PURE__ */ f({
|
|
60
|
+
__name: "EffectComposer",
|
|
61
|
+
props: {
|
|
62
|
+
enabled: { type: Boolean, default: !0 },
|
|
63
|
+
depthBuffer: { type: Boolean, default: void 0 },
|
|
64
|
+
disableNormalPass: { type: Boolean, default: !1 },
|
|
65
|
+
stencilBuffer: { type: Boolean, default: void 0 },
|
|
66
|
+
resolutionScale: {},
|
|
67
|
+
autoClear: { type: Boolean, default: !0 },
|
|
68
|
+
multisampling: { default: 0 },
|
|
69
|
+
frameBufferType: { default: T }
|
|
70
|
+
},
|
|
71
|
+
emits: ["render"],
|
|
72
|
+
setup(s, { expose: o, emit: e }) {
|
|
73
|
+
const t = s, n = e, { scene: a, camera: r, renderer: u, sizes: c, render: d } = w(), l = E(null);
|
|
74
|
+
let m = null, g = null;
|
|
75
|
+
U($, l), o({ composer: l });
|
|
76
|
+
const N = () => {
|
|
77
|
+
l.value && (g = new q(a.value, r.value), g.enabled = !1, l.value.addPass(g), t.resolutionScale !== void 0 && O.isWebGL2Available() && (m = new K({
|
|
78
|
+
normalBuffer: g.texture,
|
|
79
|
+
resolutionScale: t.resolutionScale
|
|
80
|
+
}), m.enabled = !1, l.value.addPass(m)));
|
|
81
|
+
}, Y = z(() => {
|
|
82
|
+
const i = new G(), v = {
|
|
83
|
+
depthBuffer: t.depthBuffer !== void 0 ? t.depthBuffer : i.inputBuffer.depthBuffer,
|
|
84
|
+
stencilBuffer: t.stencilBuffer !== void 0 ? t.stencilBuffer : i.inputBuffer.stencilBuffer,
|
|
85
|
+
multisampling: O.isWebGL2Available() ? t.multisampling !== void 0 ? t.multisampling : i.multisampling : 0,
|
|
86
|
+
frameBufferType: t.frameBufferType !== void 0 ? t.frameBufferType : T
|
|
87
|
+
};
|
|
88
|
+
return i.dispose(), v;
|
|
89
|
+
}), F = () => {
|
|
90
|
+
var i;
|
|
91
|
+
!u.value && !a.value && !r.value || ((i = l.value) == null || i.dispose(), l.value = new G(u.value, Y.value), l.value.addPass(new I(a.value, r.value)), t.disableNormalPass || N());
|
|
92
|
+
};
|
|
93
|
+
b([u, a, r, () => t.disableNormalPass], () => {
|
|
94
|
+
!c.width.value || !c.height.value || F();
|
|
95
|
+
}), b(() => [c.width.value, c.height.value], ([i, v]) => {
|
|
96
|
+
!i && !v || (l.value ? l.value.setSize(i, v) : F());
|
|
97
|
+
}, {
|
|
98
|
+
immediate: !0
|
|
99
|
+
});
|
|
100
|
+
const { render: j } = _();
|
|
101
|
+
return j(() => {
|
|
102
|
+
if (t.enabled && u.value && l.value && c.width.value && c.height.value && d.frames.value > 0) {
|
|
103
|
+
const i = u.value.autoClear;
|
|
104
|
+
u.value.autoClear = t.autoClear, t.stencilBuffer && !t.autoClear && u.value.clearStencil(), l.value.render(), n("render", l.value), u.value.autoClear = i;
|
|
105
|
+
}
|
|
106
|
+
d.frames.value = d.mode.value === "always" ? 1 : Math.max(0, d.frames.value - 1);
|
|
107
|
+
}), A(() => {
|
|
108
|
+
var i;
|
|
109
|
+
(i = l.value) == null || i.dispose();
|
|
110
|
+
}), (i, v) => X(i.$slots, "default");
|
|
111
|
+
}
|
|
112
|
+
}), p = (s, o) => {
|
|
113
|
+
const e = V($), t = E(null), n = E(null), { scene: a, camera: r, invalidate: u } = w();
|
|
114
|
+
o && b(o, () => u()), y(() => {
|
|
115
|
+
!r.value || !(n != null && n.value) || (n.value.mainCamera = r.value);
|
|
116
|
+
});
|
|
117
|
+
const c = y(() => {
|
|
118
|
+
!r.value || !(e != null && e.value) || !a.value || (H(() => c()), !n.value && (n.value = s(), t.value = new J(r.value, n.value), e.value.addPass(t.value)));
|
|
119
|
+
});
|
|
120
|
+
return A(() => {
|
|
121
|
+
var d, l, m;
|
|
122
|
+
t.value && ((d = e == null ? void 0 : e.value) == null || d.removePass(t.value)), (l = n.value) == null || l.dispose(), (m = t.value) == null || m.dispose();
|
|
123
|
+
}), {
|
|
124
|
+
pass: t,
|
|
125
|
+
effect: n
|
|
126
|
+
};
|
|
127
|
+
}, se = /* @__PURE__ */ f({
|
|
128
|
+
__name: "Bloom",
|
|
129
|
+
props: {
|
|
130
|
+
blendFunction: {},
|
|
131
|
+
intensity: {},
|
|
132
|
+
kernelSize: {},
|
|
133
|
+
luminanceThreshold: {},
|
|
134
|
+
luminanceSmoothing: {},
|
|
135
|
+
mipmapBlur: { type: Boolean, default: void 0 }
|
|
136
|
+
},
|
|
137
|
+
setup(s, { expose: o }) {
|
|
138
|
+
const e = s, { pass: t, effect: n } = p(() => new L(e), e);
|
|
139
|
+
return o({ pass: t, effect: n }), x(
|
|
140
|
+
[
|
|
141
|
+
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
142
|
+
[() => e.intensity, "intensity"],
|
|
143
|
+
[() => e.kernelSize, "kernelSize"],
|
|
144
|
+
[() => e.luminanceSmoothing, "luminanceMaterial.smoothing"],
|
|
145
|
+
[() => e.luminanceThreshold, "luminanceMaterial.threshold"]
|
|
146
|
+
],
|
|
147
|
+
n,
|
|
148
|
+
() => new L()
|
|
149
|
+
), () => {
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}), re = /* @__PURE__ */ f({
|
|
153
|
+
__name: "DepthOfField",
|
|
154
|
+
props: {
|
|
155
|
+
blendFunction: {},
|
|
156
|
+
worldFocusDistance: {},
|
|
157
|
+
worldFocusRange: {},
|
|
158
|
+
focusDistance: {},
|
|
159
|
+
focusRange: {},
|
|
160
|
+
bokehScale: {},
|
|
161
|
+
resolutionScale: {},
|
|
162
|
+
resolutionX: {},
|
|
163
|
+
resolutionY: {}
|
|
164
|
+
},
|
|
165
|
+
setup(s, { expose: o }) {
|
|
166
|
+
const e = s, { camera: t } = w(), { pass: n, effect: a } = p(() => new P(t.value, e), e);
|
|
167
|
+
return o({ pass: n, effect: a }), x(
|
|
168
|
+
[
|
|
169
|
+
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
170
|
+
[() => e.worldFocusDistance, "circleOfConfusionMaterial.worldFocusDistance"],
|
|
171
|
+
[() => e.focusDistance, "circleOfConfusionMaterial.focusDistance"],
|
|
172
|
+
[() => e.worldFocusRange, "circleOfConfusionMaterial.worldFocusRange"],
|
|
173
|
+
[() => e.focusRange, "circleOfConfusionMaterial.focusRange"],
|
|
174
|
+
[() => e.bokehScale, "bokehScale"],
|
|
175
|
+
[() => e.resolutionScale, "blurPass.resolution.scale"],
|
|
176
|
+
[() => e.resolutionX, "resolution.width"],
|
|
177
|
+
[() => e.resolutionY, "resolution.height"]
|
|
178
|
+
],
|
|
179
|
+
a,
|
|
180
|
+
() => new P()
|
|
181
|
+
), () => {
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}), ie = /* @__PURE__ */ f({
|
|
185
|
+
__name: "Glitch",
|
|
186
|
+
props: {
|
|
187
|
+
blendFunction: {},
|
|
188
|
+
delay: {},
|
|
189
|
+
duration: {},
|
|
190
|
+
strength: {},
|
|
191
|
+
mode: {},
|
|
192
|
+
active: { type: Boolean },
|
|
193
|
+
ratio: {},
|
|
194
|
+
columns: {},
|
|
195
|
+
chromaticAberrationOffset: {},
|
|
196
|
+
perturbationMap: {},
|
|
197
|
+
dtSize: {}
|
|
198
|
+
},
|
|
199
|
+
setup(s, { expose: o }) {
|
|
200
|
+
const e = s, { pass: t, effect: n } = p(() => new C(e), e);
|
|
201
|
+
o({ pass: t, effect: n });
|
|
202
|
+
const { onBeforeRender: a } = _();
|
|
203
|
+
return a(({ invalidate: r }) => r()), y(() => {
|
|
204
|
+
const r = () => {
|
|
205
|
+
if (e.mode !== void 0)
|
|
206
|
+
return e.active === !1 ? Q.DISABLED : e.mode;
|
|
207
|
+
const u = new C(), c = u.mode;
|
|
208
|
+
return u.dispose(), c;
|
|
209
|
+
};
|
|
210
|
+
n.value && (n.value.mode = r());
|
|
211
|
+
}), h(
|
|
212
|
+
B(e, ["active", "mode", "blendFunction"]),
|
|
213
|
+
n,
|
|
214
|
+
() => new C()
|
|
215
|
+
), () => {
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}), ue = /* @__PURE__ */ f({
|
|
219
|
+
__name: "Noise",
|
|
220
|
+
props: {
|
|
221
|
+
premultiply: { type: Boolean, default: !1 },
|
|
222
|
+
blendFunction: { default: D.SCREEN }
|
|
223
|
+
},
|
|
224
|
+
setup(s, { expose: o }) {
|
|
225
|
+
const e = s, { pass: t, effect: n } = p(() => new R(e), e);
|
|
226
|
+
o({ pass: t, effect: n });
|
|
227
|
+
const { onBeforeRender: a } = _();
|
|
228
|
+
return a(({ invalidate: r }) => r()), h(
|
|
229
|
+
B(e, ["blendFunction"]),
|
|
230
|
+
n,
|
|
231
|
+
() => new R()
|
|
232
|
+
), () => {
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}), ce = /* @__PURE__ */ f({
|
|
236
|
+
__name: "Outline",
|
|
237
|
+
props: {
|
|
238
|
+
outlinedObjects: {},
|
|
239
|
+
blur: { type: Boolean, default: void 0 },
|
|
240
|
+
xRay: { type: Boolean, default: void 0 },
|
|
241
|
+
kernelSize: {},
|
|
242
|
+
pulseSpeed: {},
|
|
243
|
+
resolutionX: {},
|
|
244
|
+
resolutionY: {},
|
|
245
|
+
edgeStrength: {},
|
|
246
|
+
patternScale: {},
|
|
247
|
+
multisampling: {},
|
|
248
|
+
blendFunction: {},
|
|
249
|
+
patternTexture: {},
|
|
250
|
+
resolutionScale: {},
|
|
251
|
+
hiddenEdgeColor: {},
|
|
252
|
+
visibleEdgeColor: {}
|
|
253
|
+
},
|
|
254
|
+
setup(s, { expose: o }) {
|
|
255
|
+
const e = s, t = (l) => l !== void 0 ? S(l).getHex() : void 0, { camera: n, scene: a } = w(), r = {
|
|
256
|
+
blur: e.blur,
|
|
257
|
+
xRay: e.xRay,
|
|
258
|
+
kernelSize: e.kernelSize,
|
|
259
|
+
pulseSpeed: e.pulseSpeed,
|
|
260
|
+
resolutionX: e.resolutionX,
|
|
261
|
+
resolutionY: e.resolutionY,
|
|
262
|
+
patternScale: e.patternScale,
|
|
263
|
+
edgeStrength: e.edgeStrength,
|
|
264
|
+
blendFunction: e.blendFunction,
|
|
265
|
+
multisampling: e.multisampling,
|
|
266
|
+
patternTexture: e.patternTexture,
|
|
267
|
+
resolutionScale: e.resolutionScale,
|
|
268
|
+
hiddenEdgeColor: t(e.hiddenEdgeColor),
|
|
269
|
+
visibleEdgeColor: t(e.visibleEdgeColor)
|
|
270
|
+
}, { pass: u, effect: c } = p(() => new W(a.value, n.value, r), e);
|
|
271
|
+
o({ pass: u, effect: c }), b(
|
|
272
|
+
[() => e.outlinedObjects, c],
|
|
273
|
+
// watchEffect is intentionally not used here as it would result in an endless loop
|
|
274
|
+
() => {
|
|
275
|
+
var l;
|
|
276
|
+
(l = c.value) == null || l.selection.set(e.outlinedObjects || []);
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
immediate: !0
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
const d = z(() => ({
|
|
283
|
+
hiddenEdgeColor: e.hiddenEdgeColor ? S(e.hiddenEdgeColor) : void 0,
|
|
284
|
+
visibleEdgeColor: e.visibleEdgeColor ? S(e.visibleEdgeColor) : void 0
|
|
285
|
+
}));
|
|
286
|
+
return x(
|
|
287
|
+
[
|
|
288
|
+
/* some properties are not updated because of different reasons:
|
|
289
|
+
resolutionX - has no setter in OutlineEffect
|
|
290
|
+
resolutionY - has no setter in OutlineEffect
|
|
291
|
+
blendFunction - has no setter in OutlineEffect
|
|
292
|
+
patternTexture - different type in constructor and in setter
|
|
293
|
+
resolutionScale - has no setter in OutlineEffect
|
|
294
|
+
*/
|
|
295
|
+
[() => e.blur, "blur"],
|
|
296
|
+
[() => e.xRay, "xRay"],
|
|
297
|
+
[() => e.pulseSpeed, "pulseSpeed"],
|
|
298
|
+
[() => e.kernelSize, "kernelSize"],
|
|
299
|
+
[() => e.edgeStrength, "edgeStrength"],
|
|
300
|
+
[() => e.patternScale, "patternScale"],
|
|
301
|
+
[() => e.multisampling, "multisampling"],
|
|
302
|
+
[() => d.value.hiddenEdgeColor, "hiddenEdgeColor"],
|
|
303
|
+
[() => d.value.visibleEdgeColor, "visibleEdgeColor"]
|
|
304
|
+
],
|
|
305
|
+
c,
|
|
306
|
+
() => new W()
|
|
307
|
+
), () => {
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}), de = /* @__PURE__ */ f({
|
|
311
|
+
__name: "Pixelation",
|
|
312
|
+
props: {
|
|
313
|
+
granularity: {}
|
|
314
|
+
},
|
|
315
|
+
setup(s, { expose: o }) {
|
|
316
|
+
const e = s, { pass: t, effect: n } = p(() => new M(e.granularity), e);
|
|
317
|
+
return o({ pass: t, effect: n }), h(
|
|
318
|
+
e,
|
|
319
|
+
n,
|
|
320
|
+
() => new M()
|
|
321
|
+
), () => {
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}), fe = /* @__PURE__ */ f({
|
|
325
|
+
__name: "Vignette",
|
|
326
|
+
props: {
|
|
327
|
+
technique: { default: Z.DEFAULT },
|
|
328
|
+
blendFunction: { default: D.NORMAL },
|
|
329
|
+
offset: { default: 0.5 },
|
|
330
|
+
darkness: { default: 0.5 }
|
|
331
|
+
},
|
|
332
|
+
setup(s, { expose: o }) {
|
|
333
|
+
const e = s, { pass: t, effect: n } = p(() => new k(e), e);
|
|
334
|
+
return o({ pass: t, effect: n }), h(
|
|
335
|
+
B(e, ["blendFunction"]),
|
|
336
|
+
n,
|
|
337
|
+
() => new k()
|
|
338
|
+
), () => {
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
export {
|
|
343
|
+
se as Bloom,
|
|
344
|
+
re as DepthOfField,
|
|
345
|
+
le as EffectComposer,
|
|
346
|
+
ie as Glitch,
|
|
347
|
+
ue as Noise,
|
|
348
|
+
ce as Outline,
|
|
349
|
+
de as Pixelation,
|
|
350
|
+
fe as Vignette,
|
|
351
|
+
p as useEffect
|
|
352
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @tresjs/post-processing
|
|
3
|
+
* version: v1.0.0
|
|
4
|
+
* (c) 2024
|
|
5
|
+
* description: Post-processing library for TresJS
|
|
6
|
+
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
|
+
*/
|
|
8
|
+
import { watch as f } from "vue";
|
|
9
|
+
const m = /([^[.\]])+/g, d = (r, s) => {
|
|
10
|
+
if (!s)
|
|
11
|
+
return;
|
|
12
|
+
const e = Array.isArray(s) ? s : s.match(m);
|
|
13
|
+
return e == null ? void 0 : e.reduce((o, n) => o && o[n], r);
|
|
14
|
+
}, a = (r, s, e) => {
|
|
15
|
+
const o = Array.isArray(s) ? s : s.match(m);
|
|
16
|
+
o && o.reduce((n, t, c) => (n[t] === void 0 && (n[t] = {}), c === o.length - 1 && (n[t] = e), n[t]), r);
|
|
17
|
+
}, v = (r, s) => {
|
|
18
|
+
const e = { ...r };
|
|
19
|
+
return s.forEach((o) => delete e[o]), e;
|
|
20
|
+
}, u = (r, s, e, o, n = {}) => f(r, (t) => {
|
|
21
|
+
var c;
|
|
22
|
+
if (s.value)
|
|
23
|
+
if (t === void 0) {
|
|
24
|
+
const i = o();
|
|
25
|
+
a(s.value, e, d(i, e)), (c = i.dispose) == null || c.call(i);
|
|
26
|
+
} else
|
|
27
|
+
a(s.value, e, r());
|
|
28
|
+
}, n), A = (r, s, e) => r.map(([o, n]) => u(
|
|
29
|
+
o,
|
|
30
|
+
s,
|
|
31
|
+
n,
|
|
32
|
+
e
|
|
33
|
+
)), g = (r, s, e) => Object.keys(r).map((o) => u(
|
|
34
|
+
() => r[o],
|
|
35
|
+
s,
|
|
36
|
+
o,
|
|
37
|
+
e
|
|
38
|
+
));
|
|
39
|
+
export {
|
|
40
|
+
g as a,
|
|
41
|
+
A as m,
|
|
42
|
+
v as o
|
|
43
|
+
};
|
package/dist/three.d.ts
ADDED