fix(mesh): pre-pivot sub-meshes must cover their pool, not just index in range
The last two blocks that under-covered their vertex pool were f102_break.dat and f104_break.dat in ptc_pack.xpr, each reading a neighbouring block's index buffer against the wrong declaration (414 verts indexed to 404; 160 indexed to 79). Their marker lists do not map onto the stored blocks -- only 2 of 9 and 4 of 10 sub-meshes decoded at all. Requiring coverage (max_idx + 4 >= vtx_count) for pre-pivot sub-meshes drops exactly the mismatched pieces. Every decoded sub-mesh disc-wide now covers its pool: 8580 at slack 0, 49 within tolerance, none beyond, none negative. Coverage 6069/6294, inconsistency 56, truth table 46/46 -- all unchanged. Suite green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
24
crates/sylpheed-formats/examples/submesh_dump.rs
Normal file
24
crates/sylpheed-formats/examples/submesh_dump.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
//! Per-sub-mesh vertex/index/coverage dump for one resource.
|
||||
//! Usage: submesh_dump <container.xpr> <resource>...
|
||||
use sylpheed_formats::mesh::{debug_resource_params, Xbg7Model};
|
||||
use std::collections::HashSet;
|
||||
fn main() {
|
||||
let a: Vec<String> = std::env::args().collect();
|
||||
let bytes = std::fs::read(&a[1]).expect("container");
|
||||
let want: HashSet<String> = a[2..].iter().cloned().collect();
|
||||
for m in Xbg7Model::models_named(&bytes, &want, &|| false) {
|
||||
let markers = debug_resource_params(&bytes, &m.name).map(|(mk, _)| mk).unwrap_or_default();
|
||||
println!("{} — {} sub-meshes decoded, {} markers declared", m.name, m.meshes.len(), markers.len());
|
||||
for (i, s) in m.meshes.iter().enumerate() {
|
||||
let max_idx = s.indices.iter().max().copied().unwrap_or(0) as usize;
|
||||
println!(
|
||||
" #{i:<2} at 0x{:<9x} verts {:<6} idx {:<6} max_idx {:<6} slack {}",
|
||||
s.vbuf_offset.unwrap_or(0),
|
||||
s.positions.len(),
|
||||
s.indices.len(),
|
||||
max_idx,
|
||||
s.positions.len() as i64 - 1 - max_idx as i64
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user