feat(raytracer): add native rt functions to lisp

This commit is contained in:
2024-11-28 01:57:40 +01:00
parent 4b227fdd28
commit 6a3348d727
11 changed files with 554 additions and 32 deletions

View File

@@ -1,3 +1,5 @@
use std::fmt::Display;
use super::{
scene::Scene,
types::{Color, Point3, Ray, Scalar, Vector3},
@@ -6,6 +8,7 @@ use image::RgbImage;
use rayon::prelude::*;
/// A camera that can render a scene.
#[derive(Clone, PartialEq, Debug)]
pub struct Camera {
/// Position of the camera's eye.
position: Point3,
@@ -106,3 +109,16 @@ impl Camera {
img
}
}
impl Display for Camera {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Camera {{ position: {}, lower_left: {}, x_dir: {}, y_dir: {}, width: {}, height: {} }}",
self.position, self.lower_left, self.x_dir, self.y_dir, self.width, self.height)
}
}
impl PartialOrd for Camera {
fn partial_cmp(&self, _other: &Self) -> Option<std::cmp::Ordering> {
None
}
}