Skip to main content

surface_styles

Macro surface_styles 

Source
macro_rules! surface_styles {
    ($(#[$attribute:meta])* $vis:vis enum $set:ident { $($style:ident),+ $(,)? }) => { ... };
}
Expand description

Writes the set of every style a game draws with: an enum with one variant wrapping each named type, which Game::SurfaceStyles names.

Each type is spelled by its own name and must be in scope; a set that holds a type twice does not compile. Seats run in the order the set lists them, and a draw’s style is its seat. A pub before enum makes the enum public, and /// lines before that are the enum’s.

use mirage_engine::prelude::*;

#[derive(Default, ShaderValues)]
struct Water {
    wave: f32,
}

impl SurfaceStyle for Water {
    const PASS: DrawPass = DrawPass::Translucent;
}

surface_styles! { enum Looks { Water } }