@tresjs/post-processing 0.7.1 → 1.0.0-next.1

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 CHANGED
@@ -23,7 +23,7 @@ pnpm i @tresjs/post-processing
23
23
 
24
24
  ## Docs
25
25
 
26
- Checkout the [docs](https://postprocessing.tresjs.org/)
26
+ Checkout the [docs](https://post-processing.tresjs.org/)
27
27
 
28
28
  ## Demos
29
29
 
@@ -1,6 +1,7 @@
1
- import type { TresObject } from '@tresjs/core';
1
+ import { TresObject } from '@tresjs/core';
2
2
  import { EffectComposer as EffectComposerImpl } from 'postprocessing';
3
- import type { ShallowRef } from 'vue';
3
+ import { ShallowRef } from 'vue';
4
+
4
5
  export interface EffectComposerProps {
5
6
  enabled?: boolean;
6
7
  children?: TresObject[];
@@ -12,7 +13,10 @@ export interface EffectComposerProps {
12
13
  multisampling?: number;
13
14
  frameBufferType?: number;
14
15
  }
15
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EffectComposerProps>, {
16
+ declare function __VLS_template(): {
17
+ default?(_: {}): any;
18
+ };
19
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<EffectComposerProps>, {
16
20
  enabled: boolean;
17
21
  autoClear: boolean;
18
22
  frameBufferType: 1016;
@@ -22,7 +26,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
22
26
  stencilBuffer: undefined;
23
27
  }>, {
24
28
  composer: ShallowRef<EffectComposerImpl | null>;
25
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<EffectComposerProps>, {
29
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ render: (...args: any[]) => void;
31
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<EffectComposerProps>, {
26
32
  enabled: boolean;
27
33
  autoClear: boolean;
28
34
  frameBufferType: 1016;
@@ -30,7 +36,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
30
36
  depthBuffer: undefined;
31
37
  multisampling: number;
32
38
  stencilBuffer: undefined;
33
- }>>>, {
39
+ }>>> & {
40
+ onRender?: ((...args: any[]) => any) | undefined;
41
+ }, {
34
42
  enabled: boolean;
35
43
  depthBuffer: boolean;
36
44
  disableNormalPass: boolean;
@@ -38,19 +46,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
38
46
  autoClear: boolean;
39
47
  multisampling: number;
40
48
  frameBufferType: number;
41
- }, {}>, {
42
- default?(_: {}): any;
43
- }>;
49
+ }, {}>;
50
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
44
51
  export default _default;
45
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
46
- type __VLS_TypePropsToRuntimeProps<T> = {
47
- [K in keyof T]-?: {} extends Pick<T, K> ? {
48
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
49
- } : {
50
- type: import('vue').PropType<T[K]>;
51
- required: true;
52
- };
53
- };
54
52
  type __VLS_WithDefaults<P, D> = {
55
53
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
56
54
  default: D[K];
@@ -64,3 +62,12 @@ type __VLS_WithTemplateSlots<T, S> = T & {
64
62
  $slots: S;
65
63
  };
66
64
  };
65
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
66
+ type __VLS_TypePropsToOption<T> = {
67
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
68
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
69
+ } : {
70
+ type: import('vue').PropType<T[K]>;
71
+ required: true;
72
+ };
73
+ };
@@ -1,5 +1,5 @@
1
- import { BloomEffect } from 'postprocessing';
2
- import type { KernelSize, BlendFunction } from 'postprocessing';
1
+ import { BloomEffect, BlendFunction, KernelSize } from 'postprocessing';
2
+
3
3
  export interface BloomProps {
4
4
  /**
5
5
  * The blend function of this effect. This prop is not reactive.
@@ -53,26 +53,138 @@ export interface BloomProps {
53
53
  */
54
54
  mipmapBlur?: boolean;
55
55
  }
56
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BloomProps>, {
56
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<BloomProps>, {
57
57
  mipmapBlur: undefined;
58
58
  }>, {
59
- pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
60
- effect: import("vue").ShallowRef<BloomEffect | null>;
61
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BloomProps>, {
59
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
60
+ effect: import('vue').ShallowRef<BloomEffect | null>;
61
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<BloomProps>, {
62
62
  mipmapBlur: undefined;
63
63
  }>>>, {
64
64
  mipmapBlur: boolean;
65
65
  }, {}>;
66
66
  export default _default;
67
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
68
- type __VLS_TypePropsToRuntimeProps<T> = {
69
- [K in keyof T]-?: {} extends Pick<T, K> ? {
70
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
67
+ export declare const __VLS_globalTypesStart: {};
68
+ declare global {
69
+ type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<globalThis.JSX.IntrinsicElements, Record<string, any>>>;
70
+ type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, globalThis.JSX.Element>;
71
+ type __VLS_GlobalComponents = __VLS_PickNotAny<import('vue').GlobalComponents, {}> & __VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}> & __VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}> & Pick<typeof import('vue'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>;
72
+ type __VLS_BuiltInPublicProps = __VLS_PickNotAny<import('vue').VNodeProps, {}> & __VLS_PickNotAny<import('vue').AllowedComponentProps, {}> & __VLS_PickNotAny<import('vue').ComponentCustomProps, {}>;
73
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
74
+ type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
75
+ const __VLS_intrinsicElements: __VLS_IntrinsicElements;
76
+ function __VLS_getVForSourceType(source: number): [number, number, number][];
77
+ function __VLS_getVForSourceType(source: string): [string, number, number][];
78
+ function __VLS_getVForSourceType<T extends any[]>(source: T): [
79
+ item: T[number],
80
+ key: number,
81
+ index: number
82
+ ][];
83
+ function __VLS_getVForSourceType<T extends {
84
+ [Symbol.iterator](): Iterator<any>;
85
+ }>(source: T): [
86
+ item: T extends {
87
+ [Symbol.iterator](): Iterator<infer T1>;
88
+ } ? T1 : never,
89
+ key: number,
90
+ index: undefined
91
+ ][];
92
+ function __VLS_getVForSourceType<T extends number | {
93
+ [Symbol.iterator](): Iterator<any>;
94
+ }>(source: T): [
95
+ item: number | (Exclude<T, number> extends {
96
+ [Symbol.iterator](): Iterator<infer T1>;
97
+ } ? T1 : never),
98
+ key: number,
99
+ index: undefined
100
+ ][];
101
+ function __VLS_getVForSourceType<T>(source: T): [
102
+ item: T[keyof T],
103
+ key: keyof T,
104
+ index: number
105
+ ][];
106
+ function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
107
+ function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
108
+ function __VLS_directiveFunction<T>(dir: T): T extends import('vue').ObjectDirective<infer E, infer V> | import('vue').FunctionDirective<infer E, infer V> ? (value: V) => void : T;
109
+ function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
110
+ function __VLS_makeOptional<T>(t: T): {
111
+ [K in keyof T]?: T[K];
112
+ };
113
+ type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? {
114
+ [P in N]: C;
115
+ } : {};
116
+ type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
117
+ [K in N0]: LocalComponents[N1];
118
+ } : N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
119
+ [K in N0]: LocalComponents[N2];
120
+ } : N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
121
+ [K in N0]: LocalComponents[N3];
122
+ } : N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
123
+ [K in N0]: __VLS_GlobalComponents[N1];
124
+ } : N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
125
+ [K in N0]: __VLS_GlobalComponents[N2];
126
+ } : N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
127
+ [K in N0]: __VLS_GlobalComponents[N3];
71
128
  } : {
72
- type: import('vue').PropType<T[K]>;
73
- required: true;
129
+ [K in N0]: unknown;
74
130
  };
75
- };
131
+ function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K): T extends new (...args: any) => any ? (props: (K extends {
132
+ $props: infer Props;
133
+ } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
134
+ __ctx?: {
135
+ attrs?: any;
136
+ slots?: K extends {
137
+ $slots: infer Slots;
138
+ } ? Slots : any;
139
+ emit?: K extends {
140
+ $emit: infer Emit;
141
+ } ? Emit : any;
142
+ } & {
143
+ props?: (K extends {
144
+ $props: infer Props;
145
+ } ? Props : any) & Record<string, unknown>;
146
+ expose?(exposed: K): void;
147
+ };
148
+ } : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T> : T extends (...args: any) => any ? T : (_: {} & Record<string, unknown>, ctx?: any) => {
149
+ __ctx?: {
150
+ attrs?: any;
151
+ expose?: any;
152
+ slots?: any;
153
+ emit?: any;
154
+ props?: {} & Record<string, unknown>;
155
+ };
156
+ };
157
+ function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
158
+ function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
159
+ function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
160
+ __ctx?: infer Ctx;
161
+ } ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>;
162
+ type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
163
+ __ctx?: {
164
+ props?: infer P;
165
+ };
166
+ } ? NonNullable<P> : never : T extends (props: infer P, ...args: any) => any ? P : {};
167
+ type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
168
+ function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
169
+ /**
170
+ * emit
171
+ */
172
+ type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
173
+ type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R ? U extends T ? never : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R) : never;
174
+ type __VLS_OverloadUnion<T> = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends () => never ? never : () => never>;
175
+ type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F ? F extends (event: infer E, ...args: infer A) => any ? {
176
+ [K in E & string]: (...args: A) => void;
177
+ } : never : never;
178
+ type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<__VLS_UnionToIntersection<__VLS_ConstructorOverloads<T> & {
179
+ [K in keyof T]: T[K] extends any[] ? {
180
+ (...args: T[K]): void;
181
+ } : never;
182
+ }>>;
183
+ type __VLS_PrettifyGlobal<T> = {
184
+ [K in keyof T]: T[K];
185
+ } & {};
186
+ }
187
+ export declare const __VLS_globalTypesEnd: {};
76
188
  type __VLS_WithDefaults<P, D> = {
77
189
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
78
190
  default: D[K];
@@ -81,3 +193,12 @@ type __VLS_WithDefaults<P, D> = {
81
193
  type __VLS_Prettify<T> = {
82
194
  [K in keyof T]: T[K];
83
195
  } & {};
196
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
197
+ type __VLS_TypePropsToOption<T> = {
198
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
199
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
200
+ } : {
201
+ type: import('vue').PropType<T[K]>;
202
+ required: true;
203
+ };
204
+ };
@@ -1,5 +1,5 @@
1
- import type { BlendFunction } from 'postprocessing';
2
- import { DepthOfFieldEffect } from 'postprocessing';
1
+ import { BlendFunction, DepthOfFieldEffect } from 'postprocessing';
2
+
3
3
  export interface DepthOfFieldProps {
4
4
  /**
5
5
  * The blend function of this effect. This prop is not reactive.
@@ -29,13 +29,13 @@ export interface DepthOfFieldProps {
29
29
  resolutionX?: number;
30
30
  resolutionY?: number;
31
31
  }
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>;
35
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DepthOfFieldProps>>>, {}, {}>;
32
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<DepthOfFieldProps>, {
33
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
34
+ effect: import('vue').ShallowRef<DepthOfFieldEffect | null>;
35
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<DepthOfFieldProps>>>, {}, {}>;
36
36
  export default _default;
37
37
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
38
- type __VLS_TypePropsToRuntimeProps<T> = {
38
+ type __VLS_TypePropsToOption<T> = {
39
39
  [K in keyof T]-?: {} extends Pick<T, K> ? {
40
40
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
41
41
  } : {
@@ -1,6 +1,6 @@
1
- import { GlitchMode, GlitchEffect } from 'postprocessing';
2
- import type { BlendFunction } from 'postprocessing';
3
- import type { Vector2, Texture } from 'three';
1
+ import { GlitchEffect, GlitchMode, BlendFunction } from 'postprocessing';
2
+ import { Texture, Vector2 } from 'three';
3
+
4
4
  export interface GlitchProps {
5
5
  blendFunction?: BlendFunction;
6
6
  /**
@@ -89,13 +89,13 @@ export interface GlitchProps {
89
89
  */
90
90
  dtSize?: number;
91
91
  }
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>;
95
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<GlitchProps>>>, {}, {}>;
92
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<GlitchProps>, {
93
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
94
+ effect: import('vue').ShallowRef<GlitchEffect | null>;
95
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<GlitchProps>>>, {}, {}>;
96
96
  export default _default;
97
97
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
98
- type __VLS_TypePropsToRuntimeProps<T> = {
98
+ type __VLS_TypePropsToOption<T> = {
99
99
  [K in keyof T]-?: {} extends Pick<T, K> ? {
100
100
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
101
101
  } : {
@@ -1,4 +1,5 @@
1
1
  import { BlendFunction, NoiseEffect } from 'postprocessing';
2
+
2
3
  export interface NoiseProps {
3
4
  /**
4
5
  * Whether the noise should be multiplied with the input color.
@@ -6,13 +7,13 @@ export interface NoiseProps {
6
7
  premultiply?: boolean;
7
8
  blendFunction?: BlendFunction;
8
9
  }
9
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<NoiseProps>, {
10
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<NoiseProps>, {
10
11
  premultiply: boolean;
11
12
  blendFunction: BlendFunction;
12
13
  }>, {
13
- pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
14
- effect: import("vue").ShallowRef<NoiseEffect | null>;
15
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<NoiseProps>, {
14
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
15
+ effect: import('vue').ShallowRef<NoiseEffect | null>;
16
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<NoiseProps>, {
16
17
  premultiply: boolean;
17
18
  blendFunction: BlendFunction;
18
19
  }>>>, {
@@ -20,15 +21,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
20
21
  premultiply: boolean;
21
22
  }, {}>;
22
23
  export default _default;
23
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
- type __VLS_TypePropsToRuntimeProps<T> = {
25
- [K in keyof T]-?: {} extends Pick<T, K> ? {
26
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
- } : {
28
- type: import('vue').PropType<T[K]>;
29
- required: true;
30
- };
31
- };
32
24
  type __VLS_WithDefaults<P, D> = {
33
25
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
26
  default: D[K];
@@ -37,3 +29,12 @@ type __VLS_WithDefaults<P, D> = {
37
29
  type __VLS_Prettify<T> = {
38
30
  [K in keyof T]: T[K];
39
31
  } & {};
32
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
+ type __VLS_TypePropsToOption<T> = {
34
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
35
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
36
+ } : {
37
+ type: import('vue').PropType<T[K]>;
38
+ required: true;
39
+ };
40
+ };
@@ -1,7 +1,7 @@
1
- import { OutlineEffect } from 'postprocessing';
2
- import type { TresColor } from '@tresjs/core';
3
- import type { Object3D, Texture } from 'three';
4
- import type { BlendFunction, KernelSize } from 'postprocessing';
1
+ import { OutlineEffect, BlendFunction, KernelSize } from 'postprocessing';
2
+ import { TresColor } from '@tresjs/core';
3
+ import { Object3D, Texture } from 'three';
4
+
5
5
  export interface OutlineProps {
6
6
  /**
7
7
  * The objects in the scene which should have an outline.
@@ -37,13 +37,13 @@ export interface OutlineProps {
37
37
  hiddenEdgeColor?: TresColor;
38
38
  visibleEdgeColor?: TresColor;
39
39
  }
40
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlineProps>, {
40
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<OutlineProps>, {
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>;
46
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlineProps>, {
44
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
45
+ effect: import('vue').ShallowRef<OutlineEffect | null>;
46
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<OutlineProps>, {
47
47
  blur: undefined;
48
48
  xRay: undefined;
49
49
  }>>>, {
@@ -51,15 +51,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
51
51
  xRay: boolean;
52
52
  }, {}>;
53
53
  export default _default;
54
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
55
- type __VLS_TypePropsToRuntimeProps<T> = {
56
- [K in keyof T]-?: {} extends Pick<T, K> ? {
57
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
58
- } : {
59
- type: import('vue').PropType<T[K]>;
60
- required: true;
61
- };
62
- };
63
54
  type __VLS_WithDefaults<P, D> = {
64
55
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
65
56
  default: D[K];
@@ -68,3 +59,12 @@ type __VLS_WithDefaults<P, D> = {
68
59
  type __VLS_Prettify<T> = {
69
60
  [K in keyof T]: T[K];
70
61
  } & {};
62
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
63
+ type __VLS_TypePropsToOption<T> = {
64
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
65
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
66
+ } : {
67
+ type: import('vue').PropType<T[K]>;
68
+ required: true;
69
+ };
70
+ };
@@ -1,17 +1,18 @@
1
1
  import { PixelationEffect } from 'postprocessing';
2
+
2
3
  export interface PixelationProps {
3
4
  /**
4
5
  * The pixel granularity.
5
6
  */
6
7
  granularity?: number;
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>;
11
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<PixelationProps>>>, {}, {}>;
9
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<PixelationProps>, {
10
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
11
+ effect: import('vue').ShallowRef<PixelationEffect | null>;
12
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<PixelationProps>>>, {}, {}>;
12
13
  export default _default;
13
14
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
- type __VLS_TypePropsToRuntimeProps<T> = {
15
+ type __VLS_TypePropsToOption<T> = {
15
16
  [K in keyof T]-?: {} extends Pick<T, K> ? {
16
17
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
18
  } : {
@@ -1,4 +1,5 @@
1
1
  import { BlendFunction, VignetteEffect, VignetteTechnique } from 'postprocessing';
2
+
2
3
  export interface VignetteProps {
3
4
  /**
4
5
  * Whether the noise should be multiplied with the input color.
@@ -8,15 +9,15 @@ export interface VignetteProps {
8
9
  offset: number;
9
10
  darkness: number;
10
11
  }
11
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<VignetteProps>, {
12
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<VignetteProps>, {
12
13
  technique: VignetteTechnique;
13
14
  blendFunction: BlendFunction;
14
15
  offset: number;
15
16
  darkness: number;
16
17
  }>, {
17
- pass: import("vue").ShallowRef<import("postprocessing").EffectPass | null>;
18
- effect: import("vue").ShallowRef<VignetteEffect | null>;
19
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<VignetteProps>, {
18
+ pass: import('vue').ShallowRef<import('postprocessing').EffectPass | null>;
19
+ effect: import('vue').ShallowRef<VignetteEffect | null>;
20
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<VignetteProps>, {
20
21
  technique: VignetteTechnique;
21
22
  blendFunction: BlendFunction;
22
23
  offset: number;
@@ -28,15 +29,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
28
29
  darkness: number;
29
30
  }, {}>;
30
31
  export default _default;
31
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
32
- type __VLS_TypePropsToRuntimeProps<T> = {
33
- [K in keyof T]-?: {} extends Pick<T, K> ? {
34
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
35
- } : {
36
- type: import('vue').PropType<T[K]>;
37
- required: true;
38
- };
39
- };
40
32
  type __VLS_WithDefaults<P, D> = {
41
33
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
42
34
  default: D[K];
@@ -45,3 +37,12 @@ type __VLS_WithDefaults<P, D> = {
45
37
  type __VLS_Prettify<T> = {
46
38
  [K in keyof T]: T[K];
47
39
  } & {};
40
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
41
+ type __VLS_TypePropsToOption<T> = {
42
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
43
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
44
+ } : {
45
+ type: import('vue').PropType<T[K]>;
46
+ required: true;
47
+ };
48
+ };
@@ -1,3 +1,4 @@
1
- import type { EffectComposer } from 'postprocessing';
2
- import type { InjectionKey, ShallowRef } from 'vue';
1
+ import { EffectComposer } from 'postprocessing';
2
+ import { InjectionKey, ShallowRef } from 'vue';
3
+
3
4
  export declare const effectComposerInjectionKey: InjectionKey<ShallowRef<EffectComposer | null>>;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import Bloom from './core/effects/Bloom.vue';
2
- import DepthOfField from './core/effects/DepthOfField.vue';
3
- import EffectComposer from './core/EffectComposer.vue';
4
- import Glitch from './core/effects/Glitch.vue';
5
- import Outline from './core/effects/Outline.vue';
6
- import Pixelation from './core/effects/Pixelation.vue';
7
- import Vignette from './core/effects/Vignette.vue';
8
- import Noise from './core/effects/Noise.vue';
9
- export { Bloom, DepthOfField, EffectComposer, Glitch, Noise, Outline, Pixelation, Vignette, };
1
+ import { default as Bloom } from './core/effects/Bloom.vue';
2
+ import { default as DepthOfField } from './core/effects/DepthOfField.vue';
3
+ import { default as EffectComposer } from './core/EffectComposer.vue';
4
+ import { default as Glitch } from './core/effects/Glitch.vue';
5
+ import { default as Outline } from './core/effects/Outline.vue';
6
+ import { default as Pixelation } from './core/effects/Pixelation.vue';
7
+ import { default as Vignette } from './core/effects/Vignette.vue';
8
+ import { default as Noise } from './core/effects/Noise.vue';
9
+ import { useEffect } from './core/composables/effect.ts';
10
+
11
+ export { Bloom, DepthOfField, EffectComposer, Glitch, Noise, Outline, Pixelation, Vignette, useEffect, };
@@ -1,64 +1,60 @@
1
1
  /**
2
2
  * name: @tresjs/post-processing
3
- * version: v0.7.1
3
+ * version: v1.0.0-next.1
4
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 Y, shallowRef as C, watchEffect as w, onUnmounted as N, watch as g, defineComponent as d, provide as V, computed as L, renderSlot as U } from "vue";
9
- import { EffectPass as q, BloomEffect as F, DepthOfFieldEffect as P, EffectComposer as R, RenderPass as H, NormalPass as I, DepthDownsamplingPass as K, GlitchEffect as b, GlitchMode as J, OutlineEffect as O, PixelationEffect as D, VignetteTechnique as Q, BlendFunction as $, VignetteEffect as T, NoiseEffect as z } from "postprocessing";
10
- import { useTresContext as h, useRenderLoop as Z, normalizeColor as S } from "@tresjs/core";
11
- import { HalfFloatType as k } from "three";
12
- const G = Symbol(), m = (l) => {
13
- const t = Y(G), e = C(null), n = C(null), { scene: o, camera: a } = h();
14
- w(() => {
15
- !a.value || !(n != null && n.value) || (n.value.mainCamera = a.value);
8
+ import { inject as q, shallowRef as _, watchEffect as B, onUnmounted as L, watch as h, 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 w, 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 E } from "@tresjs/core";
11
+ import { HalfFloatType as A } from "three";
12
+ const W = Symbol("effectComposer"), p = (l) => {
13
+ const n = q(W), e = _(null), t = _(null), { scene: o, camera: a } = b();
14
+ B(() => {
15
+ !a.value || !(t != null && t.value) || (t.value.mainCamera = a.value);
16
16
  });
17
- let s = () => {
17
+ let i = () => {
18
18
  };
19
- return s = w(() => {
20
- !a.value || !(t != null && t.value) || !o.value || (s(), !n.value && (n.value = l(), e.value = new q(a.value, n.value), t.value.addPass(e.value)));
21
- }), N(() => {
22
- var r, i, c;
23
- e.value && ((r = t == null ? void 0 : t.value) == null || r.removePass(e.value)), (i = n.value) == null || i.dispose(), (c = e.value) == null || c.dispose();
19
+ return i = B(() => {
20
+ !a.value || !(n != null && n.value) || !o.value || (i(), !t.value && (t.value = l(), e.value = new K(a.value, t.value), n.value.addPass(e.value)));
21
+ }), L(() => {
22
+ var s, u, f;
23
+ e.value && ((s = n == null ? void 0 : n.value) == null || s.removePass(e.value)), (u = t.value) == null || u.dispose(), (f = e.value) == null || f.dispose();
24
24
  }), {
25
25
  pass: e,
26
- effect: n
26
+ effect: t
27
27
  };
28
- }, W = /([^[.\]])+/g, ee = (l, t) => {
29
- if (!t)
28
+ }, j = /([^[.\]])+/g, oe = (l, n) => {
29
+ if (!n)
30
30
  return;
31
- const e = Array.isArray(t) ? t : t.match(W);
32
- return e == null ? void 0 : e.reduce((n, o) => n && n[o], l);
33
- }, A = (l, t, e) => {
34
- const n = Array.isArray(t) ? t : t.match(W);
35
- n && n.reduce((o, a, s) => (o[a] === void 0 && (o[a] = {}), s === n.length - 1 && (o[a] = e), o[a]), l);
36
- }, E = (l, t) => {
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, i) => (o[a] === void 0 && (o[a] = {}), i === t.length - 1 && (o[a] = e), o[a]), l);
36
+ }, x = (l, n) => {
37
37
  const e = { ...l };
38
- return t.forEach((n) => delete e[n]), e;
39
- }, j = (l, t, e, n, o = {}) => g(
40
- l,
41
- (a) => {
42
- var s;
43
- if (t.value)
44
- if (a === void 0) {
45
- const r = n();
46
- A(t.value, e, ee(r, e)), (s = r.dispose) == null || s.call(r);
47
- } else
48
- A(t.value, e, l());
49
- },
50
- o
51
- ), x = (l, t, e) => l.map(([n, o]) => j(
52
- n,
38
+ return n.forEach((t) => delete e[t]), e;
39
+ }, X = (l, n, e, t, o = {}) => h(l, (a) => {
40
+ var i;
41
+ if (n.value)
42
+ if (a === void 0) {
43
+ const s = t();
44
+ M(n.value, e, oe(s, e)), (i = s.dispose) == null || i.call(s);
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
- )), _ = (l, t, e) => Object.keys(l).map((n) => j(
57
- () => l[n],
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
- )), ae = /* @__PURE__ */ d({
57
+ )), ie = /* @__PURE__ */ d({
62
58
  __name: "Bloom",
63
59
  props: {
64
60
  blendFunction: {},
@@ -68,9 +64,9 @@ const G = Symbol(), m = (l) => {
68
64
  luminanceSmoothing: {},
69
65
  mipmapBlur: { type: Boolean, default: void 0 }
70
66
  },
71
- setup(l, { expose: t }) {
72
- const e = l, { pass: n, effect: o } = m(() => new F(e));
73
- return t({ pass: n, effect: o }), x(
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,11 @@ const G = Symbol(), m = (l) => {
79
75
  [() => e.luminanceThreshold, "luminanceMaterial.threshold"]
80
76
  ],
81
77
  o,
82
- () => new F()
83
- ), (a, s) => null;
78
+ () => new P()
79
+ ), () => {
80
+ };
84
81
  }
85
- }), se = /* @__PURE__ */ d({
82
+ }), ue = /* @__PURE__ */ d({
86
83
  __name: "DepthOfField",
87
84
  props: {
88
85
  blendFunction: {},
@@ -95,9 +92,9 @@ const G = Symbol(), m = (l) => {
95
92
  resolutionX: {},
96
93
  resolutionY: {}
97
94
  },
98
- setup(l, { expose: t }) {
99
- const e = l, { camera: n } = h(), { pass: o, effect: a } = m(() => new P(n.value, e));
100
- return t({ pass: o, effect: a }), x(
95
+ setup(l, { expose: n }) {
96
+ const e = l, { camera: t } = b(), { pass: o, effect: a } = p(() => new R(t.value, e));
97
+ return n({ pass: o, effect: a }), y(
101
98
  [
102
99
  // blendFunction is not updated, because it has no setter in BloomEffect
103
100
  [() => e.worldFocusDistance, "circleOfConfusionMaterial.worldFocusDistance"],
@@ -110,24 +107,25 @@ const G = Symbol(), m = (l) => {
110
107
  [() => e.resolutionY, "resolution.height"]
111
108
  ],
112
109
  a,
113
- () => new P()
114
- ), (s, r) => null;
110
+ () => new R()
111
+ ), () => {
112
+ };
115
113
  }
116
114
  });
117
115
  let v;
118
- function M() {
116
+ function N() {
119
117
  var l;
120
118
  if (v !== void 0)
121
119
  return v;
122
120
  try {
123
- let t;
121
+ let n;
124
122
  const e = document.createElement("canvas");
125
- return v = !!(window.WebGL2RenderingContext && (t = e.getContext("webgl2"))), t && ((l = t.getExtension("WEBGL_lose_context")) == null || l.loseContext()), v;
123
+ return v = !!(window.WebGL2RenderingContext && (n = e.getContext("webgl2"))), n && ((l = n.getExtension("WEBGL_lose_context")) == null || l.loseContext()), v;
126
124
  } catch {
127
125
  return v = !1;
128
126
  }
129
127
  }
130
- const re = /* @__PURE__ */ d({
128
+ const ce = /* @__PURE__ */ d({
131
129
  __name: "EffectComposer",
132
130
  props: {
133
131
  enabled: { type: Boolean, default: !0 },
@@ -138,47 +136,49 @@ const re = /* @__PURE__ */ d({
138
136
  resolutionScale: {},
139
137
  autoClear: { type: Boolean, default: !0 },
140
138
  multisampling: { default: 0 },
141
- frameBufferType: { default: k }
139
+ frameBufferType: { default: A }
142
140
  },
143
- setup(l, { expose: t }) {
144
- const e = l, { scene: n, camera: o, renderer: a, sizes: s } = h(), r = C(null);
145
- let i = null, c = null;
146
- V(G, r), t({ composer: r });
147
- const f = () => {
148
- r.value && (c = new I(n.value, o.value), c.enabled = !1, r.value.addPass(c), e.resolutionScale !== void 0 && M() && (i = new K({
149
- normalBuffer: c.texture,
150
- resolutionScale: e.resolutionScale
151
- }), i.enabled = !1, r.value.addPass(i)));
152
- }, B = L(() => {
153
- const u = new R(), p = {
154
- depthBuffer: e.depthBuffer !== void 0 ? e.depthBuffer : u.inputBuffer.depthBuffer,
155
- stencilBuffer: e.stencilBuffer !== void 0 ? e.stencilBuffer : u.inputBuffer.stencilBuffer,
156
- multisampling: M() ? e.multisampling !== void 0 ? e.multisampling : u.multisampling : 0,
157
- frameBufferType: e.frameBufferType !== void 0 ? e.frameBufferType : k
141
+ emits: ["render"],
142
+ setup(l, { expose: n, emit: e }) {
143
+ const t = l, o = e, { scene: a, camera: i, renderer: s, sizes: u, render: f } = b(), r = _(null);
144
+ let S = null, g = null;
145
+ H(W, r), n({ composer: r });
146
+ const Y = () => {
147
+ r.value && (g = new Q(a.value, i.value), g.enabled = !1, r.value.addPass(g), t.resolutionScale !== void 0 && N() && (S = new Z({
148
+ normalBuffer: g.texture,
149
+ resolutionScale: t.resolutionScale
150
+ }), S.enabled = !1, r.value.addPass(S)));
151
+ }, V = $(() => {
152
+ const c = new O(), m = {
153
+ depthBuffer: t.depthBuffer !== void 0 ? t.depthBuffer : c.inputBuffer.depthBuffer,
154
+ stencilBuffer: t.stencilBuffer !== void 0 ? t.stencilBuffer : c.inputBuffer.stencilBuffer,
155
+ multisampling: N() ? t.multisampling !== void 0 ? t.multisampling : c.multisampling : 0,
156
+ frameBufferType: t.frameBufferType !== void 0 ? t.frameBufferType : A
158
157
  };
159
- return u.dispose(), p;
160
- }), y = () => {
161
- !a.value && !n.value && !o.value || (r.value = new R(a.value, B.value), r.value.addPass(new H(n.value, o.value)), e.disableNormalPass || f());
158
+ return c.dispose(), m;
159
+ }), F = () => {
160
+ !s.value && !a.value && !i.value || (r.value = new O(s.value, V.value), r.value.addPass(new J(a.value, i.value)), t.disableNormalPass || Y());
162
161
  };
163
- g([a, n, o, () => e.disableNormalPass], () => {
164
- !s.width.value || !s.height.value || y();
165
- }), g(() => [s.width.value, s.height.value], ([u, p]) => {
166
- !u && !p || (r.value ? r.value.setSize(u, p) : y());
162
+ h([s, a, i, () => t.disableNormalPass], () => {
163
+ !u.width.value || !u.height.value || F();
164
+ }), h(() => [u.width.value, u.height.value], ([c, m]) => {
165
+ !c && !m || (r.value ? r.value.setSize(c, m) : F());
167
166
  }, {
168
167
  immediate: !0
169
168
  });
170
- const { onLoop: X } = Z();
171
- return X(({ delta: u }) => {
172
- if (e.enabled && a.value && r.value && s.width.value && s.height.value) {
173
- const p = a.value.autoClear;
174
- a.value.autoClear = e.autoClear, e.stencilBuffer && !e.autoClear && a.value.clearStencil(), r.value.render(u), a.value.autoClear = p;
169
+ const { render: U } = ne();
170
+ return U(() => {
171
+ if (t.enabled && s.value && r.value && u.width.value && u.height.value && f.frames.value > 0) {
172
+ const c = s.value.autoClear;
173
+ s.value.autoClear = t.autoClear, t.stencilBuffer && !t.autoClear && s.value.clearStencil(), r.value.render(), o("render", r.value), s.value.autoClear = c;
175
174
  }
176
- }), N(() => {
177
- var u;
178
- (u = r.value) == null || u.dispose();
179
- }), (u, p) => U(u.$slots, "default");
175
+ f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
176
+ }), L(() => {
177
+ var c;
178
+ (c = r.value) == null || c.dispose();
179
+ }), (c, m) => I(c.$slots, "default");
180
180
  }
181
- }), ue = /* @__PURE__ */ d({
181
+ }), fe = /* @__PURE__ */ d({
182
182
  __name: "Glitch",
183
183
  props: {
184
184
  blendFunction: {},
@@ -193,23 +193,24 @@ const re = /* @__PURE__ */ d({
193
193
  perturbationMap: {},
194
194
  dtSize: {}
195
195
  },
196
- setup(l, { expose: t }) {
197
- const e = l, { pass: n, effect: o } = m(() => new b(e));
198
- return t({ pass: n, effect: o }), w(() => {
196
+ setup(l, { expose: n }) {
197
+ const e = l, { pass: t, effect: o } = p(() => new w(e));
198
+ return n({ pass: t, effect: o }), B(() => {
199
199
  const a = () => {
200
200
  if (e.mode !== void 0)
201
- return e.active === !1 ? J.DISABLED : e.mode;
202
- const s = new b(), r = s.mode;
203
- return s.dispose(), r;
201
+ return e.active === !1 ? ee.DISABLED : e.mode;
202
+ const i = new w(), s = i.mode;
203
+ return i.dispose(), s;
204
204
  };
205
205
  o.value && (o.value.mode = a());
206
- }), _(
207
- E(e, ["active", "mode", "blendFunction"]),
206
+ }), C(
207
+ x(e, ["active", "mode", "blendFunction"]),
208
208
  o,
209
- () => new b()
210
- ), (a, s) => null;
209
+ () => new w()
210
+ ), () => {
211
+ };
211
212
  }
212
- }), ie = /* @__PURE__ */ d({
213
+ }), de = /* @__PURE__ */ d({
213
214
  __name: "Outline",
214
215
  props: {
215
216
  outlinedObjects: {},
@@ -228,8 +229,8 @@ const re = /* @__PURE__ */ d({
228
229
  hiddenEdgeColor: {},
229
230
  visibleEdgeColor: {}
230
231
  },
231
- setup(l, { expose: t }) {
232
- const e = l, n = (f) => f !== void 0 ? S(f).getHex() : void 0, { camera: o, scene: a } = h(), s = {
232
+ setup(l, { expose: n }) {
233
+ const e = l, t = (r) => r !== void 0 ? E(r).getHex() : void 0, { camera: o, scene: a } = b(), i = {
233
234
  blur: e.blur,
234
235
  xRay: e.xRay,
235
236
  kernelSize: e.kernelSize,
@@ -242,25 +243,25 @@ const re = /* @__PURE__ */ d({
242
243
  multisampling: e.multisampling,
243
244
  patternTexture: e.patternTexture,
244
245
  resolutionScale: e.resolutionScale,
245
- hiddenEdgeColor: n(e.hiddenEdgeColor),
246
- visibleEdgeColor: n(e.visibleEdgeColor)
247
- }, { pass: r, effect: i } = m(() => new O(a.value, o.value, s));
248
- t({ pass: r, effect: i }), g(
249
- [() => e.outlinedObjects, i],
246
+ hiddenEdgeColor: t(e.hiddenEdgeColor),
247
+ visibleEdgeColor: t(e.visibleEdgeColor)
248
+ }, { pass: s, effect: u } = p(() => new D(a.value, o.value, i));
249
+ n({ pass: s, effect: u }), h(
250
+ [() => e.outlinedObjects, u],
250
251
  // watchEffect is intentionally not used here as it would result in an endless loop
251
252
  () => {
252
- var f;
253
- (f = i.value) == null || f.selection.set(e.outlinedObjects || []);
253
+ var r;
254
+ (r = u.value) == null || r.selection.set(e.outlinedObjects || []);
254
255
  },
255
256
  {
256
257
  immediate: !0
257
258
  }
258
259
  );
259
- const c = L(() => ({
260
- hiddenEdgeColor: e.hiddenEdgeColor ? S(e.hiddenEdgeColor) : void 0,
261
- visibleEdgeColor: e.visibleEdgeColor ? S(e.visibleEdgeColor) : void 0
260
+ const f = $(() => ({
261
+ hiddenEdgeColor: e.hiddenEdgeColor ? E(e.hiddenEdgeColor) : void 0,
262
+ visibleEdgeColor: e.visibleEdgeColor ? E(e.visibleEdgeColor) : void 0
262
263
  }));
263
- return x(
264
+ return y(
264
265
  [
265
266
  /* some properties are not updated because of different reasons:
266
267
  resolutionX - has no setter in OutlineEffect
@@ -276,64 +277,69 @@ const re = /* @__PURE__ */ d({
276
277
  [() => e.edgeStrength, "edgeStrength"],
277
278
  [() => e.patternScale, "patternScale"],
278
279
  [() => e.multisampling, "multisampling"],
279
- [() => c.value.hiddenEdgeColor, "hiddenEdgeColor"],
280
- [() => c.value.visibleEdgeColor, "visibleEdgeColor"]
280
+ [() => f.value.hiddenEdgeColor, "hiddenEdgeColor"],
281
+ [() => f.value.visibleEdgeColor, "visibleEdgeColor"]
281
282
  ],
282
- i,
283
- () => new O()
284
- ), (f, B) => null;
283
+ u,
284
+ () => new D()
285
+ ), () => {
286
+ };
285
287
  }
286
- }), ce = /* @__PURE__ */ d({
288
+ }), pe = /* @__PURE__ */ d({
287
289
  __name: "Pixelation",
288
290
  props: {
289
291
  granularity: {}
290
292
  },
291
- setup(l, { expose: t }) {
292
- const e = l, { pass: n, effect: o } = m(() => new D(e.granularity));
293
- return t({ pass: n, effect: o }), _(
293
+ setup(l, { expose: n }) {
294
+ const e = l, { pass: t, effect: o } = p(() => new T(e.granularity));
295
+ return n({ pass: t, effect: o }), C(
294
296
  e,
295
297
  o,
296
- () => new D()
297
- ), (a, s) => null;
298
+ () => new T()
299
+ ), () => {
300
+ };
298
301
  }
299
- }), fe = /* @__PURE__ */ d({
302
+ }), me = /* @__PURE__ */ d({
300
303
  __name: "Vignette",
301
304
  props: {
302
- technique: { default: Q.DEFAULT },
303
- blendFunction: { default: $.NORMAL },
305
+ technique: { default: te.DEFAULT },
306
+ blendFunction: { default: G.NORMAL },
304
307
  offset: { default: 0.5 },
305
308
  darkness: { default: 0.5 }
306
309
  },
307
- setup(l, { expose: t }) {
308
- const e = l, { pass: n, effect: o } = m(() => new T(e));
309
- return t({ pass: n, effect: o }), _(
310
- E(e, ["blendFunction"]),
310
+ setup(l, { expose: n }) {
311
+ const e = l, { pass: t, effect: o } = p(() => new z(e));
312
+ return n({ pass: t, effect: o }), C(
313
+ x(e, ["blendFunction"]),
311
314
  o,
312
- () => new T()
313
- ), (a, s) => null;
315
+ () => new z()
316
+ ), () => {
317
+ };
314
318
  }
315
- }), de = /* @__PURE__ */ d({
319
+ }), ve = /* @__PURE__ */ d({
316
320
  __name: "Noise",
317
321
  props: {
318
322
  premultiply: { type: Boolean, default: !1 },
319
- blendFunction: { default: $.SCREEN }
323
+ blendFunction: { default: G.SCREEN }
320
324
  },
321
- setup(l, { expose: t }) {
322
- const e = l, { pass: n, effect: o } = m(() => new z(e));
323
- return t({ pass: n, effect: o }), _(
324
- E(e, ["blendFunction"]),
325
+ setup(l, { expose: n }) {
326
+ const e = l, { pass: t, effect: o } = p(() => new k(e));
327
+ return n({ pass: t, effect: o }), C(
328
+ x(e, ["blendFunction"]),
325
329
  o,
326
- () => new z()
327
- ), (a, s) => null;
330
+ () => new k()
331
+ ), () => {
332
+ };
328
333
  }
329
334
  });
330
335
  export {
331
- ae as Bloom,
332
- se as DepthOfField,
333
- re as EffectComposer,
334
- ue as Glitch,
335
- de as Noise,
336
- ie as Outline,
337
- ce as Pixelation,
338
- fe as Vignette
336
+ ie as Bloom,
337
+ ue as DepthOfField,
338
+ ce as EffectComposer,
339
+ fe as Glitch,
340
+ ve as Noise,
341
+ de as Outline,
342
+ pe as Pixelation,
343
+ me as Vignette,
344
+ p as useEffect
339
345
  };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * name: @tresjs/post-processing
3
- * version: v0.7.1
3
+ * version: v1.0.0-next.1
4
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(c,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("postprocessing"),require("@tresjs/core"),require("three")):typeof define=="function"&&define.amd?define(["exports","vue","postprocessing","@tresjs/core","three"],i):(c=typeof globalThis<"u"?globalThis:c||self,i(c["tres-postprocessing"]={},c.Vue,c.Postprocessing,c.TresjsCore,c.Three))})(this,function(c,i,r,p,S){"use strict";const g=Symbol(),v=o=>{const n=i.inject(g),e=i.shallowRef(null),t=i.shallowRef(null),{scene:l,camera:a}=p.useTresContext();i.watchEffect(()=>{!a.value||!(t!=null&&t.value)||(t.value.mainCamera=a.value)});let u=()=>{};return u=i.watchEffect(()=>{!a.value||!(n!=null&&n.value)||!l.value||(u(),!t.value&&(t.value=o(),e.value=new r.EffectPass(a.value,t.value),n.value.addPass(e.value)))}),i.onUnmounted(()=>{var s,d,m;e.value&&((s=n==null?void 0:n.value)==null||s.removePass(e.value)),(d=t.value)==null||d.dispose(),(m=e.value)==null||m.dispose()}),{pass:e,effect:t}},B=/([^[.\]])+/g,R=(o,n)=>{if(!n)return;const e=Array.isArray(n)?n:n.match(B);return e==null?void 0:e.reduce((t,l)=>t&&t[l],o)},x=(o,n,e)=>{const t=Array.isArray(n)?n:n.match(B);t&&t.reduce((l,a,u)=>(l[a]===void 0&&(l[a]={}),u===t.length-1&&(l[a]=e),l[a]),o)},w=(o,n)=>{const e={...o};return n.forEach(t=>delete e[t]),e},y=(o,n,e,t,l={})=>i.watch(o,a=>{var u;if(n.value)if(a===void 0){const s=t();x(n.value,e,R(s,e)),(u=s.dispose)==null||u.call(s)}else x(n.value,e,o())},l),b=(o,n,e)=>o.map(([t,l])=>y(t,n,l,e)),E=(o,n,e)=>Object.keys(o).map(t=>y(()=>o[t],n,t,e)),O=i.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}),b([[()=>e.intensity,"intensity"],[()=>e.kernelSize,"kernelSize"],[()=>e.luminanceSmoothing,"luminanceMaterial.smoothing"],[()=>e.luminanceThreshold,"luminanceMaterial.threshold"]],l,()=>new r.BloomEffect),(a,u)=>null}}),z=i.defineComponent({__name:"DepthOfField",props:{blendFunction:{},worldFocusDistance:{},worldFocusRange:{},focusDistance:{},focusRange:{},bokehScale:{},resolutionScale:{},resolutionX:{},resolutionY:{}},setup(o,{expose:n}){const e=o,{camera:t}=p.useTresContext(),{pass:l,effect:a}=v(()=>new r.DepthOfFieldEffect(t.value,e));return n({pass:l,effect:a}),b([[()=>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"]],a,()=>new r.DepthOfFieldEffect),(u,s)=>null}});let _;function F(){var o;if(_!==void 0)return _;try{let n;const e=document.createElement("canvas");return _=!!(window.WebGL2RenderingContext&&(n=e.getContext("webgl2"))),n&&((o=n.getExtension("WEBGL_lose_context"))==null||o.loseContext()),_}catch{return _=!1}}const D=i.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:S.HalfFloatType}},setup(o,{expose:n}){const e=o,{scene:t,camera:l,renderer:a,sizes:u}=p.useTresContext(),s=i.shallowRef(null);let d=null,m=null;i.provide(g,s),n({composer:s});const h=()=>{s.value&&(m=new r.NormalPass(t.value,l.value),m.enabled=!1,s.value.addPass(m),e.resolutionScale!==void 0&&F()&&(d=new r.DepthDownsamplingPass({normalBuffer:m.texture,resolutionScale:e.resolutionScale}),d.enabled=!1,s.value.addPass(d)))},P=i.computed(()=>{const f=new r.EffectComposer,C={depthBuffer:e.depthBuffer!==void 0?e.depthBuffer:f.inputBuffer.depthBuffer,stencilBuffer:e.stencilBuffer!==void 0?e.stencilBuffer:f.inputBuffer.stencilBuffer,multisampling:F()?e.multisampling!==void 0?e.multisampling:f.multisampling:0,frameBufferType:e.frameBufferType!==void 0?e.frameBufferType:S.HalfFloatType};return f.dispose(),C}),T=()=>{!a.value&&!t.value&&!l.value||(s.value=new r.EffectComposer(a.value,P.value),s.value.addPass(new r.RenderPass(t.value,l.value)),e.disableNormalPass||h())};i.watch([a,t,l,()=>e.disableNormalPass],()=>{!u.width.value||!u.height.value||T()}),i.watch(()=>[u.width.value,u.height.value],([f,C])=>{!f&&!C||(s.value?s.value.setSize(f,C):T())},{immediate:!0});const{onLoop:G}=p.useRenderLoop();return G(({delta:f})=>{if(e.enabled&&a.value&&s.value&&u.width.value&&u.height.value){const C=a.value.autoClear;a.value.autoClear=e.autoClear,e.stencilBuffer&&!e.autoClear&&a.value.clearStencil(),s.value.render(f),a.value.autoClear=C}}),i.onUnmounted(()=>{var f;(f=s.value)==null||f.dispose()}),(f,C)=>i.renderSlot(f.$slots,"default")}}),k=i.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}),i.watchEffect(()=>{const a=()=>{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=a())}),E(w(e,["active","mode","blendFunction"]),l,()=>new r.GlitchEffect),(a,u)=>null}}),A=i.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=h=>h!==void 0?p.normalizeColor(h).getHex():void 0,{camera:l,scene:a}=p.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(a.value,l.value,u));n({pass:s,effect:d}),i.watch([()=>e.outlinedObjects,d],()=>{var h;(h=d.value)==null||h.selection.set(e.outlinedObjects||[])},{immediate:!0});const m=i.computed(()=>({hiddenEdgeColor:e.hiddenEdgeColor?p.normalizeColor(e.hiddenEdgeColor):void 0,visibleEdgeColor:e.visibleEdgeColor?p.normalizeColor(e.visibleEdgeColor):void 0}));return b([[()=>e.blur,"blur"],[()=>e.xRay,"xRay"],[()=>e.pulseSpeed,"pulseSpeed"],[()=>e.kernelSize,"kernelSize"],[()=>e.edgeStrength,"edgeStrength"],[()=>e.patternScale,"patternScale"],[()=>e.multisampling,"multisampling"],[()=>m.value.hiddenEdgeColor,"hiddenEdgeColor"],[()=>m.value.visibleEdgeColor,"visibleEdgeColor"]],d,()=>new r.OutlineEffect),(h,P)=>null}}),M=i.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(e,l,()=>new r.PixelationEffect),(a,u)=>null}}),N=i.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}),E(w(e,["blendFunction"]),l,()=>new r.VignetteEffect),(a,u)=>null}}),j=i.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}),E(w(e,["blendFunction"]),l,()=>new r.NoiseEffect),(a,u)=>null}});c.Bloom=O,c.DepthOfField=z,c.EffectComposer=D,c.Glitch=k,c.Noise=j,c.Outline=A,c.Pixelation=M,c.Vignette=N,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
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,i,v,y){"use strict";const _=Symbol("effectComposer"),h=o=>{const n=a.inject(_),e=a.shallowRef(null),t=a.shallowRef(null),{scene:l,camera:r}=v.useTresContext();a.watchEffect(()=>{!r.value||!(t!=null&&t.value)||(t.value.mainCamera=r.value)});let c=()=>{};return c=a.watchEffect(()=>{!r.value||!(n!=null&&n.value)||!l.value||(c(),!t.value&&(t.value=o(),e.value=new i.EffectPass(r.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,r,c)=>(l[r]===void 0&&(l[r]={}),c===t.length-1&&(l[r]=e),l[r]),o)},S=(o,n)=>{const e={...o};return n.forEach(t=>delete e[t]),e},P=(o,n,e,t,l={})=>a.watch(o,r=>{var c;if(n.value)if(r===void 0){const s=t();F(n.value,e,R(s,e)),(c=s.dispose)==null||c.call(s)}else F(n.value,e,o())},l),g=(o,n,e)=>o.map(([t,l])=>P(t,n,l,e)),w=(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}=h(()=>new i.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 i.BloomEffect),()=>{}}}),D=a.defineComponent({__name:"DepthOfField",props:{blendFunction:{},worldFocusDistance:{},worldFocusRange:{},focusDistance:{},focusRange:{},bokehScale:{},resolutionScale:{},resolutionX:{},resolutionY:{}},setup(o,{expose:n}){const e=o,{camera:t}=v.useTresContext(),{pass:l,effect:r}=h(()=>new i.DepthOfFieldEffect(t.value,e));return n({pass:l,effect:r}),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"]],r,()=>new i.DepthOfFieldEffect),()=>{}}});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:y.HalfFloatType}},emits:["render"],setup(o,{expose:n,emit:e}){const t=o,l=e,{scene:r,camera:c,renderer:s,sizes:d,render:p}=v.useTresContext(),u=a.shallowRef(null);let B=null,b=null;a.provide(_,u),n({composer:u});const L=()=>{u.value&&(b=new i.NormalPass(r.value,c.value),b.enabled=!1,u.value.addPass(b),t.resolutionScale!==void 0&&T()&&(B=new i.DepthDownsamplingPass({normalBuffer:b.texture,resolutionScale:t.resolutionScale}),B.enabled=!1,u.value.addPass(B)))},$=a.computed(()=>{const m=new i.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:y.HalfFloatType};return m.dispose(),E}),O=()=>{!s.value&&!r.value&&!c.value||(u.value=new i.EffectComposer(s.value,$.value),u.value.addPass(new i.RenderPass(r.value,c.value)),t.disableNormalPass||L())};a.watch([s,r,c,()=>t.disableNormalPass],()=>{!d.width.value||!d.height.value||O()}),a.watch(()=>[d.width.value,d.height.value],([m,E])=>{!m&&!E||(u.value?u.value.setSize(m,E):O())},{immediate:!0});const{render:q}=v.useLoop();return q(()=>{if(t.enabled&&s.value&&u.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(),u.value.render(),l("render",u.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=u.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}=h(()=>new i.GlitchEffect(e));return n({pass:t,effect:l}),a.watchEffect(()=>{const r=()=>{if(e.mode!==void 0)return e.active===!1?i.GlitchMode.DISABLED:e.mode;const c=new i.GlitchEffect,s=c.mode;return c.dispose(),s};l.value&&(l.value.mode=r())}),w(S(e,["active","mode","blendFunction"]),l,()=>new i.GlitchEffect),()=>{}}}),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=u=>u!==void 0?v.normalizeColor(u).getHex():void 0,{camera:l,scene:r}=v.useTresContext(),c={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}=h(()=>new i.OutlineEffect(r.value,l.value,c));n({pass:s,effect:d}),a.watch([()=>e.outlinedObjects,d],()=>{var u;(u=d.value)==null||u.selection.set(e.outlinedObjects||[])},{immediate:!0});const p=a.computed(()=>({hiddenEdgeColor:e.hiddenEdgeColor?v.normalizeColor(e.hiddenEdgeColor):void 0,visibleEdgeColor:e.visibleEdgeColor?v.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 i.OutlineEffect),()=>{}}}),N=a.defineComponent({__name:"Pixelation",props:{granularity:{}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=h(()=>new i.PixelationEffect(e.granularity));return n({pass:t,effect:l}),w(e,l,()=>new i.PixelationEffect),()=>{}}}),j=a.defineComponent({__name:"Vignette",props:{technique:{default:i.VignetteTechnique.DEFAULT},blendFunction:{default:i.BlendFunction.NORMAL},offset:{default:.5},darkness:{default:.5}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=h(()=>new i.VignetteEffect(e));return n({pass:t,effect:l}),w(S(e,["blendFunction"]),l,()=>new i.VignetteEffect),()=>{}}}),G=a.defineComponent({__name:"Noise",props:{premultiply:{type:Boolean,default:!1},blendFunction:{default:i.BlendFunction.SCREEN}},setup(o,{expose:n}){const e=o,{pass:t,effect:l}=h(()=>new i.NoiseEffect(e));return n({pass:t,effect:l}),w(S(e,["blendFunction"]),l,()=>new i.NoiseEffect),()=>{}}});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=h,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,5 @@
1
- import type { Ref, WatchOptions } from 'vue';
1
+ import { Ref, WatchOptions } from 'vue';
2
+
2
3
  /**
3
4
  * Creates a prop watcher function that monitors changes to a property and updates a target object.
4
5
  *
@@ -11,8 +12,8 @@ import type { Ref, WatchOptions } from 'vue';
11
12
  * @param {WatchOptions} watchOptions - The options for watch.
12
13
  */
13
14
  export declare const makePropWatcher: <T, E>(propGetter: () => T, target: Ref<E>, propertyPath: string, newPlainObjectFunction: () => E & {
14
- dispose?(): void;
15
- }, watchOptions?: WatchOptions) => import("vue").WatchStopHandle;
15
+ dispose?: () => void;
16
+ }, watchOptions?: WatchOptions) => import('vue').WatchStopHandle;
16
17
  /**
17
18
  * Creates multiple prop watchers for monitoring changes to multiple properties and updating a target object.
18
19
  *
@@ -23,8 +24,8 @@ export declare const makePropWatcher: <T, E>(propGetter: () => T, target: Ref<E>
23
24
  * @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
25
  */
25
26
  export declare const makePropWatchers: <E>(propGettersAndPropertyPaths: (string | (() => any))[][], target: Ref<E>, newPlainObjectFunction: () => E & {
26
- dispose?(): void;
27
- }) => import("vue").WatchStopHandle[];
27
+ dispose?: () => void;
28
+ }) => import('vue').WatchStopHandle[];
28
29
  /**
29
30
  * Creates multiple prop watchers via the props object for monitoring changes to multiple properties and updating a target object.
30
31
  * Use this method in case the prop names match the names of the properties you want to set on your target object.
@@ -36,5 +37,5 @@ export declare const makePropWatchers: <E>(propGettersAndPropertyPaths: (string
36
37
  export declare const makePropWatchersUsingAllProps: <E>(props: {
37
38
  [key: string]: any;
38
39
  }, target: Ref<E>, newPlainObjectFunction: () => E & {
39
- dispose?(): void;
40
- }) => import("vue").WatchStopHandle[];
40
+ dispose?: () => void;
41
+ }) => import('vue').WatchStopHandle[];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tresjs/post-processing",
3
3
  "type": "module",
4
- "version": "0.7.1",
5
- "packageManager": "pnpm@8.11.0",
4
+ "version": "1.0.0-next.1",
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/)",
8
8
  "license": "MIT",
@@ -25,8 +25,8 @@
25
25
  "main": "./dist/tres-postprocessing.js",
26
26
  "module": "./dist/tres-postprocessing.js",
27
27
  "files": [
28
- "dist",
29
- "*.d.ts"
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 . --ext .js,.jsx,.ts,.tsx,.vue",
41
- "lint:fix": "pnpm run 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
- "vue": ">=3.3"
49
+ "vue": ">=3.4"
49
50
  },
50
51
  "dependencies": {
51
- "@tresjs/core": "^3.5.1",
52
- "@unocss/core": "^0.58.0",
53
- "@vueuse/core": "^10.6.1",
54
- "postprocessing": "^6.33.4",
55
- "three-stdlib": "^2.28.7"
52
+ "@vueuse/core": "^10.11.0",
53
+ "postprocessing": "^6.36.0",
54
+ "three-stdlib": "^2.30.5"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@release-it/conventional-changelog": "^8.0.1",
59
- "@tresjs/eslint-config-vue": "^0.2.1",
60
- "@types/three": "^0.159.0",
61
- "@vitejs/plugin-vue": "^4.5.1",
62
- "gsap": "^3.12.3",
58
+ "@tresjs/core": "^4.2.2",
59
+ "@tresjs/eslint-config": "^1.1.0",
60
+ "@types/three": "^0.167.0",
61
+ "@unocss/core": "^0.61.5",
62
+ "@vitejs/plugin-vue": "^5.1.0",
63
+ "eslint": "^9.7.0",
64
+ "gsap": "^3.12.5",
63
65
  "kolorist": "^1.8.0",
64
- "pathe": "^1.1.1",
65
- "prettier": "^3.1.0",
66
- "release-it": "^17.0.0",
66
+ "pathe": "^1.1.2",
67
+ "release-it": "^17.6.0",
67
68
  "rollup-plugin-analyzer": "^4.0.0",
68
- "rollup-plugin-visualizer": "^5.10.0",
69
- "three": "^0.159.0",
70
- "typescript": "^5.3.2",
71
- "unocss": "^0.58.0",
72
- "vite": "^5.0.4",
69
+ "rollup-plugin-visualizer": "^5.12.0",
70
+ "three": "^0.167.0",
71
+ "typescript": "^5.5.4",
72
+ "unocss": "^0.61.5",
73
+ "vite": "^5.3.5",
73
74
  "vite-plugin-banner": "^0.7.1",
74
- "vite-plugin-dts": "3.6.4",
75
+ "vite-plugin-dts": "4.0.0-beta.1",
75
76
  "vite-svg-loader": "^5.1.0",
76
- "vitepress": "1.0.0-rc.31",
77
- "vue": "^3.3.9",
78
- "vue-tsc": "^1.8.24"
77
+ "vitepress": "1.3.1",
78
+ "vue": "^3.4.34",
79
+ "vue-tsc": "^2.0.29"
79
80
  }
80
81
  }