cyber_rider/src/lights.rs

47 lines
1.1 KiB
Rust
Raw Normal View History

2023-03-10 19:45:01 +00:00
use bevy::{pbr::CascadeShadowConfigBuilder, prelude::*};
use crate::planet::PLANET_RADIUS;
2024-06-13 21:50:41 +00:00
pub const LIGHT_RANGE: f32 = 900.0;
2022-01-19 23:07:24 +00:00
fn spawn_static_lights(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
let pink_light = PointLight {
2024-06-15 21:18:17 +00:00
intensity: 10_00.0,
2022-01-19 23:07:24 +00:00
range: LIGHT_RANGE,
2024-06-13 21:50:41 +00:00
color: Color::WHITE,
radius: 10.0,
2022-01-19 23:07:24 +00:00
shadows_enabled: true,
..Default::default()
};
commands.insert_resource(AmbientLight {
color: Color::WHITE,
2024-06-13 23:29:50 +00:00
brightness: 100.0,
2022-01-19 23:07:24 +00:00
});
2022-01-19 04:08:47 +00:00
2024-06-13 21:50:41 +00:00
// let _cascade_shadow_config = CascadeShadowConfigBuilder {
// first_cascade_far_bound: 0.3,
// maximum_distance: 3.0,
// ..default()
// }
// .build();
2023-03-10 19:45:01 +00:00
// up light
2024-06-13 21:50:41 +00:00
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(0.0, 100.0, 0.0),
point_light: pink_light,
..Default::default()
});
}
2022-01-14 00:14:08 +00:00
pub struct CyberSpaceLightsPlugin;
impl Plugin for CyberSpaceLightsPlugin {
fn build(&self, app: &mut App) {
2024-06-13 20:00:39 +00:00
app.add_systems(Startup, spawn_static_lights);
2022-01-14 00:14:08 +00:00
}
}