euv_engine/lighting/enum.rs
1use super::*;
2
3/// Describes the kind of light source being represented.
4///
5/// ## Direction convention
6///
7/// Every direction a [`Light`] carries is measured **toward the light
8/// source**, with one deliberate exception:
9///
10/// - [`LightType::Directional`]: `direction` points from the surface
11/// toward the light (sourceward), so a surface is lit when
12/// `dot(normal, direction) > 0`.
13/// - [`LightType::Point`]: the direction is derived from
14/// `position - surface_point` at shading time and is also sourceward;
15/// the light stores no direction of its own.
16/// - [`LightType::Spot`]: `direction` points **outward along the cone
17/// axis**, away from the lamp, i.e. the way the light travels. The
18/// surface→light vector used for shading is its negation. This is the
19/// opposite sense from the other two kinds, so a spot light's cone axis
20/// and a spot light's shading direction are *not* the same vector.
21#[derive(Clone, Copy, Debug, Default, PartialEq)]
22pub enum LightType {
23 /// An infinitely distant directional light (e.g. sunlight).
24 ///
25 /// The `direction` field carries the unit vector pointing from the
26 /// shaded surface toward the light source, matching the convention of
27 /// [`LightType::Point`].
28 #[default]
29 Directional,
30 /// A positional point light with inverse-square falloff.
31 ///
32 /// The light radiates in every direction; the surface→light vector is
33 /// computed from `position` at shading time.
34 Point,
35 /// A positional spotlight with a cone defined by a unit direction and a
36 /// half-angle whose cosine is stored in the light's `spot_cos` field.
37 ///
38 /// The `direction` field is the cone **axis pointing outward** from the
39 /// lamp, in the direction the beam travels — the opposite sense to the
40 /// shading direction derived from `position`.
41 Spot,
42}
43
44/// Describes the shading model applied to a [`Material`] during lighting and
45/// ray-tracing evaluation.
46#[derive(Clone, Copy, Debug, Default, PartialEq)]
47pub enum MaterialKind {
48 /// Pure Lambertian diffuse, no specular highlight.
49 ///
50 /// [`LightingUniforms::shade`] evaluates the diffuse term only.
51 #[default]
52 Lambert,
53 /// Lambertian diffuse plus a Phong specular highlight.
54 ///
55 /// [`LightingUniforms::shade`] evaluates the diffuse term plus a specular
56 /// lobe driven by the material's `specular` and `shininess` fields.
57 Phong,
58 /// Diffuse with a Schlick fresnel rim, and no separate specular lobe.
59 ///
60 /// ## This is not a full PBR model
61 ///
62 /// A physically based renderer would evaluate a microfacet BRDF with
63 /// roughness-driven geometry, a metallic / dielectric split, multiple
64 /// scattering, and per-channel Fresnel. None of that is implemented here.
65 /// What this variant actually does is scale the Lambertian diffuse term
66 /// by [`apply_schlick_fresnel`], which brightens grazing angles and adds
67 /// a rim. That is a *deliberate, documented approximation* rather than
68 /// the physically based model the variant name suggests.
69 ///
70 /// The variant is kept rather than removed so callers can branch on
71 /// material model without a breaking change when a real BRDF lands. Note
72 /// that `specular` and `shininess` are ignored on this path: the diffuse
73 /// fresnel blend replaces them entirely.
74 Pbr,
75}