Fixed capture

This commit is contained in:
2018-10-11 15:22:59 +02:00
parent c6c26f7201
commit 1e638681a4
2 changed files with 23 additions and 2 deletions
+21 -1
View File
@@ -58,6 +58,8 @@ fn main() {
// Set verbose flag
verbose_log::set(matches.occurrences_of("verbose") > 0);
let mut capture_count = 0;
use std::f64::{MIN, MAX};
let mut bbox = BoundingBox3::new(
Vector3::new(MAX, MAX, MAX),
@@ -177,7 +179,25 @@ fn main() {
camera.target.x(), camera.target.y(), camera.target.z());
println!("\tUp: ({}, {}, {})",
camera.up.x(), camera.up.y(), camera.up.z());
}
},
Event::WindowEvent {
event: WindowEvent::KeyboardInput {
input: glutin::KeyboardInput {
virtual_keycode: Some(VirtualKeyCode::C),
state: ElementState::Pressed, ..
}, ..
}, ..
} => {
// Make a screenshot
let size = renderer.gl_window().get_inner_size().unwrap();
let cap = renderer.capture(size);
cap.save(format!("capture-{}.png", capture_count)).unwrap();
capture_count += 1;
},
_ => (),
}