mirage-engine 0.2.0

Mirage, an immediate-mode 3D engine for simple games on desktop and the browser
Documentation
1
2
3
4
5
6
7
8
9
10
11
// The `Scanlines` post effect's whole look: darkens every other physical pixel
// row, at a fixed two-pixel pitch, by `effect.strength`.

fn draw(pixel: Pixel) -> vec4<f32> {
    let row = u32(floor(pixel.position.y));
    var darken = 1.0;
    if row % 2u == 0u {
        darken = 1.0 - effect.strength;
    }
    return vec4<f32>(pixel.color.rgb * darken, pixel.color.a);
}