euv-core 0.56.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Physical BSDF surface shading family evaluated by ray tracing integrators.
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
pub enum RtMaterialKind {
    /// Matte diffuse surface (Lambert or Oren-Nayar micro-roughness).
    #[default]
    Diffuse,
    /// GGX microfacet metallic conductor with colored Fresnel reflectance.
    Metal,
    /// Refractive dielectric (glass or water) with Fresnel, Snell refraction, TIR, and Beer-Lambert absorption.
    Dielectric,
    /// Unified Disney/GGX Principled BSDF combining diffuse, specular, metallic, clearcoat, and transmission.
    Principled,
    /// Pure area light emitter radiating HDR energy without reflecting incident light.
    Emissive,
}

/// Physical light emitter geometry supported by direct sampling, soft shadows, and MIS.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RtLightKind {
    /// Infinite directional light (sun/moon) with optional cone angular radius for soft penumbrae.
    Directional {
        /// Unit direction pointing from the scene toward the light source.
        direction: Vec3,
        /// Cone half-angle in radians (`0.0` produces crisp shadows; `~0.00465` matches solar disk).
        angular_radius_rad: f32,
    },
    /// Omnidirectional spherical point light with inverse-square falloff and optional emitter radius.
    Point {
        /// World-space light center.
        position: Vec3,
        /// Spherical emitter radius in meters (`0.0` for delta point light).
        radius: f32,
    },
    /// Focused cone spotlight with smooth inner-to-outer angular falloff and optional emitter radius.
    Spot {
        /// World-space emitter center.
        position: Vec3,
        /// Unit beam direction pointing away from the emitter.
        direction: Vec3,
        /// Cosine of the inner full-intensity cone half-angle.
        inner_cos: f32,
        /// Cosine of the outer cutoff cone half-angle.
        outer_cos: f32,
        /// Spherical emitter radius in meters.
        radius: f32,
    },
    /// Physically based rectangular area emitter supporting exact uniform surface sampling and MIS.
    RectArea {
        /// World-space rectangle center.
        position: Vec3,
        /// Unit tangent axis along rectangle width.
        right: Vec3,
        /// Unit bitangent axis along rectangle height.
        up: Vec3,
        /// Unit emitting normal direction.
        normal: Vec3,
        /// Total rectangle width in meters.
        width: f32,
        /// Total rectangle height in meters.
        height: f32,
        /// Whether both sides of the rectangle emit radiance.
        two_sided: bool,
    },
    /// Physically based circular disk area emitter supporting exact uniform disk sampling and MIS.
    DiskArea {
        /// World-space disk center.
        position: Vec3,
        /// Unit tangent axis in the disk plane.
        right: Vec3,
        /// Unit bitangent axis in the disk plane.
        up: Vec3,
        /// Unit emitting normal direction.
        normal: Vec3,
        /// Disk radius in meters.
        radius: f32,
        /// Whether both sides of the disk emit radiance.
        two_sided: bool,
    },
}

/// Background environment dome evaluated when rays escape all scene geometry.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RtEnvironment {
    /// Completely dark background (zero radiance).
    Black,
    /// Uniform constant HDR radiance sphere (useful for white-furnace energy conservation tests).
    Solid(Vec3),
    /// Physical sky-to-ground atmospheric gradient with optional solar disk radiance.
    GradientSky {
        /// Zenith sky HDR color at `+Y`.
        zenith: Vec3,
        /// Horizon sky HDR color at `y = 0`.
        horizon: Vec3,
        /// Ground hemisphere HDR bounce color at `-Y`.
        ground: Vec3,
        /// Unit direction pointing toward the sun disk.
        sun_dir: Vec3,
        /// HDR radiance emitted inside the sun angular disk.
        sun_color: Vec3,
        /// Sun angular half-angle in radians.
        sun_angular_radius_rad: f32,
    },
}