#[repr(C)]pub struct Vec4<T> {
pub x: T,
pub y: T,
pub z: T,
pub w: T,
}Fields§
§x: T§y: T§z: T§w: TImplementations§
Source§impl<T> Vec4<T>
impl<T> Vec4<T>
pub fn splat(value: T) -> Selfwhere
T: Copy,
pub fn splat_from_scalar(value: Scalar<T>) -> Selfwhere
T: Copy,
Sourcepub const fn select(self, trues: Self, mask: Vec4<bool>) -> Selfwhere
T: Copy,
pub const fn select(self, trues: Self, mask: Vec4<bool>) -> Selfwhere
T: Copy,
Replaces the elements of self with the elements of trues wherever
mask contains true.
pub fn map<U, F>(self, f: F) -> Vec4<U>where
F: FnMut(T) -> U,
Source§impl Vec4<f32>
impl Vec4<f32>
Sourcepub fn distance(self, rhs: Self) -> f32
pub fn distance(self, rhs: Self) -> f32
As per WGSL distance().
Sourcepub fn face_forward(self, e2: Self, e3: Self) -> Self
pub fn face_forward(self, e2: Self, e3: Self) -> Self
As per WGSL faceForward().
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
As per WGSL normalize().
Sourcepub const fn saturate(self) -> Self
pub const fn saturate(self) -> Self
As per WGSL saturate().
pub const fn abs(self) -> Self
pub fn acos(self) -> Self
pub fn acosh(self) -> Self
pub fn asin(self) -> Self
pub fn asinh(self) -> Self
pub fn atan(self) -> Self
pub fn atanh(self) -> Self
pub fn ceil(self) -> Self
pub fn cos(self) -> Self
pub fn cosh(self) -> Self
pub fn exp(self) -> Self
pub fn exp2(self) -> Self
pub fn floor(self) -> Self
pub fn fract(self) -> Self
pub fn log2(self) -> Self
pub fn round(self) -> Self
pub fn sin(self) -> Self
pub fn sinh(self) -> Self
pub fn tan(self) -> Self
pub fn tanh(self) -> Self
pub fn trunc(self) -> Self
pub fn to_degrees(self) -> Self
pub fn to_radians(self) -> Self
pub fn atan2(self, rhs: Self) -> Self
pub fn max(self, rhs: Self) -> Self
pub fn min(self, rhs: Self) -> Self
pub fn powf(self, rhs: Self) -> Self
Source§impl Vec4<f64>
impl Vec4<f64>
Sourcepub fn distance(self, rhs: Self) -> f64
pub fn distance(self, rhs: Self) -> f64
As per WGSL distance().
Sourcepub fn face_forward(self, e2: Self, e3: Self) -> Self
pub fn face_forward(self, e2: Self, e3: Self) -> Self
As per WGSL faceForward().
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
As per WGSL normalize().
Sourcepub const fn saturate(self) -> Self
pub const fn saturate(self) -> Self
As per WGSL saturate().
pub const fn abs(self) -> Self
pub fn acos(self) -> Self
pub fn acosh(self) -> Self
pub fn asin(self) -> Self
pub fn asinh(self) -> Self
pub fn atan(self) -> Self
pub fn atanh(self) -> Self
pub fn ceil(self) -> Self
pub fn cos(self) -> Self
pub fn cosh(self) -> Self
pub fn exp(self) -> Self
pub fn exp2(self) -> Self
pub fn floor(self) -> Self
pub fn fract(self) -> Self
pub fn log2(self) -> Self
pub fn round(self) -> Self
pub fn sin(self) -> Self
pub fn sinh(self) -> Self
pub fn tan(self) -> Self
pub fn tanh(self) -> Self
pub fn trunc(self) -> Self
pub fn to_degrees(self) -> Self
pub fn to_radians(self) -> Self
pub fn atan2(self, rhs: Self) -> Self
pub fn max(self, rhs: Self) -> Self
pub fn min(self, rhs: Self) -> Self
pub fn powf(self, rhs: Self) -> Self
Source§impl Vec4<i32>
impl Vec4<i32>
pub fn cast_elem_as_u32(self) -> Vec4<u32>
pub fn cast_elem_as_i32(self) -> Vec4<i32>
pub fn cast_elem_as_f32(self) -> Vec4<f32>
pub fn cast_elem_as_f64(self) -> Vec4<f64>
Source§impl Vec4<u32>
impl Vec4<u32>
pub fn cast_elem_as_u32(self) -> Vec4<u32>
pub fn cast_elem_as_i32(self) -> Vec4<i32>
pub fn cast_elem_as_f32(self) -> Vec4<f32>
pub fn cast_elem_as_f64(self) -> Vec4<f64>
Source§impl Vec4<f32>
impl Vec4<f32>
pub fn cast_elem_as_u32(self) -> Vec4<u32>
pub fn cast_elem_as_i32(self) -> Vec4<i32>
pub fn cast_elem_as_f32(self) -> Vec4<f32>
pub fn cast_elem_as_f64(self) -> Vec4<f64>
Source§impl Vec4<f64>
impl Vec4<f64>
pub fn cast_elem_as_u32(self) -> Vec4<u32>
pub fn cast_elem_as_i32(self) -> Vec4<i32>
pub fn cast_elem_as_f32(self) -> Vec4<f32>
pub fn cast_elem_as_f64(self) -> Vec4<f64>
Source§impl<T: PartialOrd> Vec4<T>
impl<T: PartialOrd> Vec4<T>
pub fn elementwise_eq(self, rhs: Self) -> Vec4<bool>
pub fn elementwise_ne(self, rhs: Self) -> Vec4<bool>
pub fn elementwise_lt(self, rhs: Self) -> Vec4<bool>
pub fn elementwise_le(self, rhs: Self) -> Vec4<bool>
pub fn elementwise_gt(self, rhs: Self) -> Vec4<bool>
pub fn elementwise_ge(self, rhs: Self) -> Vec4<bool>
Source§impl<T: Copy> Vec4<T>
impl<T: Copy> Vec4<T>
pub const fn new_112(x: T, y: T, zw: Vec2<T>) -> Self
pub const fn new_121(x: T, yz: Vec2<T>, w: T) -> Self
pub const fn new_211(xy: Vec2<T>, z: T, w: T) -> Self
pub const fn new_22(xy: Vec2<T>, zw: Vec2<T>) -> Self
pub const fn new_13(x: T, yzw: Vec3<T>) -> Self
pub const fn new_31(xyz: Vec3<T>, w: T) -> Self
Source§impl<T: Copy> Vec4<T>
impl<T: Copy> Vec4<T>
Sourcepub fn xyzw(self) -> Vec4<T>
pub fn xyzw(self) -> Vec4<T>
Takes the
x, y, z, w
elements of self and returns them in that order.
Sourcepub fn xywz(self) -> Vec4<T>
pub fn xywz(self) -> Vec4<T>
Takes the
x, y, w, z
elements of self and returns them in that order.
Sourcepub fn xzwy(self) -> Vec4<T>
pub fn xzwy(self) -> Vec4<T>
Takes the
x, z, w, y
elements of self and returns them in that order.
Sourcepub fn xzyw(self) -> Vec4<T>
pub fn xzyw(self) -> Vec4<T>
Takes the
x, z, y, w
elements of self and returns them in that order.
Sourcepub fn xwyz(self) -> Vec4<T>
pub fn xwyz(self) -> Vec4<T>
Takes the
x, w, y, z
elements of self and returns them in that order.
Sourcepub fn xwzy(self) -> Vec4<T>
pub fn xwzy(self) -> Vec4<T>
Takes the
x, w, z, y
elements of self and returns them in that order.
Sourcepub fn yxzw(self) -> Vec4<T>
pub fn yxzw(self) -> Vec4<T>
Takes the
y, x, z, w
elements of self and returns them in that order.
Sourcepub fn yxwz(self) -> Vec4<T>
pub fn yxwz(self) -> Vec4<T>
Takes the
y, x, w, z
elements of self and returns them in that order.
Sourcepub fn yzxw(self) -> Vec4<T>
pub fn yzxw(self) -> Vec4<T>
Takes the
y, z, x, w
elements of self and returns them in that order.
Sourcepub fn yzwx(self) -> Vec4<T>
pub fn yzwx(self) -> Vec4<T>
Takes the
y, z, w, x
elements of self and returns them in that order.
Sourcepub fn ywzx(self) -> Vec4<T>
pub fn ywzx(self) -> Vec4<T>
Takes the
y, w, z, x
elements of self and returns them in that order.
Sourcepub fn ywxz(self) -> Vec4<T>
pub fn ywxz(self) -> Vec4<T>
Takes the
y, w, x, z
elements of self and returns them in that order.
Sourcepub fn zxyw(self) -> Vec4<T>
pub fn zxyw(self) -> Vec4<T>
Takes the
z, x, y, w
elements of self and returns them in that order.
Sourcepub fn zxwy(self) -> Vec4<T>
pub fn zxwy(self) -> Vec4<T>
Takes the
z, x, w, y
elements of self and returns them in that order.
Sourcepub fn zyxw(self) -> Vec4<T>
pub fn zyxw(self) -> Vec4<T>
Takes the
z, y, x, w
elements of self and returns them in that order.
Sourcepub fn zywx(self) -> Vec4<T>
pub fn zywx(self) -> Vec4<T>
Takes the
z, y, w, x
elements of self and returns them in that order.
Sourcepub fn zwxy(self) -> Vec4<T>
pub fn zwxy(self) -> Vec4<T>
Takes the
z, w, x, y
elements of self and returns them in that order.
Sourcepub fn zwyx(self) -> Vec4<T>
pub fn zwyx(self) -> Vec4<T>
Takes the
z, w, y, x
elements of self and returns them in that order.
Sourcepub fn wxyz(self) -> Vec4<T>
pub fn wxyz(self) -> Vec4<T>
Takes the
w, x, y, z
elements of self and returns them in that order.
Sourcepub fn wxzy(self) -> Vec4<T>
pub fn wxzy(self) -> Vec4<T>
Takes the
w, x, z, y
elements of self and returns them in that order.
Sourcepub fn wyxz(self) -> Vec4<T>
pub fn wyxz(self) -> Vec4<T>
Takes the
w, y, x, z
elements of self and returns them in that order.
Sourcepub fn wyzx(self) -> Vec4<T>
pub fn wyzx(self) -> Vec4<T>
Takes the
w, y, z, x
elements of self and returns them in that order.