aboutsummaryrefslogtreecommitdiff
path: root/src/core/spectrum.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/spectrum.rs')
-rw-r--r--src/core/spectrum.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/spectrum.rs b/src/core/spectrum.rs
index c72a251..fb82a9e 100644
--- a/src/core/spectrum.rs
+++ b/src/core/spectrum.rs
@@ -12,9 +12,13 @@ pub struct Spectrum {
}
impl Spectrum {
- fn new_rgb(r: Float, g: Float, b: Float) -> Spectrum {
+ pub fn new_rgb(r: Float, g: Float, b: Float) -> Spectrum {
Spectrum { c: [r, g, b] }
}
+
+ pub fn to_rgb(&self, scale: Float) -> (Float, Float, Float) {
+ (self.c[0] * scale, self.c[1] * scale, self.c[2] * scale)
+ }
}
impl std::ops::Mul<Float> for &Spectrum {