Skip to content

Commit

Permalink
feat: add smaa effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Apr 2, 2024
1 parent 098fe1f commit f19ce09
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/core/effects/SMAA.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import { BlendFunction, EdgeDetectionMode, PredicationMode, SMAAEffect, SMAAPreset } from 'postprocessing'
import { useEffect } from '../composables/effect'
// import { makePropWatchers } from '../../util/prop'
export interface SMAAProps {
/**
* The blend function of this effect. This prop is not reactive.
* @default BlendFunction.SCREEN
* @type {BlendFunction}
* @memberof SMAAProps
*/
blendFunction?: BlendFunction
/**
* The quality preset.
*
* @default SMAAPreset.MEDIUM
* @type {number}
* @memberof SMAAPreset
*/
preset?: SMAAPreset
/**
* The edge detection mode.
*
* @default EdgeDetectionMode.COLOR
* @type {EdgeDetectionMode}
* @memberof SMAAProps
*/
edgeDetectionMode?: EdgeDetectionMode
/**
* The predication mode.
*
* @default PredicationMode.NORMAL
* @type {PredicationMode}
* @memberof SMAAProps
*/
predicationMode?: PredicationMode
}
const props = withDefaults(defineProps<SMAAProps>(), {})
const { pass, effect } = useEffect(() => new SMAAEffect(props))
defineExpose({ pass, effect }) // to allow users to modify pass and effect via template ref
// makePropWatchers([], effect, () => new SMAAEffect())
</script>

<template></template>
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EffectComposer from './core/EffectComposer.vue'
import Glitch from './core/effects/Glitch.vue'
import Outline from './core/effects/Outline.vue'
import Pixelation from './core/effects/Pixelation.vue'
import SMAA from './core/effects/SMAA.vue'
import Vignette from './core/effects/Vignette.vue'
import Noise from './core/effects/Noise.vue'

Expand All @@ -15,5 +16,6 @@ export {
Noise,
Outline,
Pixelation,
SMAA,
Vignette,
}

0 comments on commit f19ce09

Please sign in to comment.