euv-core 0.57.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::*;

/// Parametric configuration controlling multi-noise synthesis, terracing, and erosion of a `HeightfieldTerrain`.
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct TerrainConfig {
    /// Grid resolution along the X axis (`2..=512`).
    #[get(type(copy))]
    pub(crate) grid_x: u32,
    /// Grid resolution along the Z axis (`2..=512`).
    #[get(type(copy))]
    pub(crate) grid_z: u32,
    /// Total world-space width along the X axis.
    #[get(type(copy))]
    pub(crate) world_size_x: f32,
    /// Total world-space depth along the Z axis.
    #[get(type(copy))]
    pub(crate) world_size_z: f32,
    /// Vertical elevation amplitude multiplier.
    #[get(type(copy))]
    pub(crate) height_scale: f32,
    /// Deterministic 64-bit random seed for noise and droplet erosion.
    #[get(type(copy))]
    pub(crate) seed: u64,
    /// Number of fractal Brownian motion noise octaves (`1..=8`).
    #[get(type(copy))]
    pub(crate) fbm_octaves: u32,
    /// Base spatial frequency for multi-octave terrain noise.
    #[get(type(copy))]
    pub(crate) fbm_frequency: f32,
    /// Frequency multiplier per octave.
    #[get(type(copy))]
    pub(crate) fbm_lacunarity: f32,
    /// Amplitude decay multiplier per octave.
    #[get(type(copy))]
    pub(crate) fbm_persistence: f32,
    /// Blend weight for sharp ridged multifractal mountain crests (`0.0..=1.0`).
    #[get(type(copy))]
    pub(crate) ridged_weight: f32,
    /// Blend weight for Worley cellular canyon carving (`0.0..=1.0`).
    #[get(type(copy))]
    pub(crate) canyon_weight: f32,
    /// Number of vertical plateau terrace steps (`0` disables terracing).
    #[get(type(copy))]
    pub(crate) terrace_steps: u32,
    /// Blending strength of terracing plateaus (`0.0..=1.0`).
    #[get(type(copy))]
    pub(crate) terrace_strength: f32,
    /// Number of simulated hydraulic rain droplets (`0` skips hydraulic erosion).
    #[get(type(copy))]
    pub(crate) hydraulic_droplets: u32,
    /// Number of thermal talus slippage iterations (`0` skips thermal erosion).
    #[get(type(copy))]
    pub(crate) thermal_iterations: u32,
    /// Maximum stable talus slope angle in radians for thermal erosion.
    #[get(type(copy))]
    pub(crate) talus_angle: f32,
    /// Biome mask and vertex coloring preset.
    #[get(type(copy))]
    pub(crate) biome: TerrainBiome,
}

/// Generated heightfield terrain storing elevations, splat weights, vertex colors, and normal map bytes.
#[derive(Clone, Data, Debug, PartialEq)]
pub struct HeightfieldTerrain {
    /// Grid resolution along X.
    #[get(type(copy))]
    pub(crate) grid_x: u32,
    /// Grid resolution along Z.
    #[get(type(copy))]
    pub(crate) grid_z: u32,
    /// Total world-space width along X.
    #[get(type(copy))]
    pub(crate) world_size_x: f32,
    /// Total world-space depth along Z.
    #[get(type(copy))]
    pub(crate) world_size_z: f32,
    /// Row-major height samples (`len == grid_x * grid_z`).
    pub(crate) heights: Vec<f32>,
    /// Per-vertex normalized splat weights `[grass, rock, snow, sand]`.
    pub(crate) splat_weights: Vec<[f32; 4]>,
    /// Per-vertex RGBA8 slope/altitude biome colors.
    pub(crate) vertex_colors: Vec<[u8; 4]>,
    /// Row-major RGBA8 normal map texture matching `(grid_x, grid_z)`.
    pub(crate) normal_map: Vec<[u8; 4]>,
    /// Minimum finite elevation present in `heights`.
    #[get(type(copy))]
    pub(crate) min_height: f32,
    /// Maximum finite elevation present in `heights`.
    #[get(type(copy))]
    pub(crate) max_height: f32,
}