pub trait Program {
// Required method
fn fragment(&self, x: f32, y: f32) -> (Vec3, f32);
// Provided methods
fn advance(&mut self, now: Duration, width: f32, height: f32) { ... }
fn particles(&self, emit: &mut dyn FnMut(f32, f32, Vec3, f32)) { ... }
}Expand description
A fullscreen effect: per-frame state plus a shader for every pixel.
fragment returns a unit-range color and a coverage
alpha. Coverage decides whether a pixel lights; color, scaled by
coverage, is composited over black. particles
splats point sprites over the shaded field — the CPU stand-in for an
instanced sprite pass. Any Fn(f32, f32) -> (Vec3, f32) closure is a
still, particle-free program.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".