From a8860dc3a02cb695847ca79eec773ced2e297f0c Mon Sep 17 00:00:00 2001 From: Damien Montastier Date: Mon, 31 Mar 2025 18:32:29 +0200 Subject: [PATCH 1/2] fix: big clean demo docs, demos, multisampling delete bad using --- .../pmdrs/BrightnessContrastDemo.vue | 3 +- .../components/pmdrs/ColorAverageDemo.vue | 1 - .../theme/components/pmdrs/ColorDepthDemo.vue | 1 - .../theme/components/pmdrs/FishEyeDemo.vue | 1 - .../theme/components/pmdrs/GodRaysDemo.vue | 40 ++++++++++++++----- .../theme/components/pmdrs/GridDemo.vue | 1 - .../theme/components/pmdrs/LinocutDemo.vue | 1 - docs/guide/pmndrs/barrel-blur.md | 4 +- docs/guide/pmndrs/bloom.md | 30 +++++++++----- docs/guide/pmndrs/brightness-contrast.md | 14 ++----- docs/guide/pmndrs/chromatic-aberration.md | 6 ++- docs/guide/pmndrs/color-average.md | 10 +++-- docs/guide/pmndrs/color-depth.md | 8 +--- docs/guide/pmndrs/depth-of-field.md | 18 ++++++--- docs/guide/pmndrs/dot-screen.md | 10 +++-- docs/guide/pmndrs/fish-eye.md | 14 +++---- docs/guide/pmndrs/fxaa.md | 2 +- docs/guide/pmndrs/glitch.md | 18 ++++++--- docs/guide/pmndrs/god-rays.md | 27 +++++-------- docs/guide/pmndrs/grid.md | 8 +--- docs/guide/pmndrs/hue-saturation.md | 6 ++- docs/guide/pmndrs/kuwahara.md | 8 ++-- docs/guide/pmndrs/lens-distortion.md | 6 ++- docs/guide/pmndrs/linocut.md | 8 ++-- docs/guide/pmndrs/noise.md | 25 +++++++----- docs/guide/pmndrs/outline.md | 18 ++++++--- docs/guide/pmndrs/pixelation.md | 18 ++++++--- docs/guide/pmndrs/scanline.md | 6 ++- docs/guide/pmndrs/sepia.md | 6 ++- docs/guide/pmndrs/shock-wave.md | 2 +- docs/guide/pmndrs/tilt-shift.md | 6 ++- docs/guide/pmndrs/tone-mapping.md | 6 ++- docs/guide/pmndrs/vignette.md | 24 +++++++---- .../src/pages/postprocessing/barrel-blur.vue | 1 - .../postprocessing/brightness-contrast.vue | 1 - .../postprocessing/chromatic-aberration.vue | 1 - .../pages/postprocessing/color-average.vue | 1 - .../src/pages/postprocessing/color-depth.vue | 1 - .../src/pages/postprocessing/fish-eye.vue | 2 - playground/src/pages/postprocessing/fxaa.vue | 2 +- .../src/pages/postprocessing/god-rays.vue | 1 - playground/src/pages/postprocessing/grid.vue | 1 - .../src/pages/postprocessing/linocut.vue | 1 - .../src/pages/postprocessing/scanline.vue | 1 - .../src/pages/postprocessing/shock-wave.vue | 1 - 45 files changed, 212 insertions(+), 158 deletions(-) diff --git a/docs/.vitepress/theme/components/pmdrs/BrightnessContrastDemo.vue b/docs/.vitepress/theme/components/pmdrs/BrightnessContrastDemo.vue index 35c95187..299c6a59 100644 --- a/docs/.vitepress/theme/components/pmdrs/BrightnessContrastDemo.vue +++ b/docs/.vitepress/theme/components/pmdrs/BrightnessContrastDemo.vue @@ -11,7 +11,6 @@ import '@tresjs/leches/styles' const gl = { clearColor: '#ffffff', toneMapping: NoToneMapping, - multisampling: 8, } const { brightness, contrast, blendFunction } = useControls({ @@ -20,7 +19,7 @@ const { brightness, contrast, blendFunction } = useControls({ blendFunction: { options: Object.keys(BlendFunction).map(key => ({ text: key, - value: BlendFunction[key], + value: BlendFunction[key as keyof typeof BlendFunction], })), value: BlendFunction.SRC, }, diff --git a/docs/.vitepress/theme/components/pmdrs/ColorAverageDemo.vue b/docs/.vitepress/theme/components/pmdrs/ColorAverageDemo.vue index 84ada864..3e82eede 100644 --- a/docs/.vitepress/theme/components/pmdrs/ColorAverageDemo.vue +++ b/docs/.vitepress/theme/components/pmdrs/ColorAverageDemo.vue @@ -14,7 +14,6 @@ import '@tresjs/leches/styles' const gl = { clearColor: '#ffffff', toneMapping: NoToneMapping, - envMapIntensity: 10, } const glComposer = { diff --git a/docs/.vitepress/theme/components/pmdrs/ColorDepthDemo.vue b/docs/.vitepress/theme/components/pmdrs/ColorDepthDemo.vue index ca9345d8..b93d5f91 100644 --- a/docs/.vitepress/theme/components/pmdrs/ColorDepthDemo.vue +++ b/docs/.vitepress/theme/components/pmdrs/ColorDepthDemo.vue @@ -14,7 +14,6 @@ import '@tresjs/leches/styles' const gl = { clearColor: '#ffffff', toneMapping: NoToneMapping, - multisampling: 8, } const ctx = gsap.context(() => {}) diff --git a/docs/.vitepress/theme/components/pmdrs/FishEyeDemo.vue b/docs/.vitepress/theme/components/pmdrs/FishEyeDemo.vue index fb5431cf..7c9c3d11 100644 --- a/docs/.vitepress/theme/components/pmdrs/FishEyeDemo.vue +++ b/docs/.vitepress/theme/components/pmdrs/FishEyeDemo.vue @@ -15,7 +15,6 @@ import '@tresjs/leches/styles' const gl = { clearColor: '#ffffff', toneMapping: NoToneMapping, - multisampling: 8, } const lensParams = [ diff --git a/docs/.vitepress/theme/components/pmdrs/GodRaysDemo.vue b/docs/.vitepress/theme/components/pmdrs/GodRaysDemo.vue index dd4af009..962dbf84 100644 --- a/docs/.vitepress/theme/components/pmdrs/GodRaysDemo.vue +++ b/docs/.vitepress/theme/components/pmdrs/GodRaysDemo.vue @@ -6,30 +6,25 @@ import type { Mesh } from 'three' import { BackSide, NoToneMapping } from 'three' import { BlendFunction, KernelSize } from 'postprocessing' import { EffectComposerPmndrs, GodRaysPmndrs } from '@tresjs/post-processing' -import { ref, watch } from 'vue' +import { onUnmounted, ref, watch } from 'vue' import { gsap } from 'gsap' import '@tresjs/leches/styles' const gl = { toneMapping: NoToneMapping, - multisampling: 8, } +let tween: gsap.core.Tween | null = null + const sphereMeshRef = ref(null) const pbrTexture = await useTexture({ map: '/lens-distortion/room-map.png', }) -const { blur, kernelSize, resolutionScale, opacity, blendFunction, density, decay, weight, exposure, samples, clampMax } = useControls({ - blendFunction: { - options: Object.keys(BlendFunction).map(key => ({ - text: key, - value: BlendFunction[key as keyof typeof BlendFunction], - })), - value: BlendFunction.SCREEN, - }, +const { freezeAnimationLightSource, blur, kernelSize, resolutionScale, opacity, blendFunction, density, decay, weight, exposure, samples, clampMax } = useControls({ + freezeAnimationLightSource: { value: false, label: 'pauseLightSource', type: 'boolean' }, kernelSize: { options: Object.keys(KernelSize).map(key => ({ text: key, @@ -46,6 +41,13 @@ const { blur, kernelSize, resolutionScale, opacity, blendFunction, density, deca clampMax: { value: 1.0, step: 0.1, max: 1.0 }, resolutionScale: { value: 0.5, step: 0.1, min: 0.1, max: 1.0 }, blur: true, + blendFunction: { + options: Object.keys(BlendFunction).map(key => ({ + text: key, + value: BlendFunction[key as keyof typeof BlendFunction], + })), + value: BlendFunction.SCREEN, + }, }) const torusMeshes = [ @@ -57,14 +59,30 @@ const torusMeshes = [ watch(sphereMeshRef, () => { if (!sphereMeshRef.value) { return } - gsap.to(sphereMeshRef.value.position, { + tween = gsap.to(sphereMeshRef.value.position, { x: 20, duration: 3, repeat: -1, yoyo: true, + paused: freezeAnimationLightSource.value, ease: 'sine.inOut', }) }) + +watch(freezeAnimationLightSource, () => { + if (!sphereMeshRef.value) { return } + + if (freezeAnimationLightSource.value) { + tween?.pause() + } + else { + tween?.resume() + } +}) + +onUnmounted(() => { + tween?.revert() +})