Struct truster::camera::Camera [−][src]
pub struct Camera { /* fields omitted */ }
Expand description
Represents a camera which can be used together with an instance of crate::world::World to render a scene.
Implementations
Returns a ray for the pixel at the given coordinates.
Examples
Constructing a ray through the center of the canvas
use std::f64::consts::PI; use truster::ray::Ray; use truster::tuple::Tuple; let camera = Camera::new(Config { hsize: 201, vsize: 101, fov: PI / 2.0, ..Config::default() }); let ray = camera.ray_for_pixel(100, 50); // ray == Ray::new(Tuple::point(0.0, 0.0, 0.0), Tuple::vector(0.0, 0.0, -1.0))); // approximately
Auto Trait Implementations
impl RefUnwindSafe for Camera
impl UnwindSafe for Camera