Skip to content

Commit

Permalink
fix V2 update and modify code about reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
damienmontastier committed Jan 3, 2025
1 parent d175bff commit 61d3862
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default defineConfig({
{ text: 'Glitch', link: '/guide/pmndrs/glitch' },
{ text: 'Noise', link: '/guide/pmndrs/noise' },
{ text: 'Outline', link: '/guide/pmndrs/outline' },
{ text: 'ToneMapping', link: '/guide/pmndrs/tonemapping' },
{ text: 'Tone Mapping', link: '/guide/pmndrs/tone-mapping' },
{ text: 'Pixelation', link: '/guide/pmndrs/pixelation' },
{ text: 'Vignette', link: '/guide/pmndrs/vignette' },
],
Expand Down
8 changes: 4 additions & 4 deletions docs/.vitepress/theme/components/pmdrs/ToneMappingDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ContactShadows, Environment, Levioso, OrbitControls, useGLTF } from '@tresjs/cientos'
import { dispose, TresCanvas } from '@tresjs/core'
import { TresLeches, useControls } from '@tresjs/leches'
import { EffectComposer, ToneMapping } from '@tresjs/post-processing/pmndrs'
import { EffectComposerPmndrs, ToneMappingPmndrs } from '@tresjs/post-processing'
import { ToneMappingMode } from 'postprocessing'
import { NoToneMapping } from 'three'
import { onUnmounted, shallowRef } from 'vue'
Expand Down Expand Up @@ -67,9 +67,9 @@ onUnmounted(() => {
/>

<Suspense>
<EffectComposer>
<ToneMapping :mode="Number(mode.value)" />
</EffectComposer>
<EffectComposerPmndrs>
<ToneMappingPmndrs :mode="Number(mode.value)" />
</EffectComposerPmndrs>
</Suspense>
</TresCanvas>
</template>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { ContactShadows, Environment, OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { TresLeches, useControls } from '@tresjs/leches'
import { EffectComposer, ToneMapping } from '@tresjs/post-processing/pmndrs'
import { BlendFunction, ToneMappingMode } from 'postprocessing'
import { NoToneMapping } from 'three'
import { EffectComposerPmndrs, ToneMappingPmndrs } from '@tresjs/post-processing'
import '@tresjs/leches/styles'
Expand Down Expand Up @@ -69,9 +69,9 @@ const { blendFunction, resolution, mode } = useControls({
/>

<Suspense>
<EffectComposer>
<ToneMapping :mode="Number(mode.value)" :resolution="Number(resolution.value)" :blendFunction="Number(blendFunction.value)" />
</EffectComposer>
<EffectComposerPmndrs>
<ToneMappingPmndrs :mode="Number(mode.value)" :resolution="Number(resolution.value)" :blendFunction="Number(blendFunction.value)" />
</EffectComposerPmndrs>
</Suspense>
</TresCanvas>
</template>
2 changes: 1 addition & 1 deletion playground/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const threeRoutes = [

export const postProcessingRoutes = [
makeRoute('Outline', '🔲', false),
makeRoute('Tonemapping', '🎨', false),
makeRoute('Tone Mapping', '🎨', false),
makeRoute('Glitch', '📺', false),
makeRoute('Depth of Field', '📷', false),
makeRoute('Pixelation', '👾', false),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts" setup>
import { BlendFunction, ToneMappingEffect, ToneMappingMode } from 'postprocessing'
import { defineExpose, defineProps, watchEffect, withDefaults } from 'vue'
import { useEffect } from './composables/useEffect'
import { defineExpose } from 'vue'
import { makePropWatchers } from '../../util/prop'
import { useEffectPmndrs } from './composables/useEffectPmndrs'
export interface ToneMappingProps {
export interface ToneMappingPmndrsProps {
/**
* The tone mapping mode.
*/
Expand Down Expand Up @@ -42,7 +42,7 @@ export interface ToneMappingProps {
}
const props = withDefaults(
defineProps<ToneMappingProps>(),
defineProps<ToneMappingPmndrsProps>(),
{
mode: ToneMappingMode.AGX,
blendFunction: BlendFunction.SRC,
Expand All @@ -54,23 +54,18 @@ const props = withDefaults(
},
)
const { pass, effect } = useEffect(() => new ToneMappingEffect(props), props)
const { pass, effect } = useEffectPmndrs(() => new ToneMappingEffect(props), props)
defineExpose({ pass, effect })
watchEffect(() => {
if (!effect.value) { return }
effect.value.blendMode.blendFunction = Number(props.blendFunction)
})
makePropWatchers(
[
[() => props.mode, 'mode'],
[() => props.blendFunction, 'blendMode.blendFunction'],
[() => props.resolution, 'resolution'],
[() => props.averageLuminance, 'averageLuminance'],
[() => props.middleGrey, 'middleGrey'],
[() => props.minLuminance, 'minLuminance'],
[() => props.minLuminance, 'adaptiveLuminanceMaterial.minLuminance'],
[() => props.whitePoint, 'whitePoint'],
],
effect,
Expand Down
3 changes: 3 additions & 0 deletions src/core/pmndrs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import NoisePmndrs, { type NoisePmndrsProps } from './NoisePmndrs.vue'
import OutlinePmndrs, { type OutlinePmndrsProps } from './OutlinePmndrs.vue'
import PixelationPmndrs, { type PixelationPmndrsProps } from './PixelationPmndrs.vue'
import VignettePmndrs, { type VignettePmndrsProps } from './VignettePmndrs.vue'
import ToneMappingPmndrs, { type ToneMappingPmndrsProps } from './ToneMappingPmndrs.vue'

export {
BloomPmndrs,
Expand All @@ -20,6 +21,7 @@ export {
PixelationPmndrs,
useEffectPmndrs,
VignettePmndrs,
ToneMappingPmndrs,

BloomPmndrsProps,
DepthOfFieldPmndrsProps,
Expand All @@ -29,4 +31,5 @@ export {
OutlinePmndrsProps,
PixelationPmndrsProps,
VignettePmndrsProps,
ToneMappingPmndrsProps,
}

0 comments on commit 61d3862

Please sign in to comment.