rtiow: include render time in metadata written.

This commit is contained in:
Bill Thiede 2019-10-30 19:54:51 -07:00
parent 5841ab61e8
commit 6bd29a2152
2 changed files with 9 additions and 2 deletions

View File

@ -3,6 +3,7 @@ use std::fs::File;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use std::time;
use chrono::Local;
use image;
@ -38,6 +39,7 @@ struct ImageMetadata {
#[serde(rename_all = "camelCase")]
struct Data<'s> {
timestamp: i64,
render_time_seconds: f32,
scene: &'s Scene,
image_metadata: Vec<ImageMetadata>,
}
@ -115,7 +117,11 @@ trait ImageSaver {
Q: AsRef<Path> + Sized;
}
pub fn write_images<P: AsRef<Path>>(scene: &Scene, output_dir: P) -> std::io::Result<()> {
pub fn write_images<P: AsRef<Path>>(
scene: &Scene,
render_time: time::Duration,
output_dir: P,
) -> std::io::Result<()> {
let output_dir: &Path = output_dir.as_ref();
let debugger = DEBUGGER.lock().unwrap();
let now = Local::now();
@ -204,6 +210,7 @@ pub fn write_images<P: AsRef<Path>>(scene: &Scene, output_dir: P) -> std::io::Re
f,
&Data {
timestamp: now.timestamp(),
render_time_seconds: render_time.as_secs_f32(),
scene,
image_metadata,
},

View File

@ -641,5 +641,5 @@ pub fn render(scene: Scene, output_dir: &Path) -> std::result::Result<(), std::i
progress(&Default::default(), &current_stat, time_diff, pixel_total)
);
output::write_images(&scene, output_dir)
output::write_images(&scene, time_diff, output_dir)
}