From fef9459b3f483dfd7759f89f1a3710a30ce2b7f6 Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Mon, 16 Nov 2026 18:36:48 -0800 Subject: [PATCH] craft-mesh: list FBX and 3MF once in the READMEs and correct the crate description (#1268) --- README.md | 5 ++--- crates/mesh/Cargo.toml | 2 +- crates/mesh/README.md | 20 +++++--------------- crates/mesh/src/fbx.rs | 9 ++++++--- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1544c19d9..cb47345a8 100644 --- a/README.md +++ b/README.md @@ -287,9 +287,8 @@ See the [release notes](CHANGELOG.md) for included functionality and known limit stay in each app. - [`craft-mesh`](crates/mesh/README.md): 3D mesh file formats behind one neutral model (meshes of polygons with per-corner indices, materials, a node hierarchy): STL, OBJ with MTL, PLY, - glTF 2.0 / GLB and 3MF, one feature each. Readers are bounded by `Limits`, never open a file themselves - glTF 2.0 / GLB and FBX, one feature each. Readers are bounded by `Limits`, never open a file themselves - and never panic. Carved from EffectCraft, SolidCraft, TextureCraft and MaterialCraft. + glTF 2.0 / GLB, FBX and 3MF, one feature each. Readers are bounded by `Limits`, never open a file + themselves and never panic. Carved from EffectCraft, SolidCraft, TextureCraft and MaterialCraft. - [`craft-midi`](crates/midi/README.md): Standard MIDI Files: a bounded reader for formats 0, 1 and 2 and a format-1 writer, over a neutral model of notes and channel events in ticks at 960 per quarter note. From SoundCraft. diff --git a/crates/mesh/Cargo.toml b/crates/mesh/Cargo.toml index 861c19239..ef860114f 100644 --- a/crates/mesh/Cargo.toml +++ b/crates/mesh/Cargo.toml @@ -1,6 +1,6 @@ [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" +description = "3D mesh file formats behind one neutral model: STL and Wavefront OBJ/MTL readers and writers, a glTF 2.0 / GLB reader and GLB writer, and PLY, FBX and 3MF readers, bounded on hostile input" version.workspace = true edition.workspace = true license.workspace = true diff --git a/crates/mesh/README.md b/crates/mesh/README.md index d58dd9072..8c0cdec00 100644 --- a/crates/mesh/README.md +++ b/crates/mesh/README.md @@ -127,27 +127,17 @@ mutations of every byte of good files. | `max_vertices` | 20 000 000 | entries per attribute pool (OBJ: each of `v`, `vt`, `vn`, counting unused ones; glTF: vertices over all meshes; 3MF: vertices, colours and texture coordinates of the file together) | | `max_triangles` | 20 000 000 | triangles after fanning polygons, strips and fans | | `max_face_corners` | 4096 | corners of one face; PLY list lengths | -| `max_meshes` | 100 000 | OBJ objects, glTF meshes, 3MF objects | -| `max_parts` | 100 000 | groups, material runs, glTF primitives | +| `max_meshes` | 100 000 | OBJ objects, glTF meshes, 3MF objects, FBX meshes | +| `max_parts` | 100 000 | groups, material runs, glTF primitives, material slots of an FBX mesh | | `max_materials` | 100 000 | materials; images; OBJ material libraries; 3MF base materials and textures together | | `max_nodes` | 100 000 | nodes, and node visits when the hierarchy is walked (ends cycles); 3MF placed objects, build items and components | | `max_depth` | 64 | node nesting; 3MF component nesting (ends cycles) | -| `max_data_bytes` | 1 GiB | buffers and material libraries taken from the resolver; embedded image bytes; skin and animation values; the binary chunk `write_glb` builds; what a 3MF package inflates to, and its textures | +| `max_data_bytes` | 1 GiB | buffers and material libraries taken from the resolver; embedded image bytes; skin and animation values; the binary chunk `write_glb` builds; what a 3MF package inflates to, and its textures; an FBX file's meshes, image bytes and parsed values (binary: 8 bytes per array element, and other values are not counted; ASCII: `size_of::()` per value, each array element included, plus string bytes; record names and the overhead of records and their containers are not counted) | | `max_extras` | 10 000 | skins, animations, cameras, lights, buffers (each); channels of one animation | Fixed bounds: a PLY header of 1 MiB, 64 elements and 256 properties per element; 2^24 components -for glTF accessors without a buffer view, over the whole file; 10 000 parts in a 3MF package. -| `max_meshes` | 100 000 | OBJ objects, glTF meshes, FBX meshes | -| `max_parts` | 100 000 | groups, material runs, glTF primitives, material slots of an FBX mesh | -| `max_materials` | 100 000 | materials; images; OBJ material libraries | -| `max_nodes` | 100 000 | nodes, and node visits when the hierarchy is walked (ends cycles) | -| `max_depth` | 64 | node nesting | -| `max_data_bytes` | 1 GiB | buffers and material libraries taken from the resolver; embedded image bytes; skin and animation values; the binary chunk `write_glb` builds; everything an FBX file keeps (parsed values at 8 bytes per array element, meshes, image bytes) | -| `max_extras` | 10 000 | skins, animations, cameras, lights, buffers (each); channels of one animation | - -Fixed bounds: a PLY header of 1 MiB, 64 elements and 256 properties per element; 2^24 components -for glTF accessors without a buffer view, over the whole file; FBX records nested 64 deep and -arrays of 1 GiB. +for glTF accessors without a buffer view, over the whole file; 10 000 parts in a 3MF package; FBX +records nested 64 deep and arrays of 1 GiB. **External files.** No reader opens a file. A reader that needs another file to parse (an OBJ material library, a glTF buffer) asks the caller's `Resolver` for it by the name the file writes; diff --git a/crates/mesh/src/fbx.rs b/crates/mesh/src/fbx.rs index 5c7eaab42..054754ae3 100644 --- a/crates/mesh/src/fbx.rs +++ b/crates/mesh/src/fbx.rs @@ -41,9 +41,12 @@ //! //! Not read: FBX 5 and older, animation stacks, skin deformers, blend shapes, lights, NURBS and patches. //! -//! [`Limits::max_data_bytes`] bounds what one file may keep in memory: its parsed values (an -//! array element counts 8 bytes whatever its type in the file), the meshes built from them and -//! the image bytes. +//! [`Limits::max_data_bytes`] is the budget the reader charges for one file: its parsed values, +//! the meshes built from them and the image bytes. A binary file is charged 8 bytes per array +//! element whatever its type in the file; its scalar, string and raw values are not counted. An +//! ASCII file is charged `size_of::()` for every value, each array element included, plus +//! the bytes of its strings. Neither form is charged for record names or for the overhead of +//! records and their containers, so the reader keeps those even with a budget of 0. use std::cell::Cell; use std::collections::{HashMap, HashSet};