Trait truster::texture::Texture [−][src]
pub trait Texture { fn color_at(&self, point: Tuple) -> Color; fn transform(&self) -> &Matrix; fn transform_inverse(&self) -> &Matrix; fn set_transform(&mut self, transform: Matrix); fn color_at_shape(&self, point: Tuple, shape: Rc<dyn Shape>) -> Color { ... } fn color_at_texture(&self, point: Tuple) -> Color { ... } }
Expand description
A basic texture implementation. There is no UV mapping or anything like that. The method
Texture::color_at should just map a point in 3D space to a color. Textures can be
transformed, so color_at_shape should return the color as if the texture were not transformed.
Texture::color_at_shape will perform the transformation, so it should not be overwritten.
Texture::transform should return the texture transform matrix,
Texture::transform_inverse should return it’s inverse. Texture::set_transform should set
the texture transform to be transform
.
Required methods
fn transform_inverse(&self) -> &Matrix
fn set_transform(&mut self, transform: Matrix)
Provided methods
fn color_at_texture(&self, point: Tuple) -> Color