aboutsummaryrefslogtreecommitdiff
path: root/src/material/mod.rs
diff options
context:
space:
mode:
authorlamp2023-03-05 21:45:56 +0000
committerlamp2023-03-05 21:45:56 +0000
commit78ddaff5855bf8446adef9e18eb0d7b7ddcee52a (patch)
tree0d0e93cfa28751a2f96518eeb231cf715958e1fa /src/material/mod.rs
init
Diffstat (limited to 'src/material/mod.rs')
-rw-r--r--src/material/mod.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/material/mod.rs b/src/material/mod.rs
new file mode 100644
index 0000000..bf1eb24
--- /dev/null
+++ b/src/material/mod.rs
@@ -0,0 +1,21 @@
+mod lambertian;
+pub use lambertian::Lambertian;
+mod metal;
+pub use metal::Metal;
+mod dielectric;
+pub use dielectric::Dielectric;
+mod diffuse_light;
+pub use diffuse_light::DiffuseLight;
+mod isotropic;
+pub use isotropic::Isotropic;
+
+use crate::{hittable::HitRecord, vec3::Point3};
+use crate::vec3::Color;
+use crate::ray::Ray;
+
+pub trait Material: Send + Sync {
+ fn emitted(&self, _: f64, _: f64, _: &Point3) -> Color {
+ Color { x: 0.0, y: 0.0, z: 0.0 }
+ }
+ fn scatter(&self, ray_in: &Ray, hit_record: &HitRecord, attenuation: &mut Color, scattered: &mut Ray) -> bool;
+}