craft-mesh: test every scene choice; README names the new warnings

The README's glTF "Not read" line was doubled and listed sparse
accessors and tangents, which are read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
KenM76andClaude Opus 5.5 committed 2026-11-16 16:55:57 -05:00
1 parent 8c1498d1f8
commit 511e260d23
2 files changed
+15 -6

No files matched your search

+3 -3
View File
@@ -110,9 +110,9 @@ FBX 6.x files (a `Model` holds its mesh, `Properties60`, objects connected by na
geometry, transforms, the hierarchy and materials. Not read: FBX 5 and older, 6.x textures,
animation, skin deformers, blend shapes, cameras, lights, NURBS.
Not read (glTF): required geometry extensions (Draco, meshopt) are
Not read (glTF): sparse accessors and required geometry extensions (Draco, meshopt) are
`Error::Unsupported`; points, lines, morph targets, tangents and other extensions are passed over.
Not read (glTF): required geometry extensions (Draco, meshopt) are `Error::Unsupported`. Points,
lines and morph targets are left out and counted in a warning; scenes other than the default are
named in one; other extensions are passed over.
Not written: skins, animations, cameras, lights, and `.gltf` with separate files.
## Hostile input
+12 -3
View File
@@ -853,9 +853,18 @@ fn morph_targets_and_other_scenes_are_named_in_warnings() {
);
// The morphed primitives are still drawn, in their base shape.
assert_eq!(s.meshes[0].parts.len(), 3);
// One scene, or an out-of-range choice, is not a warning about scenes.
let one = parse(&doc(json!(5), json!([{ "nodes": [0] }]))).unwrap();
assert_eq!((one.roots.as_slice(), one.warnings.len()), ([0].as_slice(), 1));
let morphs = "2 primitive(s) have morph targets, which were left out (drawn in the base shape)";
// An out-of-range choice falls back to the first scene.
let s = parse(&doc(json!(5), json!([{ "nodes": [1] }, { "nodes": [0] }]))).unwrap();
assert_eq!(s.roots, [1]);
assert_eq!(s.warnings, ["scene 0 of 2 was read; the others were left out", morphs]);
// One scene, or none, is not a warning about scenes.
let s = parse(&doc(json!(5), json!([{ "nodes": [0] }]))).unwrap();
assert_eq!(s.roots, [0]);
assert_eq!(s.warnings, [morphs]);
let s = parse(&doc(json!(null), json!(null))).unwrap();
assert_eq!(s.roots, [0, 1]);
assert_eq!(s.warnings, [morphs]);
let s = parse(&one_mesh(&b, plain.clone())).unwrap();
assert!(s.warnings.is_empty(), "{:?}", s.warnings);
}