move global illumination from world.rs to camera.rs
This commit is contained in:
parent
71d926ec0f
commit
5c50ac33e3
|
@ -3,9 +3,11 @@ use bevy::input::mouse::MouseMotion;
|
|||
use bevy::window::PrimaryWindow;
|
||||
use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings};
|
||||
use bevy::core_pipeline::tonemapping::Tonemapping;
|
||||
use bevy::pbr::CascadeShadowConfigBuilder;
|
||||
use bevy::transform::TransformSystem;
|
||||
use bevy::math::DVec3;
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
use std::f32::consts::PI;
|
||||
use crate::{settings, audio, actor};
|
||||
|
||||
pub struct CameraPlugin;
|
||||
|
@ -46,6 +48,23 @@ pub fn setup_camera(
|
|||
..default()
|
||||
},
|
||||
));
|
||||
|
||||
// Add Light from the Sun
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
illuminance: 1000.0,
|
||||
shadows_enabled: false,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_rotation_y(PI/2.0)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 7.0,
|
||||
maximum_distance: 25.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
||||
pub fn sync_camera_to_player(
|
||||
|
|
18
src/world.rs
18
src/world.rs
|
@ -1,6 +1,5 @@
|
|||
use crate::{actor, nature, settings};
|
||||
use bevy::prelude::*;
|
||||
use bevy::pbr::CascadeShadowConfigBuilder;
|
||||
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
|
||||
use bevy::math::DVec3;
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
|
@ -180,23 +179,6 @@ pub fn setup(
|
|||
Position::from_xyz(0.0, 0.0, 0.0),
|
||||
Rotation::from(Quat::from_rotation_z(1f32.to_radians())),
|
||||
));
|
||||
|
||||
// Add Light from the Sun
|
||||
commands.spawn(DirectionalLightBundle {
|
||||
directional_light: DirectionalLight {
|
||||
illuminance: 1000.0,
|
||||
shadows_enabled: false,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_rotation(Quat::from_rotation_y(PI/2.0)),
|
||||
cascade_shadow_config: CascadeShadowConfigBuilder {
|
||||
first_cascade_far_bound: 7.0,
|
||||
maximum_distance: 25.0,
|
||||
..default()
|
||||
}
|
||||
.into(),
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
||||
fn handle_cheats(
|
||||
|
|
Loading…
Reference in a new issue