import { IFCLoader } from "web-ifc-three";
import { IFCSPACE } from "web-ifc";
import { useRef } from "react";
import { useEffect } from "react";
async function init(group) {
//Setup IFC Loader
const ifcLoader = new IFCLoader();
await ifcLoader.ifcManager.setWasmPath(
"https://unpkg.com/[email protected]/",
true
);
await ifcLoader.ifcManager.parser.setupOptionalCategories({
[IFCSPACE]: false,
});
await ifcLoader.ifcManager.applyWebIfcConfig({
USE_FAST_BOOLS: true,
});
ifcLoader.load("ifc/rac_advanced_sample_project.ifc", function (model) {
console.log("model", model);
group.add(model)
});
}
function IfcTestModel() {
const group = useRef();
useEffect(()=>{
group.current.clear();
init(group.current)
},[])
return <group ref={group}></group>;
}
export default IfcTestModel;
标签:group,import,r3f,IFC,ifc,ifcLoader,model,加载
From: https://www.cnblogs.com/sunyan97/p/17446161.html