raytracer 0.2.2

Toy raytracer in Rust
Documentation
pub mod shapelist;
pub mod sphere;


use std::sync::Arc;

use crate::{
    HitData,
    Ray
};


/// Basic trait that every scene object must implement.
pub trait Shape: Sync + Send + 'static {
    /// Wraps the object implementing this trait with Atomic Rc pointer.
    ///
    /// Used for multithreading.
    fn into_arc(self) -> Arc<dyn Shape>
        where
            Self: Shape + Sized + 'static {
        Arc::new(self)
    }

    fn hit(&self, r: &Ray, t_min: f32, t_max: f32) -> Option<HitData>;
}