Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multi viewports and windows to UI #5892

Closed
wants to merge 9 commits into from
5 changes: 5 additions & 0 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ impl Camera {
self.computed.target_info.as_ref().map(|t| t.physical_size)
}

#[inline]
pub fn target_scaling_factor(&self) -> Option<f64> {
self.computed.target_info.as_ref().map(|t| t.scale_factor)
}

/// The projection matrix computed using this camera's [`CameraProjection`].
#[inline]
pub fn projection_matrix(&self) -> Mat4 {
Expand Down
8 changes: 7 additions & 1 deletion crates/bevy_ui/src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use bevy_ecs::{
bundle::Bundle,
prelude::{Component, With},
prelude::{Component, Entity, With},
query::QueryItem,
};
use bevy_render::{
Expand Down Expand Up @@ -212,3 +212,9 @@ impl ExtractComponent for UiCameraConfig {
item.clone()
}
}

/// Optional component that will set which camera entity this UI root should get rendered on.
///
/// When this component is absent from a UI root node, the UI will use the main window's entire surface.
#[derive(Component)]
pub struct UiRootCamera(pub Entity);
Loading