Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add smaa effect #106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -17,6 +18,7 @@ export {
Noise,
Outline,
Pixelation,
SMAA,
Vignette,
useEffect,
}