diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index ab3af2c2429f0..16bf8ec5e9a49 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -18,7 +18,7 @@ use bevy_ecs::{ system::{Commands, Query, Res, ResMut, Resource}, }; use bevy_log::warn; -use bevy_math::{Mat4, Ray, UVec2, UVec4, Vec2, Vec3}; +use bevy_math::{Mat4, Ray, Rect, UVec2, UVec4, Vec2, Vec3}; use bevy_reflect::prelude::*; use bevy_reflect::FromReflect; use bevy_transform::components::GlobalTransform; @@ -156,13 +156,16 @@ impl Camera { Some((min, max)) } - /// The rendered logical bounds (minimum, maximum) of the camera. If the `viewport` field is set - /// to [`Some`], this will be the rect of that custom viewport. Otherwise it will default to the + /// The rendered logical bounds [`Rect`] of the camera. If the `viewport` field is set to + /// [`Some`], this will be the rect of that custom viewport. Otherwise it will default to the /// full logical rect of the current [`RenderTarget`]. #[inline] - pub fn logical_viewport_rect(&self) -> Option<(Vec2, Vec2)> { + pub fn logical_viewport_rect(&self) -> Option { let (min, max) = self.physical_viewport_rect()?; - Some((self.to_logical(min)?, self.to_logical(max)?)) + Some(Rect { + min: self.to_logical(min)?, + max: self.to_logical(max)?, + }) } /// The logical size of this camera's viewport. If the `viewport` field is set to [`Some`], this