FirstScene.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <script setup lang="ts">
  2. import { OrbitControls } from '@tresjs/cientos'
  3. import { TresCanvas } from '@tresjs/core'
  4. const gl = {
  5. clearColor: '#82DBC5',
  6. shadows: true,
  7. }
  8. </script>
  9. <template>
  10. <TresCanvas v-bind="gl">
  11. <TresPerspectiveCamera
  12. :position="[11, 11, 11]"
  13. :fov="45"
  14. :aspect="1"
  15. :near="0.1"
  16. :far="1000"
  17. :look-at="[0, 0, 0]"
  18. />
  19. <OrbitControls />
  20. <TresMesh
  21. :position="[-2, 6, 0]"
  22. :rotation="[0, Math.PI, 0]"
  23. cast-shadow
  24. >
  25. <TresConeGeometry :args="[1, 1.5, 3]" />
  26. <TresMeshToonMaterial color="#82DBC5" />
  27. </TresMesh>
  28. <TresMesh
  29. :position="[0, 4, 0]"
  30. cast-shadow
  31. >
  32. <TresBoxGeometry :args="[1.5, 1.5, 1.5]" />
  33. <TresMeshToonMaterial color="#4F4F4F" />
  34. </TresMesh>
  35. <TresMesh
  36. :position="[2, 2, 0]"
  37. cast-shadow
  38. >
  39. <TresSphereGeometry />
  40. <TresMeshToonMaterial color="#FBB03B" />
  41. </TresMesh>
  42. <TresDirectionalLight
  43. :position="[0, 8, 4]"
  44. :intensity="0.7"
  45. cast-shadow
  46. />
  47. <TresMesh
  48. :rotation="[-Math.PI / 2, 0, 0]"
  49. receive-shadow
  50. >
  51. <TresPlaneGeometry :args="[10, 10, 10, 10]" />
  52. <TresMeshToonMaterial color="#D3FC8A" />
  53. </TresMesh>
  54. <TresAmbientLight :intensity="0.75" />
  55. <TresDirectionalLight
  56. :position="[0, 2, 4]"
  57. :intensity="2"
  58. cast-shadow
  59. />
  60. </TresCanvas>
  61. </template>