Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private float[DIMENSION] coords = [0.0f, 0.0f, 0.0f, 1.0f];
- @property pure auto opDispatch(const string swizzling)() const
- if (swizzling.length == DIMENSION || swizzling.length == DIMENSION - 1)
- {
- immutable expression = "coords".repeat().take(swizzling.length)
- .zip(swizzling).map!( a => format("%s[%c]", a[0], a[1].toUpper()) ).reduce!((a,b) => a ~ "," ~ b);
- mixin( "return Vector4 (" ~ expression ~ ");" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement