{"_id":"@archiyou/collada-wasm","name":"@archiyou/collada-wasm","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@archiyou/collada-wasm","version":"0.1.0","description":"COLLADA (.dae) writer compiled to WebAssembly, with a typed TypeScript wrapper.","license":"MIT","author":{"name":"Mark van der Net","url":"Archiyou"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"keywords":["collada","dae","3d","wasm","export","archiyou"],"repository":{"type":"git","url":"git+https://github.com/ArchiyouApp/archiyou-web.git","directory":"packages/collada-wasm"},"homepage":"https://archiyou.com","bugs":{"url":"https://github.com/ArchiyouApp/archiyou-web/issues"},"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.5.1","tsx":"^4.19.3","typescript":"^5.7.3"},"scripts":{"build":"tsup","build:wasm":"tsx buildscripts/build-wasm.ts","rust:check":"cargo check --target wasm32-unknown-unknown","rust:test":"cargo test"},"_id":"@archiyou/collada-wasm@0.1.0","_integrity":"sha512-KKdLgI+cm+vpSFe9CifewCRn8uPBd7MDIdjihKYQ7OxoQKssHQ2ig7psuHxYjycgHk+MZsvgH3TU0rkIi/rfbw==","_resolved":"/tmp/a5deee4b4d0ae99a78cd1ced7c9111fc/archiyou-collada-wasm-0.1.0.tgz","_from":"file:archiyou-collada-wasm-0.1.0.tgz","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-KKdLgI+cm+vpSFe9CifewCRn8uPBd7MDIdjihKYQ7OxoQKssHQ2ig7psuHxYjycgHk+MZsvgH3TU0rkIi/rfbw==","shasum":"0396fe8013e85b08b500d3442c2ee8cf14885d68","tarball":"https://registry.npmjs.org/@archiyou/collada-wasm/-/collada-wasm-0.1.0.tgz","fileCount":8,"unpackedSize":339362,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCRQByp8NSPT4RCp6TB79G6xxDznrl+8BgRwqA6aTt4tAIhALbrt7AnoRB7qasxmn8L4JDV1xPyq0wtRVR4oElTC9QD"}]},"_npmUser":{"name":"mvdnet","email":"info@archiyou.com"},"directories":{},"maintainers":[{"name":"mvdnet","email":"info@archiyou.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/collada-wasm_0.1.0_1787166765204_0.35549737685147065"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-19T19:12:45.091Z","0.1.0":"2026-08-19T19:12:45.413Z","modified":"2026-08-19T19:12:45.584Z"},"maintainers":[{"name":"mvdnet","email":"info@archiyou.com"}],"description":"COLLADA (.dae) writer compiled to WebAssembly, with a typed TypeScript wrapper.","homepage":"https://archiyou.com","keywords":["collada","dae","3d","wasm","export","archiyou"],"repository":{"type":"git","url":"git+https://github.com/ArchiyouApp/archiyou-web.git","directory":"packages/collada-wasm"},"author":{"name":"Mark van der Net","url":"Archiyou"},"bugs":{"url":"https://github.com/ArchiyouApp/archiyou-web/issues"},"license":"MIT","readme":"# @archiyou/collada-wasm\n\nCOLLADA (`.dae`) writer for Archiyou: a small Rust crate compiled to WebAssembly, built on a\nvendored + patched copy of [`collada_io`](https://github.com/5mattmatt1/voxport) 0.1.0\n(MIT OR Apache-2.0).\n\nUsed by `packages/core/src/modeler/DAEExporter.ts`, which walks the meshup scene graph and\ndrives this writer. See `Modeler.toDAE()`.\n\n## Install\n\n```bash\nnpm install @archiyou/collada-wasm\n```\n\n## Why the crate is vendored\n\nUpstream is unmaintained (published 2020), undocumented, and its writer was missing most of\nwhat we need. Rather than depend on it, `src/collada_io/` holds a patched copy — the same\napproach `packages/gdrr2bp-wasm` takes with gdrr-2bp. Every change is marked `// vendored:`\nand listed in the patch log at the top of `src/collada_io/mod.rs`:\n\n| Patch | What |\n|---|---|\n| P1 | `<unit>` emitted `unit=\"…\"`; the spec attribute is `name=\"…\"` — importers read model scale from it |\n| P2 | `<created>`/`<modified>` were RFC2822, not `xs:dateTime`. Now caller-supplied strings, which also drops the `chrono` dependency |\n| P3 | Added `library_effects` + `library_materials` (upstream had none; its `fx/` directory is unreferenced and does not compile) |\n| P4 | Added `<lines>` for curves |\n| P4b | Added `<polylist>` + `<vcount>` so n-gon faces survive |\n| P4c | `<mesh>` can now carry triangles / polylist / lines instead of exactly one `Triangles` |\n| P5 | `bind_material` was dropped on the floor (`// TODO`), so materials could never be bound |\n| P6 | Removed unreachable/unfinished types |\n| P7 | `Node` had no children — only a flat node list was possible |\n| P8 | `#[derive(Clone)]` on the writer types |\n\n## API\n\nTwo phases, mirroring COLLADA's own structure: `library_geometries` is a flat pool, while\n`library_visual_scenes` is a tree.\n\n```ts\nimport { createColladaWriter } from '@archiyou/collada-wasm';\n\nconst writer = await createColladaWriter({ unitName: 'millimeter', meter: 0.001 });\ntry {\n    writer.addMaterial('mat_0', 'Oak', 0.8, 0.6, 0.3, 1);\n    writer.addPolylistGeometry('geom_0', 'Box', positions, normals, vcount);\n\n    writer.beginNode('walls', 'walls');\n        writer.beginNode('geom_0_node', 'Box');\n        writer.attachGeometry('geom_0', 'mat_0');\n        writer.endNode();\n    writer.endNode();\n\n    const dae = writer.toStringDae();\n} finally {\n    writer.free();\n}\n```\n\n## Welding\n\nVertex welding happens here, not in meshup. meshup already has an equivalent welder in Rust\n(`rust/src/mesh/mod.rs get_vertices_and_indices`), but it is not exposed to WASM, and\nexposing it would mean rebuilding meshup's wasm binary — which in this repo is *ahead of* its\ncsgrs submodule pin, so rebuilding regresses rings, silhouette and `reconstruct_ngons`.\nWelding a buffer we already hold is far cheaper than that risk.\n\nPositions and normals weld independently into separate sources with separate `<input>`\noffsets — the standard COLLADA layout, and where most of the size win is: a cube goes from 36\nloose vertices to 6 quad faces over 8 positions and 6 normals.\n\nThe welder is grid-quantized (`HashMap<[i64;3], u32>` keyed on `(v / tol).round()`), matching\nwhat meshup's own welder does. Two points closer than the tolerance can occasionally land in\ndifferent cells and stay unwelded; it never merges points it shouldn't, which is the\ndirection that matters.\n\n## Build\n\n```bash\npnpm --filter @archiyou/collada-wasm build:wasm   # wasm-pack + inline base64\ncargo test                                        # native smoke tests\n```\n\n`ts/wasm/` and `ts/collada-wasm-binary.ts` are **committed**, and the base64 is regenerated by\n`buildscripts/build-wasm.ts` — never by hand. A fresh clone therefore needs no Rust toolchain,\nand there is deliberately **no** `build` script, so `turbo build` never requires one either.\n\n`wasm-pack`'s built-in wasm-opt step was observed respawning in a loop here, so the build\npasses `--no-opt` and runs wasm-opt itself, where a failure is non-fatal.\n\n## Known limitations\n\n- Nodes are all identity transforms (meshup bakes transforms into geometry), so the hierarchy\n  is organisational, not transformational — moving a parent node in a DCC app will not behave\n  the way it does in Archiyou.\n- No UVs or textures: meshup meshes carry no UVs at all (the glTF exporter synthesizes them),\n  so materials are flat `lambert` diffuse colour only.\n- `Vertex` shapes are skipped — there is no point primitive here.\n- N-gon faces *with holes* are triangulated; `<polylist>` cannot express a hole. Hole-free\n  faces keep their original topology.\n- Face normals come from the polygon *plane*, not the per-vertex normals, which lose their\n  sign in meshup (a box reports only 3 distinct vertex normals instead of 6).\n","readmeFilename":"README.md","_rev":"1-6fd9e7ba0cc928f8b7a84cd444d7156b"}