Skip to main content

PostEffect

Trait PostEffect 

Source
pub trait PostEffect: ShaderValues {
    const STAGE: EffectStage;
    const SHADER: &'static str;
}
Expand description

A pass of a game’s own over the whole frame, written in WGSL and stitched into the engine’s own at startup.

Required if you want to change every pixel of the frame after the scene is drawn: implement it on a type whose fields are the values its WGSL reads, name that type in Game::PostEffects, and run it with set_post_effect.

Required Associated Constants§

Source

const STAGE: EffectStage

Where in the post chain this effect runs, and so what its color holds and what its own alpha reaches; see the module’s own docs.

Source

const SHADER: &'static str

WGSL declaring fn draw(pixel: Pixel) -> vec4<f32>, run once per pixel, which returns what this effect writes there.

Pixel, color_at and depth_at are the engine’s, and the module’s own docs state what each of them holds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§