diff options
author | lamp | 2023-03-05 21:45:56 +0000 |
---|---|---|
committer | lamp | 2023-03-05 21:45:56 +0000 |
commit | 78ddaff5855bf8446adef9e18eb0d7b7ddcee52a (patch) | |
tree | 0d0e93cfa28751a2f96518eeb231cf715958e1fa /src/texture/solid_color.rs |
init
Diffstat (limited to 'src/texture/solid_color.rs')
-rw-r--r-- | src/texture/solid_color.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/texture/solid_color.rs b/src/texture/solid_color.rs new file mode 100644 index 0000000..3af46ca --- /dev/null +++ b/src/texture/solid_color.rs @@ -0,0 +1,20 @@ +use super::Texture; +use crate::{vec3::Color, vec3::Point3}; + +pub struct SolidColor { + pub color_value: Color, +} + +impl SolidColor { + pub fn from_color(color_value: Color) -> Self { + Self { + color_value, + } + } +} + +impl Texture for SolidColor { + fn value(&self, _: f64, _: f64, _: &Point3) -> Color { + self.color_value.clone() + } +} |