From 8b724c9f988289c69c46071f46260b6b7aebd812 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 20 Aug 2024 19:44:23 +0200 Subject: refactor(engine): replace Camera current field with Active component --- engine/src/renderer/opengl.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'engine/src/renderer/opengl.rs') diff --git a/engine/src/renderer/opengl.rs b/engine/src/renderer/opengl.rs index a90c069..292fd94 100644 --- a/engine/src/renderer/opengl.rs +++ b/engine/src/renderer/opengl.rs @@ -13,7 +13,7 @@ use ecs::sole::Single; use ecs::system::{Into as _, System}; use ecs::{Component, Query}; -use crate::camera::Camera; +use crate::camera::{Active as ActiveCamera, Camera}; use crate::color::Color; use crate::data_types::dimens::Dimens; use crate::draw_flags::{DrawFlags, NoDraw, PolygonModeConfig}; @@ -115,16 +115,14 @@ fn render( query: Query>>, point_light_query: Query<(PointLight,)>, directional_lights: Query<(DirectionalLight,)>, - camera_query: Query<(Camera, Position)>, + camera_query: Query<(Camera, Position, ActiveCamera)>, window: Single, global_light: Single, mut gl_objects: Local, mut actions: Actions, ) { - let Some((camera, camera_pos)) = - camera_query.iter().find(|(camera, _)| camera.current) - else { + let Some((camera, camera_pos, _)) = camera_query.iter().next() else { #[cfg(feature = "debug")] tracing::warn!("No current camera. Nothing will be rendered"); return; -- cgit v1.2.3-18-g5258