TresBasic.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <script setup lang="ts">
  2. import { reactive } from 'vue'
  3. import { BasicShadowMap, sRGBEncoding, NoToneMapping } from 'three'
  4. import { OrbitControls } from '@tresjs/cientos'
  5. const state = reactive({
  6. clearColor: '#82DBC5',
  7. shadows: true,
  8. alpha: false,
  9. physicallyCorrectLights: true,
  10. shadowMapType: BasicShadowMap,
  11. outputEncoding: sRGBEncoding,
  12. toneMapping: NoToneMapping,
  13. })
  14. </script>
  15. <template>
  16. <TresCanvas v-bind="state">
  17. <OrbitControls />
  18. <TresPerspectiveCamera :position="[11, 11, 11]" :fov="45" :aspect="1" :near="0.1" :far="1000" />
  19. <TresScene>
  20. <TresMesh :position="[-2, 2, 0]" :rotation="[0, Math.PI, 0]" cast-shadow>
  21. <TresConeGeometry :args="[1, 1.5, 3]" />
  22. <TresMeshToonMaterial color="#82DBC5" />
  23. </TresMesh>
  24. <TresMesh :position="[0, 0, 0]" cast-shadow>
  25. <TresBoxGeometry :args="[1.5, 1.5, 1.5]" />
  26. <TresMeshToonMaterial color="#4F4F4F" />
  27. </TresMesh>
  28. <TresMesh :position="[2, -2, 0]" cast-shadow>
  29. <TresSphereGeometry />
  30. <TresMeshToonMaterial color="#FBB03B" />
  31. </TresMesh>
  32. <TresDirectionalLight :position="[0, 2, 4]" :intensity="2" cast-shadow />
  33. </TresScene>
  34. </TresCanvas>
  35. </template>