add light

This commit is contained in:
Kseninia Mikhaylova 2024-06-13 17:13:57 +03:00
parent ba62bb0ffa
commit 91887fe38e
6 changed files with 8 additions and 1 deletions

View File

@ -56,7 +56,7 @@ const point = reactive({
<TresCanvas shadows> <TresCanvas shadows>
<TresPerspectiveCamera v-bind="cameraStat" /> <TresPerspectiveCamera v-bind="cameraStat" />
<OrbitControls v-bind="controlsState" make-default /> <OrbitControls v-bind="controlsState" make-default />
<Suspense> <Suspense v-if="false">
<Environment files='/hdrmaps/kloppenheim_06_4k.hdr' :background="true" /> <Environment files='/hdrmaps/kloppenheim_06_4k.hdr' :background="true" />
</Suspense> </Suspense>
<Suspense> <Suspense>

View File

@ -38,6 +38,7 @@ const { scene: top } = await useGLTF('/models_one/verh_100.glb')
const { scene: fence } = await useGLTF('/models_one/fence.glb') const { scene: fence } = await useGLTF('/models_one/fence.glb')
const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb') const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb')
const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb') const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb')
const { scene: light } = await useGLTF('/models_light/zabor_so_svetom.glb')
const { seek, seekAll } = useSeek() const { seek, seekAll } = useSeek()
watch(section_count, () => { watch(section_count, () => {
@ -81,6 +82,7 @@ ctx.fillRect(10, 10, 512, 512)
console.log(canvas.toDataURL()) console.log(canvas.toDataURL())
const texture = new DataTexture(ctx?.getImageData(0, 0, 512, 512).data.buffer, width, height); const texture = new DataTexture(ctx?.getImageData(0, 0, 512, 512).data.buffer, width, height);
texture.needsUpdate = true; texture.needsUpdate = true;
console.log(light)
</script> </script>
<template> <template>
<TresGroup :translate-y="-3.25" name="base"> <TresGroup :translate-y="-3.25" name="base">
@ -105,6 +107,11 @@ texture.needsUpdate = true;
<TresBoxGeometry :args="[1, 1, 1]" /> <TresBoxGeometry :args="[1, 1, 1]" />
<TresMeshStandardMaterial :map="texture_one" /> <TresMeshStandardMaterial :map="texture_one" />
</TresMesh> </TresMesh>
<TresPointLight v-bind="light.children[2]" :intensity="50" cast-shadow color="rgb(191,231,255)" />
<template v-for="i in light.children[1].children">
<TresDirectionalLight :position="i.position" color="rgb(191,231,255)" cast-shadow />
</template>
<TresAmbientLight />
<template v-for="i in section_count"> <template v-for="i in section_count">
<template v-if="i <= 20"> <template v-if="i <= 20">
<ModelFence :index="i" :models="{ top, fence, fastening, lamelle }" /> <ModelFence :index="i" :models="{ top, fence, fastening, lamelle }" />

Binary file not shown.

Binary file not shown.