@tresjs/post-processing 1.0.0-next.0 → 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/dist/core/EffectComposer.vue.d.ts +20 -17
- package/dist/core/effects/Bloom.vue.d.ts +134 -13
- package/dist/core/effects/DepthOfField.vue.d.ts +7 -7
- package/dist/core/effects/Glitch.vue.d.ts +8 -8
- package/dist/core/effects/Noise.vue.d.ts +14 -13
- package/dist/core/effects/Outline.vue.d.ts +17 -17
- package/dist/core/effects/Pixelation.vue.d.ts +6 -5
- package/dist/core/effects/Vignette.vue.d.ts +14 -13
- package/dist/core/injectionKeys.d.ts +3 -2
- package/dist/index.d.ts +9 -8
- package/dist/tres-postprocessing.js +67 -60
- package/dist/tres-postprocessing.umd.cjs +2 -2
- package/dist/util/prop.d.ts +8 -7
- package/package.json +22 -22
- package/dist/core/composables/effect.d.ts +0 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TresObject } from '@tresjs/core';
|
|
2
2
|
import { EffectComposer as EffectComposerImpl } from 'postprocessing';
|
|
3
|
-
import
|
|
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
|
|
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,9 +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(
|
|
29
|
+
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
26
30
|
render: (...args: any[]) => void;
|
|
27
|
-
}, string, import(
|
|
31
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<EffectComposerProps>, {
|
|
28
32
|
enabled: boolean;
|
|
29
33
|
autoClear: boolean;
|
|
30
34
|
frameBufferType: 1016;
|
|
@@ -42,19 +46,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
42
46
|
autoClear: boolean;
|
|
43
47
|
multisampling: number;
|
|
44
48
|
frameBufferType: number;
|
|
45
|
-
}, {}
|
|
46
|
-
|
|
47
|
-
}>;
|
|
49
|
+
}, {}>;
|
|
50
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
48
51
|
export default _default;
|
|
49
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
50
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
51
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
52
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
53
|
-
} : {
|
|
54
|
-
type: import('vue').PropType<T[K]>;
|
|
55
|
-
required: true;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
52
|
type __VLS_WithDefaults<P, D> = {
|
|
59
53
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
60
54
|
default: D[K];
|
|
@@ -68,3 +62,12 @@ type __VLS_WithTemplateSlots<T, S> = T & {
|
|
|
68
62
|
$slots: S;
|
|
69
63
|
};
|
|
70
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
|
-
|
|
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(
|
|
56
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<BloomProps>, {
|
|
57
57
|
mipmapBlur: undefined;
|
|
58
58
|
}>, {
|
|
59
|
-
pass: import(
|
|
60
|
-
effect: import(
|
|
61
|
-
}, unknown, {}, {}, import(
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
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(
|
|
33
|
-
pass: import(
|
|
34
|
-
effect: import(
|
|
35
|
-
}, unknown, {}, {}, import(
|
|
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
|
|
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 { GlitchEffect, GlitchMode } from 'postprocessing';
|
|
2
|
-
import
|
|
3
|
-
|
|
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(
|
|
93
|
-
pass: import(
|
|
94
|
-
effect: import(
|
|
95
|
-
}, unknown, {}, {}, import(
|
|
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
|
|
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(
|
|
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(
|
|
14
|
-
effect: import(
|
|
15
|
-
}, unknown, {}, {}, import(
|
|
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
|
|
3
|
-
import
|
|
4
|
-
|
|
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(
|
|
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(
|
|
45
|
-
effect: import(
|
|
46
|
-
}, unknown, {}, {}, import(
|
|
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(
|
|
9
|
-
pass: import(
|
|
10
|
-
effect: import(
|
|
11
|
-
}, unknown, {}, {}, import(
|
|
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
|
|
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(
|
|
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(
|
|
18
|
-
effect: import(
|
|
19
|
-
}, unknown, {}, {}, import(
|
|
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
|
|
2
|
-
import
|
|
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,10 +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';
|
|
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
9
|
import { useEffect } from './core/composables/effect.ts';
|
|
10
|
+
|
|
10
11
|
export { Bloom, DepthOfField, EffectComposer, Glitch, Noise, Outline, Pixelation, Vignette, useEffect, };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version: v1.0.0-next.
|
|
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 q, shallowRef as
|
|
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
|
|
10
|
-
import { useTresContext as b, useLoop as ne, normalizeColor as
|
|
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
11
|
import { HalfFloatType as A } from "three";
|
|
12
12
|
const W = Symbol("effectComposer"), p = (l) => {
|
|
13
|
-
const n = q(W), e =
|
|
14
|
-
|
|
13
|
+
const n = q(W), e = _(null), t = _(null), { scene: o, camera: a } = b();
|
|
14
|
+
B(() => {
|
|
15
15
|
!a.value || !(t != null && t.value) || (t.value.mainCamera = a.value);
|
|
16
16
|
});
|
|
17
|
-
let
|
|
17
|
+
let i = () => {
|
|
18
18
|
};
|
|
19
|
-
return
|
|
20
|
-
!a.value || !(n != null && n.value) || !o.value || (
|
|
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
21
|
}), L(() => {
|
|
22
|
-
var
|
|
23
|
-
e.value && ((
|
|
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
26
|
effect: t
|
|
@@ -32,16 +32,16 @@ const W = Symbol("effectComposer"), p = (l) => {
|
|
|
32
32
|
return e == null ? void 0 : e.reduce((t, o) => t && t[o], l);
|
|
33
33
|
}, M = (l, n, e) => {
|
|
34
34
|
const t = Array.isArray(n) ? n : n.match(j);
|
|
35
|
-
t && t.reduce((o, a,
|
|
36
|
-
},
|
|
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
38
|
return n.forEach((t) => delete e[t]), e;
|
|
39
|
-
}, X = (l, n, e, t, o = {}) =>
|
|
40
|
-
var
|
|
39
|
+
}, X = (l, n, e, t, o = {}) => h(l, (a) => {
|
|
40
|
+
var i;
|
|
41
41
|
if (n.value)
|
|
42
42
|
if (a === void 0) {
|
|
43
|
-
const
|
|
44
|
-
M(n.value, e, oe(
|
|
43
|
+
const s = t();
|
|
44
|
+
M(n.value, e, oe(s, e)), (i = s.dispose) == null || i.call(s);
|
|
45
45
|
} else
|
|
46
46
|
M(n.value, e, l());
|
|
47
47
|
}, o), y = (l, n, e) => l.map(([t, o]) => X(
|
|
@@ -54,7 +54,7 @@ const W = Symbol("effectComposer"), p = (l) => {
|
|
|
54
54
|
n,
|
|
55
55
|
t,
|
|
56
56
|
e
|
|
57
|
-
)),
|
|
57
|
+
)), ie = /* @__PURE__ */ d({
|
|
58
58
|
__name: "Bloom",
|
|
59
59
|
props: {
|
|
60
60
|
blendFunction: {},
|
|
@@ -76,9 +76,10 @@ const W = Symbol("effectComposer"), p = (l) => {
|
|
|
76
76
|
],
|
|
77
77
|
o,
|
|
78
78
|
() => new P()
|
|
79
|
-
), (
|
|
79
|
+
), () => {
|
|
80
|
+
};
|
|
80
81
|
}
|
|
81
|
-
}),
|
|
82
|
+
}), ue = /* @__PURE__ */ d({
|
|
82
83
|
__name: "DepthOfField",
|
|
83
84
|
props: {
|
|
84
85
|
blendFunction: {},
|
|
@@ -107,7 +108,8 @@ const W = Symbol("effectComposer"), p = (l) => {
|
|
|
107
108
|
],
|
|
108
109
|
a,
|
|
109
110
|
() => new R()
|
|
110
|
-
), (
|
|
111
|
+
), () => {
|
|
112
|
+
};
|
|
111
113
|
}
|
|
112
114
|
});
|
|
113
115
|
let v;
|
|
@@ -138,14 +140,14 @@ const ce = /* @__PURE__ */ d({
|
|
|
138
140
|
},
|
|
139
141
|
emits: ["render"],
|
|
140
142
|
setup(l, { expose: n, emit: e }) {
|
|
141
|
-
const t = l, o = e, { scene: a, camera:
|
|
142
|
-
let
|
|
143
|
-
H(W,
|
|
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 });
|
|
144
146
|
const Y = () => {
|
|
145
|
-
|
|
146
|
-
normalBuffer:
|
|
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,
|
|
147
149
|
resolutionScale: t.resolutionScale
|
|
148
|
-
}),
|
|
150
|
+
}), S.enabled = !1, r.value.addPass(S)));
|
|
149
151
|
}, V = $(() => {
|
|
150
152
|
const c = new O(), m = {
|
|
151
153
|
depthBuffer: t.depthBuffer !== void 0 ? t.depthBuffer : c.inputBuffer.depthBuffer,
|
|
@@ -155,25 +157,25 @@ const ce = /* @__PURE__ */ d({
|
|
|
155
157
|
};
|
|
156
158
|
return c.dispose(), m;
|
|
157
159
|
}), F = () => {
|
|
158
|
-
!
|
|
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());
|
|
159
161
|
};
|
|
160
|
-
|
|
161
|
-
!
|
|
162
|
-
}),
|
|
163
|
-
!c && !m || (
|
|
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());
|
|
164
166
|
}, {
|
|
165
167
|
immediate: !0
|
|
166
168
|
});
|
|
167
169
|
const { render: U } = ne();
|
|
168
170
|
return U(() => {
|
|
169
|
-
if (t.enabled &&
|
|
170
|
-
const c =
|
|
171
|
-
|
|
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;
|
|
172
174
|
}
|
|
173
175
|
f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
|
|
174
176
|
}), L(() => {
|
|
175
177
|
var c;
|
|
176
|
-
(c =
|
|
178
|
+
(c = r.value) == null || c.dispose();
|
|
177
179
|
}), (c, m) => I(c.$slots, "default");
|
|
178
180
|
}
|
|
179
181
|
}), fe = /* @__PURE__ */ d({
|
|
@@ -192,20 +194,21 @@ const ce = /* @__PURE__ */ d({
|
|
|
192
194
|
dtSize: {}
|
|
193
195
|
},
|
|
194
196
|
setup(l, { expose: n }) {
|
|
195
|
-
const e = l, { pass: t, effect: o } = p(() => new
|
|
196
|
-
return n({ pass: t, effect: o }),
|
|
197
|
+
const e = l, { pass: t, effect: o } = p(() => new w(e));
|
|
198
|
+
return n({ pass: t, effect: o }), B(() => {
|
|
197
199
|
const a = () => {
|
|
198
200
|
if (e.mode !== void 0)
|
|
199
201
|
return e.active === !1 ? ee.DISABLED : e.mode;
|
|
200
|
-
const
|
|
201
|
-
return
|
|
202
|
+
const i = new w(), s = i.mode;
|
|
203
|
+
return i.dispose(), s;
|
|
202
204
|
};
|
|
203
205
|
o.value && (o.value.mode = a());
|
|
204
206
|
}), C(
|
|
205
|
-
|
|
207
|
+
x(e, ["active", "mode", "blendFunction"]),
|
|
206
208
|
o,
|
|
207
|
-
() => new
|
|
208
|
-
), (
|
|
209
|
+
() => new w()
|
|
210
|
+
), () => {
|
|
211
|
+
};
|
|
209
212
|
}
|
|
210
213
|
}), de = /* @__PURE__ */ d({
|
|
211
214
|
__name: "Outline",
|
|
@@ -227,7 +230,7 @@ const ce = /* @__PURE__ */ d({
|
|
|
227
230
|
visibleEdgeColor: {}
|
|
228
231
|
},
|
|
229
232
|
setup(l, { expose: n }) {
|
|
230
|
-
const e = l, t = (
|
|
233
|
+
const e = l, t = (r) => r !== void 0 ? E(r).getHex() : void 0, { camera: o, scene: a } = b(), i = {
|
|
231
234
|
blur: e.blur,
|
|
232
235
|
xRay: e.xRay,
|
|
233
236
|
kernelSize: e.kernelSize,
|
|
@@ -242,21 +245,21 @@ const ce = /* @__PURE__ */ d({
|
|
|
242
245
|
resolutionScale: e.resolutionScale,
|
|
243
246
|
hiddenEdgeColor: t(e.hiddenEdgeColor),
|
|
244
247
|
visibleEdgeColor: t(e.visibleEdgeColor)
|
|
245
|
-
}, { pass:
|
|
246
|
-
n({ pass:
|
|
247
|
-
[() => e.outlinedObjects,
|
|
248
|
+
}, { pass: s, effect: u } = p(() => new D(a.value, o.value, i));
|
|
249
|
+
n({ pass: s, effect: u }), h(
|
|
250
|
+
[() => e.outlinedObjects, u],
|
|
248
251
|
// watchEffect is intentionally not used here as it would result in an endless loop
|
|
249
252
|
() => {
|
|
250
|
-
var
|
|
251
|
-
(
|
|
253
|
+
var r;
|
|
254
|
+
(r = u.value) == null || r.selection.set(e.outlinedObjects || []);
|
|
252
255
|
},
|
|
253
256
|
{
|
|
254
257
|
immediate: !0
|
|
255
258
|
}
|
|
256
259
|
);
|
|
257
260
|
const f = $(() => ({
|
|
258
|
-
hiddenEdgeColor: e.hiddenEdgeColor ?
|
|
259
|
-
visibleEdgeColor: e.visibleEdgeColor ?
|
|
261
|
+
hiddenEdgeColor: e.hiddenEdgeColor ? E(e.hiddenEdgeColor) : void 0,
|
|
262
|
+
visibleEdgeColor: e.visibleEdgeColor ? E(e.visibleEdgeColor) : void 0
|
|
260
263
|
}));
|
|
261
264
|
return y(
|
|
262
265
|
[
|
|
@@ -277,9 +280,10 @@ const ce = /* @__PURE__ */ d({
|
|
|
277
280
|
[() => f.value.hiddenEdgeColor, "hiddenEdgeColor"],
|
|
278
281
|
[() => f.value.visibleEdgeColor, "visibleEdgeColor"]
|
|
279
282
|
],
|
|
280
|
-
|
|
283
|
+
u,
|
|
281
284
|
() => new D()
|
|
282
|
-
), (
|
|
285
|
+
), () => {
|
|
286
|
+
};
|
|
283
287
|
}
|
|
284
288
|
}), pe = /* @__PURE__ */ d({
|
|
285
289
|
__name: "Pixelation",
|
|
@@ -292,7 +296,8 @@ const ce = /* @__PURE__ */ d({
|
|
|
292
296
|
e,
|
|
293
297
|
o,
|
|
294
298
|
() => new T()
|
|
295
|
-
), (
|
|
299
|
+
), () => {
|
|
300
|
+
};
|
|
296
301
|
}
|
|
297
302
|
}), me = /* @__PURE__ */ d({
|
|
298
303
|
__name: "Vignette",
|
|
@@ -305,10 +310,11 @@ const ce = /* @__PURE__ */ d({
|
|
|
305
310
|
setup(l, { expose: n }) {
|
|
306
311
|
const e = l, { pass: t, effect: o } = p(() => new z(e));
|
|
307
312
|
return n({ pass: t, effect: o }), C(
|
|
308
|
-
|
|
313
|
+
x(e, ["blendFunction"]),
|
|
309
314
|
o,
|
|
310
315
|
() => new z()
|
|
311
|
-
), (
|
|
316
|
+
), () => {
|
|
317
|
+
};
|
|
312
318
|
}
|
|
313
319
|
}), ve = /* @__PURE__ */ d({
|
|
314
320
|
__name: "Noise",
|
|
@@ -319,15 +325,16 @@ const ce = /* @__PURE__ */ d({
|
|
|
319
325
|
setup(l, { expose: n }) {
|
|
320
326
|
const e = l, { pass: t, effect: o } = p(() => new k(e));
|
|
321
327
|
return n({ pass: t, effect: o }), C(
|
|
322
|
-
|
|
328
|
+
x(e, ["blendFunction"]),
|
|
323
329
|
o,
|
|
324
330
|
() => new k()
|
|
325
|
-
), (
|
|
331
|
+
), () => {
|
|
332
|
+
};
|
|
326
333
|
}
|
|
327
334
|
});
|
|
328
335
|
export {
|
|
329
|
-
|
|
330
|
-
|
|
336
|
+
ie as Bloom,
|
|
337
|
+
ue as DepthOfField,
|
|
331
338
|
ce as EffectComposer,
|
|
332
339
|
fe as Glitch,
|
|
333
340
|
ve as Noise,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/post-processing
|
|
3
|
-
* version: v1.0.0-next.
|
|
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(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,
|
|
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"})});
|
package/dist/util/prop.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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?: (
|
|
15
|
-
}, watchOptions?: WatchOptions) => import(
|
|
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?: (
|
|
27
|
-
}) => import(
|
|
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?: (
|
|
40
|
-
}) => import(
|
|
40
|
+
dispose?: () => void;
|
|
41
|
+
}) => 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": "1.0.0-next.
|
|
4
|
+
"version": "1.0.0-next.1",
|
|
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/)",
|
|
@@ -46,36 +46,36 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@tresjs/core": ">=4.0",
|
|
48
48
|
"three": ">=0.133",
|
|
49
|
-
"vue": ">=3.
|
|
49
|
+
"vue": ">=3.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vueuse/core": "^10.
|
|
53
|
-
"postprocessing": "^6.
|
|
54
|
-
"three-stdlib": "^2.
|
|
52
|
+
"@vueuse/core": "^10.11.0",
|
|
53
|
+
"postprocessing": "^6.36.0",
|
|
54
|
+
"three-stdlib": "^2.30.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
58
|
-
"@tresjs/core": "^4.
|
|
58
|
+
"@tresjs/core": "^4.2.2",
|
|
59
59
|
"@tresjs/eslint-config": "^1.1.0",
|
|
60
|
-
"@types/three": "^0.
|
|
61
|
-
"@unocss/core": "^0.
|
|
62
|
-
"@vitejs/plugin-vue": "^
|
|
63
|
-
"eslint": "^9.
|
|
64
|
-
"gsap": "^3.12.
|
|
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",
|
|
65
65
|
"kolorist": "^1.8.0",
|
|
66
|
-
"pathe": "^1.1.
|
|
67
|
-
"release-it": "^17.
|
|
66
|
+
"pathe": "^1.1.2",
|
|
67
|
+
"release-it": "^17.6.0",
|
|
68
68
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
69
|
-
"rollup-plugin-visualizer": "^5.
|
|
70
|
-
"three": "^0.
|
|
71
|
-
"typescript": "^5.
|
|
72
|
-
"unocss": "^0.
|
|
73
|
-
"vite": "^5.
|
|
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",
|
|
74
74
|
"vite-plugin-banner": "^0.7.1",
|
|
75
|
-
"vite-plugin-dts": "
|
|
75
|
+
"vite-plugin-dts": "4.0.0-beta.1",
|
|
76
76
|
"vite-svg-loader": "^5.1.0",
|
|
77
|
-
"vitepress": "1.
|
|
78
|
-
"vue": "^3.
|
|
79
|
-
"vue-tsc": "^
|
|
77
|
+
"vitepress": "1.3.1",
|
|
78
|
+
"vue": "^3.4.34",
|
|
79
|
+
"vue-tsc": "^2.0.29"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Effect } from 'postprocessing';
|
|
2
|
-
import { EffectPass } from 'postprocessing';
|
|
3
|
-
export declare const useEffect: <T extends Effect>(newEffectFunction: () => T) => {
|
|
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
|
-
};
|