summaryrefslogtreecommitdiff
path: root/racer-tracer/src/scene.rs
diff options
context:
space:
mode:
Diffstat (limited to 'racer-tracer/src/scene.rs')
-rw-r--r--racer-tracer/src/scene.rs24
1 files changed, 2 insertions, 22 deletions
diff --git a/racer-tracer/src/scene.rs b/racer-tracer/src/scene.rs
index 2d530af..672b39b 100644
--- a/racer-tracer/src/scene.rs
+++ b/racer-tracer/src/scene.rs
@@ -1,7 +1,7 @@
use crate::geometry::Hittable;
pub struct Scene {
- objects: Vec<Box<dyn Hittable>>,
+ objects: Vec<Box<dyn Hittable + Sync + Send>>,
}
impl Scene {
@@ -11,27 +11,11 @@ impl Scene {
}
}
- pub fn add(&mut self, hittable: Box<dyn Hittable>) {
+ pub fn add(&mut self, hittable: Box<dyn Hittable + Sync + Send>) {
self.objects.push(hittable);
}
}
-// TODO: What to do?
-// Cloning everything is nice since then every task can do whatever they like.
-// Cloning everything is bad becuse you copy everything which takes time.
-// Could also put locks on the Scene but then it becomes this global object that everyone
-// wants to access at the same time.
-// Will do some laborations later and decide on a solution.
-impl Clone for Scene {
- fn clone(&self) -> Self {
- let mut objects = Vec::with_capacity(self.objects.capacity());
- for i in self.objects.iter() {
- objects.push(i.clone_box());
- }
- Self { objects }
- }
-}
-
impl Hittable for Scene {
fn hit(
&self,
@@ -51,8 +35,4 @@ impl Hittable for Scene {
rec
}
-
- fn clone_box(&self) -> Box<dyn Hittable> {
- Box::new(self.clone())
- }
}