diff --git a/src/render/light_aggregate.rs b/src/render/light_aggregate.rs new file mode 100644 index 0000000..c45cd4b --- /dev/null +++ b/src/render/light_aggregate.rs @@ -0,0 +1,60 @@ +use crate::light; + +#[derive(Debug, PartialEq)] +pub struct LightAggregate { + ambient_lights: Vec, + directional_lights: Vec, + point_lights: Vec, + spot_lights: Vec, +} + +impl LightAggregate { + pub fn empty() -> Self { + LightAggregate::new(vec![], vec![], vec![], vec![]) + } + + pub fn new( + ambient_lights: Vec, + directional_lights: Vec, + point_lights: Vec, + spot_lights: Vec, + ) -> Self { + LightAggregate { + ambient_lights, + directional_lights, + point_lights, + spot_lights, + } + } +} + +impl Default for LightAggregate { + fn default() -> Self { + LightAggregate::empty() + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn empty_works() { + let lights = LightAggregate::empty(); + assert_eq!( + lights, + LightAggregate { + ambient_lights: vec![], + directional_lights: vec![], + point_lights: vec![], + spot_lights: vec![], + } + ) + } + + #[test] + fn default_is_empty() { + let lights = ::default(); + assert_eq!(lights, LightAggregate::empty()) + } +} diff --git a/src/render/mod.rs b/src/render/mod.rs index 099ed81..175aa06 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -1,2 +1,5 @@ +pub mod light_aggregate; +pub use light_aggregate::*; + pub mod object; pub use object::*;