From 77a061f73309c596e464ebb4fa787a23c62199e6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 24 Apr 2024 19:28:05 +0200 Subject: fix: prevent panic when light source is also rendered --- engine/src/renderer/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engine/src/renderer/mod.rs') diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs index cb7066f..5125da8 100644 --- a/engine/src/renderer/mod.rs +++ b/engine/src/renderer/mod.rs @@ -110,7 +110,12 @@ fn render( return; }; - let light_source = light_source_query.iter().next(); + // TODO: Maybe find a way to not clone here? Cloning here is needed since a light + // source transform can be in both the object query and the light source query + let light_source = light_source_query + .iter() + .next() + .map(|(light_source, transform)| (light_source.clone(), transform.clone())); let GlObjects { shader_programs: gl_shader_programs, @@ -137,7 +142,7 @@ fn render( light_source .as_ref() .map(|(light_source, light_source_transform)| { - (&**light_source, &**light_source_transform) + (light_source, light_source_transform) }), &camera, ); -- cgit v1.2.3-18-g5258