euv-core 0.48.3

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

/// Interior mutable state of `GyroLiquidGameScene` uniting SI PBF physics, double-buffered snapshots, optical rendering, and live sensor binding.
#[derive(CustomDebug, Data)]
pub(crate) struct GyroLiquidSceneState {
    /// Core SI Position-Based Fluids solver.
    pub(crate) solver: LiquidFluidSolver,
    /// Double-buffered zero-allocation simulation snapshot store for smooth 240/360/480Hz+ interpolation.
    pub(crate) snapshots: DoubleBufferedSnapshot<FluidSimSnapshot>,
    /// Photorealistic optical liquid RGBA8 renderer.
    pub(crate) renderer: LiquidOpticalRenderer,
    /// Bounded zero-allocation RGBA8 output frame pool.
    #[debug(skip)]
    pub(crate) frame_pool: RenderBufferPool,
    /// Monotonic submission fence counter for `RenderBufferPool`.
    #[get(type(copy))]
    pub(crate) frame_fence: u64,
    /// Active sensor mode (`Auto`, `LiveHardware`, or `VirtualTilt`).
    #[get(type(copy))]
    pub(crate) sensor_mode: FluidSensorMode,
    /// Optional explicit reactive `Signal<DeviceMotionSample>` bound from `Context` / `use_device_motion()`.
    #[get(type(copy))]
    pub(crate) device_motion_signal: Option<Signal<DeviceMotionSample>>,
    /// Most recently injected explicit `DeviceMotionSample` (for direct programmatic / test sensor injection).
    #[get(type(copy))]
    pub(crate) manual_motion_sample: Option<DeviceMotionSample>,
    /// Whether live hardware motion data drove the previous simulation tick.
    #[get(type(copy))]
    pub(crate) sensor_active: bool,
    /// Last measured viewport rectangle in root logical coordinates for pointer stirring and aspect adaptation.
    #[get(type(copy))]
    pub(crate) last_viewport_bounds: Rect,
    /// Last measured simulation step duration in milliseconds.
    #[get(type(copy))]
    pub(crate) last_sim_ms: f32,
    /// Last measured optical render duration in milliseconds.
    #[get(type(copy))]
    pub(crate) last_render_ms: f32,
    /// Cached read-only live telemetry snapshot.
    #[get(type(copy))]
    pub(crate) stats: GyroLiquidStats,
}

/// Shareable high-fidelity gyroscope liquid water `GameScene` ready for `GameEngineHost`, arbitrary dynamic resize, and edge-to-edge fullscreen.
///
/// Cloning `GyroLiquidGameScene` shares the same underlying solver/renderer handle so UI controls can tilt, shake, stir, change viscosity/fill, toggle buoyant bodies, and read live `GyroLiquidStats` seamlessly while `GameEngineHost` drives fixed-step physics and zero-copy pooled rendering.
#[derive(Clone, CustomDebug, Getter)]
pub struct GyroLiquidGameScene {
    /// Shared interior-mutable liquid scene state.
    #[debug(skip)]
    #[get(pub(crate))]
    pub(crate) inner: Rc<RefCell<GyroLiquidSceneState>>,
}