pathtracer/pathtracer/src/texture/mod.rs
2020-03-24 21:47:09 +01:00

27 lines
653 B
Rust

//! Various texture implementations
use super::core::LinearColor;
use super::Point2D;
use serde::Deserialize;
/// All the existing `Texture` implementation.
#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
#[allow(missing_docs)]
#[enum_dispatch::enum_dispatch]
#[derive(Debug, PartialEq, Deserialize)]
pub enum TextureEnum {
#[serde(rename = "uniform")]
UniformTexture,
}
/// Represent an object's texture.
#[enum_dispatch::enum_dispatch(TextureEnum)]
pub trait Texture: std::fmt::Debug {
/// Get the color at a given texel coordinate
fn texel_color(&self, point: Point2D) -> LinearColor;
}
mod uniform;
pub use uniform::*;