mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 10:03:51 +00:00
Reads a 3MF package into the crate's Scene: mesh objects, component objects and build items with their transforms (as a node hierarchy; an object placed several times is one mesh), the unit, base materials, colour groups, texture coordinate groups and their textures. The package is opened with craft-opc (3MF is an OPC package) and the model part is read with craft-xml's pull reader, so a large part never becomes a tree. read_model_part reads a model part on its own. Ported from storytold/deckcraft#743 (crates/mesh/src/threemf.rs). What that reader did for DeckCraft and stays there: baking placements into world-space triangles, the turn to Y-up, scaling to metres, and decoding the textures. Here placements stay nodes, positions stay in the file's unit and axes (Model::unit says which), and a texture is its bytes. Co-authored-by: uvxszi <uvxszi@gmail.com>