39 lines
597 B
Rust
39 lines
597 B
Rust
use crate::vec3::Vec3;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Sphere {
|
|
pub center: Vec3,
|
|
pub radius: f64,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum Object {
|
|
Sphere(Sphere),
|
|
Cylinder {
|
|
center: Vec3,
|
|
direction: Vec3,
|
|
radius: f64,
|
|
length: f64,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
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>,
|
|
}
|