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:
parent
447108b2a4
commit
8ac1f8ccdc
@ -219,7 +219,7 @@ pub struct ExtractedBoxShadow {
|
|||||||
pub transform: Mat4,
|
pub transform: Mat4,
|
||||||
pub bounds: Vec2,
|
pub bounds: Vec2,
|
||||||
pub clip: Option<Rect>,
|
pub clip: Option<Rect>,
|
||||||
pub camera_entity: Entity,
|
pub extracted_camera_entity: Entity,
|
||||||
pub color: LinearRgba,
|
pub color: LinearRgba,
|
||||||
pub radius: ResolvedBorderRadius,
|
pub radius: ResolvedBorderRadius,
|
||||||
pub blur_radius: f32,
|
pub blur_radius: f32,
|
||||||
@ -259,7 +259,7 @@ pub fn extract_shadows(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(render_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ pub fn extract_shadows(
|
|||||||
color: drop_shadow.color.into(),
|
color: drop_shadow.color.into(),
|
||||||
bounds: shadow_size + 6. * blur_radius,
|
bounds: shadow_size + 6. * blur_radius,
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
camera_entity: render_entity,
|
extracted_camera_entity,
|
||||||
radius,
|
radius,
|
||||||
blur_radius,
|
blur_radius,
|
||||||
size: shadow_size,
|
size: shadow_size,
|
||||||
@ -348,7 +348,8 @@ pub fn queue_shadows(
|
|||||||
) {
|
) {
|
||||||
let draw_function = draw_functions.read().id::<DrawBoxShadows>();
|
let draw_function = draw_functions.read().id::<DrawBoxShadows>();
|
||||||
for (entity, extracted_shadow) in extracted_box_shadows.box_shadows.iter() {
|
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 {
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@ -511,7 +512,7 @@ pub fn prepare_shadows(
|
|||||||
item.entity(),
|
item.entity(),
|
||||||
UiShadowsBatch {
|
UiShadowsBatch {
|
||||||
range: vertices_index..vertices_index + 6,
|
range: vertices_index..vertices_index + 6,
|
||||||
camera: box_shadow.camera_entity,
|
camera: box_shadow.extracted_camera_entity,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ pub fn extract_debug_overlay(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ pub fn extract_debug_overlay(
|
|||||||
.filter(|_| !debug_options.show_clipped)
|
.filter(|_| !debug_options.show_clipped)
|
||||||
.map(|clip| clip.clip),
|
.map(|clip| clip.clip),
|
||||||
image: AssetId::default(),
|
image: AssetId::default(),
|
||||||
camera_entity: render_camera_entity,
|
extracted_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
atlas_scaling: None,
|
atlas_scaling: None,
|
||||||
transform: transform.compute_matrix(),
|
transform: transform.compute_matrix(),
|
||||||
|
@ -193,10 +193,8 @@ pub struct ExtractedUiNode {
|
|||||||
pub rect: Rect,
|
pub rect: Rect,
|
||||||
pub image: AssetId<Image>,
|
pub image: AssetId<Image>,
|
||||||
pub clip: Option<Rect>,
|
pub clip: Option<Rect>,
|
||||||
// Camera to render this UI node to. By the time it is extracted,
|
/// Render world entity of the extracted camera corresponding to this node's target camera.
|
||||||
// it is defaulted to a single camera if only one exists.
|
pub extracted_camera_entity: Entity,
|
||||||
// Nodes with ambiguous camera will be ignored.
|
|
||||||
pub camera_entity: Entity,
|
|
||||||
pub item: ExtractedUiItem,
|
pub item: ExtractedUiItem,
|
||||||
pub main_entity: MainEntity,
|
pub main_entity: MainEntity,
|
||||||
}
|
}
|
||||||
@ -273,7 +271,7 @@ pub fn extract_uinode_background_colors(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -293,7 +291,7 @@ pub fn extract_uinode_background_colors(
|
|||||||
},
|
},
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
image: AssetId::default(),
|
image: AssetId::default(),
|
||||||
camera_entity: render_camera_entity,
|
extracted_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
atlas_scaling: None,
|
atlas_scaling: None,
|
||||||
transform: transform.compute_matrix(),
|
transform: transform.compute_matrix(),
|
||||||
@ -333,7 +331,7 @@ pub fn extract_uinode_images(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -383,7 +381,7 @@ pub fn extract_uinode_images(
|
|||||||
rect,
|
rect,
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
image: image.image.id(),
|
image: image.image.id(),
|
||||||
camera_entity: render_camera_entity,
|
extracted_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
atlas_scaling,
|
atlas_scaling,
|
||||||
transform: transform.compute_matrix(),
|
transform: transform.compute_matrix(),
|
||||||
@ -439,7 +437,7 @@ pub fn extract_uinode_borders(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(render_camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -463,7 +461,7 @@ pub fn extract_uinode_borders(
|
|||||||
},
|
},
|
||||||
image,
|
image,
|
||||||
clip: maybe_clip.map(|clip| clip.clip),
|
clip: maybe_clip.map(|clip| clip.clip),
|
||||||
camera_entity: render_camera_entity,
|
extracted_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
atlas_scaling: None,
|
atlas_scaling: None,
|
||||||
transform: global_transform.compute_matrix(),
|
transform: global_transform.compute_matrix(),
|
||||||
@ -501,7 +499,7 @@ pub fn extract_uinode_borders(
|
|||||||
},
|
},
|
||||||
image,
|
image,
|
||||||
clip: parent_clip.map(|clip| clip.clip),
|
clip: parent_clip.map(|clip| clip.clip),
|
||||||
camera_entity: render_camera_entity,
|
extracted_camera_entity,
|
||||||
item: ExtractedUiItem::Node {
|
item: ExtractedUiItem::Node {
|
||||||
transform: global_transform.compute_matrix(),
|
transform: global_transform.compute_matrix(),
|
||||||
atlas_scaling: None,
|
atlas_scaling: None,
|
||||||
@ -629,7 +627,7 @@ pub fn extract_text_sections(
|
|||||||
)>,
|
)>,
|
||||||
>,
|
>,
|
||||||
text_styles: Extract<Query<&TextColor>>,
|
text_styles: Extract<Query<&TextColor>>,
|
||||||
mapping: Extract<Query<&RenderEntity>>,
|
mapping: Extract<Query<RenderEntity>>,
|
||||||
) {
|
) {
|
||||||
let mut start = 0;
|
let mut start = 0;
|
||||||
let mut end = 1;
|
let mut end = 1;
|
||||||
@ -655,7 +653,7 @@ pub fn extract_text_sections(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Ok(&render_camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -710,7 +708,7 @@ pub fn extract_text_sections(
|
|||||||
color,
|
color,
|
||||||
image: atlas_info.texture.id(),
|
image: atlas_info.texture.id(),
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
camera_entity: render_camera_entity.id(),
|
extracted_camera_entity,
|
||||||
rect,
|
rect,
|
||||||
item: ExtractedUiItem::Glyphs { range: start..end },
|
item: ExtractedUiItem::Glyphs { range: start..end },
|
||||||
main_entity: entity.into(),
|
main_entity: entity.into(),
|
||||||
@ -798,7 +796,8 @@ pub fn queue_uinodes(
|
|||||||
) {
|
) {
|
||||||
let draw_function = draw_functions.read().id::<DrawUi>();
|
let draw_function = draw_functions.read().id::<DrawUi>();
|
||||||
for (entity, extracted_uinode) in extracted_uinodes.uinodes.iter() {
|
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 {
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@ -892,7 +891,7 @@ pub fn prepare_uinodes(
|
|||||||
&& extracted_uinode.image != AssetId::default()
|
&& extracted_uinode.image != AssetId::default()
|
||||||
&& batch_image_handle != extracted_uinode.image)
|
&& batch_image_handle != extracted_uinode.image)
|
||||||
|| existing_batch.as_ref().map(|(_, b)| b.camera)
|
|| 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) {
|
if let Some(gpu_image) = gpu_images.get(extracted_uinode.image) {
|
||||||
batch_item_index = item_index;
|
batch_item_index = item_index;
|
||||||
@ -901,7 +900,7 @@ pub fn prepare_uinodes(
|
|||||||
let new_batch = UiBatch {
|
let new_batch = UiBatch {
|
||||||
range: vertices_index..vertices_index,
|
range: vertices_index..vertices_index,
|
||||||
image: extracted_uinode.image,
|
image: extracted_uinode.image,
|
||||||
camera: extracted_uinode.camera_entity,
|
camera: extracted_uinode.extracted_camera_entity,
|
||||||
};
|
};
|
||||||
|
|
||||||
batches.push((item.entity(), new_batch));
|
batches.push((item.entity(), new_batch));
|
||||||
|
@ -341,7 +341,7 @@ pub struct ExtractedUiMaterialNode<M: UiMaterial> {
|
|||||||
// Camera to render this UI node to. By the time it is extracted,
|
// Camera to render this UI node to. By the time it is extracted,
|
||||||
// it is defaulted to a single camera if only one exists.
|
// it is defaulted to a single camera if only one exists.
|
||||||
// Nodes with ambiguous camera will be ignored.
|
// Nodes with ambiguous camera will be ignored.
|
||||||
pub camera_entity: Entity,
|
pub extracted_camera_entity: Entity,
|
||||||
pub main_entity: MainEntity,
|
pub main_entity: MainEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ pub fn extract_ui_material_nodes<M: UiMaterial>(
|
|||||||
continue;
|
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;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ pub fn extract_ui_material_nodes<M: UiMaterial>(
|
|||||||
},
|
},
|
||||||
border,
|
border,
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
camera_entity,
|
extracted_camera_entity,
|
||||||
main_entity: entity.into(),
|
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 {
|
let Some(material) = render_materials.get(extracted_uinode.material) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let Ok(view) = views.get(extracted_uinode.camera_entity) else {
|
let Ok(view) = views.get(extracted_uinode.extracted_camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let Some(transparent_phase) =
|
let Some(transparent_phase) =
|
||||||
transparent_render_phases.get_mut(&extracted_uinode.camera_entity)
|
transparent_render_phases.get_mut(&extracted_uinode.extracted_camera_entity)
|
||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
@ -230,7 +230,7 @@ pub struct ExtractedUiTextureSlice {
|
|||||||
pub atlas_rect: Option<Rect>,
|
pub atlas_rect: Option<Rect>,
|
||||||
pub image: AssetId<Image>,
|
pub image: AssetId<Image>,
|
||||||
pub clip: Option<Rect>,
|
pub clip: Option<Rect>,
|
||||||
pub camera_entity: Entity,
|
pub extracted_camera_entity: Entity,
|
||||||
pub color: LinearRgba,
|
pub color: LinearRgba,
|
||||||
pub image_scale_mode: SpriteImageMode,
|
pub image_scale_mode: SpriteImageMode,
|
||||||
pub flip_x: bool,
|
pub flip_x: bool,
|
||||||
@ -269,7 +269,7 @@ pub fn extract_ui_texture_slices(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(camera_entity) = mapping.get(camera_entity) else {
|
let Ok(extracted_camera_entity) = mapping.get(camera_entity) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ pub fn extract_ui_texture_slices(
|
|||||||
},
|
},
|
||||||
clip: clip.map(|clip| clip.clip),
|
clip: clip.map(|clip| clip.clip),
|
||||||
image: image.image.id(),
|
image: image.image.id(),
|
||||||
camera_entity,
|
extracted_camera_entity,
|
||||||
image_scale_mode,
|
image_scale_mode,
|
||||||
atlas_rect,
|
atlas_rect,
|
||||||
flip_x: image.flip_x,
|
flip_x: image.flip_x,
|
||||||
@ -349,7 +349,7 @@ pub fn queue_ui_slices(
|
|||||||
) {
|
) {
|
||||||
let draw_function = draw_functions.read().id::<DrawUiTextureSlices>();
|
let draw_function = draw_functions.read().id::<DrawUiTextureSlices>();
|
||||||
for (entity, extracted_slicer) in extracted_ui_slicers.slices.iter() {
|
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;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ pub fn prepare_ui_slices(
|
|||||||
&& texture_slices.image != AssetId::default()
|
&& texture_slices.image != AssetId::default()
|
||||||
&& batch_image_handle != texture_slices.image)
|
&& batch_image_handle != texture_slices.image)
|
||||||
|| existing_batch.as_ref().map(|(_, b)| b.camera)
|
|| 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) {
|
if let Some(gpu_image) = gpu_images.get(texture_slices.image) {
|
||||||
batch_item_index = item_index;
|
batch_item_index = item_index;
|
||||||
@ -445,7 +445,7 @@ pub fn prepare_ui_slices(
|
|||||||
let new_batch = UiTextureSlicerBatch {
|
let new_batch = UiTextureSlicerBatch {
|
||||||
range: vertices_index..vertices_index,
|
range: vertices_index..vertices_index,
|
||||||
image: texture_slices.image,
|
image: texture_slices.image,
|
||||||
camera: texture_slices.camera_entity,
|
camera: texture_slices.extracted_camera_entity,
|
||||||
};
|
};
|
||||||
|
|
||||||
batches.push((item.entity(), new_batch));
|
batches.push((item.entity(), new_batch));
|
||||||
|
Loading…
Reference in New Issue
Block a user