From 63cb5429164edb962375bb8ac4b84e6132c47e7f Mon Sep 17 00:00:00 2001 From: Artem Titoulenko Date: Wed, 15 Aug 2018 14:31:39 -0400 Subject: [PATCH 1/2] add --straight flag to take model screenshots from head-on --- src/main.rs | 4 ++++ src/viewer.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 64dfa22..f3d1336 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,6 +85,9 @@ pub fn main() { .arg(Arg::with_name("headless") .long("headless") .help("Use real headless rendering for screenshots (default is a hidden window) [EXPERIMENTAL - see README for details]")) + .arg(Arg::with_name("straight") + .long("straight") + .help("Position camera in front of model if not using default camera")) .arg(Arg::with_name("scene") .long("scene") .default_value("0") @@ -130,6 +133,7 @@ pub fn main() { position: args.value_of("CAM-POS").map(|v| parse_vec3(v).unwrap()), target: args.value_of("CAM-TARGET").map(|v| parse_vec3(v).unwrap()), fovy: args.value_of("CAM-FOVY").map(|n| Deg(n.parse().unwrap())).unwrap(), + straight: args.is_present("straight"), }; let log_level = match args.occurrences_of("verbose") { diff --git a/src/viewer.rs b/src/viewer.rs index 327676f..deac237 100644 --- a/src/viewer.rs +++ b/src/viewer.rs @@ -45,6 +45,7 @@ pub struct CameraOptions { pub position: Option, pub target: Option, pub fovy: Deg, + pub straight: bool, } pub struct GltfViewer { @@ -202,7 +203,7 @@ impl GltfViewer { } } else { info!("Determining camera view from bounding box"); - viewer.set_camera_from_bounds(false); + viewer.set_camera_from_bounds(camera_options.straight); if let Some(p) = camera_options.position { viewer.orbit_controls.position = Point3::from_vec(p) From fbc061c950c92d1d5a6e7e03f7ae6228b7fdfe29 Mon Sep 17 00:00:00 2001 From: Benjamin Wasty Date: Thu, 16 Aug 2018 19:22:19 +0200 Subject: [PATCH 2/2] adapt help string for --straight --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f3d1336..18ed44f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,7 +87,7 @@ pub fn main() { .help("Use real headless rendering for screenshots (default is a hidden window) [EXPERIMENTAL - see README for details]")) .arg(Arg::with_name("straight") .long("straight") - .help("Position camera in front of model if not using default camera")) + .help("Position camera in front of model if using default camera (i.e. glTF doesn't contain a camera or `--cam-index -1` is passed.")) .arg(Arg::with_name("scene") .long("scene") .default_value("0")