aboutsummaryrefslogtreecommitdiff
path: root/src/scene/mod.rs
blob: cd072368efc1c90fca9342f692ae346e4cb0b67b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Defines the scene type which contains all the objects in the scene.
//! 
//! Also handles finding intersections between rays and shapes
pub mod shapes;

mod scene;
pub use scene::*;

use std::rc::Rc;
use crate::core::Hittable;
use crate::material::Material;

pub struct Object {
    pub shape: Box<dyn Hittable>,
    pub mat: Rc<dyn Material>,
}

impl Object {
    pub fn new(mat: Rc<dyn Material>, shape: Box<dyn Hittable>) -> Self {
        Object {
            mat,
            shape,
        }
    }
}