Monopoly / monopoly-client /src /utils /three /model-loader.ts
Haruka041
chore: reset repository history with clean initial import
5b324f1
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader";
import { __MONOPOLYSERVER__ } from "@G/global.config";
import { GLTF, GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import { getDracoLoader } from "@/utils/three/draco";
const gltfLoader = new GLTFLoader();
gltfLoader.setDRACOLoader(getDracoLoader());
export function loadModel(name: string): Promise<GLTF> {
return new Promise<GLTF>((resolve, reject) => {
gltfLoader.load(
`https://monopoly-static-1304992673.cos.ap-guangzhou.myqcloud.com/${name}`,
(glft: GLTF) => {
resolve(glft);
},
undefined,
(error) => {
reject(error);
}
);
});
}