11<script lang="ts" setup>
2- import type { BlendFunction } from ' postprocessing'
32import { ChromaticAberrationEffect } from ' postprocessing'
4- import { Vector2 } from ' three'
53import { makePropWatchers } from ' ../../util/prop'
64import { useEffectPmndrs } from ' ./composables/useEffectPmndrs'
5+ import type { Vector2 } from ' three'
6+ import type { BlendFunction } from ' postprocessing'
77
88export interface ChromaticAberrationPmndrsProps {
99 /**
@@ -30,13 +30,21 @@ export interface ChromaticAberrationPmndrsProps {
3030const props = withDefaults (
3131 defineProps <ChromaticAberrationPmndrsProps >(),
3232 {
33- offset : () => new Vector2 (0.01 , 0.01 ),
34- radialModulation: false ,
35- modulationOffset: 0.15 ,
33+ radialModulation: undefined ,
3634 },
3735)
3836
39- const { pass, effect } = useEffectPmndrs (() => new ChromaticAberrationEffect (props ), props )
37+ const plainEffect = new ChromaticAberrationEffect ()
38+
39+ const { pass, effect } = useEffectPmndrs (() => new ChromaticAberrationEffect ({
40+ ... props ,
41+ // Unfortunately, these defaults must be set this way as the type in postprocessing is not correct.
42+ // The arguments are optional in the actual constructor, but not in the type.
43+ radialModulation: props .radialModulation ?? plainEffect .radialModulation ,
44+ modulationOffset: props .modulationOffset ?? plainEffect .modulationOffset ,
45+ }), props )
46+
47+ plainEffect .dispose ()
4048
4149defineExpose ({ pass , effect })
4250
0 commit comments