library: document texture module

This commit is contained in:
Antoine Martin 2020-03-22 00:34:01 +01:00
parent 94ab40413a
commit ce1b8eeaaa
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,5 @@
//! Various texture implementations
use super::core::LinearColor; use super::core::LinearColor;
use super::Point2D; use super::Point2D;
use serde::Deserialize; use serde::Deserialize;
@ -5,6 +7,7 @@ use serde::Deserialize;
/// All the existing `Texture` implementation. /// All the existing `Texture` implementation.
#[serde(tag = "type")] #[serde(tag = "type")]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
#[allow(missing_docs)]
#[enum_dispatch::enum_dispatch] #[enum_dispatch::enum_dispatch]
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub enum TextureEnum { pub enum TextureEnum {

View file

@ -10,6 +10,16 @@ pub struct UniformTexture {
} }
impl UniformTexture { impl UniformTexture {
/// Creates a new `UniformTexture`.
///
/// # Examples
///
/// ```
/// # use pathtracer::texture::UniformTexture;
/// # use pathtracer::core::LinearColor;
/// #
/// let uni_text = UniformTexture::new(LinearColor::new(0.5, 0.5, 0.5));
/// ```
pub fn new(color: LinearColor) -> Self { pub fn new(color: LinearColor) -> Self {
UniformTexture { color } UniformTexture { color }
} }