Advertisement
Guest User

Untitled

a guest
Jul 25th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. pub inline fn transpose(m: Mat4x4) Mat4x4 {
  2. const d = m._data;
  3. var c1 = @shuffle(f32, d.vecs[0], d.vecs[1], [_]i32 { 2, 3, ~i32(2), ~i32(3)});
  4. var c2 = @shuffle(f32, d.vecs[2], d.vecs[3], [_]i32 { 2, 3, ~i32(2), ~i32(3)});
  5. var c3 = @shuffle(f32, d.vecs[0], d.vecs[1], [_]i32 { 0, 1, ~i32(0), ~i32(1)});
  6. var c4 = @shuffle(f32, d.vecs[2], d.vecs[3], [_]i32 { 0, 1, ~i32(0), ~i32(1)});
  7.  
  8. return Mat4x4 {
  9. ._data = Mat4x4Data.setVecs(
  10. @shuffle(f32, c3, c4, [_]i32 {0, 2, ~i32(0), ~i32(2)}),
  11. @shuffle(f32, c3, c4, [_]i32 {1, 3, ~i32(1), ~i32(3)}),
  12. @shuffle(f32, c1, c2, [_]i32 {0, 2, ~i32(0), ~i32(2)}),
  13. @shuffle(f32, c1, c2, [_]i32 {1, 3, ~i32(1), ~i32(3)}),
  14. ),
  15. };
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement