pub struct Scene {
pub triangles: Vec<Triangle>,
pub materials: Vec<Material>,
pub lights: Vec<PointLight>,
pub area_lights: Vec<AreaLight>,
pub bvh: Option<Bvh>,
}Expand description
A simple ray-traced scene.
Fields§
§triangles: Vec<Triangle>Scene triangles.
materials: Vec<Material>Scene materials.
lights: Vec<PointLight>Point lights.
area_lights: Vec<AreaLight>Area lights.
bvh: Option<Bvh>Prebuilt BVH (None until built).
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn add_material(&mut self, mat: Material) -> u32
pub fn add_material(&mut self, mat: Material) -> u32
Add a material and return its index.
Sourcepub fn add_triangle(&mut self, tri: Triangle)
pub fn add_triangle(&mut self, tri: Triangle)
Add a triangle.
Sourcepub fn add_light(&mut self, light: PointLight)
pub fn add_light(&mut self, light: PointLight)
Add a point light.
Sourcepub fn add_box(&mut self, center: [f64; 3], hs: [f64; 3], material_id: u32)
pub fn add_box(&mut self, center: [f64; 3], hs: [f64; 3], material_id: u32)
Add a unit box (12 triangles) centered at center with half-size hs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scene
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnsafeUnpin for Scene
impl UnwindSafe for Scene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more