Trait rust_pathtracer::scene::Scene
source · pub trait Scene: Sync + Send {
// Required methods
fn new() -> Self
where Self: Sized;
fn background(&self, ray: &Ray) -> F3;
fn closest_hit(
&self,
ray: &Ray,
state: &mut State,
light: &mut LightSampleRec
) -> bool;
fn any_hit(&self, ray: &Ray, max_dist: F) -> 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: F3) -> F3 { ... }
fn sample_lights(
&self,
ray: &Ray,
state: &mut State,
light_sample: &mut LightSampleRec,
lights: &Vec<AnalyticalLight>
) -> bool { ... }
}Expand description
A trait based scene abstraction.
Required Methods§
fn new() -> Selfwhere Self: Sized,
sourcefn background(&self, ray: &Ray) -> F3
fn background(&self, ray: &Ray) -> F3
Background color for the given ray
sourcefn closest_hit(
&self,
ray: &Ray,
state: &mut State,
light: &mut LightSampleRec
) -> bool
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
sourcefn number_of_lights(&self) -> usize
fn number_of_lights(&self) -> usize
Return the number of lights in the scene
sourcefn light_at(&self, index: usize) -> &AnalyticalLight
fn light_at(&self, index: usize) -> &AnalyticalLight
Return a reference for the light at the given index
Provided Methods§
sourcefn recursion_depth(&self) -> u16
fn recursion_depth(&self) -> u16
The recursion depth for the path tracer