@tresjs/post-processing 0.7.0 → 1.0.0-next.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 +4 -5
- package/dist/core/EffectComposer.vue.d.ts +10 -2
- package/dist/core/composables/effect.d.ts +2 -2
- package/dist/core/effects/Bloom.vue.d.ts +3 -3
- package/dist/core/effects/DepthOfField.vue.d.ts +2 -2
- package/dist/core/effects/Glitch.vue.d.ts +4 -4
- package/dist/core/effects/Noise.vue.d.ts +2 -2
- package/dist/core/effects/Outline.vue.d.ts +2 -2
- package/dist/core/effects/Pixelation.vue.d.ts +2 -2
- package/dist/core/effects/Vignette.vue.d.ts +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/tres-postprocessing.js +138 -139
- package/dist/tres-postprocessing.umd.cjs +3 -3
- package/dist/util/prop.d.ts +3 -3
- package/package.json +25 -24
package/README.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://www.npmjs.com/package/@tresjs/core"><img src="https://img.shields.io/npm/v/@tresjs/post-processing?color
|
|
5
|
-
|
|
6
|
-
<a href="https://discord.gg/UCr96AQmWn"><img src="https://img.shields.io/badge/chat-discord-purple?style=flat&logo=discord" alt="discord chat"></a>
|
|
7
|
-
|
|
4
|
+
<a href="https://www.npmjs.com/package/@tresjs/core"><img src="https://img.shields.io/npm/v/@tresjs/post-processing?color=FF7BAC" alt="npm package"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@tresjs/post-processing"><img src="https://img.shields.io/npm/dm/@tresjs/post-processing?color=FF7BAC" alt="npm downloads"></a>
|
|
6
|
+
<a href="https://discord.gg/UCr96AQmWn"><img src="https://img.shields.io/badge/chat-discord-purple?style=flat&logo=discord" alt="discord chat"></a>
|
|
8
7
|
</p>
|
|
9
8
|
<br/>
|
|
10
9
|
|
|
@@ -24,7 +23,7 @@ pnpm i @tresjs/post-processing
|
|
|
24
23
|
|
|
25
24
|
## Docs
|
|
26
25
|
|
|
27
|
-
Checkout the [docs](https://
|
|
26
|
+
Checkout the [docs](https://post-processing.tresjs.org/)
|
|
28
27
|
|
|
29
28
|
## Demos
|
|
30
29
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { TresObject } from '@tresjs/core';
|
|
2
|
+
import { EffectComposer as EffectComposerImpl } from 'postprocessing';
|
|
3
|
+
import type { ShallowRef } from 'vue';
|
|
2
4
|
export interface EffectComposerProps {
|
|
3
5
|
enabled?: boolean;
|
|
4
6
|
children?: TresObject[];
|
|
@@ -18,7 +20,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
18
20
|
depthBuffer: undefined;
|
|
19
21
|
multisampling: number;
|
|
20
22
|
stencilBuffer: undefined;
|
|
21
|
-
}>, {
|
|
23
|
+
}>, {
|
|
24
|
+
composer: ShallowRef<EffectComposerImpl | null>;
|
|
25
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
render: (...args: any[]) => void;
|
|
27
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EffectComposerProps>, {
|
|
22
28
|
enabled: boolean;
|
|
23
29
|
autoClear: boolean;
|
|
24
30
|
frameBufferType: 1016;
|
|
@@ -26,7 +32,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
26
32
|
depthBuffer: undefined;
|
|
27
33
|
multisampling: number;
|
|
28
34
|
stencilBuffer: undefined;
|
|
29
|
-
}
|
|
35
|
+
}>>> & {
|
|
36
|
+
onRender?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
}, {
|
|
30
38
|
enabled: boolean;
|
|
31
39
|
depthBuffer: boolean;
|
|
32
40
|
disableNormalPass: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Effect } from 'postprocessing';
|
|
2
2
|
import { EffectPass } from 'postprocessing';
|
|
3
3
|
export declare const useEffect: <T extends Effect>(newEffectFunction: () => T) => {
|
|
4
|
-
pass: import("vue").ShallowRef<EffectPass | null>;
|
|
5
|
-
effect: import("vue").ShallowRef<T | null>;
|
|
4
|
+
pass: import("vue").Ref<EffectPass | null> | import("vue").ShallowRef<EffectPass | null>;
|
|
5
|
+
effect: import("vue").Ref<T | null> | import("vue").ShallowRef<T | null>;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BloomEffect } from 'postprocessing';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BlendFunction, KernelSize } from 'postprocessing';
|
|
3
3
|
export interface BloomProps {
|
|
4
4
|
/**
|
|
5
5
|
* The blend function of this effect. This prop is not reactive.
|
|
@@ -56,8 +56,8 @@ export interface BloomProps {
|
|
|
56
56
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BloomProps>, {
|
|
57
57
|
mipmapBlur: undefined;
|
|
58
58
|
}>, {
|
|
59
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
60
|
-
effect: import("vue").ShallowRef<BloomEffect | null>;
|
|
59
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
60
|
+
effect: import("vue").Ref<BloomEffect | null> | import("vue").ShallowRef<BloomEffect | null>;
|
|
61
61
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BloomProps>, {
|
|
62
62
|
mipmapBlur: undefined;
|
|
63
63
|
}>>>, {
|
|
@@ -30,8 +30,8 @@ export interface DepthOfFieldProps {
|
|
|
30
30
|
resolutionY?: number;
|
|
31
31
|
}
|
|
32
32
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<DepthOfFieldProps>, {
|
|
33
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
34
|
-
effect: import("vue").ShallowRef<DepthOfFieldEffect | null>;
|
|
33
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
34
|
+
effect: import("vue").Ref<DepthOfFieldEffect | null> | import("vue").ShallowRef<DepthOfFieldEffect | null>;
|
|
35
35
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DepthOfFieldProps>>>, {}, {}>;
|
|
36
36
|
export default _default;
|
|
37
37
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlitchEffect, GlitchMode } from 'postprocessing';
|
|
2
2
|
import type { BlendFunction } from 'postprocessing';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Texture, Vector2 } from 'three';
|
|
4
4
|
export interface GlitchProps {
|
|
5
5
|
blendFunction?: BlendFunction;
|
|
6
6
|
/**
|
|
@@ -90,8 +90,8 @@ export interface GlitchProps {
|
|
|
90
90
|
dtSize?: number;
|
|
91
91
|
}
|
|
92
92
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<GlitchProps>, {
|
|
93
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
94
|
-
effect: import("vue").ShallowRef<GlitchEffect | null>;
|
|
93
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
94
|
+
effect: import("vue").Ref<GlitchEffect | null> | import("vue").ShallowRef<GlitchEffect | null>;
|
|
95
95
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<GlitchProps>>>, {}, {}>;
|
|
96
96
|
export default _default;
|
|
97
97
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -10,8 +10,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
10
10
|
premultiply: boolean;
|
|
11
11
|
blendFunction: BlendFunction;
|
|
12
12
|
}>, {
|
|
13
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
14
|
-
effect: import("vue").ShallowRef<NoiseEffect | null>;
|
|
13
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
14
|
+
effect: import("vue").Ref<NoiseEffect | null> | import("vue").ShallowRef<NoiseEffect | null>;
|
|
15
15
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<NoiseProps>, {
|
|
16
16
|
premultiply: boolean;
|
|
17
17
|
blendFunction: BlendFunction;
|
|
@@ -41,8 +41,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
41
41
|
blur: undefined;
|
|
42
42
|
xRay: undefined;
|
|
43
43
|
}>, {
|
|
44
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
45
|
-
effect: import("vue").ShallowRef<OutlineEffect | null>;
|
|
44
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
45
|
+
effect: import("vue").Ref<OutlineEffect | null> | import("vue").ShallowRef<OutlineEffect | null>;
|
|
46
46
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlineProps>, {
|
|
47
47
|
blur: undefined;
|
|
48
48
|
xRay: undefined;
|
|
@@ -6,8 +6,8 @@ export interface PixelationProps {
|
|
|
6
6
|
granularity?: number;
|
|
7
7
|
}
|
|
8
8
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<PixelationProps>, {
|
|
9
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
10
|
-
effect: import("vue").ShallowRef<PixelationEffect | null>;
|
|
9
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
10
|
+
effect: import("vue").Ref<PixelationEffect | null> | import("vue").ShallowRef<PixelationEffect | null>;
|
|
11
11
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PixelationProps>>>, {}, {}>;
|
|
12
12
|
export default _default;
|
|
13
13
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -14,8 +14,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
14
14
|
offset: number;
|
|
15
15
|
darkness: number;
|
|
16
16
|
}>, {
|
|
17
|
-
pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
18
|
-
effect: import("vue").ShallowRef<VignetteEffect | null>;
|
|
17
|
+
pass: import("vue").Ref<import("postprocessing").EffectPass | null> | import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
|
|
18
|
+
effect: import("vue").Ref<VignetteEffect | null> | import("vue").ShallowRef<VignetteEffect | null>;
|
|
19
19
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<VignetteProps>, {
|
|
20
20
|
technique: VignetteTechnique;
|
|
21
21
|
blendFunction: BlendFunction;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ import Outline from './core/effects/Outline.vue';
|
|
|
6
6
|
import Pixelation from './core/effects/Pixelation.vue';
|
|
7
7
|
import Vignette from './core/effects/Vignette.vue';
|
|
8
8
|
import Noise from './core/effects/Noise.vue';
|
|
9
|
-
|
|
9
|
+
import { useEffect } from './core/composables/effect.ts';
|
|
10
|
+
export { Bloom, DepthOfField, EffectComposer, Glitch, Noise, Outline, Pixelation, Vignette, useEffect, };
|
|
@@ -1,64 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version:
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v1.0.0-next.0
|
|
4
|
+
* (c) 2024
|
|
5
5
|
* description: Post-processing library for TresJS
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
import { inject as
|
|
9
|
-
import { EffectPass as
|
|
10
|
-
import { useTresContext as
|
|
11
|
-
import { HalfFloatType as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
!a.value || !(
|
|
8
|
+
import { inject as q, shallowRef as E, watchEffect as x, onUnmounted as L, watch as _, defineComponent as d, provide as H, computed as $, renderSlot as I } from "vue";
|
|
9
|
+
import { EffectPass as K, BloomEffect as P, DepthOfFieldEffect as R, EffectComposer as O, RenderPass as J, NormalPass as Q, DepthDownsamplingPass as Z, GlitchEffect as S, GlitchMode as ee, OutlineEffect as D, PixelationEffect as T, VignetteTechnique as te, BlendFunction as G, VignetteEffect as z, NoiseEffect as k } from "postprocessing";
|
|
10
|
+
import { useTresContext as b, useLoop as ne, normalizeColor as w } from "@tresjs/core";
|
|
11
|
+
import { HalfFloatType as A } from "three";
|
|
12
|
+
const W = Symbol("effectComposer"), p = (l) => {
|
|
13
|
+
const n = q(W), e = E(null), t = E(null), { scene: o, camera: a } = b();
|
|
14
|
+
x(() => {
|
|
15
|
+
!a.value || !(t != null && t.value) || (t.value.mainCamera = a.value);
|
|
16
16
|
});
|
|
17
17
|
let s = () => {
|
|
18
18
|
};
|
|
19
|
-
return s =
|
|
20
|
-
!a.value || !(
|
|
21
|
-
}),
|
|
22
|
-
var r, i,
|
|
23
|
-
e.value && ((r =
|
|
19
|
+
return s = x(() => {
|
|
20
|
+
!a.value || !(n != null && n.value) || !o.value || (s(), !t.value && (t.value = l(), e.value = new K(a.value, t.value), n.value.addPass(e.value)));
|
|
21
|
+
}), L(() => {
|
|
22
|
+
var r, i, f;
|
|
23
|
+
e.value && ((r = n == null ? void 0 : n.value) == null || r.removePass(e.value)), (i = t.value) == null || i.dispose(), (f = e.value) == null || f.dispose();
|
|
24
24
|
}), {
|
|
25
25
|
pass: e,
|
|
26
|
-
effect:
|
|
26
|
+
effect: t
|
|
27
27
|
};
|
|
28
|
-
},
|
|
29
|
-
if (!
|
|
28
|
+
}, j = /([^[.\]])+/g, oe = (l, n) => {
|
|
29
|
+
if (!n)
|
|
30
30
|
return;
|
|
31
|
-
const e = Array.isArray(
|
|
32
|
-
return e == null ? void 0 : e.reduce((
|
|
33
|
-
},
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
},
|
|
31
|
+
const e = Array.isArray(n) ? n : n.match(j);
|
|
32
|
+
return e == null ? void 0 : e.reduce((t, o) => t && t[o], l);
|
|
33
|
+
}, M = (l, n, e) => {
|
|
34
|
+
const t = Array.isArray(n) ? n : n.match(j);
|
|
35
|
+
t && t.reduce((o, a, s) => (o[a] === void 0 && (o[a] = {}), s === t.length - 1 && (o[a] = e), o[a]), l);
|
|
36
|
+
}, B = (l, n) => {
|
|
37
37
|
const e = { ...l };
|
|
38
|
-
return
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
k(t.value, e, l());
|
|
49
|
-
},
|
|
50
|
-
o
|
|
51
|
-
), B = (l, t, e) => l.map(([n, o]) => W(
|
|
52
|
-
n,
|
|
38
|
+
return n.forEach((t) => delete e[t]), e;
|
|
39
|
+
}, X = (l, n, e, t, o = {}) => _(l, (a) => {
|
|
40
|
+
var s;
|
|
41
|
+
if (n.value)
|
|
42
|
+
if (a === void 0) {
|
|
43
|
+
const r = t();
|
|
44
|
+
M(n.value, e, oe(r, e)), (s = r.dispose) == null || s.call(r);
|
|
45
|
+
} else
|
|
46
|
+
M(n.value, e, l());
|
|
47
|
+
}, o), y = (l, n, e) => l.map(([t, o]) => X(
|
|
53
48
|
t,
|
|
49
|
+
n,
|
|
54
50
|
o,
|
|
55
51
|
e
|
|
56
|
-
)),
|
|
57
|
-
() => l[
|
|
58
|
-
t,
|
|
52
|
+
)), C = (l, n, e) => Object.keys(l).map((t) => X(
|
|
53
|
+
() => l[t],
|
|
59
54
|
n,
|
|
55
|
+
t,
|
|
60
56
|
e
|
|
61
|
-
)),
|
|
57
|
+
)), ue = /* @__PURE__ */ d({
|
|
62
58
|
__name: "Bloom",
|
|
63
59
|
props: {
|
|
64
60
|
blendFunction: {},
|
|
@@ -68,9 +64,9 @@ const $ = Symbol(), m = (l) => {
|
|
|
68
64
|
luminanceSmoothing: {},
|
|
69
65
|
mipmapBlur: { type: Boolean, default: void 0 }
|
|
70
66
|
},
|
|
71
|
-
setup(l, { expose:
|
|
72
|
-
const e = l, { pass:
|
|
73
|
-
return
|
|
67
|
+
setup(l, { expose: n }) {
|
|
68
|
+
const e = l, { pass: t, effect: o } = p(() => new P(e));
|
|
69
|
+
return n({ pass: t, effect: o }), y(
|
|
74
70
|
[
|
|
75
71
|
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
76
72
|
[() => e.intensity, "intensity"],
|
|
@@ -79,10 +75,10 @@ const $ = Symbol(), m = (l) => {
|
|
|
79
75
|
[() => e.luminanceThreshold, "luminanceMaterial.threshold"]
|
|
80
76
|
],
|
|
81
77
|
o,
|
|
82
|
-
() => new
|
|
78
|
+
() => new P()
|
|
83
79
|
), (a, s) => null;
|
|
84
80
|
}
|
|
85
|
-
}),
|
|
81
|
+
}), ie = /* @__PURE__ */ d({
|
|
86
82
|
__name: "DepthOfField",
|
|
87
83
|
props: {
|
|
88
84
|
blendFunction: {},
|
|
@@ -95,9 +91,9 @@ const $ = Symbol(), m = (l) => {
|
|
|
95
91
|
resolutionX: {},
|
|
96
92
|
resolutionY: {}
|
|
97
93
|
},
|
|
98
|
-
setup(l, { expose:
|
|
99
|
-
const e = l, { camera:
|
|
100
|
-
return
|
|
94
|
+
setup(l, { expose: n }) {
|
|
95
|
+
const e = l, { camera: t } = b(), { pass: o, effect: a } = p(() => new R(t.value, e));
|
|
96
|
+
return n({ pass: o, effect: a }), y(
|
|
101
97
|
[
|
|
102
98
|
// blendFunction is not updated, because it has no setter in BloomEffect
|
|
103
99
|
[() => e.worldFocusDistance, "circleOfConfusionMaterial.worldFocusDistance"],
|
|
@@ -110,24 +106,24 @@ const $ = Symbol(), m = (l) => {
|
|
|
110
106
|
[() => e.resolutionY, "resolution.height"]
|
|
111
107
|
],
|
|
112
108
|
a,
|
|
113
|
-
() => new
|
|
109
|
+
() => new R()
|
|
114
110
|
), (s, r) => null;
|
|
115
111
|
}
|
|
116
112
|
});
|
|
117
113
|
let v;
|
|
118
|
-
function
|
|
114
|
+
function N() {
|
|
119
115
|
var l;
|
|
120
116
|
if (v !== void 0)
|
|
121
117
|
return v;
|
|
122
118
|
try {
|
|
123
|
-
let
|
|
119
|
+
let n;
|
|
124
120
|
const e = document.createElement("canvas");
|
|
125
|
-
return v = !!(window.WebGL2RenderingContext && (
|
|
121
|
+
return v = !!(window.WebGL2RenderingContext && (n = e.getContext("webgl2"))), n && ((l = n.getExtension("WEBGL_lose_context")) == null || l.loseContext()), v;
|
|
126
122
|
} catch {
|
|
127
123
|
return v = !1;
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
|
-
const
|
|
126
|
+
const ce = /* @__PURE__ */ d({
|
|
131
127
|
__name: "EffectComposer",
|
|
132
128
|
props: {
|
|
133
129
|
enabled: { type: Boolean, default: !0 },
|
|
@@ -138,47 +134,49 @@ const se = /* @__PURE__ */ f({
|
|
|
138
134
|
resolutionScale: {},
|
|
139
135
|
autoClear: { type: Boolean, default: !0 },
|
|
140
136
|
multisampling: { default: 0 },
|
|
141
|
-
frameBufferType: { default:
|
|
137
|
+
frameBufferType: { default: A }
|
|
142
138
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
emits: ["render"],
|
|
140
|
+
setup(l, { expose: n, emit: e }) {
|
|
141
|
+
const t = l, o = e, { scene: a, camera: s, renderer: r, sizes: i, render: f } = b(), u = E(null);
|
|
142
|
+
let g = null, h = null;
|
|
143
|
+
H(W, u), n({ composer: u });
|
|
144
|
+
const Y = () => {
|
|
145
|
+
u.value && (h = new Q(a.value, s.value), h.enabled = !1, u.value.addPass(h), t.resolutionScale !== void 0 && N() && (g = new Z({
|
|
146
|
+
normalBuffer: h.texture,
|
|
150
147
|
resolutionScale: t.resolutionScale
|
|
151
|
-
}),
|
|
152
|
-
},
|
|
153
|
-
const
|
|
154
|
-
depthBuffer: t.depthBuffer !== void 0 ? t.depthBuffer :
|
|
155
|
-
stencilBuffer: t.stencilBuffer !== void 0 ? t.stencilBuffer :
|
|
156
|
-
multisampling:
|
|
157
|
-
frameBufferType: t.frameBufferType !== void 0 ? t.frameBufferType :
|
|
148
|
+
}), g.enabled = !1, u.value.addPass(g)));
|
|
149
|
+
}, V = $(() => {
|
|
150
|
+
const c = new O(), m = {
|
|
151
|
+
depthBuffer: t.depthBuffer !== void 0 ? t.depthBuffer : c.inputBuffer.depthBuffer,
|
|
152
|
+
stencilBuffer: t.stencilBuffer !== void 0 ? t.stencilBuffer : c.inputBuffer.stencilBuffer,
|
|
153
|
+
multisampling: N() ? t.multisampling !== void 0 ? t.multisampling : c.multisampling : 0,
|
|
154
|
+
frameBufferType: t.frameBufferType !== void 0 ? t.frameBufferType : A
|
|
158
155
|
};
|
|
159
|
-
return
|
|
160
|
-
}),
|
|
161
|
-
!
|
|
156
|
+
return c.dispose(), m;
|
|
157
|
+
}), F = () => {
|
|
158
|
+
!r.value && !a.value && !s.value || (u.value = new O(r.value, V.value), u.value.addPass(new J(a.value, s.value)), t.disableNormalPass || Y());
|
|
162
159
|
};
|
|
163
|
-
|
|
164
|
-
!
|
|
165
|
-
}),
|
|
166
|
-
!
|
|
160
|
+
_([r, a, s, () => t.disableNormalPass], () => {
|
|
161
|
+
!i.width.value || !i.height.value || F();
|
|
162
|
+
}), _(() => [i.width.value, i.height.value], ([c, m]) => {
|
|
163
|
+
!c && !m || (u.value ? u.value.setSize(c, m) : F());
|
|
167
164
|
}, {
|
|
168
165
|
immediate: !0
|
|
169
166
|
});
|
|
170
|
-
const {
|
|
171
|
-
return
|
|
172
|
-
if (t.enabled &&
|
|
173
|
-
const
|
|
174
|
-
|
|
167
|
+
const { render: U } = ne();
|
|
168
|
+
return U(() => {
|
|
169
|
+
if (t.enabled && r.value && u.value && i.width.value && i.height.value && f.frames.value > 0) {
|
|
170
|
+
const c = r.value.autoClear;
|
|
171
|
+
r.value.autoClear = t.autoClear, t.stencilBuffer && !t.autoClear && r.value.clearStencil(), u.value.render(), o("render", u.value), r.value.autoClear = c;
|
|
175
172
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
|
|
174
|
+
}), L(() => {
|
|
175
|
+
var c;
|
|
176
|
+
(c = u.value) == null || c.dispose();
|
|
177
|
+
}), (c, m) => I(c.$slots, "default");
|
|
180
178
|
}
|
|
181
|
-
}),
|
|
179
|
+
}), fe = /* @__PURE__ */ d({
|
|
182
180
|
__name: "Glitch",
|
|
183
181
|
props: {
|
|
184
182
|
blendFunction: {},
|
|
@@ -193,23 +191,23 @@ const se = /* @__PURE__ */ f({
|
|
|
193
191
|
perturbationMap: {},
|
|
194
192
|
dtSize: {}
|
|
195
193
|
},
|
|
196
|
-
setup(l, { expose:
|
|
197
|
-
const e = l, { pass:
|
|
198
|
-
return
|
|
194
|
+
setup(l, { expose: n }) {
|
|
195
|
+
const e = l, { pass: t, effect: o } = p(() => new S(e));
|
|
196
|
+
return n({ pass: t, effect: o }), x(() => {
|
|
199
197
|
const a = () => {
|
|
200
198
|
if (e.mode !== void 0)
|
|
201
|
-
return e.active === !1 ?
|
|
199
|
+
return e.active === !1 ? ee.DISABLED : e.mode;
|
|
202
200
|
const s = new S(), r = s.mode;
|
|
203
201
|
return s.dispose(), r;
|
|
204
202
|
};
|
|
205
203
|
o.value && (o.value.mode = a());
|
|
206
|
-
}),
|
|
207
|
-
|
|
204
|
+
}), C(
|
|
205
|
+
B(e, ["active", "mode", "blendFunction"]),
|
|
208
206
|
o,
|
|
209
207
|
() => new S()
|
|
210
208
|
), (a, s) => null;
|
|
211
209
|
}
|
|
212
|
-
}),
|
|
210
|
+
}), de = /* @__PURE__ */ d({
|
|
213
211
|
__name: "Outline",
|
|
214
212
|
props: {
|
|
215
213
|
outlinedObjects: {},
|
|
@@ -228,8 +226,8 @@ const se = /* @__PURE__ */ f({
|
|
|
228
226
|
hiddenEdgeColor: {},
|
|
229
227
|
visibleEdgeColor: {}
|
|
230
228
|
},
|
|
231
|
-
setup(l, { expose:
|
|
232
|
-
const e = l,
|
|
229
|
+
setup(l, { expose: n }) {
|
|
230
|
+
const e = l, t = (u) => u !== void 0 ? w(u).getHex() : void 0, { camera: o, scene: a } = b(), s = {
|
|
233
231
|
blur: e.blur,
|
|
234
232
|
xRay: e.xRay,
|
|
235
233
|
kernelSize: e.kernelSize,
|
|
@@ -242,25 +240,25 @@ const se = /* @__PURE__ */ f({
|
|
|
242
240
|
multisampling: e.multisampling,
|
|
243
241
|
patternTexture: e.patternTexture,
|
|
244
242
|
resolutionScale: e.resolutionScale,
|
|
245
|
-
hiddenEdgeColor:
|
|
246
|
-
visibleEdgeColor:
|
|
247
|
-
}, { pass: r, effect: i } =
|
|
248
|
-
|
|
243
|
+
hiddenEdgeColor: t(e.hiddenEdgeColor),
|
|
244
|
+
visibleEdgeColor: t(e.visibleEdgeColor)
|
|
245
|
+
}, { pass: r, effect: i } = p(() => new D(a.value, o.value, s));
|
|
246
|
+
n({ pass: r, effect: i }), _(
|
|
249
247
|
[() => e.outlinedObjects, i],
|
|
250
248
|
// watchEffect is intentionally not used here as it would result in an endless loop
|
|
251
249
|
() => {
|
|
252
|
-
var
|
|
253
|
-
(
|
|
250
|
+
var u;
|
|
251
|
+
(u = i.value) == null || u.selection.set(e.outlinedObjects || []);
|
|
254
252
|
},
|
|
255
253
|
{
|
|
256
254
|
immediate: !0
|
|
257
255
|
}
|
|
258
256
|
);
|
|
259
|
-
const
|
|
260
|
-
hiddenEdgeColor: e.hiddenEdgeColor ?
|
|
261
|
-
visibleEdgeColor: e.visibleEdgeColor ?
|
|
257
|
+
const f = $(() => ({
|
|
258
|
+
hiddenEdgeColor: e.hiddenEdgeColor ? w(e.hiddenEdgeColor) : void 0,
|
|
259
|
+
visibleEdgeColor: e.visibleEdgeColor ? w(e.visibleEdgeColor) : void 0
|
|
262
260
|
}));
|
|
263
|
-
return
|
|
261
|
+
return y(
|
|
264
262
|
[
|
|
265
263
|
/* some properties are not updated because of different reasons:
|
|
266
264
|
resolutionX - has no setter in OutlineEffect
|
|
@@ -276,64 +274,65 @@ const se = /* @__PURE__ */ f({
|
|
|
276
274
|
[() => e.edgeStrength, "edgeStrength"],
|
|
277
275
|
[() => e.patternScale, "patternScale"],
|
|
278
276
|
[() => e.multisampling, "multisampling"],
|
|
279
|
-
[() =>
|
|
280
|
-
[() =>
|
|
277
|
+
[() => f.value.hiddenEdgeColor, "hiddenEdgeColor"],
|
|
278
|
+
[() => f.value.visibleEdgeColor, "visibleEdgeColor"]
|
|
281
279
|
],
|
|
282
280
|
i,
|
|
283
|
-
() => new
|
|
284
|
-
), (
|
|
281
|
+
() => new D()
|
|
282
|
+
), (u, g) => null;
|
|
285
283
|
}
|
|
286
|
-
}),
|
|
284
|
+
}), pe = /* @__PURE__ */ d({
|
|
287
285
|
__name: "Pixelation",
|
|
288
286
|
props: {
|
|
289
287
|
granularity: {}
|
|
290
288
|
},
|
|
291
|
-
setup(l, { expose:
|
|
292
|
-
const e = l, { pass:
|
|
293
|
-
return
|
|
289
|
+
setup(l, { expose: n }) {
|
|
290
|
+
const e = l, { pass: t, effect: o } = p(() => new T(e.granularity));
|
|
291
|
+
return n({ pass: t, effect: o }), C(
|
|
294
292
|
e,
|
|
295
293
|
o,
|
|
296
|
-
() => new
|
|
294
|
+
() => new T()
|
|
297
295
|
), (a, s) => null;
|
|
298
296
|
}
|
|
299
|
-
}),
|
|
297
|
+
}), me = /* @__PURE__ */ d({
|
|
300
298
|
__name: "Vignette",
|
|
301
299
|
props: {
|
|
302
|
-
technique: { default:
|
|
303
|
-
blendFunction: { default:
|
|
300
|
+
technique: { default: te.DEFAULT },
|
|
301
|
+
blendFunction: { default: G.NORMAL },
|
|
304
302
|
offset: { default: 0.5 },
|
|
305
303
|
darkness: { default: 0.5 }
|
|
306
304
|
},
|
|
307
|
-
setup(l, { expose:
|
|
308
|
-
const e = l, { pass:
|
|
309
|
-
return
|
|
310
|
-
|
|
305
|
+
setup(l, { expose: n }) {
|
|
306
|
+
const e = l, { pass: t, effect: o } = p(() => new z(e));
|
|
307
|
+
return n({ pass: t, effect: o }), C(
|
|
308
|
+
B(e, ["blendFunction"]),
|
|
311
309
|
o,
|
|
312
|
-
() => new
|
|
310
|
+
() => new z()
|
|
313
311
|
), (a, s) => null;
|
|
314
312
|
}
|
|
315
|
-
}),
|
|
313
|
+
}), ve = /* @__PURE__ */ d({
|
|
316
314
|
__name: "Noise",
|
|
317
315
|
props: {
|
|
318
316
|
premultiply: { type: Boolean, default: !1 },
|
|
319
|
-
blendFunction: { default:
|
|
317
|
+
blendFunction: { default: G.SCREEN }
|
|
320
318
|
},
|
|
321
|
-
setup(l, { expose:
|
|
322
|
-
const e = l, { pass:
|
|
323
|
-
return
|
|
324
|
-
|
|
319
|
+
setup(l, { expose: n }) {
|
|
320
|
+
const e = l, { pass: t, effect: o } = p(() => new k(e));
|
|
321
|
+
return n({ pass: t, effect: o }), C(
|
|
322
|
+
B(e, ["blendFunction"]),
|
|
325
323
|
o,
|
|
326
|
-
() => new
|
|
324
|
+
() => new k()
|
|
327
325
|
), (a, s) => null;
|
|
328
326
|
}
|
|
329
327
|
});
|
|
330
328
|
export {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
329
|
+
ue as Bloom,
|
|
330
|
+
ie as DepthOfField,
|
|
331
|
+
ce as EffectComposer,
|
|
332
|
+
fe as Glitch,
|
|
333
|
+
ve as Noise,
|
|
334
|
+
de as Outline,
|
|
335
|
+
pe as Pixelation,
|
|
336
|
+
me as Vignette,
|
|
337
|
+
p as useEffect
|
|
339
338
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version:
|
|
4
|
-
* (c)
|
|
3
|
+
* version: v1.0.0-next.0
|
|
4
|
+
* (c) 2024
|
|
5
5
|
* description: Post-processing library for TresJS
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
(function(
|
|
8
|
+
(function(f,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue"),require("postprocessing"),require("@tresjs/core"),require("three")):typeof define=="function"&&define.amd?define(["exports","vue","postprocessing","@tresjs/core","three"],a):(f=typeof globalThis<"u"?globalThis:f||self,a(f["tres-postprocessing"]={},f.Vue,f.Postprocessing,f.TresjsCore,f.Three))})(this,function(f,a,r,h,B){"use strict";const y=Symbol("effectComposer"),v=o=>{const n=a.inject(y),e=a.shallowRef(null),t=a.shallowRef(null),{scene:l,camera:i}=h.useTresContext();a.watchEffect(()=>{!i.value||!(t!=null&&t.value)||(t.value.mainCamera=i.value)});let u=()=>{};return u=a.watchEffect(()=>{!i.value||!(n!=null&&n.value)||!l.value||(u(),!t.value&&(t.value=o(),e.value=new r.EffectPass(i.value,t.value),n.value.addPass(e.value)))}),a.onUnmounted(()=>{var s,d,p;e.value&&((s=n==null?void 0:n.value)==null||s.removePass(e.value)),(d=t.value)==null||d.dispose(),(p=e.value)==null||p.dispose()}),{pass:e,effect:t}},x=/([^[.\]])+/g,R=(o,n)=>{if(!n)return;const e=Array.isArray(n)?n:n.match(x);return e==null?void 0:e.reduce((t,l)=>t&&t[l],o)},F=(o,n,e)=>{const t=Array.isArray(n)?n:n.match(x);t&&t.reduce((l,i,u)=>(l[i]===void 0&&(l[i]={}),u===t.length-1&&(l[i]=e),l[i]),o)},S=(o,n)=>{const e={...o};return n.forEach(t=>delete e[t]),e},P=(o,n,e,t,l={})=>a.watch(o,i=>{var u;if(n.value)if(i===void 0){const s=t();F(n.value,e,R(s,e)),(u=s.dispose)==null||u.call(s)}else F(n.value,e,o())},l),g=(o,n,e)=>o.map(([t,l])=>P(t,n,l,e)),_=(o,n,e)=>Object.keys(o).map(t=>P(()=>o[t],n,t,e)),z=a.defineComponent({__name:"Bloom",props:{blendFunction:{},intensity:{},kernelSize:{},luminanceThreshold:{},luminanceSmoothing:{},mipmapBlur:{type:Boolean,default:void 0}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=v(()=>new r.BloomEffect(e));return n({pass:t,effect:l}),g([[()=>e.intensity,"intensity"],[()=>e.kernelSize,"kernelSize"],[()=>e.luminanceSmoothing,"luminanceMaterial.smoothing"],[()=>e.luminanceThreshold,"luminanceMaterial.threshold"]],l,()=>new r.BloomEffect),(i,u)=>null}}),D=a.defineComponent({__name:"DepthOfField",props:{blendFunction:{},worldFocusDistance:{},worldFocusRange:{},focusDistance:{},focusRange:{},bokehScale:{},resolutionScale:{},resolutionX:{},resolutionY:{}},setup(o,{expose:n}){const e=o,{camera:t}=h.useTresContext(),{pass:l,effect:i}=v(()=>new r.DepthOfFieldEffect(t.value,e));return n({pass:l,effect:i}),g([[()=>e.worldFocusDistance,"circleOfConfusionMaterial.worldFocusDistance"],[()=>e.focusDistance,"circleOfConfusionMaterial.focusDistance"],[()=>e.worldFocusRange,"circleOfConfusionMaterial.worldFocusRange"],[()=>e.focusRange,"circleOfConfusionMaterial.focusRange"],[()=>e.bokehScale,"bokehScale"],[()=>e.resolutionScale,"blurPass.resolution.scale"],[()=>e.resolutionX,"resolution.width"],[()=>e.resolutionY,"resolution.height"]],i,()=>new r.DepthOfFieldEffect),(u,s)=>null}});let C;function T(){var o;if(C!==void 0)return C;try{let n;const e=document.createElement("canvas");return C=!!(window.WebGL2RenderingContext&&(n=e.getContext("webgl2"))),n&&((o=n.getExtension("WEBGL_lose_context"))==null||o.loseContext()),C}catch{return C=!1}}const M=a.defineComponent({__name:"EffectComposer",props:{enabled:{type:Boolean,default:!0},children:{},depthBuffer:{type:Boolean,default:void 0},disableNormalPass:{type:Boolean,default:!1},stencilBuffer:{type:Boolean,default:void 0},resolutionScale:{},autoClear:{type:Boolean,default:!0},multisampling:{default:0},frameBufferType:{default:B.HalfFloatType}},emits:["render"],setup(o,{expose:n,emit:e}){const t=o,l=e,{scene:i,camera:u,renderer:s,sizes:d,render:p}=h.useTresContext(),c=a.shallowRef(null);let w=null,b=null;a.provide(y,c),n({composer:c});const L=()=>{c.value&&(b=new r.NormalPass(i.value,u.value),b.enabled=!1,c.value.addPass(b),t.resolutionScale!==void 0&&T()&&(w=new r.DepthDownsamplingPass({normalBuffer:b.texture,resolutionScale:t.resolutionScale}),w.enabled=!1,c.value.addPass(w)))},$=a.computed(()=>{const m=new r.EffectComposer,E={depthBuffer:t.depthBuffer!==void 0?t.depthBuffer:m.inputBuffer.depthBuffer,stencilBuffer:t.stencilBuffer!==void 0?t.stencilBuffer:m.inputBuffer.stencilBuffer,multisampling:T()?t.multisampling!==void 0?t.multisampling:m.multisampling:0,frameBufferType:t.frameBufferType!==void 0?t.frameBufferType:B.HalfFloatType};return m.dispose(),E}),O=()=>{!s.value&&!i.value&&!u.value||(c.value=new r.EffectComposer(s.value,$.value),c.value.addPass(new r.RenderPass(i.value,u.value)),t.disableNormalPass||L())};a.watch([s,i,u,()=>t.disableNormalPass],()=>{!d.width.value||!d.height.value||O()}),a.watch(()=>[d.width.value,d.height.value],([m,E])=>{!m&&!E||(c.value?c.value.setSize(m,E):O())},{immediate:!0});const{render:q}=h.useLoop();return q(()=>{if(t.enabled&&s.value&&c.value&&d.width.value&&d.height.value&&p.frames.value>0){const m=s.value.autoClear;s.value.autoClear=t.autoClear,t.stencilBuffer&&!t.autoClear&&s.value.clearStencil(),c.value.render(),l("render",c.value),s.value.autoClear=m}p.priority.value=0,p.mode.value==="always"?p.frames.value=1:p.frames.value=Math.max(0,p.frames.value-1)}),a.onUnmounted(()=>{var m;(m=c.value)==null||m.dispose()}),(m,E)=>a.renderSlot(m.$slots,"default")}}),k=a.defineComponent({__name:"Glitch",props:{blendFunction:{},delay:{},duration:{},strength:{},mode:{},active:{type:Boolean},ratio:{},columns:{},chromaticAberrationOffset:{},perturbationMap:{},dtSize:{}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=v(()=>new r.GlitchEffect(e));return n({pass:t,effect:l}),a.watchEffect(()=>{const i=()=>{if(e.mode!==void 0)return e.active===!1?r.GlitchMode.DISABLED:e.mode;const u=new r.GlitchEffect,s=u.mode;return u.dispose(),s};l.value&&(l.value.mode=i())}),_(S(e,["active","mode","blendFunction"]),l,()=>new r.GlitchEffect),(i,u)=>null}}),A=a.defineComponent({__name:"Outline",props:{outlinedObjects:{},blur:{type:Boolean,default:void 0},xRay:{type:Boolean,default:void 0},kernelSize:{},pulseSpeed:{},resolutionX:{},resolutionY:{},edgeStrength:{},patternScale:{},multisampling:{},blendFunction:{},patternTexture:{},resolutionScale:{},hiddenEdgeColor:{},visibleEdgeColor:{}},setup(o,{expose:n}){const e=o,t=c=>c!==void 0?h.normalizeColor(c).getHex():void 0,{camera:l,scene:i}=h.useTresContext(),u={blur:e.blur,xRay:e.xRay,kernelSize:e.kernelSize,pulseSpeed:e.pulseSpeed,resolutionX:e.resolutionX,resolutionY:e.resolutionY,patternScale:e.patternScale,edgeStrength:e.edgeStrength,blendFunction:e.blendFunction,multisampling:e.multisampling,patternTexture:e.patternTexture,resolutionScale:e.resolutionScale,hiddenEdgeColor:t(e.hiddenEdgeColor),visibleEdgeColor:t(e.visibleEdgeColor)},{pass:s,effect:d}=v(()=>new r.OutlineEffect(i.value,l.value,u));n({pass:s,effect:d}),a.watch([()=>e.outlinedObjects,d],()=>{var c;(c=d.value)==null||c.selection.set(e.outlinedObjects||[])},{immediate:!0});const p=a.computed(()=>({hiddenEdgeColor:e.hiddenEdgeColor?h.normalizeColor(e.hiddenEdgeColor):void 0,visibleEdgeColor:e.visibleEdgeColor?h.normalizeColor(e.visibleEdgeColor):void 0}));return g([[()=>e.blur,"blur"],[()=>e.xRay,"xRay"],[()=>e.pulseSpeed,"pulseSpeed"],[()=>e.kernelSize,"kernelSize"],[()=>e.edgeStrength,"edgeStrength"],[()=>e.patternScale,"patternScale"],[()=>e.multisampling,"multisampling"],[()=>p.value.hiddenEdgeColor,"hiddenEdgeColor"],[()=>p.value.visibleEdgeColor,"visibleEdgeColor"]],d,()=>new r.OutlineEffect),(c,w)=>null}}),N=a.defineComponent({__name:"Pixelation",props:{granularity:{}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=v(()=>new r.PixelationEffect(e.granularity));return n({pass:t,effect:l}),_(e,l,()=>new r.PixelationEffect),(i,u)=>null}}),j=a.defineComponent({__name:"Vignette",props:{technique:{default:r.VignetteTechnique.DEFAULT},blendFunction:{default:r.BlendFunction.NORMAL},offset:{default:.5},darkness:{default:.5}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=v(()=>new r.VignetteEffect(e));return n({pass:t,effect:l}),_(S(e,["blendFunction"]),l,()=>new r.VignetteEffect),(i,u)=>null}}),G=a.defineComponent({__name:"Noise",props:{premultiply:{type:Boolean,default:!1},blendFunction:{default:r.BlendFunction.SCREEN}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=v(()=>new r.NoiseEffect(e));return n({pass:t,effect:l}),_(S(e,["blendFunction"]),l,()=>new r.NoiseEffect),(i,u)=>null}});f.Bloom=z,f.DepthOfField=D,f.EffectComposer=M,f.Glitch=k,f.Noise=G,f.Outline=A,f.Pixelation=N,f.Vignette=j,f.useEffect=v,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/util/prop.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { Ref, WatchOptions } from 'vue';
|
|
|
11
11
|
* @param {WatchOptions} watchOptions - The options for watch.
|
|
12
12
|
*/
|
|
13
13
|
export declare const makePropWatcher: <T, E>(propGetter: () => T, target: Ref<E>, propertyPath: string, newPlainObjectFunction: () => E & {
|
|
14
|
-
dispose
|
|
14
|
+
dispose?: (() => void) | undefined;
|
|
15
15
|
}, watchOptions?: WatchOptions) => import("vue").WatchStopHandle;
|
|
16
16
|
/**
|
|
17
17
|
* Creates multiple prop watchers for monitoring changes to multiple properties and updating a target object.
|
|
@@ -23,7 +23,7 @@ export declare const makePropWatcher: <T, E>(propGetter: () => T, target: Ref<E>
|
|
|
23
23
|
* @param {() => E & { dispose?(): void }} newPlainObjectFunction - A function that creates a new plain object to retrieve the defaults from with an optional "dispose" method for cleanup.
|
|
24
24
|
*/
|
|
25
25
|
export declare const makePropWatchers: <E>(propGettersAndPropertyPaths: (string | (() => any))[][], target: Ref<E>, newPlainObjectFunction: () => E & {
|
|
26
|
-
dispose
|
|
26
|
+
dispose?: (() => void) | undefined;
|
|
27
27
|
}) => import("vue").WatchStopHandle[];
|
|
28
28
|
/**
|
|
29
29
|
* Creates multiple prop watchers via the props object for monitoring changes to multiple properties and updating a target object.
|
|
@@ -36,5 +36,5 @@ export declare const makePropWatchers: <E>(propGettersAndPropertyPaths: (string
|
|
|
36
36
|
export declare const makePropWatchersUsingAllProps: <E>(props: {
|
|
37
37
|
[key: string]: any;
|
|
38
38
|
}, target: Ref<E>, newPlainObjectFunction: () => E & {
|
|
39
|
-
dispose
|
|
39
|
+
dispose?: (() => void) | undefined;
|
|
40
40
|
}) => import("vue").WatchStopHandle[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tresjs/post-processing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-next.0",
|
|
5
5
|
"packageManager": "pnpm@8.10.2",
|
|
6
6
|
"description": "Post-processing library for TresJS",
|
|
7
7
|
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"main": "./dist/tres-postprocessing.js",
|
|
26
26
|
"module": "./dist/tres-postprocessing.js",
|
|
27
27
|
"files": [
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"*.d.ts",
|
|
29
|
+
"dist"
|
|
30
30
|
],
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -37,44 +37,45 @@
|
|
|
37
37
|
"build": "vite build",
|
|
38
38
|
"preview": "vite preview",
|
|
39
39
|
"release": "release-it",
|
|
40
|
-
"lint": "eslint .
|
|
41
|
-
"lint:fix": "
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"lint:fix": "eslint . --fix",
|
|
42
42
|
"docs:dev": "vitepress dev docs",
|
|
43
43
|
"docs:build": "vitepress build docs",
|
|
44
44
|
"docs:preview": "vitepress preview docs"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
+
"@tresjs/core": ">=4.0",
|
|
47
48
|
"three": ">=0.133",
|
|
48
49
|
"vue": ">=3.3"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@tresjs/core": "^3.5.0",
|
|
52
|
-
"@unocss/core": "^0.57.3",
|
|
53
52
|
"@vueuse/core": "^10.6.1",
|
|
54
|
-
"postprocessing": "^6.33.
|
|
55
|
-
"three-stdlib": "^2.28.
|
|
53
|
+
"postprocessing": "^6.33.4",
|
|
54
|
+
"three-stdlib": "^2.28.7"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
57
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
59
|
-
"@tresjs/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
58
|
+
"@tresjs/core": "^4.0.0-rc.1",
|
|
59
|
+
"@tresjs/eslint-config": "^1.1.0",
|
|
60
|
+
"@types/three": "^0.159.0",
|
|
61
|
+
"@unocss/core": "^0.58.0",
|
|
62
|
+
"@vitejs/plugin-vue": "^4.5.1",
|
|
63
|
+
"eslint": "^9.3.0",
|
|
64
|
+
"gsap": "^3.12.3",
|
|
63
65
|
"kolorist": "^1.8.0",
|
|
64
66
|
"pathe": "^1.1.1",
|
|
65
|
-
"prettier": "^3.1.0",
|
|
66
67
|
"release-it": "^17.0.0",
|
|
67
68
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
68
|
-
"rollup-plugin-visualizer": "^5.
|
|
69
|
-
"three": "^0.
|
|
70
|
-
"typescript": "^5.
|
|
71
|
-
"unocss": "^0.
|
|
72
|
-
"vite": "^
|
|
69
|
+
"rollup-plugin-visualizer": "^5.10.0",
|
|
70
|
+
"three": "^0.159.0",
|
|
71
|
+
"typescript": "^5.3.2",
|
|
72
|
+
"unocss": "^0.58.0",
|
|
73
|
+
"vite": "^5.0.4",
|
|
73
74
|
"vite-plugin-banner": "^0.7.1",
|
|
74
|
-
"vite-plugin-dts": "3.6.
|
|
75
|
-
"vite-svg-loader": "^
|
|
76
|
-
"vitepress": "1.0.0-rc.
|
|
77
|
-
"vue": "^3.3.
|
|
78
|
-
"vue-tsc": "^1.8.
|
|
75
|
+
"vite-plugin-dts": "3.6.4",
|
|
76
|
+
"vite-svg-loader": "^5.1.0",
|
|
77
|
+
"vitepress": "1.0.0-rc.31",
|
|
78
|
+
"vue": "^3.3.9",
|
|
79
|
+
"vue-tsc": "^1.8.24"
|
|
79
80
|
}
|
|
80
81
|
}
|