ExtendExample.vue 836 B

1234567891011121314151617181920212223242526272829
  1. <script setup lang="ts">
  2. import { useTres } from '/@/'
  3. const styles = {
  4. width: '100%',
  5. height: '550px',
  6. border: '1px solid #e2e2e2',
  7. borderRadius: '8px',
  8. overflow: 'hidden',
  9. }
  10. const { state } = useTres()
  11. </script>
  12. <template>
  13. <ClientOnly>
  14. <TresCanvas shadows clear-color="#fff" :style="styles">
  15. <TresPerspectiveCamera :position="[0, 2, 4]" />
  16. <TresScene>
  17. <TresOrbitControls v-if="state.renderer" :args="[state.camera, state.renderer?.domElement]" />
  18. <TresDirectionalLight :position="[0, 2, 4]" :intensity="2" cast-shadow />
  19. <TresMesh :rotation="[-Math.PI / 4, -Math.PI / 4, Math.PI / 4]">
  20. <TresTorusGeometry :args="[1, 0.5, 16, 32]" />
  21. <TresMeshToonMaterial color="#FBB03B" />
  22. </TresMesh>
  23. </TresScene>
  24. </TresCanvas>
  25. </ClientOnly>
  26. </template>