ray_tracing_show_image 0.1.1

Ray Tracing based on Peter Shirley's mini books
Documentation

Crate ray_tracing_show_image

GitHub page rabbid76.github.io/ray-tracing-with-rust
GitHub repository Rabbid76/ray-tracing-with-rust

A very simple viewer of ray tracing progress

Shows the ray tracing progress in a window. The window is updated every second. When "F1" is pressed, a callback is invoked with the intermediate rendering result. This can be used to save the rendering. The returned image is in RGB format and is stored in a tightly packed Vec<u8> object.

Examples

use ray_tracing_core::test::TestSceneSimple;
use ray_tracing_utility::view;
use ray_tracing_utility::view::{Viewer, ViewModel};
use std::error::Error;
use std::sync::Arc;

#[show_image::main]
fn main() -> Result<(), Box<dyn Error>> {
let view_model = ViewModel {
cx: 400,
cy: 200,
repetitions_threads: 2,
repetitions: 5,
samples: 2,
};
let window = ray_tracing_show_image::ShowImageWindow::new(view_model.cx, view_model.cy);
let mut viewer = Viewer::new(
view_model,
Arc::new(TestSceneSimple::new().scene),
window.clone(),
Box::new(|image_number, cx, cy, pixel_data| {

// Save the intermediate rendering here ...
}),
)?;

match viewer.run() {
Ok((cx, cy, pixel_data)) => {

// Save the final rendering here ...
}
_ => (),
}

Ok(())
}

TestSceneSimple_800x400_10000_samples