pathtracer/src/material/mod.rs

27 lines
704 B
Rust
Raw Normal View History

2020-03-22 00:24:26 +01:00
//! Various material implementations
use super::core::LightProperties;
use super::Point2D;
use serde::Deserialize;
/// All the existing `Material` implementation.
#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
2020-03-22 00:24:26 +01:00
#[allow(missing_docs)]
#[enum_dispatch::enum_dispatch]
#[derive(Debug, PartialEq, Deserialize)]
pub enum MaterialEnum {
#[serde(rename = "uniform")]
UniformMaterial,
}
/// Represent the physical light properties of an object in the scene;
#[enum_dispatch::enum_dispatch(MaterialEnum)]
pub trait Material: std::fmt::Debug {
/// Get the physical properties at a point.
fn properties(&self, point: Point2D) -> LightProperties;
}
pub mod uniform;
pub use uniform::*;