Remove camera from UiBatch (#17663)
# Objective A `TransparentUI` phase's items all target the same camera so there is no need to store the current camera entity in `UiBatch` and ending the current `UiBatch` on camera changes is pointless as the camera doesn't change. ## Solution Remove the `camera` fields from `UiBatch`, `UiShadowsBatch` and `UiTextureSliceBatch`. Remove the camera changed check from `prepare_uinodes`. ## Testing The `multiple_windows` and `split_screen` examples both render UI elements to multiple cameras and can be used to test these changes. The UI material plugin already didn't store the camera entity per batch and worked fine without it.
This commit is contained in:
parent
76e9bf9c99
commit
d76c782f39
@ -936,7 +936,6 @@ pub(crate) const QUAD_INDICES: [usize; 6] = [0, 2, 3, 0, 1, 2];
|
|||||||
pub struct UiBatch {
|
pub struct UiBatch {
|
||||||
pub range: Range<u32>,
|
pub range: Range<u32>,
|
||||||
pub image: AssetId<Image>,
|
pub image: AssetId<Image>,
|
||||||
pub camera: Entity,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The values here should match the values for the constants in `ui.wgsl`
|
/// The values here should match the values for the constants in `ui.wgsl`
|
||||||
@ -1066,8 +1065,6 @@ pub fn prepare_uinodes(
|
|||||||
|| (batch_image_handle != AssetId::default()
|
|| (batch_image_handle != AssetId::default()
|
||||||
&& 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)
|
|
||||||
!= 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;
|
||||||
@ -1076,7 +1073,6 @@ 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.extracted_camera_entity,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
batches.push((item.entity(), new_batch));
|
batches.push((item.entity(), new_batch));
|
||||||
|
|||||||
@ -88,7 +88,6 @@ struct UiTextureSliceVertex {
|
|||||||
pub struct UiTextureSlicerBatch {
|
pub struct UiTextureSlicerBatch {
|
||||||
pub range: Range<u32>,
|
pub range: Range<u32>,
|
||||||
pub image: AssetId<Image>,
|
pub image: AssetId<Image>,
|
||||||
pub camera: Entity,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
@ -446,8 +445,6 @@ pub fn prepare_ui_slices(
|
|||||||
|| (batch_image_handle != AssetId::default()
|
|| (batch_image_handle != AssetId::default()
|
||||||
&& 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)
|
|
||||||
!= 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;
|
||||||
@ -457,7 +454,6 @@ 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.extracted_camera_entity,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
batches.push((item.entity(), new_batch));
|
batches.push((item.entity(), new_batch));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user