From 6d0de72e57a89a4b8fb6e23b79eea6313a331281 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Mar 2020 02:22:26 +0200 Subject: [PATCH] WIP: library: render: pathtrace: add Path struct --- pathtracer/src/render/pathtrace/mod.rs | 2 ++ pathtracer/src/render/pathtrace/path.rs | 44 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 pathtracer/src/render/pathtrace/path.rs diff --git a/pathtracer/src/render/pathtrace/mod.rs b/pathtracer/src/render/pathtrace/mod.rs index dd2cbdd..5f3e759 100644 --- a/pathtracer/src/render/pathtrace/mod.rs +++ b/pathtracer/src/render/pathtrace/mod.rs @@ -1,2 +1,4 @@ +mod path; + mod pathtracer; pub use self::pathtracer::*; diff --git a/pathtracer/src/render/pathtrace/path.rs b/pathtracer/src/render/pathtrace/path.rs new file mode 100644 index 0000000..28da0d4 --- /dev/null +++ b/pathtracer/src/render/pathtrace/path.rs @@ -0,0 +1,44 @@ +use crate::core::LightProperties; +use crate::{Point, Vector}; +use nalgebra::Unit; + +pub struct PathPoint { + pub point: Point, + pub incident: Unit, + pub normal: Unit, + pub properties: LightProperties, +} + +impl PathPoint { + pub fn new( + point: Point, + incident: Unit, + normal: Unit, + properties: LightProperties, + ) -> Self { + PathPoint { + point, + incident, + normal, + properties, + } + } +} + +pub struct Path { + pub origin: Point, + pub points: Vec, +} + +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) + } +}