Annotated code

This commit is contained in:
STP
2023-11-26 19:02:27 -05:00
parent 8ab9be8056
commit eeae148fd5
11 changed files with 294 additions and 174 deletions

View File

@@ -3,13 +3,15 @@ use nalgebra::{Point3, Vector3};
#[derive(Clone)]
pub struct Light {
pub position: Point3<f64>,
pub colour: Vector3<f64>,
pub falloff: Vector3<f64>,
pub colour: Vector3<f32>,
pub falloff: Vector3<f32>,
pub ambient: bool,
}
impl Light {
pub fn new(position: Point3<f64>, colour: Vector3<f64>, falloff: Vector3<f64>) -> Self {
let colour = colour.cast();
let falloff = falloff.cast();
Light {
position,
colour,
@@ -20,7 +22,7 @@ impl Light {
pub fn ambient(colour: Vector3<f64>) -> Self {
Light {
position: Point3::new(0.0, 0.0, 0.0),
colour,
colour: colour.cast(),
falloff: Vector3::new(0.0, 0.0, 0.0),
ambient: true,
}