library: render: light_aggregate: add *_iter
You can iterate over the two types of lights in the aggregate: the ones implementing `SpatialLight`, and the ones that are only `Light`.
This commit is contained in:
parent
d6f5f29a2a
commit
197e8104e0
|
@ -27,6 +27,18 @@ impl LightAggregate {
|
||||||
spots,
|
spots,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ambient_lights_iter(&self) -> impl Iterator<Item = &'_ dyn Light> {
|
||||||
|
self.ambients.iter().map(|l| l as &dyn Light)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn spatial_lights_iter(&self) -> impl Iterator<Item = &'_ dyn SpatialLight> {
|
||||||
|
self.directionals
|
||||||
|
.iter()
|
||||||
|
.map(|l| l as &dyn SpatialLight)
|
||||||
|
.chain(self.points.iter().map(|l| l as &dyn SpatialLight))
|
||||||
|
.chain(self.spots.iter().map(|l| l as &dyn SpatialLight))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LightAggregate {
|
impl Default for LightAggregate {
|
||||||
|
|
Loading…
Reference in a new issue