pbrt_r3/core/primitive/
primitive.rs

1use crate::core::geometry::*;
2use crate::core::interaction::*;
3use crate::core::light::*;
4use crate::core::material::*;
5use crate::core::memory::*;
6
7use std::sync::Arc;
8
9pub trait Primitive {
10    fn world_bound(&self) -> Bounds3f;
11    fn intersect(&self, r: &Ray) -> Option<SurfaceInteraction>;
12    fn intersect_p(&self, r: &Ray) -> bool;
13    fn get_area_light(&self) -> Option<Arc<dyn Light>> {
14        None
15    }
16    fn get_material(&self) -> Option<Arc<dyn Material>> {
17        None
18    }
19    fn compute_scattering_functions(
20        &self,
21        _si: &mut SurfaceInteraction,
22        _arena: &mut MemoryArena,
23        _mode: TransportMode,
24        _allow_multiple_lobes: bool,
25    ) {
26    }
27
28    fn is_geometric(&self) -> bool {
29        return false;
30    }
31}