TheExperience.client.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <script setup lang="ts">
  2. import { useTexture } from '@tresjs/core'
  3. import { Text3D } from '@tresjs/cientos'
  4. import { BasicShadowMap, sRGBEncoding, NoToneMapping } from 'three'
  5. const state = reactive({
  6. clearColor: '#82DBC5',
  7. shadows: true,
  8. alpha: false,
  9. shadowMapType: BasicShadowMap,
  10. outputEncoding: sRGBEncoding,
  11. toneMapping: NoToneMapping,
  12. })
  13. const matcapTexture = await useTexture(['https://raw.githubusercontent.com/Tresjs/assets/main/textures/matcaps/7.png'])
  14. </script>
  15. <template>
  16. <TresCanvas v-bind="state">
  17. <!-- <OrbitControls make-default /> -->
  18. <TresPerspectiveCamera :position="[5, 5, 5]" :fov="45" :near="0.1" :far="1000" :look-at="[0, 0, 0]" />
  19. <TresScene>
  20. <TresAmbientLight :intensity="1" />
  21. <TresDirectionalLight :position="[0, 8, 4]" :intensity="0.7" cast-shadow />
  22. <TresMesh ref="sphereRef" cast-shadow>
  23. <TresSphereGeometry />
  24. <TresMeshToonMaterial color="#FBB03B" />
  25. </TresMesh>
  26. <Text3D
  27. :position="[-1, 0, 0]"
  28. font="https://raw.githubusercontent.com/Tresjs/assets/main/fonts/FiraCodeRegular.json"
  29. >
  30. TresJS
  31. <TresMeshMatcapMaterial :matcap="matcapTexture" />
  32. </Text3D>
  33. </TresScene>
  34. </TresCanvas>
  35. </template>