library: document material module
This commit is contained in:
parent
2aed964101
commit
614217d33e
|
@ -1,3 +1,5 @@
|
||||||
|
//! Various material implementations
|
||||||
|
|
||||||
use super::core::LightProperties;
|
use super::core::LightProperties;
|
||||||
use super::Point2D;
|
use super::Point2D;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -5,6 +7,7 @@ use serde::Deserialize;
|
||||||
/// All the existing `Material` implementation.
|
/// All the existing `Material` 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 MaterialEnum {
|
pub enum MaterialEnum {
|
||||||
|
|
|
@ -11,6 +11,22 @@ pub struct UniformMaterial {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
pub fn new(properties: LightProperties) -> Self {
|
||||||
UniformMaterial { properties }
|
UniformMaterial { properties }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue