add parametric fence

This commit is contained in:
Kseninia Mikhaylova 2024-06-07 10:43:03 +03:00
parent 3a7b25f5ee
commit 131aec5bfd
4 changed files with 41 additions and 41 deletions

View File

@ -1,20 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { TresCanvas } from '@tresjs/core' import { TresCanvas } from '@tresjs/core'
import { OrbitControls, vLightHelper } from '@tresjs/cientos' import { OrbitControls } from '@tresjs/cientos'
const controlsState = reactive({ const controlsState = reactive({
minDistance: 1, minDistance: 1,
maxDistance: 5, maxDistance: 5,
enablePan: false, enablePan: false,
// enableZoom: false,
maxPolarAngle: (Math.PI / 2) - 0.2, maxPolarAngle: (Math.PI / 2) - 0.2,
}) })
// console.log(controlsState)
// const { scene: backLight } = await useGLTF('/models_light/back_light.glb')
// const { scene: primaryLight } = await useGLTF('/models_light/primary_light.glb')
// const { scene: secondaryLight } = await useGLTF('/models_light/secondary_light.glb')
// console.log({ backLight, primaryLight, secondaryLight })
</script> </script>
<template> <template>
<div class="container min-w-full"> <div class="container min-w-full">

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { TresCanvas } from '@tresjs/core' import { TresCanvas } from '@tresjs/core'
import { OrbitControls, vLightHelper } from '@tresjs/cientos' import { OrbitControls } from '@tresjs/cientos'
const controlsState = reactive({ const controlsState = reactive({
minDistance: 1, minDistance: 1,
@ -16,10 +16,8 @@ const controlsState = reactive({
<TresCanvas shadows> <TresCanvas shadows>
<TresPerspectiveCamera :position="[-7, 2, 1]" /> <TresPerspectiveCamera :position="[-7, 2, 1]" />
<OrbitControls v-bind="controlsState" make-default /> <OrbitControls v-bind="controlsState" make-default />
<ModelDiagram /> <ModelDiagram />
<TresDirectionalLight :position="[2, 2, 2]" :intensity="2" color="violet" cast-shadow />
<TresDirectionalLight :position="[2, 2, -2]" :intensity="1" color="red" cast-shadow />
<TresAmbientLight />
</TresCanvas> </TresCanvas>
</div> </div>
</template> </template>

View File

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Environment } from '@tresjs/cientos'
const lamelles_count = useState<number>('lamelles_count') const lamelles_count = useState<number>('lamelles_count')
const fence_section = useState<number>('fence_section') const fence_section = useState<number>('fence_section')
const pillar_color = useState('pillar_color') const pillar_color = useState('pillar_color')
@ -18,17 +20,23 @@ watch([lamelles_count, fence_section, lamelle_color], () => {
}) })
</script> </script>
<template> <template>
<TresGroup>
<Suspense>
<Environment files='/hdrmaps/lonely_road_afternoon_4k.hdr' :background="true" />
</Suspense>
<Suspense> <Suspense>
<TresGroup> <TresGroup>
<ModelItem model-url="/models_one/bottom.glb" :position="[-fence_section * 0.5 - pillar_size, -bSize, 0]" <ModelItem model-url="/models_one/bottom.glb"
:remove-pos="true" :color="pillar_color" /> :position="[-fence_section * 0.5 - pillar_size, -bSize, 0]" :remove-pos="true"
:color="pillar_color" />
<ModelItem model-url="/models_one/bottom.glb" :position="[fence_section * 0.5 + pillar_size, -bSize, 0]" <ModelItem model-url="/models_one/bottom.glb" :position="[fence_section * 0.5 + pillar_size, -bSize, 0]"
:remove-pos="true" :color="pillar_color" /> :remove-pos="true" :color="pillar_color" />
<ModelItem model-url="/models_one/verh_100.glb" <ModelItem model-url="/models_one/verh_100.glb"
:position="[-fence_section * 0.5, lamelles_count * lSize, 0]" :remove-pos="true" :position="[-fence_section * 0.5, lamelles_count * lSize, 0]" :remove-pos="true"
:color="pillar_color" /> :color="pillar_color" />
<ModelItem model-url="/models_one/verh_100.glb" :position="[fence_section * 0.5, lamelles_count * lSize, 0]" <ModelItem model-url="/models_one/verh_100.glb"
:remove-pos="true" :color="pillar_color" /> :position="[fence_section * 0.5, lamelles_count * lSize, 0]" :remove-pos="true"
:color="pillar_color" />
<template v-for="(n, i) in lamelles_count"> <template v-for="(n, i) in lamelles_count">
<TresGroup :position="[-fence_section * 0.5 - pillar_size, (lSize * i), 0]"> <TresGroup :position="[-fence_section * 0.5 - pillar_size, (lSize * i), 0]">
<ModelItem model-url="/models_one/stolb.glb" :remove-pos="true" :color="pillar_color" /> <ModelItem model-url="/models_one/stolb.glb" :remove-pos="true" :color="pillar_color" />
@ -49,4 +57,5 @@ watch([lamelles_count, fence_section, lamelle_color], () => {
</TresGroup> </TresGroup>
</TresGroup> </TresGroup>
</Suspense> </Suspense>
</TresGroup>
</template> </template>

Binary file not shown.