From 614217d33e139b556b91733bcad6704d63b26964 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 22 Mar 2020 00:24:26 +0100 Subject: [PATCH] library: document material module --- src/material/mod.rs | 3 +++ src/material/uniform.rs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/material/mod.rs b/src/material/mod.rs index 8be6f84..4c06ddb 100644 --- a/src/material/mod.rs +++ b/src/material/mod.rs @@ -1,3 +1,5 @@ +//! Various material implementations + use super::core::LightProperties; use super::Point2D; use serde::Deserialize; @@ -5,6 +7,7 @@ use serde::Deserialize; /// All the existing `Material` implementation. #[serde(tag = "type")] #[serde(rename_all = "lowercase")] +#[allow(missing_docs)] #[enum_dispatch::enum_dispatch] #[derive(Debug, PartialEq, Deserialize)] pub enum MaterialEnum { diff --git a/src/material/uniform.rs b/src/material/uniform.rs index 73060b7..93fff05 100644 --- a/src/material/uniform.rs +++ b/src/material/uniform.rs @@ -11,6 +11,22 @@ pub struct UniformMaterial { } impl UniformMaterial { + /// Creates a new `UniformMaterial`. + /// + /// # Examples + /// + /// ``` + /// # use pathtracer::material::UniformMaterial; + /// # use pathtracer::core::{LightProperties, LinearColor}; + /// # + /// let uni_mat = UniformMaterial::new( + /// LightProperties::new( + /// LinearColor::new(1.0, 0.0, 0.0), // diffuse component + /// LinearColor::new(0.0, 0.0, 0.0), // specular component + /// None, + /// ), + /// ); + /// ``` pub fn new(properties: LightProperties) -> Self { UniformMaterial { properties } }