-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracting ambient light from light.rs, and creating light directory (#…
…12369) # Objective Beginning of refactoring of light.rs in bevy_pbr, as per issue #12349 Create and move light.rs to its own directory, and extract AmbientLight struct. ## Solution - moved light.rs to light/mod.rs - extracted AmbientLight struct to light/ambient_light.rs
- Loading branch information
Showing
2 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use super::*; | ||
|
||
/// An ambient light, which lights the entire scene equally. | ||
/// | ||
/// This resource is inserted by the [`PbrPlugin`] and by default it is set to a low ambient light. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Make ambient light slightly brighter: | ||
/// | ||
/// ``` | ||
/// # use bevy_ecs::system::ResMut; | ||
/// # use bevy_pbr::AmbientLight; | ||
/// fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) { | ||
/// ambient_light.brightness = 100.0; | ||
/// } | ||
/// ``` | ||
#[derive(Resource, Clone, Debug, ExtractResource, Reflect)] | ||
#[reflect(Resource)] | ||
pub struct AmbientLight { | ||
pub color: Color, | ||
/// A direct scale factor multiplied with `color` before being passed to the shader. | ||
pub brightness: f32, | ||
} | ||
|
||
impl Default for AmbientLight { | ||
fn default() -> Self { | ||
Self { | ||
color: Color::WHITE, | ||
brightness: 80.0, | ||
} | ||
} | ||
} | ||
impl AmbientLight { | ||
pub const NONE: AmbientLight = AmbientLight { | ||
color: Color::WHITE, | ||
brightness: 0.0, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters