@@ -21,38 +21,35 @@ export type EffectProps<T extends EffectConstructor> = ReactThreeFiber.Node<
21
21
let i = 0
22
22
const components = new WeakMap < EffectConstructor , React . ExoticComponent < any > | string > ( )
23
23
24
- export const wrapEffect = < T extends EffectConstructor > (
25
- effect : T ,
26
- defaults ?: EffectProps < T >
27
- ) =>
24
+ export const wrapEffect = < T extends EffectConstructor > ( effect : T , defaults ?: EffectProps < T > ) =>
28
25
/* @__PURE__ */ React . forwardRef < T , EffectProps < T > > ( function Effect (
29
- { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
30
- ref
26
+ { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
27
+ ref
31
28
) {
32
- let Component = components . get ( effect )
33
- if ( ! Component ) {
34
- const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
35
- extend ( { [ key ] : effect } )
36
- components . set ( effect , ( Component = key ) )
37
- }
38
-
39
- const camera = useThree ( ( state ) => state . camera )
40
- const args = React . useMemo (
41
- ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
42
- // eslint-disable-next-line react-hooks/exhaustive-deps
43
- [ JSON . stringify ( props ) ]
44
- )
45
-
46
- return (
47
- < Component
48
- camera = { camera }
49
- blendMode-blendFunction = { blendFunction }
50
- blendMode-opacity = { opacity }
51
- { ...props }
52
- ref = { ref }
53
- args = { args }
54
- />
55
- )
29
+ let Component = components . get ( effect )
30
+ if ( ! Component ) {
31
+ const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
32
+ extend ( { [ key ] : effect } )
33
+ components . set ( effect , ( Component = key ) )
34
+ }
35
+
36
+ const camera = useThree ( ( state ) => state . camera )
37
+ const args = React . useMemo (
38
+ ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ [ JSON . stringify ( props ) ]
41
+ )
42
+
43
+ return (
44
+ < Component
45
+ camera = { camera }
46
+ blendMode-blendFunction = { blendFunction }
47
+ blendMode-opacity = { opacity }
48
+ { ...props }
49
+ ref = { ref }
50
+ args = { args }
51
+ />
52
+ )
56
53
} )
57
54
58
55
export const useVector2 = ( props : Record < string , unknown > , key : string ) : THREE . Vector2 => {
0 commit comments