|
| 1 | +<script setup lang="ts"> |
| 2 | +import { ContactShadows, Environment, OrbitControls, useGLTF } from '@tresjs/cientos' |
| 3 | +import { TresCanvas } from '@tresjs/core' |
| 4 | +import { TresLeches, useControls } from '@tresjs/leches' |
| 5 | +import { DotScreenPmndrs, EffectComposerPmndrs } from '@tresjs/post-processing' |
| 6 | +
|
| 7 | +import { BlendFunction } from 'postprocessing' |
| 8 | +import { NoToneMapping } from 'three' |
| 9 | +
|
| 10 | +import '@tresjs/leches/styles' |
| 11 | +
|
| 12 | +const gl = { |
| 13 | + clearColor: '#ffffff', |
| 14 | + toneMapping: NoToneMapping, |
| 15 | + multisampling: 8, |
| 16 | +} |
| 17 | +
|
| 18 | +const { angle, scale, blendFunction } = useControls({ |
| 19 | + angle: { value: 1.57, min: -Math.PI, max: Math.PI, step: 0.001 }, |
| 20 | + scale: { value: 1.25, min: 0.1, max: 2.5, step: 0.01 }, |
| 21 | + blendFunction: { |
| 22 | + options: Object.keys(BlendFunction).map(key => ({ |
| 23 | + text: key, |
| 24 | + value: BlendFunction[key], |
| 25 | + })), |
| 26 | + value: BlendFunction.NORMAL, |
| 27 | + }, |
| 28 | +}) |
| 29 | +
|
| 30 | +const { scene } = await useGLTF('https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/suzanne/suzanne.glb', { draco: true }) |
| 31 | +</script> |
| 32 | + |
| 33 | +<template> |
| 34 | + <TresLeches style="left: initial;right:10px; top:10px;" /> |
| 35 | + |
| 36 | + <TresCanvas |
| 37 | + v-bind="gl" |
| 38 | + > |
| 39 | + <TresPerspectiveCamera |
| 40 | + :position="[0, 1, 7.5]" |
| 41 | + :look-at="[0, 0, 0]" |
| 42 | + /> |
| 43 | + <OrbitControls /> |
| 44 | + |
| 45 | + <primitive :scale="2" :rotation-x="Math.PI / -5" :rotation-y="Math.PI" :position-y=".25" :position-z="0.5" :object="scene" /> |
| 46 | + |
| 47 | + <ContactShadows |
| 48 | + :opacity="1" |
| 49 | + :position-y="-1.5" |
| 50 | + /> |
| 51 | + |
| 52 | + <Suspense> |
| 53 | + <Environment preset="modern" /> |
| 54 | + </Suspense> |
| 55 | + |
| 56 | + <Suspense> |
| 57 | + <EffectComposerPmndrs> |
| 58 | + <DotScreenPmndrs :blendFunction="Number(blendFunction.value)" :angle="angle.value" :scale="scale.value" /> |
| 59 | + </EffectComposerPmndrs> |
| 60 | + </Suspense> |
| 61 | + </TresCanvas> |
| 62 | +</template> |
0 commit comments