Files
Dylan M. Tayloranduvxszi 9e9c044fab craft-mesh: 3MF reader (threemf): core and the materials extension (#920)
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>
2026-11-11 18:40:11 -05:00

29 lines
859 B
TOML

[package]
name = "craft-mesh"
description = "3D mesh file formats behind one neutral model: STL, Wavefront OBJ/MTL, PLY and glTF 2.0 / GLB readers and writers and FBX and 3MF readers, bounded on hostile input"
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
[lints]
workspace = true
[features]
default = ["stl", "obj", "ply", "gltf", "fbx", "threemf"]
stl = []
obj = []
ply = []
gltf = ["dep:serde_json"]
fbx = ["dep:miniz_oxide"]
threemf = ["dep:craft-opc", "dep:craft-xml"]
[dependencies]
serde_json = { workspace = true, optional = true }
# zlib-compressed arrays in binary FBX.
miniz_oxide = { version = "0.9", optional = true }
# 3MF is an OPC package of XML parts.
craft-opc = { workspace = true, optional = true }
craft-xml = { workspace = true, optional = true }