2023-01-31 07:38:03 +00:00
|
|
|
use crate::vec3::Vec3;
|
2023-01-31 07:15:22 +00:00
|
|
|
|
|
|
|
pub struct Sphere {
|
|
|
|
pub center: Vec3,
|
|
|
|
pub radius: f64,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum Object {
|
|
|
|
Sphere(Sphere),
|
|
|
|
Cylinder {
|
|
|
|
center: Vec3,
|
|
|
|
direction: Vec3,
|
|
|
|
radius: f64,
|
|
|
|
length: f64,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Scene {
|
|
|
|
pub eye_pos: Vec3,
|
|
|
|
pub view_dir: Vec3,
|
|
|
|
pub up_dir: Vec3,
|
|
|
|
|
|
|
|
/// Horizontal field of view (in degrees)
|
|
|
|
pub hfov: f64,
|
|
|
|
|
|
|
|
pub image_width: usize,
|
|
|
|
pub image_height: usize,
|
|
|
|
|
|
|
|
/// Background color
|
|
|
|
pub bkg_color: Vec3,
|
|
|
|
|
|
|
|
/// Material color
|
|
|
|
pub mtl_color: Vec3,
|
|
|
|
|
|
|
|
pub objects: Vec<Object>,
|
|
|
|
}
|