1
0

index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <script setup lang="ts">
  2. import { sRGBEncoding, BasicShadowMap, NoToneMapping } from 'three'
  3. import { TresCanvas } from '/@/'
  4. import { OrbitControls } from '@tresjs/cientos'
  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 akuAkuRef = ref(null) */
  14. const context = ref()
  15. watchEffect(() => {
  16. if (context.value) {
  17. console.log({ context: context.value.state.scene })
  18. }
  19. })
  20. </script>
  21. <template>
  22. <TresCanvas v-bind="state" ref="context">
  23. <TresPerspectiveCamera :position="[5, 5, 5]" :fov="45" :near="0.1" :far="1000" :look-at="[-8, 3, -3]" />
  24. <OrbitControls make-default />
  25. <TresAmbientLight :intensity="0.5" />
  26. <Suspense>
  27. <!-- <GLTFModel
  28. ref="akuAkuRef"
  29. path="https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/aku-aku/AkuAku.gltf"
  30. draco
  31. /> -->
  32. <TresGroup :scale="[1, 2, 1]">
  33. <TheModel />
  34. </TresGroup>
  35. </Suspense>
  36. <TresAxesHelper />
  37. <TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
  38. </TresCanvas>
  39. </template>
  40. 0.5