Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn transpose(m: Mat4x4) Mat4x4 {
- const d = m._data;
- var c1 = @shuffle(f32, d.vecs[0], d.vecs[1], [_]i32{ 2, 3, ~i32(2), ~i32(3) });
- var c2 = @shuffle(f32, d.vecs[2], d.vecs[3], [_]i32{ 2, 3, ~i32(2), ~i32(3) });
- var c3 = @shuffle(f32, d.vecs[0], d.vecs[1], [_]i32{ 0, 1, ~i32(0), ~i32(1) });
- var c4 = @shuffle(f32, d.vecs[2], d.vecs[3], [_]i32{ 0, 1, ~i32(0), ~i32(1) });
- return Mat4x4{
- ._data = Mat4x4Data.setVecs(
- @shuffle(f32, c3, c4, [_]i32{ 0, 2, ~i32(0), ~i32(2) }),
- @shuffle(f32, c3, c4, [_]i32{ 1, 3, ~i32(1), ~i32(3) }),
- @shuffle(f32, c1, c2, [_]i32{ 0, 2, ~i32(0), ~i32(2) }),
- @shuffle(f32, c1, c2, [_]i32{ 1, 3, ~i32(1), ~i32(3) }),
- ),
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement