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::*;

/// Deterministic zero-allocation PCG32 pseudo-random number generator seeded with Wang hashing.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct RtRng {
    /// Internal 64-bit PCG state register.
    #[get(type(copy))]
    pub(crate) state: u64,
    /// Odd 64-bit PCG stream selector.
    #[get(type(copy))]
    pub(crate) inc: u64,
}

/// Per-step ray telemetry counter separated into primary, shadow, and secondary bounce rays.
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct RtRayCounter {
    /// Primary camera rays cast.
    #[get(type(copy))]
    pub(crate) primary_rays: u64,
    /// Shadow and ambient-occlusion visibility rays cast.
    #[get(type(copy))]
    pub(crate) shadow_rays: u64,
    /// Secondary reflection, refraction, and indirect path bounce rays cast.
    #[get(type(copy))]
    pub(crate) bounce_rays: u64,
}

/// Single-pixel traced output pairing sanitized HDR radiance with primary G-buffer attributes for SVGF denoising.
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct RtSampleOutput {
    /// Sanitized non-negative finite HDR RGB radiance.
    #[get(type(copy))]
    pub(crate) radiance: Vec3,
    /// Primary surface base albedo (or sky radiance on miss).
    #[get(type(copy))]
    pub(crate) albedo: Vec3,
    /// Primary world-space shading normal (zero vector on miss).
    #[get(type(copy))]
    pub(crate) normal: Vec3,
    /// Primary linear hit distance in meters (`RT_SKY_DEPTH` on miss).
    #[get(type(copy))]
    pub(crate) depth: f32,
    /// Whether the primary ray intersected scene geometry.
    #[get(type(copy))]
    pub(crate) hit: bool,
}

/// Sampled outgoing BSDF scattering event used by `PathTraceIntegrator`.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub(crate) struct RtBsdfSample {
    /// Sampled world-space outgoing ray direction.
    #[get(type(copy))]
    pub(crate) wi: Vec3,
    /// Throughput multiplier `f(wo, wi) * |n·wi| / pdf` for this scattering event.
    #[get(type(copy))]
    pub(crate) weight: Vec3,
    /// Solid-angle probability density `p(wi)` (zero for Dirac delta lobes).
    #[get(type(copy))]
    pub(crate) pdf: f32,
    /// Whether the sampled event came from a Dirac delta mirror or smooth dielectric lobe.
    #[get(type(copy))]
    pub(crate) is_delta: bool,
    /// Whether the sampled ray transmits across the surface into/out of a dielectric medium.
    #[get(type(copy))]
    pub(crate) is_transmission: bool,
}

/// Recursive Whitted ray-tracing integrator supporting mirror reflections, Snell refractions with Beer-Lambert absorption, and soft multi-sample shadows.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct WhittedIntegrator {
    /// Maximum reflection/refraction recursion depth.
    #[get(type(copy))]
    pub(crate) max_depth: u32,
    /// Number of shadow rays cast per non-delta light for soft penumbrae.
    #[get(type(copy))]
    pub(crate) shadow_samples: u32,
    /// Ambient sky fill multiplier applied to shaded diffuse surfaces.
    #[get(type(copy))]
    pub(crate) ambient_scale: f32,
    /// Maximum HDR luminance clamp suppressing extreme highlights.
    #[get(type(copy))]
    pub(crate) firefly_clamp: f32,
}

/// Unbiased Monte Carlo PBR Path Tracer with GGX VNDF sampling, MIS Next-Event Estimation, Beer-Lambert dielectrics, and Russian roulette.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct PathTraceIntegrator {
    /// Maximum indirect scattering bounces per camera path.
    #[get(type(copy))]
    pub(crate) max_bounces: u32,
    /// Path depth at which Russian roulette termination activates.
    #[get(type(copy))]
    pub(crate) rr_start_bounce: u32,
    /// Maximum HDR luminance clamp preventing firefly spikes.
    #[get(type(copy))]
    pub(crate) firefly_clamp: f32,
    /// Enables explicit Next-Event Estimation direct light sampling.
    #[get(type(copy))]
    pub(crate) enable_nee: bool,
    /// Enables Multiple Importance Sampling weighting between NEE and BSDF hits.
    #[get(type(copy))]
    pub(crate) enable_mis: bool,
    /// Selects power heuristic (`beta = 2`, `true`) or balance heuristic (`beta = 1`, `false`) for MIS.
    #[get(type(copy))]
    pub(crate) use_power_heuristic: bool,
}

/// Multi-ray cosine-weighted hemisphere Ray-Traced Ambient Occlusion integrator.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct RtaoIntegrator {
    /// Number of cosine-weighted hemisphere occlusion rays cast per primary hit.
    #[get(type(copy))]
    pub(crate) sample_count: u32,
    /// Maximum occlusion test distance in meters.
    #[get(type(copy))]
    pub(crate) radius: f32,
    /// Surface normal ray offset avoiding self-occlusion.
    #[get(type(copy))]
    pub(crate) bias: f32,
}

/// Fast 1-spp hybrid interactive preview integrator emitting direct radiance plus full G-buffers for real-time camera orbit.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct HybridPreviewIntegrator {
    /// Ambient environment fill weight.
    #[get(type(copy))]
    pub(crate) ambient_scale: f32,
    /// Enables 1-sample visibility shadow rays on direct lights.
    #[get(type(copy))]
    pub(crate) shadow_enabled: bool,
    /// Maximum HDR luminance clamp.
    #[get(type(copy))]
    pub(crate) firefly_clamp: f32,
}