vec4

Macro vec4 

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

Macro for creating a 4D vector (Vec4) using a concise syntax.

§Syntax

The vec4! macro accepts a comma-separated list of values, representing the elements of a 4D vector. It constructs a Vec4 instance using the provided values.

§Examples

let vec = vec4![1.0, 2.0, 3.0, 4.0];
 
assert_eq!(vec.to_arr(), &[1.0, 2.0, 3.0, 4.0]);

§Notes

  • The macro internally uses the from_array function to create the vector.
  • Ensure that the provided expressions are suitable for initializing a 4D vector.
  • The resulting Vec4 struct will be created using the from_array function.

§See Also

  • Vec4: The 4D vector type used by this macro.
  • from_array: Function to construct a vector from an array.