test(formats): retain crafted USDC mesh acceptance (#704)

This commit is contained in:
FredApps
2026-11-21 00:24:02 +07:00
committed by GitHub
parent 90d63ca58f
commit 2971e3d8e6
5 changed files with 46 additions and 0 deletions
+1
View File
@@ -24,6 +24,7 @@ licensed and keep their license file next to them.
| `docs/images/texturecraft-lantern.png` | README render: a storm lantern (original procedural mesh of lathes and swept wires, eight texture sets) in chipped red enamel, rust, soot, tarnished brass and glass with an emissive flame (`texturecraft-cli render --camera Hero --samples 2048`, 1200×900) | TextureCraft contributors | original model and render by TextureCraft | MIT OR Apache-2.0 |
| `docs/images/texturecraft-camera.png` | README render: a rangefinder camera (original procedural mesh) in black enamel worn to brass, leatherette, chrome and coated glass; the lens distance scale is an original image drawn in code (`texturecraft-cli render --camera Hero --samples 2048`, 1200×900) | TextureCraft contributors | original model and render by TextureCraft | MIT OR Apache-2.0 |
| `docs/brand/artcraft-*.svg`, `docs/brand/artcraft-*.png` | ArtCraft logo and mark | ArtCraft Team | storytold/craftrules `assets/brand/` | ArtCraft brand terms, not open source ([`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt)) |
| `crates/formats/src/mesh_import/usd/fixtures/crafted-references.usdc` | Synthetic USDC class/reference/time-sample acceptance fixture | ArtCraft Team and craft-libs contributors | [Pinned generator and provenance](crates/formats/src/mesh_import/usd/fixtures/README.md) | MIT (`crates/formats/src/mesh_import/usd/fixtures/LICENSE-MIT`) |
## Third-party assets compiled into the binary
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 ArtCraft Team and the craft-libs contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,12 @@
# Crafted USDC acceptance fixture
`crafted-references.usdc` is synthetic test data, not an external product asset.
Generated from `scene::write::tests::crafted_crate_with_references_time_samples_and_inlined_values` in [craft-libs at 3dff4793](https://github.com/storytold/craft-libs/blob/3dff4793f1a5bd1f99a4fe3280d48f515158dff3/crates/usd/src/scene/write.rs). The generator's existing assertions passed in [this hosted run](https://github.com/FredApps/texturecraft/actions/runs/44688984933). [Committed generation wrapper](https://github.com/FredApps/texturecraft/blob/15a07f4fc845f2d4d6594dd07e8b34e8e77de456/.github/workflows/validate-pr270.yml). Generation added only a write of the completed byte buffer; no writer logic was changed.
The fixture restores the application-boundary assertions from TextureCraft's [pre-cutover test](https://github.com/storytold/texturecraft/blob/e099725db4425c0149eca46198acf5cc5575cced/crates/formats/src/mesh_export/usdc.rs). A class prim is referenced by a def prim with reference custom data, a double3 translation uses its first time sample, and an inlined diagonal matrix scales the single triangle. The class itself must not draw. Expected final bounds are (1, 0, 0) through (3, 2, 0).
Size: 1,170 bytes.
SHA-256: `f270b11c6bb21c3e5b9106b5af0697d4559cbdbe36c8be8539c40d72d01d1519`.
Source copyright: ArtCraft Team and the craft-libs contributors. Distributed under MIT; see `LICENSE-MIT` beside this fixture.
@@ -517,3 +517,15 @@ fn shared_integer_writer_preserves_tie_wire_and_rejects_oversized_budget() {
assert!(craft_usd::integers::encode(&[1], craft_usd::integers::Width::I32, 16).is_err());
assert!(craft_usd::integers::encode(&[], craft_usd::integers::Width::I64, 0).unwrap().is_empty());
}
/// Keep the final mesh contract of the binary fixture used before the shared USD cutover.
#[test]
fn crafted_usdc_references_time_samples_and_inlined_values_reach_mesh() {
let bytes = include_bytes!("fixtures/crafted-references.usdc");
let m = import_mesh_bytes("crafted.usdc", bytes).unwrap().mesh;
assert_eq!(m.triangle_count(), 1, "the class prim itself is not drawn");
let (lo, hi) = m.bounds();
// Scaled 2× by the inlined matrix, then moved by the first time sample.
assert!((lo - Vec3::new(1.0, 0.0, 0.0)).length() < 1e-5, "{lo}");
assert!((hi - Vec3::new(3.0, 2.0, 0.0)).length() < 1e-5, "{hi}");
}