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§
- Matrix
Background - Matrix screensaver state.
- Matrix
Config - Rain simulation, glyph-rendering, bloom, and color tunables.
- Palette
Stop - One color stop in a
Effect::Palettegradient.atis the brightness position (0..1) this color sits at; stops are sorted and interpolated between when the gradient texture is built (seepasses/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
versionsobject exceptholoplay(hardware-specific Looking Glass display support, out of scope).1999/throwbackaliasOperator, and2021/updatedaliasResurrectionsin the original — not represented as separate variants here since they’re identical configs. - Ripple
Type - Which screen-space ripple distortion effect is active, if any. The
original’s
rippleTypeName(null/"box"/"circle").