Skip to main content

Crate egui_screensaver_matrix

Crate egui_screensaver_matrix 

Source
Expand description

Matrix digital rain screensaver for egui, ported from Rezmason’s Matrix WebGL original.

Like the original, this runs the whole simulation on the GPU: ping-pong “compute” render targets drive the falling-glyph animation, an MSDF font atlas renders the glyphs, and a bloom pass plus a palette/stripe color-effect pass finish the look — all through an egui::PaintCallback via egui_glow. This requires the host eframe::App to use the glow rendering backend (not wgpu) — MatrixBackground::paint simply skips drawing if no glow::Context is available. Volumetric 3D mode is not implemented yet.

§Usage

use egui_screensaver_matrix::MatrixBackground;

struct MyApp {
    matrix: MatrixBackground,
}

impl eframe::App for MyApp {
    fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {
        let ctx = ui.ctx().clone();
        // Call paint once per frame before drawing any UI windows so the
        // screensaver sits on the background layer behind everything else.
        self.matrix.paint(&ctx, frame.gl());
    }
}

Re-exports§

pub use fonts::FontId;
pub use textures::DecorativeTexture;

Modules§

fonts
Bundled MSDF glyph atlas metadata for all 8 fonts used by the 9 non-volumetric presets (the gtarg_* fonts from the original aren’t used by any named preset, so they’re not bundled).
textures
Bundled decorative base/glint textures used by the volumetric presets (trinity, morpheus, bugs). Each is sampled as a grayscale mask (only the red channel is read) multiplying the base/glint brightness.

Structs§

MatrixBackground
Matrix screensaver state.
MatrixConfig
Rain simulation, glyph-rendering, bloom, and color tunables.
PaletteStop
One color stop in a Effect::Palette gradient. at is the brightness position (0..1) this color sits at; stops are sorted and interpolated between when the gradient texture is built (see passes/effect.rs).

Enums§

Effect
Selects how rain brightness gets mapped to final on-screen color. Independent of Preset/font selection, matching the original (any font/version can be combined with any effect).
Preset
All 13 named presets from the original’s versions object except holoplay (hardware-specific Looking Glass display support, out of scope). 1999/throwback alias Operator, and 2021/updated alias Resurrections in the original — not represented as separate variants here since they’re identical configs.
RippleType
Which screen-space ripple distortion effect is active, if any. The original’s rippleTypeName (null / "box" / "circle").