Remove dead code
This commit is contained in:
parent
f9cc374ce8
commit
8a174c6c8b
|
@ -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<DirectionalLight>>,
|
|
||||||
mut added_spotlights: Query<&mut SpotLight, Added<SpotLight>>,
|
|
||||||
mut added_pointlights: Query<&mut PointLight, Added<PointLight>>,
|
|
||||||
|
|
||||||
added_ambient_proxies: Query<&BlenderBackgroundShader, Added<BlenderBackgroundShader>>,
|
|
||||||
added_shadowmap_settings: Query<&BlenderShadowSettings, Added<BlenderShadowSettings>>,
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,11 @@
|
||||||
mod lighting_replace_proxies;
|
|
||||||
use lighting_replace_proxies::*;
|
|
||||||
|
|
||||||
use bevy::pbr::NotShadowCaster;
|
use bevy::pbr::NotShadowCaster;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
pub struct LightingPlugin;
|
pub struct LightingPlugin;
|
||||||
impl Plugin for LightingPlugin {
|
impl Plugin for LightingPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.register_type::<BlenderBackgroundShader>()
|
app
|
||||||
.register_type::<BlenderShadowSettings>()
|
|
||||||
// FIXME: adding these since they are missing
|
// FIXME: adding these since they are missing
|
||||||
.register_type::<NotShadowCaster>()
|
.register_type::<NotShadowCaster>();
|
||||||
.add_systems(PreUpdate, lighting_replace_proxies);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue