ray-trace-w1/src/types_defined.rs

37 lines
465 B
Rust

/*
* [3]
*/
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Vec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
pub type Point = Vec3;
pub type Color = Vec3;
/*
fn: P(t) = t*b
*/
#[derive(Debug)]
pub struct Ray {
pub point: Point,
pub direction: Vec3
}
pub struct HitRecord {
pub t: f32,
pub p: Vec3,
pub normal: Vec3,
}
/*
/////////////
// for test
/////////////
*/
pub struct Sphere {
pub center: Point,
pub radius: f32,
}