use bevy_camera::Camera;1use bevy_color::Color;2use bevy_ecs::prelude::*;3use bevy_reflect::prelude::*;45/// An ambient light, which lights the entire scene equally.6///7/// This resource is inserted by the [`LightPlugin`] and by default it is set to a low ambient light.8///9/// It can also be added to a camera to override the resource (or default) ambient for that camera only.10///11/// # Examples12///13/// Make ambient light slightly brighter:14///15/// ```16/// # use bevy_ecs::system::ResMut;17/// # use bevy_light::AmbientLight;18/// fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) {19/// ambient_light.brightness = 100.0;20/// }21/// ```22///23/// [`LightPlugin`]: crate::LightPlugin24#[derive(Resource, Component, Clone, Debug, Reflect)]25#[reflect(Resource, Component, Debug, Default, Clone)]26#[require(Camera)]27pub struct AmbientLight {28pub color: Color,2930/// A direct scale factor multiplied with `color` before being passed to the shader.31///32/// After applying this multiplier, the resulting value should be in units of [cd/m^2].33///34/// [cd/m^2]: https://en.wikipedia.org/wiki/Candela_per_square_metre35pub brightness: f32,3637/// Whether this ambient light has an effect on meshes with lightmaps.38///39/// Set this to false if your lightmap baking tool bakes the ambient light40/// into the lightmaps, to avoid rendering that light twice.41///42/// By default, this is set to true.43pub affects_lightmapped_meshes: bool,44}4546impl Default for AmbientLight {47fn default() -> Self {48Self {49color: Color::WHITE,50brightness: 80.0,51affects_lightmapped_meshes: true,52}53}54}5556impl AmbientLight {57pub const NONE: AmbientLight = AmbientLight {58color: Color::WHITE,59brightness: 0.0,60affects_lightmapped_meshes: true,61};62}636465