added antialiasing

This commit is contained in:
2023-01-29 20:06:49 +01:00
parent 7a4dd5a1b9
commit 95f5132d1d
9 changed files with 637 additions and 566 deletions

View File

@@ -1,7 +1,7 @@
use crate::hittable::*;
use crate::vec3::*;
struct Sphere {
pub struct Sphere {
center: Point3,
radius: f64
}
@@ -13,7 +13,7 @@ impl Sphere {
}
impl Hittable for Sphere {
fn hit(&self, r: &crate::ray::Ray, t_min: f64, t_max: f64, rec: &mut HitRecord) -> bool {
fn hit(&mut self, r: &crate::ray::Ray, t_min: f64, t_max: f64, rec: &mut HitRecord) -> bool {
let oc = r.origin() - self.center;
let a = r.direction().length_squared();
let half_b = oc.dot(&r.direction());