Hack to allow CSG of Turtle meshes to work

This commit is contained in:
Tony Garnock-Jones 2023-02-14 14:52:25 +01:00
parent a2124faebc
commit 7d1f6fe249
1 changed files with 9 additions and 2 deletions

View File

@ -462,8 +462,15 @@ export function buildCSG(name: string, scene: Scene, expr: Shapes.CSGExpr): Buil
n.freezeWorldMatrix(matrix, true);
n.unfreezeWorldMatrix();
});
const c = CSG.FromMesh(nodes[0]);
nodes.slice(1).forEach(n => c.unionInPlace(CSG.FromMesh(n)));
const cs = nodes.flatMap(n => {
try {
return [CSG.FromMesh(n)];
} catch (_e) {
return [];
}
});
const c = cs[0];
cs.slice(1).forEach(d => c.unionInPlace(d));
nodes.forEach(n => n.dispose());
return c;
}