-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutable Swizzles #516
Comments
Alternatively, it can be implemented like this. (But this doesn't allow passing pub trait Vec3SwizzleSet {
fn set_xz(&mut self, thing: Vec2);
fn set_xy(&mut self, thing: Vec2);
fn set_zy(&mut self, thing: Vec2);
fn set_yz(&mut self, thing: Vec2);
}
impl Vec3SwizzleSet for Vec3 {
fn set_xz(&mut self, thing: Vec2) {
self.x = thing.x;
self.z = thing.y;
}
fn set_xy(&mut self, thing: Vec2) {
self.x = thing.x;
self.y = thing.y;
}
fn set_zy(&mut self, thing: Vec2) {
self.z = thing.x;
self.y = thing.y;
}
fn set_yz(&mut self, thing: Vec2) {
self.y = thing.x;
self.z = thing.y;
}
} |
I was thinking about this when adding the So rather than The swizzles are all generated code which does reduce the amount of typing required but that particular bit of codegen is reasonably complex. One complication is it would be good to support |
What about making it I saw, and I was trying to understand what was going on, but failed. |
The main Idea is to be able to do this
Here is something that works, but only done for xy_mut()
The text was updated successfully, but these errors were encountered: