<script setup lang="ts">
import { useGLTF, } from '@tresjs/cientos'

const props = defineProps(['modelUrl', 'modelFile', 'onClick'])

let scene: any
if (props.modelUrl) {
    let { scene: loaded_scene } = await useGLTF(props.modelUrl)
    scene = loaded_scene.clone()
} else if (props.modelFile) {
    scene = props.modelFile.clone()
}
function shadows_and_pos(scene: any) {
    scene.children.forEach((el: any) => {
        el.receiveShadow = true
        el.castShadow = true
        shadows_and_pos(el)
    })
}

shadows_and_pos(scene)
</script>
<template>
    <TresMesh v-if="scene.children[0].isObject3D">
        <TresObject3D v-bind="scene.children[0].clone()"/>
    </TresMesh>
</template>