pub trait Scene: Sync + Send {
    // Required methods
    fn new() -> Self
       where Self: Sized;
    fn background(&self, ray: &Ray) -> PTF3;
    fn closest_hit(
        &self,
        ray: &Ray,
        state: &mut State,
        light: &mut LightSampleRec
    ) -> bool;
    fn any_hit(&self, ray: &Ray, max_dist: PTF) -> bool;
    fn camera(&self) -> &Box<dyn Camera3D>;
    fn number_of_lights(&self) -> usize;
    fn light_at(&self, index: usize) -> &AnalyticalLight;

    // Provided methods
    fn recursion_depth(&self) -> u16 { ... }
    fn to_linear(&self, c: PTF3) -> PTF3 { ... }
}
Expand description

A trait based scene abstraction.

Required Methods§

source

fn new() -> Selfwhere Self: Sized,

source

fn background(&self, ray: &Ray) -> PTF3

Background color for the given ray

source

fn closest_hit( &self, ray: &Ray, state: &mut State, light: &mut LightSampleRec ) -> bool

Closest hit should return the state.hit_dist, state.normal and fill out the state.material as needed

source

fn any_hit(&self, ray: &Ray, max_dist: PTF) -> bool

Used for shadow rays.

source

fn camera(&self) -> &Box<dyn Camera3D>

Return the camera for the scene

source

fn number_of_lights(&self) -> usize

Return the number of lights in the scene

source

fn light_at(&self, index: usize) -> &AnalyticalLight

Return a reference for the light at the given index

Provided Methods§

source

fn recursion_depth(&self) -> u16

The recursion depth for the path tracer

source

fn to_linear(&self, c: PTF3) -> PTF3

Implementors§