raytracer 0.2.2

Toy raytracer in Rust
Documentation
use std::sync::Arc;

use crate::{
    Material,
    Vec3
};



/// Data struct that holds information about the [`Ray`] intersection with a [`Shape`].
///
/// [`Ray`]: ray/struct.Ray.html
/// [`Shape`]: shape/trait.Shape.html
#[derive(Clone)]
pub struct HitData {
    pub t: f32,
    pub point: Vec3,
    pub normal: Vec3,
    pub material: Arc<dyn Material>
}

impl HitData {
    /// HitData constructor.
    pub fn new(t: f32, point: Vec3, normal: Vec3, material: Arc<dyn Material>) -> HitData {
        HitData {
            t,
            point,
            normal,
            material
        }
    }
}