Skip to content
Snippets Groups Projects
Commit 49048bb9 authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Add LightData enum for storing analysis results of nodes.

parent c810fafe
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ pub mod optic_scenery; ...@@ -5,6 +5,7 @@ pub mod optic_scenery;
/// The basic structure representing an optical element /// The basic structure representing an optical element
pub mod optic_node; pub mod optic_node;
pub mod light; pub mod light;
pub mod lightdata;
pub mod optic_ports; pub mod optic_ports;
......
use crate::lightdata::LightData;
#[derive(Debug)] #[derive(Debug)]
pub struct Light { pub struct Light {
src_port: String, src_port: String,
target_port: String, target_port: String,
data: Option<LightData>
} }
impl Light { impl Light {
...@@ -9,6 +12,7 @@ impl Light { ...@@ -9,6 +12,7 @@ impl Light {
Self { Self {
src_port: src_port.into(), src_port: src_port.into(),
target_port: target_port.into(), target_port: target_port.into(),
data: None
} }
} }
pub fn src_port(&self) -> &str { pub fn src_port(&self) -> &str {
...@@ -33,6 +37,7 @@ mod test { ...@@ -33,6 +37,7 @@ mod test {
let light = Light::new("test1", "test2"); let light = Light::new("test1", "test2");
assert_eq!(light.src_port, "test1"); assert_eq!(light.src_port, "test1");
assert_eq!(light.target_port, "test2"); assert_eq!(light.target_port, "test2");
assert_eq!(light.data, None);
} }
#[test] #[test]
fn src_port() { fn src_port() {
......
#[derive(Debug, PartialEq)]
pub enum LightData {
Energy(LightDataEnergy),
Geometric(LightDataGeometric),
Fourier
}
#[derive(Debug, PartialEq)]
pub struct LightDataEnergy {
energy: f32
}
#[derive(Debug, PartialEq)]
pub struct LightDataGeometric {
ray: i32
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment