library: light: add SpatialLight trait definition

This commit is contained in:
Bruno BELANYI 2020-03-16 15:20:13 +01:00
parent 20d9103d39
commit 30c48ea021

View file

@ -1,8 +1,14 @@
use super::core::LinearColor; use super::core::LinearColor;
use super::Point; use super::{Point, Vector};
/// Represent a light in the scene being rendered. /// Represent a light in the scene being rendered.
pub trait Light: std::fmt::Debug { pub trait Light: std::fmt::Debug {
/// Get the illumination of that light on that point. /// Get the illumination of that light on that point.
fn illumination(&self, point: &Point) -> LinearColor; fn illumination(&self, point: &Point) -> LinearColor;
} }
/// Represent a light which has an abstract position in the scene being rendered.
pub trait SpatialLight: Light {
/// Get a unit vector from the origin to the position of the light, and its distance
fn to_source(&self, origin: &Point) -> (Vector, f64);
}