|
@@ -1,36 +1,11 @@
|
|
|
<script setup lang="ts">
|
|
|
-import {
|
|
|
- sRGBEncoding,
|
|
|
- LinearEncoding,
|
|
|
- BasicShadowMap,
|
|
|
- PCFShadowMap,
|
|
|
- PCFSoftShadowMap,
|
|
|
- VSMShadowMap,
|
|
|
- NoToneMapping,
|
|
|
- LinearToneMapping,
|
|
|
- ReinhardToneMapping,
|
|
|
- CineonToneMapping,
|
|
|
- ACESFilmicToneMapping,
|
|
|
- CustomToneMapping,
|
|
|
-} from 'three'
|
|
|
-import { reactive, ref, shallowRef, watch } from 'vue'
|
|
|
-import { OrbitControls, useTweakPane, Environment } from '../../../cientos/src'
|
|
|
+import { ref, shallowRef, watch } from 'vue'
|
|
|
+import { OrbitControls, Environment, Box } from '../../../cientos/src'
|
|
|
import { TresCanvas } from '../core/useRenderer/component'
|
|
|
/* import { OrbitControls, GLTFModel } from '@tresjs/cientos' */
|
|
|
|
|
|
-const state = reactive({
|
|
|
- shadows: true,
|
|
|
- alpha: true,
|
|
|
- physicallyCorrectLights: true,
|
|
|
- shadowMapType: BasicShadowMap,
|
|
|
- outputEncoding: sRGBEncoding,
|
|
|
- toneMapping: NoToneMapping,
|
|
|
-})
|
|
|
-
|
|
|
const sphereRef = ref()
|
|
|
|
|
|
-const { pane } = useTweakPane()
|
|
|
-
|
|
|
/* const environmentFiles = [
|
|
|
'https://raw.githubusercontent.com/Tresjs/assets/main/textures/environmentMap/px.jpg',
|
|
|
'https://raw.githubusercontent.com/Tresjs/assets/main/textures/environmentMap/nx.jpg',
|
|
@@ -49,65 +24,10 @@ const environmentTexture = shallowRef()
|
|
|
watch(environmentTexture, ({ getTexture }) => {
|
|
|
envMap = getTexture()
|
|
|
})
|
|
|
-
|
|
|
-pane.addInput(state, 'shadows', {
|
|
|
- label: 'Shadows',
|
|
|
-})
|
|
|
-pane.addInput(state, 'physicallyCorrectLights', {
|
|
|
- label: 'physicallyCorrectLights',
|
|
|
-})
|
|
|
-
|
|
|
-pane
|
|
|
- .addBlade({
|
|
|
- view: 'list',
|
|
|
- label: 'outputEncoding',
|
|
|
- options: [
|
|
|
- { text: 'sRGBEncoding', value: sRGBEncoding },
|
|
|
- { text: 'LinearEncoding', value: LinearEncoding },
|
|
|
- ],
|
|
|
- value: sRGBEncoding,
|
|
|
- })
|
|
|
- .on('change', ev => {
|
|
|
- state.outputEncoding = ev.value
|
|
|
- })
|
|
|
-
|
|
|
-pane
|
|
|
- .addBlade({
|
|
|
- view: 'list',
|
|
|
- label: 'ShadowMap Type',
|
|
|
- options: [
|
|
|
- { text: 'BasicShadowMap', value: BasicShadowMap },
|
|
|
- { text: 'PCFShadowMap', value: PCFShadowMap },
|
|
|
- { text: 'PCFSoftShadowMap', value: PCFSoftShadowMap },
|
|
|
- { text: 'VSMShadowMap', value: VSMShadowMap },
|
|
|
- ],
|
|
|
- value: BasicShadowMap,
|
|
|
- })
|
|
|
- .on('change', ev => {
|
|
|
- state.shadowMapType = ev.value
|
|
|
- })
|
|
|
-
|
|
|
-pane
|
|
|
- .addBlade({
|
|
|
- view: 'list',
|
|
|
- label: 'toneMapping',
|
|
|
- options: [
|
|
|
- { text: 'NoToneMapping', value: NoToneMapping },
|
|
|
- { text: 'LinearToneMapping', value: LinearToneMapping },
|
|
|
- { text: 'ReinhardToneMapping', value: ReinhardToneMapping },
|
|
|
- { text: 'CineonToneMapping', value: CineonToneMapping },
|
|
|
- { text: 'ACESFilmicToneMapping', value: ACESFilmicToneMapping },
|
|
|
- { text: 'CustomToneMapping', value: CustomToneMapping },
|
|
|
- ],
|
|
|
- value: NoToneMapping,
|
|
|
- })
|
|
|
- .on('change', ev => {
|
|
|
- console.log(ev.value)
|
|
|
- state.toneMapping = ev.value
|
|
|
- })
|
|
|
</script>
|
|
|
<template>
|
|
|
- <TresCanvas v-bind="state">
|
|
|
+ <!-- <TresCanvas v-bind="state"> -->
|
|
|
+ <TresCanvas preset="realistic">
|
|
|
<TresPerspectiveCamera :position="[8, 8, 8]" :fov="45" :near="0.1" :far="1000" :look-at="[-8, 3, -3]" />
|
|
|
<OrbitControls make-default />
|
|
|
<TresScene>
|
|
@@ -124,9 +44,12 @@ pane
|
|
|
<TresSphereGeometry />
|
|
|
<TresMeshStandardMaterial color="#FBB03B" :map="envMap" :metalness="1" :roughness="0" />
|
|
|
</TresMesh>
|
|
|
+ <Box :position="[2, 6, 0]" cast-shadow>
|
|
|
+ <TresMeshStandardMaterial color="#008080" :map="envMap" :metalness="1" :roughness="0" />
|
|
|
+ </Box>
|
|
|
<TresDirectionalLight :position="[0, 8, 4]" :intensity="0.7" cast-shadow />
|
|
|
<TresMesh :rotation="[-Math.PI / 2, 0, 0]" receive-shadow>
|
|
|
- <TresPlaneGeometry :args="[10, 10, 10, 10]" />
|
|
|
+ <TresPlaneGeometry :args="[20, 20, 20, 10]" />
|
|
|
<TresMeshToonMaterial />
|
|
|
</TresMesh>
|
|
|
<TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
|