Skip to main content

euv_engine/lighting/
enum.rs

1use super::*;
2
3/// Describes the kind of light source being represented.
4#[derive(Clone, Copy, Debug, Default, PartialEq)]
5pub enum LightType {
6    /// An infinitely distant directional light (e.g. sunlight). The `direction`
7    /// field carries the unit vector pointing away from the light source.
8    #[default]
9    Directional,
10    /// A positional point light with inverse-square falloff.
11    Point,
12    /// A positional spotlight with a cone defined by a unit direction and a
13    /// half-angle whose cosine is stored in the light's `spot_cos` field.
14    Spot,
15}
16
17/// Describes the shading model applied to a [`Material`] during lighting and
18/// ray-tracing evaluation.
19#[derive(Clone, Copy, Debug, Default, PartialEq)]
20pub enum MaterialKind {
21    /// Pure Lambertian diffuse, no specular highlight.
22    ///
23    /// [`LightingUniforms::shade`] evaluates the diffuse term only.
24    #[default]
25    Lambert,
26    /// Lambertian diffuse plus Blinn-Phong style specular highlight.
27    ///
28    /// [`LightingUniforms::shade`] evaluates the diffuse term plus a specular
29    /// lobe driven by the material's `specular` and `shininess` fields.
30    Phong,
31    /// Diffuse with a Schlick fresnel rim, and no separate specular lobe.
32    ///
33    /// ## This is not a full PBR model
34    ///
35    /// A physically based renderer would evaluate a microfacet BRDF with
36    /// roughness-driven geometry, a metallic / dielectric split, multiple
37    /// scattering, and per-channel Fresnel. None of that is implemented here.
38    /// What this variant actually does is scale the Lambertian diffuse term
39    /// by [`apply_schlick_fresnel`], which brightens grazing angles and adds
40    /// a rim. That is a *deliberate, documented approximation* rather than
41    /// the physically based model the variant name suggests.
42    ///
43    /// The variant is kept rather than removed so callers can branch on
44    /// material model without a breaking change when a real BRDF lands. Note
45    /// that `specular` and `shininess` are ignored on this path: the diffuse
46    /// fresnel blend replaces them entirely.
47    Pbr,
48}