TheConditional.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <script setup lang="ts">
  2. import { BasicShadowMap, MeshToonMaterial, NoToneMapping, sRGBEncoding } from 'three'
  3. import { reactive } from 'vue'
  4. import { OrbitControls, useTweakPane } from '@tresjs/cientos'
  5. import { TresCanvas } from '/@/'
  6. const state = reactive({
  7. clearColor: '#201919',
  8. shadows: true,
  9. alpha: false,
  10. shadowMapType: BasicShadowMap,
  11. outputEncoding: sRGBEncoding,
  12. toneMapping: NoToneMapping,
  13. })
  14. const paneElements = reactive({
  15. boxVisible: true,
  16. groupVisible: true,
  17. })
  18. const { pane } = useTweakPane()
  19. pane.addInput(paneElements, 'boxVisible')
  20. pane.addInput(paneElements, 'groupVisible')
  21. const material = new MeshToonMaterial({ color: '#ff0000' })
  22. </script>
  23. <template>
  24. <TresCanvas v-bind="state">
  25. <TresPerspectiveCamera :position="[11, 11, 11]" :fov="45" :near="0.1" :far="1000" :look-at="[-8, 3, -3]" />
  26. <TresDirectionalLight :position="[0, 8, 4]" :intensity="0.2" cast-shadow />
  27. <TresMesh v-if="paneElements.boxVisible" :position="[0, 0, 0]" :material="material">
  28. <TresBoxGeometry :args="[1, 1, 1]" />
  29. <!-- <TresMeshToonMaterial color="#efefef" /> -->
  30. </TresMesh>
  31. <!-- <TresGroup v-if="paneElements.groupVisible" :position="[0, -4, -5]">
  32. <TresMesh :position="[0, 0, 0]">
  33. <TresBoxGeometry :args="[1, 1, 1]" />
  34. <TresMeshToonMaterial color="#efef11" />
  35. </TresMesh>
  36. </TresGroup> -->
  37. <OrbitControls></OrbitControls>
  38. <TresAmbientLight :intensity="0.5" />
  39. </TresCanvas>
  40. </template>