Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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