lights: make intensity parameter generic.

This commit is contained in:
Bill Thiede 2021-07-22 21:33:09 -07:00
parent c058d043e0
commit c500d56d4d

View File

@ -28,10 +28,13 @@ impl PointLight {
/// assert_eq!(light.position, position);
/// assert_eq!(light.intensity, intensity);
/// ```
pub fn new(position: Tuple, intensity: Color) -> PointLight {
pub fn new<C>(position: Tuple, intensity: C) -> PointLight
where
C: Into<Color>,
{
PointLight {
position,
intensity,
intensity: intensity.into(),
}
}
}