WIP: library: render: pathtrace: add Path struct

This commit is contained in:
Bruno BELANYI 2020-03-30 02:22:26 +02:00
parent a200a839b6
commit 6d0de72e57
2 changed files with 46 additions and 0 deletions

View file

@ -1,2 +1,4 @@
mod path;
mod pathtracer; mod pathtracer;
pub use self::pathtracer::*; pub use self::pathtracer::*;

View file

@ -0,0 +1,44 @@
use crate::core::LightProperties;
use crate::{Point, Vector};
use nalgebra::Unit;
pub struct PathPoint {
pub point: Point,
pub incident: Unit<Vector>,
pub normal: Unit<Vector>,
pub properties: LightProperties,
}
impl PathPoint {
pub fn new(
point: Point,
incident: Unit<Vector>,
normal: Unit<Vector>,
properties: LightProperties,
) -> Self {
PathPoint {
point,
incident,
normal,
properties,
}
}
}
pub struct Path {
pub origin: Point,
pub points: Vec<PathPoint>,
}
impl Path {
pub fn new(origin: Point) -> Self {
Path {
origin,
points: Vec::new(),
}
}
pub fn push_point(&mut self, new_point: PathPoint) {
self.points.push(new_point)
}
}