| 1 | //! CPU cross-check of the fixed depth range: for every clip/frame (project fps) |
| 2 | //! and all 60 views, the view-space depth of every skinned vertex versus |
| 3 | //! near/far. Usage: depth_clamp_probe BODY HEIGHT_MILLI CENTER_MILLI [FPS] |
| 4 | use paperdoll_renderer::{camera, preview, project::CameraFraming}; |
| 5 | |
| 6 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 7 | let a: Vec<String> = std::env::args().skip(1).collect(); |
| 8 | let body = preview::load_body_file(std::path::Path::new(&a[0]))?; |
| 9 | let fps: u32 = a.get(3).map(|v| v.parse()).transpose()?.unwrap_or(4); |
| 10 | let framing = CameraFraming { |
| 11 | height_milli: a[1].parse()?, |
| 12 | center_y_milli: a[2].parse()?, |
| 13 | ..CameraFraming::default() |
| 14 | }; |
| 15 | let resolved = camera::resolve(&body, framing); |
| 16 | let (near, far) = camera::depth_range(resolved.framing); |
| 17 | println!("{} near {near:.3} far {far:.3}", resolved.description()); |
| 18 | for (pitch, lo, hi, out) in camera::depth_extents(&body, resolved.framing, fps) { |
| 19 | println!("pitch {pitch:+}: depth {lo:.3}..{hi:.3}, vertices outside {out}"); |
| 20 | } |
| 21 | Ok(()) |
| 22 | } |