From 8a174c6c8b2e728059004050cb0198278b8c7dc2 Mon Sep 17 00:00:00 2001 From: Jan Hohenheim Date: Sun, 3 Mar 2024 23:27:02 +0100 Subject: [PATCH] Remove dead code --- .../core/lighting/lighting_replace_proxies.rs | 61 ------------------- examples/common/src/core/lighting/mod.rs | 9 +-- 2 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 examples/common/src/core/lighting/lighting_replace_proxies.rs diff --git a/examples/common/src/core/lighting/lighting_replace_proxies.rs b/examples/common/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 36c5fc4..0000000 --- a/examples/common/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,61 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder, DirectionalLightShadowMap}; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct BlenderBackgroundShader { - pub color: Color, - pub brightness: f32, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct BlenderShadowSettings { - pub size: usize, -} - -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut added_pointlights: Query<&mut PointLight, Added>, - - added_ambient_proxies: Query<&BlenderBackgroundShader, Added>, - added_shadowmap_settings: Query<&BlenderShadowSettings, Added>, - - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - // light.illuminance *= 5.0; // arbitrary/ eyeballed to match the levels of Blender - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } - - for mut light in added_pointlights.iter_mut() { - // light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender - light.shadows_enabled = true; - } - - for setting in added_shadowmap_settings.iter() { - commands.insert_resource(DirectionalLightShadowMap { size: setting.size }); - } - - for ambient in added_ambient_proxies.iter() { - println!("AMBIENT {:?} {}", ambient.color, ambient.brightness); - commands.insert_resource(AmbientLight { - color: ambient.color, - brightness: ambient.brightness, // * 4000., - }); - // FIXME: does this belong here ? - commands.insert_resource(ClearColor(ambient.color * ambient.brightness)); - } -} diff --git a/examples/common/src/core/lighting/mod.rs b/examples/common/src/core/lighting/mod.rs index 87ec4d6..25ed640 100644 --- a/examples/common/src/core/lighting/mod.rs +++ b/examples/common/src/core/lighting/mod.rs @@ -1,16 +1,11 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - use bevy::pbr::NotShadowCaster; use bevy::prelude::*; pub struct LightingPlugin; impl Plugin for LightingPlugin { fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() + app // FIXME: adding these since they are missing - .register_type::() - .add_systems(PreUpdate, lighting_replace_proxies); + .register_type::(); } }