46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
use bevy::{pbr::CascadeShadowConfigBuilder, prelude::*};
|
|
|
|
use crate::planet::PLANET_RADIUS;
|
|
|
|
pub const LIGHT_RANGE: f32 = 900.0;
|
|
|
|
fn spawn_static_lights(
|
|
mut commands: Commands,
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
) {
|
|
let pink_light = PointLight {
|
|
intensity: 10_00.0,
|
|
range: LIGHT_RANGE,
|
|
color: Color::WHITE,
|
|
radius: 10.0,
|
|
shadows_enabled: true,
|
|
..Default::default()
|
|
};
|
|
|
|
commands.insert_resource(AmbientLight {
|
|
color: Color::WHITE,
|
|
brightness: 100.0,
|
|
});
|
|
|
|
// let _cascade_shadow_config = CascadeShadowConfigBuilder {
|
|
// first_cascade_far_bound: 0.3,
|
|
// maximum_distance: 3.0,
|
|
// ..default()
|
|
// }
|
|
// .build();
|
|
|
|
// up light
|
|
commands.spawn(PointLightBundle {
|
|
transform: Transform::from_xyz(0.0, 100.0, 0.0),
|
|
point_light: pink_light,
|
|
..Default::default()
|
|
});
|
|
}
|
|
|
|
pub struct CyberSpaceLightsPlugin;
|
|
impl Plugin for CyberSpaceLightsPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_systems(Startup, spawn_static_lights);
|
|
}
|
|
}
|