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