🚀 Auto-deploy: melhoria no snap e medição AR em 22/05/2026 20:51:44

This commit is contained in:
2026-05-22 20:51:44 +00:00
parent d64d77dba6
commit d8ca2b2e6c
5 changed files with 145 additions and 20 deletions
+9 -5
View File
@@ -7,10 +7,7 @@ const WASM_PATH = 'https://unpkg.com/web-ifc@0.0.57/';
/**
* Convert an IFC file (ArrayBuffer) into a GLB Blob using web-ifc + GLTFExporter.
*/
export async function convertIFCtoGLB(
buffer: ArrayBuffer,
fileName: string
): Promise<{ blob: Blob; fileName: string; fileSize: number }> {
export async function parseIFCtoThree(buffer: ArrayBuffer): Promise<THREE.Scene> {
const ifcApi = new WebIFC.IfcAPI();
ifcApi.SetWasmPath(WASM_PATH, true);
await ifcApi.Init();
@@ -92,6 +89,14 @@ export async function convertIFCtoGLB(
});
ifcApi.CloseModel(modelID);
return scene;
}
export async function convertIFCtoGLB(
buffer: ArrayBuffer,
fileName: string
): Promise<{ blob: Blob; fileName: string; fileSize: number }> {
const scene = await parseIFCtoThree(buffer);
// Export to GLB
const exporter = new GLTFExporter();
@@ -108,7 +113,6 @@ export async function convertIFCtoGLB(
const blob = new Blob([glb], { type: 'model/gltf-binary' });
// Cleanup
materials.forEach((m) => m.dispose());
scene.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.geometry.dispose();