Crate crystal_ball[−][src]
Expand description
Overview
Crystal Ball is a path tracing library written in Rust.
It uses rayon for parallelization and can save the rendered image in various formats thanks to the image crate.
Example Usage
use std::path::Path; use crystal_ball::prelude::*; fn main() { let objects: Vec<Box<dyn Shape>> = vec![ Box::new( Sphere::new() .with_material(Box::new(Diffuse::new(Color::new(1.0, 0.45, 0.31)))) ), Box::new( Sphere::new() .with_center(Vec3::new(0.0, -101.0, 0.0)) .with_radius(100.0) ), ]; let scene = Scene::new().with_objects(objects); let engine = RenderEngine::new(64, 4); // Samples and max bounces let image = engine.render(&scene); image .write(Path::new("example_render.png")) .expect("Error writing rendered image"); }
Modules
color | Data Types and functions related to colors and images. |
math | Data Types and functions related to math with focus on vectors. |
prelude | |
rendering | Data Types and functions related to rendering. |
shapes | Geometric shapes that can be placed into the scene. |