import * as THREE from 'three';
import { GLTFLoader, type GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';

const loader = new GLTFLoader();

export async function loadGLB(name: string): Promise<GLTF> {
  return new Promise((resolve, reject) => {
    loader.load(
      `./models/${name}.glb`,
      (gltf) => resolve(gltf),
      undefined,
      (err) => reject(err)
    );
  });
}
