Skip to content

Commit

Permalink
- removed defaults from chromatic aberration effect
Browse files Browse the repository at this point in the history
- added workaround
  • Loading branch information
Tinoooo committed Jan 6, 2025
1 parent 02a0eef commit 275209e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/core/pmndrs/ChromaticAberration.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import type { BlendFunction } from 'postprocessing'
import { ChromaticAberrationEffect } from 'postprocessing'
import { Vector2 } from 'three'
import { makePropWatchers } from '../../util/prop'
import { useEffectPmndrs } from './composables/useEffectPmndrs'
import type { Vector2 } from 'three'
import type { BlendFunction } from 'postprocessing'
export interface ChromaticAberrationPmndrsProps {
/**
Expand All @@ -30,13 +30,21 @@ export interface ChromaticAberrationPmndrsProps {
const props = withDefaults(
defineProps<ChromaticAberrationPmndrsProps>(),
{
offset: () => new Vector2(0.01, 0.01),
radialModulation: false,
modulationOffset: 0.15,
radialModulation: undefined,
},
)
const { pass, effect } = useEffectPmndrs(() => new ChromaticAberrationEffect(props), props)
const plainEffect = new ChromaticAberrationEffect()
const { pass, effect } = useEffectPmndrs(() => new ChromaticAberrationEffect({
...props,
// Unfortunately, these defaults must be set this way as the type in postprocessing is not correct.
// The arguments are optional in the actual constructor, but not in the type.
radialModulation: props.radialModulation ?? plainEffect.radialModulation,
modulationOffset: props.modulationOffset ?? plainEffect.modulationOffset,
}), props)
plainEffect.dispose()
defineExpose({ pass, effect })
Expand Down

0 comments on commit 275209e

Please sign in to comment.