Skip to content

Commit

Permalink
fix(ToneMapping): remove use of CONVOLUTION attribute (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Dec 26, 2024
1 parent 35b1950 commit c115639
Showing 1 changed file with 3 additions and 53 deletions.
56 changes: 3 additions & 53 deletions src/effects/ToneMapping.tsx
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)

0 comments on commit c115639

Please sign in to comment.