Skip to content

Commit 38002a6

Browse files
fix: big clean demo — docs — bad using multisampling (#201)
* fix: big clean demo docs, demos, multisampling delete bad using * typo fix --------- Co-authored-by: Tino Koch <[email protected]>
1 parent 51acad5 commit 38002a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+211
-157
lines changed

docs/.vitepress/theme/components/pmdrs/BrightnessContrastDemo.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import '@tresjs/leches/styles'
1111
const gl = {
1212
clearColor: '#ffffff',
1313
toneMapping: NoToneMapping,
14-
multisampling: 8,
1514
}
1615
1716
const { brightness, contrast, blendFunction } = useControls({
@@ -20,7 +19,7 @@ const { brightness, contrast, blendFunction } = useControls({
2019
blendFunction: {
2120
options: Object.keys(BlendFunction).map(key => ({
2221
text: key,
23-
value: BlendFunction[key],
22+
value: BlendFunction[key as keyof typeof BlendFunction],
2423
})),
2524
value: BlendFunction.SRC,
2625
},

docs/.vitepress/theme/components/pmdrs/ColorAverageDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import '@tresjs/leches/styles'
1414
const gl = {
1515
clearColor: '#ffffff',
1616
toneMapping: NoToneMapping,
17-
envMapIntensity: 10,
1817
}
1918
2019
const glComposer = {

docs/.vitepress/theme/components/pmdrs/ColorDepthDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import '@tresjs/leches/styles'
1414
const gl = {
1515
clearColor: '#ffffff',
1616
toneMapping: NoToneMapping,
17-
multisampling: 8,
1817
}
1918
2019
const ctx = gsap.context(() => {})

docs/.vitepress/theme/components/pmdrs/FishEyeDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import '@tresjs/leches/styles'
1515
const gl = {
1616
clearColor: '#ffffff',
1717
toneMapping: NoToneMapping,
18-
multisampling: 8,
1918
}
2019
2120
const lensParams = [

docs/.vitepress/theme/components/pmdrs/GodRaysDemo.vue

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,25 @@ import type { Mesh } from 'three'
66
import { BackSide, NoToneMapping } from 'three'
77
import { BlendFunction, KernelSize } from 'postprocessing'
88
import { EffectComposerPmndrs, GodRaysPmndrs } from '@tresjs/post-processing'
9-
import { ref, watch } from 'vue'
9+
import { onUnmounted, ref, watch } from 'vue'
1010
import { gsap } from 'gsap'
1111
1212
import '@tresjs/leches/styles'
1313
1414
const gl = {
1515
toneMapping: NoToneMapping,
16-
multisampling: 8,
1716
}
1817
18+
let tween: gsap.core.Tween | null = null
19+
1920
const sphereMeshRef = ref<Mesh | null>(null)
2021
2122
const pbrTexture = await useTexture({
2223
map: '/lens-distortion/room-map.png',
2324
})
2425
25-
const { blur, kernelSize, resolutionScale, opacity, blendFunction, density, decay, weight, exposure, samples, clampMax } = useControls({
26-
blendFunction: {
27-
options: Object.keys(BlendFunction).map(key => ({
28-
text: key,
29-
value: BlendFunction[key as keyof typeof BlendFunction],
30-
})),
31-
value: BlendFunction.SCREEN,
32-
},
26+
const { freezeAnimationLightSource, blur, kernelSize, resolutionScale, opacity, blendFunction, density, decay, weight, exposure, samples, clampMax } = useControls({
27+
freezeAnimationLightSource: { value: false, label: 'pauseLightSource', type: 'boolean' },
3328
kernelSize: {
3429
options: Object.keys(KernelSize).map(key => ({
3530
text: key,
@@ -46,6 +41,13 @@ const { blur, kernelSize, resolutionScale, opacity, blendFunction, density, deca
4641
clampMax: { value: 1.0, step: 0.1, max: 1.0 },
4742
resolutionScale: { value: 0.5, step: 0.1, min: 0.1, max: 1.0 },
4843
blur: true,
44+
blendFunction: {
45+
options: Object.keys(BlendFunction).map(key => ({
46+
text: key,
47+
value: BlendFunction[key as keyof typeof BlendFunction],
48+
})),
49+
value: BlendFunction.SCREEN,
50+
},
4951
})
5052
5153
const torusMeshes = [
@@ -57,14 +59,30 @@ const torusMeshes = [
5759
watch(sphereMeshRef, () => {
5860
if (!sphereMeshRef.value) { return }
5961
60-
gsap.to(sphereMeshRef.value.position, {
62+
tween = gsap.to(sphereMeshRef.value.position, {
6163
x: 20,
6264
duration: 3,
6365
repeat: -1,
6466
yoyo: true,
67+
paused: freezeAnimationLightSource.value,
6568
ease: 'sine.inOut',
6669
})
6770
})
71+
72+
watch(freezeAnimationLightSource, () => {
73+
if (!sphereMeshRef.value) { return }
74+
75+
if (freezeAnimationLightSource.value) {
76+
tween?.pause()
77+
}
78+
else {
79+
tween?.resume()
80+
}
81+
})
82+
83+
onUnmounted(() => {
84+
tween?.revert()
85+
})
6886
</script>
6987

7088
<template>

docs/.vitepress/theme/components/pmdrs/GridDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import '@tresjs/leches/styles'
1111
const gl = {
1212
clearColor: '#ffffff',
1313
toneMapping: NoToneMapping,
14-
multisampling: 8,
1514
}
1615
1716
const { blendFunction, scale, lineWidth } = useControls({

docs/.vitepress/theme/components/pmdrs/LinocutDemo.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import '@tresjs/leches/styles'
1111
const gl = {
1212
clearColor: '#00ff00',
1313
toneMapping: NoToneMapping,
14-
envMapIntensity: 10,
1514
}
1615
1716
const glComposer = {

docs/guide/pmndrs/barrel-blur.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The `Barrel Blur` is a custom effect that applies a barrel distortion with chrom
1616

1717
The `<BarrelBlurPmndrs>` component is straightforward to use and provides customizable options to fine-tune the barrel blur effect.
1818

19-
```vue{3,11-14,21-25}
19+
```vue{3,11-14,23-27}
2020
<script setup lang="ts">
2121
import { TresCanvas } from '@tresjs/core'
2222
import { EffectComposerPmndrs, BarrelBlurPmndrs } from '@tresjs/post-processing'
@@ -37,6 +37,8 @@ const effectProps = {
3737
<TresCanvas v-bind="gl">
3838
<TresPerspectiveCamera :position="[5, 5, 5]"/>
3939
40+
<!-- Your scene -->
41+
4042
<Suspense>
4143
<EffectComposerPmndrs>
4244
<BarrelBlurPmndrs v-bind="effectProps" />

docs/guide/pmndrs/bloom.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,29 @@ Bloom is an effect that simulates the way that bright objects in the real world
88

99
## Usage
1010

11-
```vue
11+
```vue{2,11-21}
1212
<script setup lang="ts">
1313
import { BloomPmndrs, EffectComposerPmndrs } from '@tresjs/post-processing'
1414
</script>
1515
1616
<template>
17-
<EffectComposerPmndrs>
18-
<BloomPmndrs
19-
:radius="0.85"
20-
:intensity="4.0"
21-
:luminance-threshold="0.1"
22-
:luminance-smoothing="0.3"
23-
mipmap-blur
24-
/>
25-
</EffectComposerPmndrs>
17+
<TresCanvas>
18+
<TresPerspectiveCamera :position="[5, 5, 5]" />
19+
20+
<!-- Your scene -->
21+
22+
<Suspense>
23+
<EffectComposerPmndrs>
24+
<BloomPmndrs
25+
:radius="0.85"
26+
:intensity="4.0"
27+
:luminance-threshold="0.1"
28+
:luminance-smoothing="0.3"
29+
mipmap-blur
30+
/>
31+
</EffectComposerPmndrs>
32+
</Suspense>
33+
</TresCanvas>
2634
</template>
2735
```
2836

@@ -38,4 +46,4 @@ import { BloomPmndrs, EffectComposerPmndrs } from '@tresjs/post-processing'
3846
| `mipMapBlur` | Enables mip map blur (UnrealBloom). | `false` |
3947

4048
## Further Reading
41-
see [postprocessing docs](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/BloomEffect.js~BloomEffect.html)
49+
For more details, see the [BloomEffect documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/BloomEffect.js~BloomEffect.html)

docs/guide/pmndrs/brightness-contrast.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ It adjusts the brightness and contrast of your scene.
1717

1818
The `<BrightnessContrastPmndrs>` component is easy to use and provides customizable options to suit different visual styles.
1919

20-
```vue{2,9-13,27-31}
20+
```vue{2,8-12,21-25}
2121
<script setup lang="ts">
2222
import { EffectComposerPmndrs, BrightnessContrastPmndrs } from '@tresjs/post-processing/pmndrs'
2323
2424
const gl = {
2525
toneMapping: NoToneMapping,
26-
multisampling: 8,
2726
}
2827
2928
const effectProps = {
@@ -34,15 +33,10 @@ const effectProps = {
3433
</script>
3534
3635
<template>
37-
<TresCanvas
38-
v-bind="gl"
39-
>
36+
<TresCanvas v-bind="gl">
4037
<TresPerspectiveCamera />
4138
42-
<TresMesh :position="[0, .5, 0]">
43-
<TresBoxGeometry :args="[2, 2, 2]" />
44-
<TresMeshPhysicalMaterial color="black" :roughness=".25" />
45-
</TresMesh>
39+
<!-- Your scene -->
4640
4741
<Suspense>
4842
<EffectComposerPmndrs>
@@ -62,4 +56,4 @@ const effectProps = {
6256
| contrast | The contrast factor, where 0 means no change. <br> Range: `[-1.0, 1.0]` | `0` |
6357

6458
## Further Reading
65-
For more details, see the [BrightnessContrast documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/BrightnessContrastEffect.js~BrightnessContrastEffect.html)
59+
For more details, see the [BrightnessContrastEffect documentation](https://pmndrs.github.io/postprocessing/public/docs/class/src/effects/BrightnessContrastEffect.js~BrightnessContrastEffect.html)

0 commit comments

Comments
 (0)