Skip to content

Commit

Permalink
rename LightShadows to ShadowsStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoskey committed Dec 7, 2024
1 parent ec87088 commit 1c5e5b6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions crates/bevy_pbr/src/light/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub struct Cascade {
}

pub fn clear_directional_light_cascades(
mut lights: Query<(&LightShadows, &mut Cascades), With<DirectionalLight>>,
mut lights: Query<(&ShadowsStyle, &mut Cascades), With<DirectionalLight>>,
) {
for (directional_light_shadows, mut cascades) in lights.iter_mut() {
if !directional_light_shadows.enabled() {
Expand All @@ -313,7 +313,7 @@ pub fn build_directional_light_cascades<P: CameraProjection + Component>(
mut lights: Query<
(
&GlobalTransform,
&LightShadows,
&ShadowsStyle,
&CascadeShadowConfig,
&mut Cascades,
),
Expand Down Expand Up @@ -453,7 +453,7 @@ fn calculate_cascade(
/// [`SpotLight`]) to control what style of shadows it casts.
#[derive(Copy, Clone, Default, Component, PartialEq, Eq, Hash, Debug, Reflect)]
#[reflect(Component, Default, Debug)]
pub enum LightShadows {
pub enum ShadowsStyle {
/// Disables all shadows for this light.
#[default]
None,
Expand Down Expand Up @@ -481,16 +481,16 @@ pub enum LightShadows {
Soft,
}

impl LightShadows {
impl ShadowsStyle {
pub fn enabled(&self) -> bool {
*self != LightShadows::None
*self != ShadowsStyle::None
}

#[inline]
#[allow(unreachable_patterns)]
pub(crate) fn if_soft(&self, num: f32) -> f32 {
match self {
LightShadows::None | LightShadows::Hard => 0.0,
ShadowsStyle::None | ShadowsStyle::Hard => 0.0,
_ => num,
}
}
Expand Down Expand Up @@ -596,7 +596,7 @@ pub fn update_directional_light_frusta(
mut views: Query<
(
&Cascades,
&LightShadows,
&ShadowsStyle,
&ViewVisibility,
&mut CascadesFrusta,
),
Expand Down Expand Up @@ -639,7 +639,7 @@ pub fn update_point_light_frusta(
Entity,
&GlobalTransform,
&PointLight,
&LightShadows,
&ShadowsStyle,
&mut CubemapFrusta,
),
Or<(Changed<GlobalTransform>, Changed<PointLight>)>,
Expand Down Expand Up @@ -693,7 +693,7 @@ pub fn update_spot_light_frusta(
Entity,
&GlobalTransform,
&SpotLight,
&LightShadows,
&ShadowsStyle,
&mut Frustum,
),
Or<(Changed<GlobalTransform>, Changed<SpotLight>)>,
Expand Down Expand Up @@ -747,7 +747,7 @@ pub fn check_dir_light_mesh_visibility(
mut commands: Commands,
mut directional_lights: Query<
(
&LightShadows,
&ShadowsStyle,
&CascadesFrusta,
&mut CascadesVisibleEntities,
Option<&RenderLayers>,
Expand Down Expand Up @@ -917,15 +917,15 @@ pub fn check_point_light_mesh_visibility(
visible_point_lights: Query<&VisibleClusterableObjects>,
mut point_lights: Query<(
&PointLight,
&LightShadows,
&ShadowsStyle,
&GlobalTransform,
&CubemapFrusta,
&mut CubemapVisibleEntities,
Option<&RenderLayers>,
)>,
mut spot_lights: Query<(
&SpotLight,
&LightShadows,
&ShadowsStyle,
&GlobalTransform,
&Frustum,
&mut VisibleMeshEntities,
Expand Down

0 comments on commit 1c5e5b6

Please sign in to comment.