Skip to main content

vec4

Macro vec4 

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

Constructs a 4-dimensional vector from the provided arguments.

The macro accepts scalars and vectors as arguments, as long as they can be combined to form a 4-component vector. If only a single scalar argument is provided, it is duplicated across all components.

ยงExamples

use ggmath::{Vec4, vec2, vec3, vec4};

let one_two_three_four: Vec4<f32> = vec4!(1.0, 2.0, 3.0, 4.0);
let one_two_three_four: Vec4<f32> = vec4!(vec2!(1.0, 2.0), vec2!(3.0, 4.0));
let one_two_three_four: Vec4<f32> = vec4!(vec3!(1.0, 2.0, 3.0), 4.0);
let one_two_three_four: Vec4<f32> = vec4!(vec4!(1.0, 2.0, 3.0, 4.0));
let one_one_one_one: Vec4<f32> = vec4!(1.0);