Rename UI camera_entity fields (#17243)

# Objective

The `camera_entity` field on the extracted uinode structs holds the
render world entity that has the extracted camera components
corresponding to the target camera world entity. It should be renamed so
that it's clear it isn't the target camera world entity itself.

## Solution

Rename the `camera_entity` field on each of the extracted UI item
structs to `extracted_camera_entity`.
This commit is contained in:
ickshonpe 2025-01-12 05:32:08 +00:00 committed by GitHub
parent 447108b2a4
commit 8ac1f8ccdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 35 deletions

View File

@ -219,7 +219,7 @@ pub struct ExtractedBoxShadow {
pub transform: Mat4,
pub bounds: Vec2,
pub clip: Option<Rect>,
pub camera_entity: Entity,
pub extracted_camera_entity: Entity,
pub color: LinearRgba,
pub radius: ResolvedBorderRadius,
pub blur_radius: f32,
@ -259,7 +259,7 @@ pub fn extract_shadows(
continue;
};
let Ok(render_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -326,7 +326,7 @@ pub fn extract_shadows(
color: drop_shadow.color.into(),
bounds: shadow_size + 6. * blur_radius,
clip: clip.map(|clip| clip.clip),
camera_entity: render_entity,
extracted_camera_entity,
radius,
blur_radius,
size: shadow_size,
@ -348,7 +348,8 @@ pub fn queue_shadows(
) {
let draw_function = draw_functions.read().id::<DrawBoxShadows>();
for (entity, extracted_shadow) in extracted_box_shadows.box_shadows.iter() {
let Ok((view_entity, view, shadow_samples)) = views.get(extracted_shadow.camera_entity)
let Ok((view_entity, view, shadow_samples)) =
views.get(extracted_shadow.extracted_camera_entity)
else {
continue;
};
@ -511,7 +512,7 @@ pub fn prepare_shadows(
item.entity(),
UiShadowsBatch {
range: vertices_index..vertices_index + 6,
camera: box_shadow.camera_entity,
camera: box_shadow.extracted_camera_entity,
},
));

View File

@ -86,7 +86,7 @@ pub fn extract_debug_overlay(
continue;
};
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -105,7 +105,7 @@ pub fn extract_debug_overlay(
.filter(|_| !debug_options.show_clipped)
.map(|clip| clip.clip),
image: AssetId::default(),
camera_entity: render_camera_entity,
extracted_camera_entity,
item: ExtractedUiItem::Node {
atlas_scaling: None,
transform: transform.compute_matrix(),

View File

@ -193,10 +193,8 @@ pub struct ExtractedUiNode {
pub rect: Rect,
pub image: AssetId<Image>,
pub clip: Option<Rect>,
// Camera to render this UI node to. By the time it is extracted,
// it is defaulted to a single camera if only one exists.
// Nodes with ambiguous camera will be ignored.
pub camera_entity: Entity,
/// Render world entity of the extracted camera corresponding to this node's target camera.
pub extracted_camera_entity: Entity,
pub item: ExtractedUiItem,
pub main_entity: MainEntity,
}
@ -273,7 +271,7 @@ pub fn extract_uinode_background_colors(
continue;
};
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -293,7 +291,7 @@ pub fn extract_uinode_background_colors(
},
clip: clip.map(|clip| clip.clip),
image: AssetId::default(),
camera_entity: render_camera_entity,
extracted_camera_entity,
item: ExtractedUiItem::Node {
atlas_scaling: None,
transform: transform.compute_matrix(),
@ -333,7 +331,7 @@ pub fn extract_uinode_images(
continue;
};
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -383,7 +381,7 @@ pub fn extract_uinode_images(
rect,
clip: clip.map(|clip| clip.clip),
image: image.image.id(),
camera_entity: render_camera_entity,
extracted_camera_entity,
item: ExtractedUiItem::Node {
atlas_scaling,
transform: transform.compute_matrix(),
@ -439,7 +437,7 @@ pub fn extract_uinode_borders(
continue;
};
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -463,7 +461,7 @@ pub fn extract_uinode_borders(
},
image,
clip: maybe_clip.map(|clip| clip.clip),
camera_entity: render_camera_entity,
extracted_camera_entity,
item: ExtractedUiItem::Node {
atlas_scaling: None,
transform: global_transform.compute_matrix(),
@ -501,7 +499,7 @@ pub fn extract_uinode_borders(
},
image,
clip: parent_clip.map(|clip| clip.clip),
camera_entity: render_camera_entity,
extracted_camera_entity,
item: ExtractedUiItem::Node {
transform: global_transform.compute_matrix(),
atlas_scaling: None,
@ -629,7 +627,7 @@ pub fn extract_text_sections(
)>,
>,
text_styles: Extract<Query<&TextColor>>,
mapping: Extract<Query<&RenderEntity>>,
mapping: Extract<Query<RenderEntity>>,
) {
let mut start = 0;
let mut end = 1;
@ -655,7 +653,7 @@ pub fn extract_text_sections(
continue;
}
let Ok(&render_camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -710,7 +708,7 @@ pub fn extract_text_sections(
color,
image: atlas_info.texture.id(),
clip: clip.map(|clip| clip.clip),
camera_entity: render_camera_entity.id(),
extracted_camera_entity,
rect,
item: ExtractedUiItem::Glyphs { range: start..end },
main_entity: entity.into(),
@ -798,7 +796,8 @@ pub fn queue_uinodes(
) {
let draw_function = draw_functions.read().id::<DrawUi>();
for (entity, extracted_uinode) in extracted_uinodes.uinodes.iter() {
let Ok((view_entity, view, ui_anti_alias)) = views.get(extracted_uinode.camera_entity)
let Ok((view_entity, view, ui_anti_alias)) =
views.get(extracted_uinode.extracted_camera_entity)
else {
continue;
};
@ -892,7 +891,7 @@ pub fn prepare_uinodes(
&& extracted_uinode.image != AssetId::default()
&& batch_image_handle != extracted_uinode.image)
|| existing_batch.as_ref().map(|(_, b)| b.camera)
!= Some(extracted_uinode.camera_entity)
!= Some(extracted_uinode.extracted_camera_entity)
{
if let Some(gpu_image) = gpu_images.get(extracted_uinode.image) {
batch_item_index = item_index;
@ -901,7 +900,7 @@ pub fn prepare_uinodes(
let new_batch = UiBatch {
range: vertices_index..vertices_index,
image: extracted_uinode.image,
camera: extracted_uinode.camera_entity,
camera: extracted_uinode.extracted_camera_entity,
};
batches.push((item.entity(), new_batch));

View File

@ -341,7 +341,7 @@ pub struct ExtractedUiMaterialNode<M: UiMaterial> {
// Camera to render this UI node to. By the time it is extracted,
// it is defaulted to a single camera if only one exists.
// Nodes with ambiguous camera will be ignored.
pub camera_entity: Entity,
pub extracted_camera_entity: Entity,
pub main_entity: MainEntity,
}
@ -384,7 +384,7 @@ pub fn extract_ui_material_nodes<M: UiMaterial>(
continue;
};
let Ok(camera_entity) = render_entity_lookup.get(camera_entity) else {
let Ok(extracted_camera_entity) = render_entity_lookup.get(camera_entity) else {
continue;
};
@ -417,7 +417,7 @@ pub fn extract_ui_material_nodes<M: UiMaterial>(
},
border,
clip: clip.map(|clip| clip.clip),
camera_entity,
extracted_camera_entity,
main_entity: entity.into(),
},
);
@ -622,11 +622,11 @@ pub fn queue_ui_material_nodes<M: UiMaterial>(
let Some(material) = render_materials.get(extracted_uinode.material) else {
continue;
};
let Ok(view) = views.get(extracted_uinode.camera_entity) else {
let Ok(view) = views.get(extracted_uinode.extracted_camera_entity) else {
continue;
};
let Some(transparent_phase) =
transparent_render_phases.get_mut(&extracted_uinode.camera_entity)
transparent_render_phases.get_mut(&extracted_uinode.extracted_camera_entity)
else {
continue;
};

View File

@ -230,7 +230,7 @@ pub struct ExtractedUiTextureSlice {
pub atlas_rect: Option<Rect>,
pub image: AssetId<Image>,
pub clip: Option<Rect>,
pub camera_entity: Entity,
pub extracted_camera_entity: Entity,
pub color: LinearRgba,
pub image_scale_mode: SpriteImageMode,
pub flip_x: bool,
@ -269,7 +269,7 @@ pub fn extract_ui_texture_slices(
continue;
};
let Ok(camera_entity) = mapping.get(camera_entity) else {
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
continue;
};
@ -326,7 +326,7 @@ pub fn extract_ui_texture_slices(
},
clip: clip.map(|clip| clip.clip),
image: image.image.id(),
camera_entity,
extracted_camera_entity,
image_scale_mode,
atlas_rect,
flip_x: image.flip_x,
@ -349,7 +349,7 @@ pub fn queue_ui_slices(
) {
let draw_function = draw_functions.read().id::<DrawUiTextureSlices>();
for (entity, extracted_slicer) in extracted_ui_slicers.slices.iter() {
let Ok((view_entity, view)) = views.get(extracted_slicer.camera_entity) else {
let Ok((view_entity, view)) = views.get(extracted_slicer.extracted_camera_entity) else {
continue;
};
@ -435,7 +435,7 @@ pub fn prepare_ui_slices(
&& texture_slices.image != AssetId::default()
&& batch_image_handle != texture_slices.image)
|| existing_batch.as_ref().map(|(_, b)| b.camera)
!= Some(texture_slices.camera_entity)
!= Some(texture_slices.extracted_camera_entity)
{
if let Some(gpu_image) = gpu_images.get(texture_slices.image) {
batch_item_index = item_index;
@ -445,7 +445,7 @@ pub fn prepare_ui_slices(
let new_batch = UiTextureSlicerBatch {
range: vertices_index..vertices_index,
image: texture_slices.image,
camera: texture_slices.camera_entity,
camera: texture_slices.extracted_camera_entity,
};
batches.push((item.entity(), new_batch));