1- <script lang="ts" setup >
1+ <script lang="ts">
22import type { BlendFunction , EdgeDetectionMode , PredicationMode , SMAAPreset } from ' postprocessing'
33import { EffectPass , SMAAEffect , TextureEffect } from ' postprocessing'
44import { makePropWatchers } from ' ../../util/prop'
@@ -7,6 +7,12 @@ import { inject, watch } from 'vue'
77import { useTresContext } from ' @tresjs/core'
88import { effectComposerInjectionKey } from ' ./EffectComposerPmndrs.vue'
99
10+ export const DEBUG_MODE = {
11+ OFF: 0 ,
12+ EDGES: 1 ,
13+ WEIGHTS: 2 ,
14+ } as const
15+
1016export interface SMAAPmndrsProps {
1117 /**
1218 * The blend function.
@@ -36,9 +42,11 @@ export interface SMAAPmndrsProps {
3642 * - 1: EDGES
3743 * - 2: WEIGHTS
3844 */
39- debug? : number
45+ debug? : typeof DEBUG_MODE [ keyof typeof DEBUG_MODE ]
4046}
47+ </script >
4148
49+ <script lang="ts" setup>
4250const props = defineProps <SMAAPmndrsProps >()
4351
4452const { pass, effect } = useEffectPmndrs (() => new SMAAEffect (props ), props )
@@ -127,9 +135,9 @@ const manageDebugPass = (pass: EffectPass | null, active: boolean) => {
127135const updateDebugMode = (mode : number ) => {
128136 if (! pass .value ) { return }
129137
130- const mainActive = mode === 0
131- const edgesActive = mode === 1
132- const weightsActive = mode === 2
138+ const mainActive = mode === DEBUG_MODE . OFF
139+ const edgesActive = mode === DEBUG_MODE . EDGES
140+ const weightsActive = mode === DEBUG_MODE . WEIGHTS
133141
134142 pass .value .enabled = mainActive
135143 pass .value .renderToScreen = mainActive
0 commit comments