-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ToneMapping): remove use of CONVOLUTION attribute (#308)
- Loading branch information
1 parent
35b1950
commit c115639
Showing
1 changed file
with
3 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,6 @@ | ||
import { ToneMappingEffect, EffectAttribute } from 'postprocessing' | ||
import { EffectProps } from '../util' | ||
import { forwardRef, useEffect, useMemo } from 'react' | ||
import { ToneMappingEffect } from 'postprocessing' | ||
import { type EffectProps, wrapEffect } from '../util' | ||
|
||
export type ToneMappingProps = EffectProps<typeof ToneMappingEffect> | ||
|
||
export const ToneMapping = forwardRef<ToneMappingEffect, ToneMappingProps>(function ToneMapping( | ||
{ | ||
blendFunction, | ||
adaptive, | ||
mode, | ||
resolution, | ||
maxLuminance, | ||
whitePoint, | ||
middleGrey, | ||
minLuminance, | ||
averageLuminance, | ||
adaptationRate, | ||
...props | ||
}, | ||
ref | ||
) { | ||
const effect = useMemo( | ||
() => | ||
new ToneMappingEffect({ | ||
blendFunction, | ||
adaptive, | ||
mode, | ||
resolution, | ||
maxLuminance, | ||
whitePoint, | ||
middleGrey, | ||
minLuminance, | ||
averageLuminance, | ||
adaptationRate, | ||
}), | ||
[ | ||
blendFunction, | ||
adaptive, | ||
mode, | ||
resolution, | ||
maxLuminance, | ||
whitePoint, | ||
middleGrey, | ||
minLuminance, | ||
averageLuminance, | ||
adaptationRate, | ||
] | ||
) | ||
|
||
useEffect(() => { | ||
effect.dispose() | ||
}, [effect]) | ||
|
||
return <primitive {...props} ref={ref} object={effect} attributes={EffectAttribute.CONVOLUTION} /> | ||
}) | ||
export const ToneMapping = wrapEffect(ToneMappingEffect) |