add texture

This commit is contained in:
Kseninia Mikhaylova 2024-06-07 17:10:09 +03:00
parent 4ce016bbbd
commit f130267c70
7 changed files with 16 additions and 3 deletions

View File

@ -15,7 +15,9 @@ const controlsState = reactive({
<TresCanvas shadows> <TresCanvas shadows>
<TresPerspectiveCamera :position="[8, 2, -4]" /> <TresPerspectiveCamera :position="[8, 2, -4]" />
<OrbitControls v-bind="controlsState" make-default /> <OrbitControls v-bind="controlsState" make-default />
<ModelParametric /> <Suspense>
<ModelParametric />
</Suspense>
</TresCanvas> </TresCanvas>
</div> </div>
</template> </template>

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useTexture } from '@tresjs/core'
import { Environment } from '@tresjs/cientos' import { Environment } from '@tresjs/cientos'
import { ReinhardToneMapping, PCFShadowMap } from 'three'; import { ReinhardToneMapping, PCFShadowMap } from 'three';
@ -16,6 +17,14 @@ renderer.value.toneMapping = ReinhardToneMapping
renderer.value.shadowMap.enabled = true renderer.value.shadowMap.enabled = true
renderer.value.shadowMap.type = PCFShadowMap renderer.value.shadowMap.type = PCFShadowMap
const pbrTexture = await useTexture({
map: '/texture/Rock035_2K_Displacement.jpg',
displacementMap: '/texture/Rock035_2K_Displacement.jpg',
roughnessMap: '/texture/Rock035_2K_Roughness.jpg',
normalMap: '/texture/Rock035_2K_NormalGL.jpg',
ambientOcclusion: '/texture/Rock035_2K_AmbientOcclusion.jpg',
})
</script> </script>
<template> <template>
<TresGroup> <TresGroup>
@ -26,6 +35,7 @@ renderer.value.shadowMap.type = PCFShadowMap
<TresGroup :scale="3" :rotate-y="-Math.PI * -0.5" :translate-y="-3.25"> <TresGroup :scale="3" :rotate-y="-Math.PI * -0.5" :translate-y="-3.25">
<TresMesh receive-shadow> <TresMesh receive-shadow>
<TresCircleGeometry :args="[8, 8, 8]" :rotate-x="-Math.PI * 0.5" /> <TresCircleGeometry :args="[8, 8, 8]" :rotate-x="-Math.PI * 0.5" />
<TresMeshStandardMaterial v-bind="pbrTexture" />
</TresMesh> </TresMesh>
<ModelItem model-url="/models_one/bottom.glb" <ModelItem model-url="/models_one/bottom.glb"
:position="[-fence_section * 0.5 - pillar_size, -bSize, 0]" :remove-pos="true" :position="[-fence_section * 0.5 - pillar_size, -bSize, 0]" :remove-pos="true"
@ -59,8 +69,9 @@ renderer.value.shadowMap.type = PCFShadowMap
<ModelItem model-url="/models_one/bottom.glb" <ModelItem model-url="/models_one/bottom.glb"
:position="[-fence_section * 0.5 - pillar_size, lamelles_count * lSize, 0]" :remove-pos="true" :position="[-fence_section * 0.5 - pillar_size, lamelles_count * lSize, 0]" :remove-pos="true"
:color="pillar_color" /> :color="pillar_color" />
<ModelItem model-url="/models_one/bottom.glb" :position="[fence_section * 0.5 + pillar_size, lamelles_count * lSize, 0]" <ModelItem model-url="/models_one/bottom.glb"
:remove-pos="true" :color="pillar_color" /> :position="[fence_section * 0.5 + pillar_size, lamelles_count * lSize, 0]" :remove-pos="true"
:color="pillar_color" />
</TresGroup> </TresGroup>
</Suspense> </Suspense>
</TresGroup> </TresGroup>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB