Agent-led CAD-drawing → 3D web showcase pipeline. Inspects CAD reports, maps layers/floors, extracts a normalized building spec (with block-probed glazing and audit gates), builds Blender/trimesh GLB variants, and assembles a Three.js web viewer. Includes XREF-shell detection and a regression test. Large inputs/outputs (work/, outputs/, source_cad/, renders) are gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
832 B
JavaScript
25 lines
832 B
JavaScript
import { NodeIO } from '@gltf-transform/core';
|
|
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
import { weld, dedup, prune, draco } from '@gltf-transform/functions';
|
|
import draco3d from 'draco3dgltf';
|
|
|
|
const [,, inPath, outPath] = process.argv;
|
|
if (!inPath || !outPath) { console.error('usage: compress.mjs in.glb out.glb'); process.exit(1); }
|
|
|
|
const io = new NodeIO()
|
|
.registerExtensions(ALL_EXTENSIONS)
|
|
.registerDependencies({
|
|
'draco3d.encoder': await draco3d.createEncoderModule(),
|
|
'draco3d.decoder': await draco3d.createDecoderModule(),
|
|
});
|
|
|
|
const doc = await io.read(inPath);
|
|
await doc.transform(
|
|
weld(),
|
|
dedup(),
|
|
prune(),
|
|
draco({ method: 'edgebreaker', quantizePosition: 14, quantizeNormal: 10, quantizeGeneric: 12 }),
|
|
);
|
|
await io.write(outPath, doc);
|
|
console.log('compressed ->', outPath);
|