|
| 1 | +<script setup lang="ts"> |
| 2 | +import { Environment, OrbitControls } from '@tresjs/cientos' |
| 3 | +import { TresCanvas } from '@tresjs/core' |
| 4 | +import { TresLeches, useControls } from '@tresjs/leches' |
| 5 | +import { EffectComposerPmndrs, HueSaturationPmndrs } 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 | + toneMapping: NoToneMapping, |
| 14 | + multisampling: 8, |
| 15 | +} |
| 16 | +
|
| 17 | +const { saturation, hue, blendFunction } = useControls({ |
| 18 | + hue: { value: -Math.PI, min: -Math.PI, max: Math.PI, step: 0.001 }, |
| 19 | + saturation: { value: 1, min: -1, max: 1, step: 0.001 }, |
| 20 | + blendFunction: { |
| 21 | + options: Object.keys(BlendFunction).map(key => ({ |
| 22 | + text: key, |
| 23 | + value: BlendFunction[key], |
| 24 | + })), |
| 25 | + value: BlendFunction.SRC, |
| 26 | + }, |
| 27 | +}) |
| 28 | +</script> |
| 29 | + |
| 30 | +<template> |
| 31 | + <TresLeches style="left: initial;right:10px; top:10px;" /> |
| 32 | + |
| 33 | + <TresCanvas |
| 34 | + v-bind="gl" |
| 35 | + > |
| 36 | + <TresPerspectiveCamera |
| 37 | + :position="[5, 5, 5]" |
| 38 | + :look-at="[0, 0, 0]" |
| 39 | + /> |
| 40 | + <OrbitControls auto-rotate /> |
| 41 | + |
| 42 | + <TresMesh :position="[0, 1, 0]"> |
| 43 | + <TresBoxGeometry :args="[2, 2, 2]" /> |
| 44 | + <TresMeshPhysicalMaterial color="white" /> |
| 45 | + </TresMesh> |
| 46 | + |
| 47 | + <Suspense> |
| 48 | + <Environment background :blur=".25" preset="modern" /> |
| 49 | + </Suspense> |
| 50 | + |
| 51 | + <Suspense> |
| 52 | + <EffectComposerPmndrs> |
| 53 | + <HueSaturationPmndrs :blendFunction="Number(blendFunction.value)" :hue="hue.value" :saturation="saturation.value" /> |
| 54 | + </EffectComposerPmndrs> |
| 55 | + </Suspense> |
| 56 | + </TresCanvas> |
| 57 | +</template> |
0 commit comments