import * as THREE from 'three'
export const loadGltf = function (game, modelPath) {
    return new Promise((success, fail) => {
        game.gltfLoader.load(modelPath, (gltf) => {
            gltf.scene.traverse((child) => {
                if (child.isMesh && child.material.isMeshStandardMaterial) {
                    child.castShadow = true
                    child.receiveShadow = true
                }
            })
            const group = new THREE.Group()
            group.add(gltf.scene)
            success(group)
        })
    })
}