Trait Vec4Ext

Source
pub trait Vec4Ext {
    // Required methods
    fn trunc(self) -> Self;
    fn step(self, value: Self) -> Self;
    fn step_select(self, value: Self, tru: Self, fals: Self) -> Self;
    fn fract(self) -> Self;
    fn sin(self) -> Self;
    fn sqrt(self) -> Self;
    fn to_bits(self) -> UVec4;
    fn mean(self) -> f32;
    fn has_equal_components(self, max_abs_diff: f32) -> bool;
}
Expand description

Extensions to Vec4

Adds additional functionality to Vec4 that glam doesn’t have.

Required Methods§

Source

fn trunc(self) -> Self

For element i of self, return v[i].trunc()

Source

fn step(self, value: Self) -> Self

For element i of the return value, returns 0.0 if value[i] < self[i] and 1.0 otherwise.

Similar to glsl’s step(edge, x), which translates into edge.step(x)

Source

fn step_select(self, value: Self, tru: Self, fals: Self) -> Self

Selects between true and false based on the result of value[i] < self[i]

Source

fn fract(self) -> Self

Return only the fractional parts of each component.

Source

fn sin(self) -> Self

Return only the sine of each component.

Source

fn sqrt(self) -> Self

Return the square root of each component.

Source

fn to_bits(self) -> UVec4

Raw transmute each component to u32.

Source

fn mean(self) -> f32

Get the mean value of all four components

Source

fn has_equal_components(self, max_abs_diff: f32) -> bool

Returns true if all components of the vector is the same within an absolute difference of max_abs_diff

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§