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

/// Analytic geometric primitive intersected directly without triangle tessellation.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RtPrimitiveShape {
    /// Solid sphere centered at `center` with positive `radius`.
    Sphere {
        /// World-space sphere center.
        center: Vec3,
        /// Sphere radius in meters.
        radius: f32,
    },
    /// Infinite plane passing through `point` with unit outward `normal`.
    Plane {
        /// Reference point lying on the plane.
        point: Vec3,
        /// Unit plane normal.
        normal: Vec3,
    },
    /// Axis-aligned solid box bounded by `[min, max]`.
    Box {
        /// Minimum box corner.
        min: Vec3,
        /// Maximum box corner.
        max: Vec3,
    },
    /// Planar circular disk centered at `center` with unit `normal` and `radius`.
    Disk {
        /// World-space disk center.
        center: Vec3,
        /// Unit disk surface normal.
        normal: Vec3,
        /// Disk radius in meters.
        radius: f32,
    },
    /// Parallelogram or rectangular quad defined by `corner` and spanning edges `edge_u` and `edge_v`.
    Quad {
        /// Reference corner position in world space.
        corner: Vec3,
        /// First spanning edge vector from `corner`.
        edge_u: Vec3,
        /// Second spanning edge vector from `corner`.
        edge_v: Vec3,
    },
    /// Y-axis aligned finite cylinder centered at `center` with `radius`, `half_height`, and optional endcaps.
    Cylinder {
        /// World-space cylinder center.
        center: Vec3,
        /// Cylinder radius in the XZ plane.
        radius: f32,
        /// Half-height along the Y axis.
        half_height: f32,
        /// Whether top and bottom circular caps are closed.
        capped: bool,
    },
}

/// Signed distance field (SDF) primitive or constructive solid geometry (CSG) operator node.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RtSdfOp {
    /// Sphere SDF centered at `center` with `radius`.
    Sphere {
        /// Sphere center in world space.
        center: Vec3,
        /// Sphere radius.
        radius: f32,
    },
    /// Rounded axis-aligned box SDF centered at `center`.
    Box {
        /// Box center in world space.
        center: Vec3,
        /// Positive half-extents along `(X, Y, Z)`.
        half_extents: Vec3,
        /// Corner rounding radius (`0.0` for sharp box).
        rounding: f32,
    },
    /// Torus SDF lying in the XZ plane around `center`.
    Torus {
        /// Torus center in world space.
        center: Vec3,
        /// Distance from torus center to tube centerline.
        major_radius: f32,
        /// Tube cross-section radius.
        minor_radius: f32,
    },
    /// Capsule SDF between endpoints `start` and `end` with `radius`.
    Capsule {
        /// First segment endpoint.
        start: Vec3,
        /// Second segment endpoint.
        end: Vec3,
        /// Capsule radius.
        radius: f32,
    },
    /// Exact CSG union (`min(left, right)`).
    Union {
        /// Index of the left child node in `SdfSphereTracer::ops`.
        left: u32,
        /// Index of the right child node in `SdfSphereTracer::ops`.
        right: u32,
    },
    /// Exact CSG subtraction (`max(base, -cutout)`).
    Subtract {
        /// Index of the base solid node.
        base: u32,
        /// Index of the subtracted volume node.
        cutout: u32,
    },
    /// Exact CSG intersection (`max(left, right)`).
    Intersect {
        /// Index of the left child node.
        left: u32,
        /// Index of the right child node.
        right: u32,
    },
    /// Polynomial smooth minimum union blending `left` and `right` with radius `smoothness`.
    SmoothUnion {
        /// Index of the left child node.
        left: u32,
        /// Index of the right child node.
        right: u32,
        /// Positive blend radius.
        smoothness: f32,
    },
    /// Polynomial smooth subtraction carving `cutout` from `base` with radius `smoothness`.
    SmoothSubtract {
        /// Index of the base solid node.
        base: u32,
        /// Index of the subtracted volume node.
        cutout: u32,
        /// Positive blend radius.
        smoothness: f32,
    },
}