somewhat fix shadows with system ordering

main
Elijah C. Voigt 2 years ago
parent 0cf4fe4fb6
commit 63ca981aa4

@ -75,10 +75,6 @@ impl Plugin for Display3dPlugin {
.run_if(just_pressed(MouseButton::Left)), .run_if(just_pressed(MouseButton::Left)),
pick_up.run_if(any_component_added::<game::Selected>()), pick_up.run_if(any_component_added::<game::Selected>()),
put_down.run_if(any_component_removed::<game::Selected>()), put_down.run_if(any_component_removed::<game::Selected>()),
setup_dissolve_materials.run_if(
any_component_added::<Handle<StandardMaterial>>()
.or_else(any_component_changed::<Handle<StandardMaterial>>()),
),
dissolve_animation.run_if(any_with_component::<Dissolving>), dissolve_animation.run_if(any_with_component::<Dissolving>),
capture_piece.run_if(any_with_component::<game::Captured>), capture_piece.run_if(any_with_component::<game::Captured>),
skip_animation skip_animation
@ -122,13 +118,20 @@ impl Plugin for Display3dPlugin {
color_grading_tweak.run_if(resource_exists::<tweak::GameTweaks>), color_grading_tweak.run_if(resource_exists::<tweak::GameTweaks>),
fog_tweak.run_if(resource_exists::<tweak::GameTweaks>), fog_tweak.run_if(resource_exists::<tweak::GameTweaks>),
bloom_tweak.run_if(resource_exists::<tweak::GameTweaks>), bloom_tweak.run_if(resource_exists::<tweak::GameTweaks>),
update_pieces.run_if(resource_exists::<tweak::GameTweaks>), ),
)
.add_systems(
Update,
setup_dissolve_materials.run_if(in_state(GameState::Intro))
.run_if(
any_component_added::<Handle<StandardMaterial>>()
.or_else(any_component_changed::<Handle<StandardMaterial>>()),
), ),
) )
.add_systems( .add_systems(
OnEnter(GameState::Play), OnEnter(GameState::Play),
( (
update_tweaks.run_if(resource_exists::<tweak::GameTweaks>), update_pieces.run_if(resource_exists::<tweak::GameTweaks>),
opening_animation opening_animation
.run_if(run_once()) .run_if(run_once())
.run_if(in_state(DisplayState::Display3d)), .run_if(in_state(DisplayState::Display3d)),
@ -1073,7 +1076,6 @@ fn setup_dissolve_materials(
base.alpha_mode = AlphaMode::Mask(0.5); base.alpha_mode = AlphaMode::Mask(0.5);
base.base_color = base.base_color.clone().with_a(0.0); base.base_color = base.base_color.clone().with_a(0.0);
debug!("Base material {:#?}", base);
let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension }); let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension });
@ -1325,7 +1327,7 @@ fn fixup_shadows(
mut point_lights: Query<&mut PointLight>, mut point_lights: Query<&mut PointLight>,
mut directional_lights: Query<&mut DirectionalLight>, mut directional_lights: Query<&mut DirectionalLight>,
) { ) {
info!("Fixing up shadows"); debug!("Fixing up shadows");
spot_lights.iter_mut().for_each(|mut l| { spot_lights.iter_mut().for_each(|mut l| {
l.shadows_enabled = true; l.shadows_enabled = true;
}); });
@ -1414,8 +1416,6 @@ fn animate_title_light_in(
} }
} }
info!("Spotlight in");
let intensity = t.fraction() * 409800.0; let intensity = t.fraction() * 409800.0;
query.iter_mut().for_each(|(e, mut v)| { query.iter_mut().for_each(|(e, mut v)| {
@ -1425,7 +1425,6 @@ fn animate_title_light_in(
children.iter_descendants(e).for_each(|c| { children.iter_descendants(e).for_each(|c| {
if let Ok(mut spot_light) = lights.get_mut(c) { if let Ok(mut spot_light) = lights.get_mut(c) {
info!("SPOTLIGHT UPDATE {:?}", spot_light);
spot_light.intensity = intensity; spot_light.intensity = intensity;
} }
}) })
@ -1456,8 +1455,6 @@ fn animate_title_light_out(
} }
} }
info!("Spotlight out");
let intensity = (1.0 - t.fraction()) * 409800.0; let intensity = (1.0 - t.fraction()) * 409800.0;
query.iter_mut().for_each(|(e, mut v)| { query.iter_mut().for_each(|(e, mut v)| {
@ -1467,7 +1464,6 @@ fn animate_title_light_out(
children.iter_descendants(e).for_each(|c| { children.iter_descendants(e).for_each(|c| {
if let Ok(mut spot_light) = lights.get_mut(c) { if let Ok(mut spot_light) = lights.get_mut(c) {
info!("SPOTLIGHT UPDATE {:?}", spot_light);
spot_light.intensity = intensity; spot_light.intensity = intensity;
} }
}) })

Loading…
Cancel
Save