diff --git a/src/effects/ToneMapping.tsx b/src/effects/ToneMapping.tsx index 54668cf..e49fd32 100644 --- a/src/effects/ToneMapping.tsx +++ b/src/effects/ToneMapping.tsx @@ -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 -export const ToneMapping = forwardRef(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 -}) +export const ToneMapping = wrapEffect(ToneMappingEffect)