macro_rules! sw {
($e:expr, . $a:tt) => { ... };
($e:expr, . $a:tt . $b:tt) => { ... };
($e:expr, . $a:tt . $b:tt . $c:tt) => { ... };
($e:expr, . $a:tt . $b:tt . $c:tt . $d:tt) => { ... };
}
Expand description
Swizzle macro.
This macro allows to swizzle expressions to yield expressions reorganizing the vector attributes. For instance,
sw!(color, .rgbr)
will take a 4D color and will output a 4D color for which the alpha channel is overridden with
the red channel.
The current syntax allows to extract and construct from a lot of types. Have a look at Swizzlable
for a
comprehensive list of what you can do.