FirstScene.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script setup lang="ts">
  2. import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
  3. import { TresCanvas } from '@tresjs/core'
  4. import { OrbitControls } from '@tresjs/cientos'
  5. const gl = {
  6. clearColor: '#82DBC5',
  7. shadows: true,
  8. alpha: false,
  9. shadowMapType: BasicShadowMap,
  10. outputColorSpace: SRGBColorSpace,
  11. toneMapping: NoToneMapping,
  12. }
  13. </script>
  14. <template>
  15. <TresCanvas v-bind="gl">
  16. <TresPerspectiveCamera :position="[11, 11, 11]" :fov="45" :aspect="1" :near="0.1" :far="1000" :look-at="[0, 0, 0]" />
  17. <OrbitControls />
  18. <TresMesh :position="[-2, 6, 0]" :rotation="[0, Math.PI, 0]" cast-shadow>
  19. <TresConeGeometry :args="[1, 1.5, 3]" />
  20. <TresMeshToonMaterial color="#82DBC5" />
  21. </TresMesh>
  22. <TresMesh :position="[0, 4, 0]" cast-shadow>
  23. <TresBoxGeometry :args="[1.5, 1.5, 1.5]" />
  24. <TresMeshToonMaterial color="#4F4F4F" />
  25. </TresMesh>
  26. <TresMesh :position="[2, 2, 0]" cast-shadow>
  27. <TresSphereGeometry />
  28. <TresMeshToonMaterial color="#FBB03B" />
  29. </TresMesh>
  30. <TresDirectionalLight :position="[0, 8, 4]" :intensity="0.7" cast-shadow />
  31. <TresMesh :rotation="[-Math.PI / 2, 0, 0]" receive-shadow>
  32. <TresPlaneGeometry :args="[10, 10, 10, 10]" />
  33. <TresMeshToonMaterial color="#D3FC8A" />
  34. </TresMesh>
  35. <TresAmbientLight :intensity="0.75" />
  36. <TresDirectionalLight ref="LightRef" :position="[0, 2, 4]" :intensity="2" cast-shadow />
  37. </TresCanvas>
  38. </template>