11<script lang="ts" setup>
22import { OrbitControls } from ' @tresjs/cientos'
33import { TresCanvas } from ' @tresjs/core'
4- import { TresLeches , useControls } from ' @tresjs/leches'
54import { EffectComposer , Outline } from ' @tresjs/post-processing/pmndrs'
6- import { KernelSize } from ' postprocessing '
5+ import type { Intersection , Object3D } from ' three '
76import { NoToneMapping } from ' three'
87import { ref } from ' vue'
98
109import { useRouteDisposal } from ' ../../composables/useRouteDisposal'
1110
12- import ' @tresjs/leches/styles'
13-
1411const gl = {
1512 clearColor: ' #121212' ,
1613 toneMapping: NoToneMapping ,
14+ multisampling: 8 ,
1715}
1816
1917const { effectComposer } = useRouteDisposal ()
@@ -24,71 +22,50 @@ const toggleMeshSelectionState = ({ object }: Intersection) => {
2422 if (outlinedObjects .value .some (({ uuid }) => uuid === object .uuid )) { outlinedObjects .value = outlinedObjects .value .filter (({ uuid }) => uuid !== object .uuid ) }
2523 else { outlinedObjects .value = [... outlinedObjects .value , object ] }
2624}
27-
28- const { edgeStrength, pulseSpeed, visibleEdgeColor, blur, kernelSize } = useControls ({
29- edgeStrength: {
30- value: 8000 ,
31- min: 0 ,
32- max: 8000 ,
33- step: 10 ,
34- },
35- pulseSpeed: {
36- value: 0 ,
37- min: 0 ,
38- max: 2 ,
39- step: 0.01 ,
40- },
41- visibleEdgeColor: ' #ffffff' ,
42- blur: false ,
43- kernelSize: {
44- value: 0 ,
45- min: KernelSize .VERY_SMALL ,
46- max: KernelSize .VERY_LARGE ,
47- step: 1 ,
48- },
49- })
50-
51- // Need to dispose of the effect composer when the route changes because Vitepress doesnt unmount the components
52- useRouteDisposal (effectComposer )
5325 </script >
5426
5527<template >
56- <TresLeches />
5728 <TresCanvas
5829 v-bind =" gl"
5930 >
6031 <TresPerspectiveCamera
61- :position =" [1, 3, 3 ]"
62- :look-at =" [2, 2, 2 ]"
32+ :position =" [3, 2, 4 ]"
33+ :look-at =" [0, 0, 0 ]"
6334 />
6435 <OrbitControls />
65- <template
66- v-for = " i in 5 "
67- : key = " i "
36+ <TresMesh
37+ :position = " [1, 0.5, 1] "
38+ @click = " toggleMeshSelectionState "
6839 >
69- <TresMesh
70- :position =" [i * 1.1 - 2.8, 1, 0]"
71- @click =" toggleMeshSelectionState"
72- >
73- <TresBoxGeometry
74- :width =" 4"
75- :height =" 4"
76- :depth =" 4"
77- />
78- <TresMeshStandardMaterial color =" hotpink" />
79- </TresMesh >
80- </template >
40+ <TresBoxGeometry />
41+ <TresMeshStandardMaterial
42+ color =" hotpink"
43+ />
44+ </TresMesh >
45+ <TresMesh
46+ :position =" [-1.5, 0.75, 0]"
47+ @click =" toggleMeshSelectionState"
48+ >
49+ <TresConeGeometry :args =" [1, 1.5, 4, 1, false, Math.PI * 0.25]" />
50+ <TresMeshStandardMaterial
51+ color =" aqua"
52+ />
53+ </TresMesh >
8154 <TresGridHelper />
82- <TresAmbientLight :intensity =" 2" />
55+ <TresAmbientLight :intensity =" 1" />
56+ <TresDirectionalLight
57+ :position =" [0, 1, 0]"
58+ :intensity =" 1"
59+ />
8360 <Suspense >
8461 <EffectComposer ref =" effectComposer" >
8562 <Outline
8663 :outlined-objects =" outlinedObjects"
87- :blur = " blur.value "
88- :edge-strength =" edgeStrength.value "
89- :pulse-speed =" pulseSpeed.value "
90- : visible-edge-color =" visibleEdgeColor.value "
91- :kernel-size =" kernelSize.value "
64+
65+ :edge-strength =" 200000 "
66+ :pulse-speed =" 2 "
67+ visible-edge-color =" #ffff00 "
68+ :kernel-size =" 3 "
9269 />
9370 </EffectComposer >
9471 </Suspense >
0 commit comments