mat4

Macro mat4 

Source
macro_rules! mat4 {
    ($($e:expr),*) => { ... };
}
Expand description

Macro for creating a 4x4 matrix (Mat4) using a concise syntax.

§Syntax

The mat4! macro creates a Mat4 from an array of Vec4.

§Notes

  • The macro internally uses the from_mat_vec function to create the matrix.
  • Ensure that the provided expressions are suitable for initializing a 4x4 matrix.

§Example

let mat = mat4![vec4![1, 2, 3, 4], vec4![8, 7, 6, 5], vec4![9, 10, 11, 12], vec4![16, 15, 14, 13]];

assert_eq!(mat, Mat4::from_mat_vec(&[vec4![1, 2, 3, 4], vec4![8, 7, 6, 5], vec4![9, 10, 11, 12], vec4![16, 15, 14, 13]]));

§See Also

  • Mat4: The 4x4 matrix type used by this macro.
  • from_mat_vec: Function to construct a matrix from an array of Vec4.