1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use crate::prelude::*;
#[derive(PartialEq, Clone, Debug)]
/// An analytical light.
pub struct AnalyticalLight {
pub light : Light,
}
impl AnalyticalLight {
/// Creates a spherical light based on its position, radius and emission.
pub fn spherical(position: F3, radius: F, emission: F3) -> Self {
let light = Light {
light_type : LightType::Spherical,
position : position,
emission : emission,
u : F3::zeros(),
v : F3::zeros(),
radius : radius,
area : 4.0 * crate::PI * radius * radius
};
Self {
light,
}
}
}