diff --git a/utils/material.ts b/utils/material.ts index 44a31e1..5c174ea 100644 --- a/utils/material.ts +++ b/utils/material.ts @@ -3,6 +3,16 @@ import { getColorHexFromRal } from "~/components/ral" const lamelle_color = use_lamelle_color() const pillar_color = use_pillar_color() +const set_metaril_func = (scene: any, material: any) => { + scene.children.forEach((el: any) => { + if (el.isMesh) { + el.castShadow = true + el.receiveShadow = true + } + if (el.material) el.material = material + set_material(el, material) + }) +} export const set_material = (scene: any, color: any) => { let c = color if (color == 'lamelle') { @@ -18,12 +28,5 @@ export const set_material = (scene: any, color: any) => { roughness: 0.3, metalness: 0.3 }) - scene.children.forEach((el: any) => { - if (el.isMesh) { - el.castShadow = true - el.receiveShadow = true - } - if (el.material) el.material = material - set_material(el, color) - }) + set_metaril_func(scene, material) } \ No newline at end of file