diff options
author | HampusM <hampus@hampusmat.com> | 2024-04-24 19:28:05 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-04-24 19:28:05 +0200 |
commit | 77a061f73309c596e464ebb4fa787a23c62199e6 (patch) | |
tree | 00a5079af1e918e3e94111fa16eb696638ca6c3f /engine/src | |
parent | f54b51c13ca0a647afbaef7c25f9ac3650be1c50 (diff) |
fix: prevent panic when light source is also rendered
Diffstat (limited to 'engine/src')
-rw-r--r-- | engine/src/renderer/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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, ); |