50 lines
1.4 KiB
Rust
50 lines
1.4 KiB
Rust
//! "Liquid Glass" layer: an OpenGL pass under the Slint UI that draws the
|
|
//! animated backdrop and the frosted, refracting glass panels.
|
|
|
|
mod renderer;
|
|
mod shaders;
|
|
|
|
pub use renderer::GlassRenderer;
|
|
|
|
/// Panels drawn per frame at most (each one is its own small draw call).
|
|
pub const MAX_RECTS: usize = 48;
|
|
/// Members of one merged (liquid) group at most.
|
|
pub const MAX_GROUP: usize = 4;
|
|
|
|
/// One glass panel in physical pixels (top-left origin).
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct Panel {
|
|
pub x: f32,
|
|
pub y: f32,
|
|
pub w: f32,
|
|
pub h: f32,
|
|
pub radius: f32,
|
|
/// 0..1, brightens the rim and adds the accent glow.
|
|
pub focus: f32,
|
|
pub alpha: f32,
|
|
/// Mip level used for the frost (higher = blurrier). Negative = nested glass.
|
|
pub blur: f32,
|
|
pub glow: [f32; 3],
|
|
/// Consecutive panels with the same group (> 0) melt into one shape.
|
|
pub group: f32,
|
|
/// rgb + amount.
|
|
pub tint: [f32; 4],
|
|
}
|
|
|
|
/// Everything the renderer needs for one frame.
|
|
#[derive(Debug, Clone)]
|
|
pub struct Frame {
|
|
pub width: u32,
|
|
pub height: u32,
|
|
pub scale: f32,
|
|
pub time: f32,
|
|
/// Backdrop palette (highlight, mid, deep), already crossfaded.
|
|
pub palette: [f32; 9],
|
|
/// 1 = top shelf visible (bright backdrop), 0 = scrolled down into the grid.
|
|
pub shelf: f32,
|
|
pub light: [f32; 2],
|
|
/// Backdrop zoom (1 = none), used for the launch fly-in.
|
|
pub zoom: f32,
|
|
pub rects: Vec<Panel>,
|
|
}
|