From 1006a528d0ae7534ea6f4efbab9064bb975ea691 Mon Sep 17 00:00:00 2001 From: Asier Illarramendi Date: Tue, 19 Nov 2024 02:28:34 +0100 Subject: [PATCH] Rename box shadow rendering variable names (#16393) # Objective It looks like this file was created based on the `ui_texture_slice` rendering code and some variable names weren't updated. ## Solution Rename "texture slice" variable names to "box shadow". --- crates/bevy_ui/src/render/box_shadow.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index fc19dde8bf..4be209f1ed 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -1,3 +1,5 @@ +//! Box shadows rendering + use core::{hash::Hash, ops::Range}; use crate::{ @@ -133,14 +135,14 @@ impl FromWorld for BoxShadowPipeline { } #[derive(Clone, Copy, Hash, PartialEq, Eq)] -pub struct UiTextureSlicePipelineKey { +pub struct BoxShadowPipelineKey { pub hdr: bool, /// Number of samples, a higher value results in better quality shadows. pub samples: u32, } impl SpecializedRenderPipeline for BoxShadowPipeline { - type Key = UiTextureSlicePipelineKey; + type Key = BoxShadowPipelineKey; fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor { let vertex_layout = VertexBufferLayout::from_vertex_formats( @@ -333,8 +335,8 @@ pub fn extract_shadows( } pub fn queue_shadows( - extracted_ui_slicers: ResMut, - ui_slicer_pipeline: Res, + extracted_box_shadows: ResMut, + box_shadow_pipeline: Res, mut pipelines: ResMut>, mut transparent_render_phases: ResMut>, mut views: Query<(Entity, &ExtractedView, Option<&UiBoxShadowSamples>)>, @@ -342,7 +344,7 @@ pub fn queue_shadows( draw_functions: Res>, ) { let draw_function = draw_functions.read().id::(); - for (entity, extracted_shadow) in extracted_ui_slicers.box_shadows.iter() { + for (entity, extracted_shadow) in extracted_box_shadows.box_shadows.iter() { let Ok((view_entity, view, shadow_samples)) = views.get_mut(extracted_shadow.camera_entity) else { continue; @@ -354,8 +356,8 @@ pub fn queue_shadows( let pipeline = pipelines.specialize( &pipeline_cache, - &ui_slicer_pipeline, - UiTextureSlicePipelineKey { + &box_shadow_pipeline, + BoxShadowPipelineKey { hdr: view.hdr, samples: shadow_samples.copied().unwrap_or_default().0, }, @@ -384,7 +386,7 @@ pub fn prepare_shadows( mut ui_meta: ResMut, mut extracted_shadows: ResMut, view_uniforms: Res, - texture_slicer_pipeline: Res, + box_shadow_pipeline: Res, mut phases: ResMut>, mut previous_len: Local, ) { @@ -394,8 +396,8 @@ pub fn prepare_shadows( ui_meta.vertices.clear(); ui_meta.indices.clear(); ui_meta.view_bind_group = Some(render_device.create_bind_group( - "ui_texture_slice_view_bind_group", - &texture_slicer_pipeline.view_layout, + "box_shadow_view_bind_group", + &box_shadow_pipeline.view_layout, &BindGroupEntries::single(view_binding), ));