File tree Expand file tree Collapse file tree 1 file changed +3
-53
lines changed
Expand file tree Collapse file tree 1 file changed +3
-53
lines changed Original file line number Diff line number Diff line change 1- import { ToneMappingEffect , EffectAttribute } from 'postprocessing'
2- import { EffectProps } from '../util'
3- import { forwardRef , useEffect , useMemo } from 'react'
1+ import { ToneMappingEffect } from 'postprocessing'
2+ import { type EffectProps , wrapEffect } from '../util'
43
54export type ToneMappingProps = EffectProps < typeof ToneMappingEffect >
65
7- export const ToneMapping = forwardRef < ToneMappingEffect , ToneMappingProps > ( function ToneMapping (
8- {
9- blendFunction,
10- adaptive,
11- mode,
12- resolution,
13- maxLuminance,
14- whitePoint,
15- middleGrey,
16- minLuminance,
17- averageLuminance,
18- adaptationRate,
19- ...props
20- } ,
21- ref
22- ) {
23- const effect = useMemo (
24- ( ) =>
25- new ToneMappingEffect ( {
26- blendFunction,
27- adaptive,
28- mode,
29- resolution,
30- maxLuminance,
31- whitePoint,
32- middleGrey,
33- minLuminance,
34- averageLuminance,
35- adaptationRate,
36- } ) ,
37- [
38- blendFunction ,
39- adaptive ,
40- mode ,
41- resolution ,
42- maxLuminance ,
43- whitePoint ,
44- middleGrey ,
45- minLuminance ,
46- averageLuminance ,
47- adaptationRate ,
48- ]
49- )
50-
51- useEffect ( ( ) => {
52- effect . dispose ( )
53- } , [ effect ] )
54-
55- return < primitive { ...props } ref = { ref } object = { effect } attributes = { EffectAttribute . CONVOLUTION } />
56- } )
6+ export const ToneMapping = wrapEffect ( ToneMappingEffect )
You can’t perform that action at this time.
0 commit comments