aboutsummaryrefslogtreecommitdiff
path: root/src/material
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-02-21 18:01:56 +0100
committerJulian T <julian@jtle.dk>2021-02-21 18:01:56 +0100
commitda1c3949a449f3fafe579c62ff6b14ffd993a197 (patch)
tree754df5c9b5e9f0fa0a8bb7a8cd3dd4b12fe5ad89 /src/material
parentc695da871a75bb6786c08c3546ef71ed032bd61d (diff)
Add 3d bounding box and merged SceneIntersection and Intersection
Diffstat (limited to 'src/material')
-rw-r--r--src/material/lambertian.rs3
-rw-r--r--src/material/mod.rs5
-rw-r--r--src/material/reflectant.rs3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/material/lambertian.rs b/src/material/lambertian.rs
index 8ef5e50..3df6522 100644
--- a/src/material/lambertian.rs
+++ b/src/material/lambertian.rs
@@ -1,5 +1,6 @@
use super::Material;
-use crate::core::{Intersection, Ray, Spectrum};
+use crate::core::{Ray, Spectrum};
+use crate::world::Intersection;
use crate::sample::Sampler;
use std::rc::Rc;
diff --git a/src/material/mod.rs b/src/material/mod.rs
index c939385..7f920e2 100644
--- a/src/material/mod.rs
+++ b/src/material/mod.rs
@@ -1,4 +1,5 @@
-use crate::core::{Ray, Intersection, Spectrum};
+use crate::core::{Ray, Spectrum};
+use crate::world::Intersection;
use crate::sample::Sampler;
mod lambertian;
@@ -7,6 +8,6 @@ mod reflectant;
pub use lambertian::Lambertian;
pub use reflectant::Reflectant;
-pub trait Material {
+pub trait Material: Sync + Send {
fn scatter(&self, ray: &Ray, i: &Intersection, sampler: &mut dyn Sampler) -> Option<(Spectrum, Ray)>;
}
diff --git a/src/material/reflectant.rs b/src/material/reflectant.rs
index f4b110c..dea7aca 100644
--- a/src/material/reflectant.rs
+++ b/src/material/reflectant.rs
@@ -1,5 +1,6 @@
use crate::Float;
-use crate::core::{Ray, Intersection, Spectrum, Vector3f};
+use crate::core::{Ray, Spectrum, Vector3f};
+use crate::world::Intersection;
use super::Material;
use crate::sample::Sampler;