diff options
Diffstat (limited to 'src/world/scene.rs')
-rw-r--r-- | src/world/scene.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/world/scene.rs b/src/world/scene.rs index 87bec1f..8954050 100644 --- a/src/world/scene.rs +++ b/src/world/scene.rs @@ -1,5 +1,7 @@ use crate::core::{Bound3f, Ray}; +use std::iter::IntoIterator; + use super::{Object, container, Hittable, Intersection}; type Container = container::HittableList; @@ -17,8 +19,11 @@ impl Scene { self.content.add(obj); } - pub fn add_objects(&mut self, objs: Vec<Object>) { - for obj in objs { + pub fn add_objects<T>(&mut self, objs: T) + where + T: IntoIterator<Item = Object>, + { + for obj in objs.into_iter() { self.add_object(obj); } } |