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

/// Velocity-predicted spherical lookahead volume queried by the spatial asset prefetcher.
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct SpatialPrefetchVolume {
    /// Current camera world position `[x, y, z]`.
    #[get(type(copy))]
    pub(crate) center: [f32; 3],
    /// Current camera world velocity `[vx, vy, vz]` in meters per second.
    #[get(type(copy))]
    pub(crate) velocity: [f32; 3],
    /// Lookahead horizon in seconds (typically `1.2`).
    #[get(type(copy))]
    pub(crate) lookahead_secs: f32,
    /// Spherical prefetch radius around the predicted camera focus point in meters.
    #[get(type(copy))]
    pub(crate) radius: f32,
}

/// World-space spatial anchor binding a streamable asset key hash to a 3D bounding sphere.
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct SpatialAssetAnchor {
    /// Deterministic 64-bit FNV-1a asset key hash.
    #[get(type(copy))]
    pub(crate) key_hash: u64,
    /// Asset world-space center `[x, y, z]`.
    #[get(type(copy))]
    pub(crate) position: [f32; 3],
    /// World-space bounding sphere radius in meters.
    #[get(type(copy))]
    pub(crate) bounding_radius: f32,
    /// Semantic asset decode category.
    #[get(type(copy))]
    pub(crate) kind: StreamJobKind,
    /// Target GPU bindless texture slot index (`0` for non-textures).
    #[get(type(copy))]
    pub(crate) texture_slot: u32,
    /// True when texture texels use sRGB encoding.
    #[get(type(copy))]
    pub(crate) is_srgb: bool,
}

/// Uniform 3D spatial hash index accelerating velocity-predicted lookahead prefetching and rear-frustum cancellation.
#[derive(Clone, Debug)]
pub struct SpatialPrefetchGrid {
    /// Uniform grid cell width in meters.
    pub(crate) cell_size: f32,
    /// Registered spatial asset anchors indexed by internal slot id.
    pub(crate) anchors: Vec<Option<SpatialAssetAnchor>>,
    /// O(1) mapping from 64-bit asset key hash to anchor slot index.
    pub(crate) key_to_index: HashMap<u64, usize>,
    /// 3D spatial hash cells storing overlapping anchor indices.
    pub(crate) cells: HashMap<(i32, i32, i32), Vec<usize>>,
    /// Active keys currently tracked as velocity-prefetched for trailing behind-camera cancellation.
    pub(crate) active_prefetches: HashSet<u64>,
}