From 049ed81ba2797bd1155474f88af62799cefb9715 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Thu, 20 Jun 2024 11:45:57 +0300 Subject: [PATCH] colors --- components/model/diagram.vue | 29 ++--------------------------- utils/material.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 utils/material.ts diff --git a/components/model/diagram.vue b/components/model/diagram.vue index 3b78248..31cd1dc 100644 --- a/components/model/diagram.vue +++ b/components/model/diagram.vue @@ -22,34 +22,9 @@ const { scene: osnova_stolba } = await useGLTF('/models/osnova_stolba.glb', { dr const { scene: planki } = await useGLTF('/models/planki.glb', { draco: true }) const { scene: stolb } = await useGLTF('/models/stolb.glb', { draco: true }) const { scene: verh } = await useGLTF('/models/verh.glb', { draco: true }) -function set_material(scene: any, material: any) { - scene.children.forEach((el: any) => { - if (el.material) el.material = material - set_material(el, material) - }) -} -const lamelle_color = use_lamelle_color() -const lcolor = getColorHexFromRal(lamelle_color.value) -const lamelle_material = new MeshStandardMaterial({ - color: new Color(lcolor || '#9c9c9c'), - transparent: true, - opacity: 1, - roughness: 0.3, - metalness: 0.3 -}) -set_material(planki, lamelle_material) - -const pillar_color = use_pillar_color() -const pcolor = getColorHexFromRal(pillar_color.value) -const pillar_material = new MeshStandardMaterial({ - color: new Color(pcolor || '#9c9c9c'), - transparent: true, - opacity: 1, - roughness: 0.3, - metalness: 0.3 -}); -[stolb, verh, krepleniye_planok].map(el => set_material(el, pillar_material)) +set_material(planki, 'lamelle'); +[stolb, verh, krepleniye_planok].map(el => set_material(el, 'pillar'))