render_pass takes impl IntoIterator instead of slice
@@ -40,9 +40,13 @@ pub enum RendererError {}
/// Render the objects. Also avoids rendering objects outside the camera frustum and render the objects in the order given by [cmp_render_order].
/// Must be called in a render target render function, for example in the callback function of [Screen::write].
///
-pub fn render_pass(camera: &Camera, objects: &[impl Object], lights: &Lights) -> ThreeDResult<()> {
+pub fn render_pass(
+ camera: &Camera,
+ objects: impl std::iter::IntoIterator<Item = impl Object>,
+ lights: &Lights,
+) -> ThreeDResult<()> {
let mut culled_objects = objects
- .iter()
+ .into_iter()
.filter(|o| camera.in_frustum(&o.aabb()))
.collect::<Vec<_>>();
culled_objects.sort_by(|a, b| cmp_render_order(camera, a, b));
