-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathTheExperience.vue
88 lines (82 loc) · 1.91 KB
/
TheExperience.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<script setup lang="ts">
import { ref, watchEffect } from 'vue'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
import { TresLeches, useControls } from '@tresjs/leches'
import '@tresjs/leches/styles'
import TheSphere from './TheSphere.vue'
const gl = {
clearColor: '#82DBC5',
shadows: true,
alpha: false,
shadowMapType: BasicShadowMap,
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
}
const wireframe = ref(true)
const canvas = ref()
const meshRef = ref()
const { isVisible } = useControls({
isVisible: true,
})
watchEffect(() => {
if (meshRef.value) {
console.log(meshRef.value)
}
})
</script>
<template>
<TresLeches />
<TresCanvas
v-bind="gl"
ref="canvas"
window-size
class="awiwi"
:style="{ background: '#008080' }"
>
<TresPerspectiveCamera
:position="[7, 7, 7]"
:look-at="[0, 4, 0]"
/>
<OrbitControls />
<TresMesh
:position="[-2, 6, 0]"
:rotation="[0, Math.PI, 0]"
name="cone"
cast-shadow
>
<TresConeGeometry :args="[1, 1.5, 3]" />
<TresMeshToonMaterial color="#82DBC5" />
</TresMesh>
<TresMesh
:position="[0, 4, 0]"
cast-shadow
>
<TresBoxGeometry :args="[1.5, 1.5, 1.5]" />
<TresMeshToonMaterial
color="#4F4F4F"
:wireframe="wireframe"
/>
</TresMesh>
<TresMesh
ref="meshRef"
:rotation="[-Math.PI / 2, 0, Math.PI / 2]"
name="floor"
receive-shadow
@click="wireframe = !wireframe"
>
<TresPlaneGeometry :args="[20, 20, 20]" />
<TresMeshToonMaterial
color="#D3FC8A"
/>
</TresMesh>
<TheSphere v-if="isVisible" />
<TresAxesHelper :args="[1]" />
<TresDirectionalLight
:position="[0, 2, 4]"
:intensity="2"
cast-shadow
/>
</TresCanvas>
</template>