123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <script setup lang="ts">
- import { TresCanvas } from '@tresjs/core'
- import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
- import { Perf, TresLeches, useControls } from '@tresjs/leches'
- import '@tresjs/leches/styles'
- import { OrbitControls } from '@tresjs/cientos'
- import AkuAku from './AkuAku.vue'
- const gl = {
- clearColor: '#82DBC5',
- shadows: true,
- alpha: false,
- shadowMapType: BasicShadowMap,
- outputColorSpace: SRGBColorSpace,
- toneMapping: NoToneMapping,
- }
- const { sphere } = useControls({
- sphere: true,
- })
- const ctx = ref(null)
- watchEffect(() => {
- if (!ctx.value) { return }
- // eslint-disable-next-line no-console
- console.log('ctx', ctx.value)
- })
- useControls({
- button: {
- label: 'Render dispose',
- type: 'button',
- onClick() {
- ctx?.value?.dispose()
- },
- },
- })
- </script>
- <template>
- <TresLeches />
- <TresCanvas
- v-bind="gl"
- ref="ctx"
- >
- <Perf />
- <TresPerspectiveCamera :position="[3, 3, 3]" />
- <OrbitControls />
- <Suspense>
- <AkuAku v-if="sphere" />
- </Suspense>
- <!-- <TresMesh
- v-if="sphere.value"
- :position="[0, 0, 0]"
- >
- <TresSphereGeometry />
- <TresMeshStandardMaterial color="teal" />
- </TresMesh> -->
- <TresAmbientLight :intensity="1" />
- </TresCanvas>
- </template>
|