2022-07-28 21:39:00 -07:00

24 lines
428 B
Rust

use crate::{texture::Texture, vec3::Vec3};
#[derive(Debug, PartialEq)]
pub struct ConstantTexture {
color: Vec3,
}
impl ConstantTexture {
pub fn new<V>(color: V) -> ConstantTexture
where
V: Into<Vec3>,
{
ConstantTexture {
color: color.into(),
}
}
}
impl Texture for ConstantTexture {
fn value(&self, _u: f32, _v: f32, _p: Vec3) -> Vec3 {
self.color
}
}