Crate qvek

Crate qvek 

Source
Expand description

§qvek: GLSL-style casts for vek. Zero-(runtime)-cost QOL vek extension.

Instead of writing:

let a = vek::Vec3::new(1.0f32, 2.0f32, 3.0f32);

you can combine different types (scalars or smaller vecs) using GLSL-like macro:

// Create a Vec2<f32> from i16 and u8 and combine it with i8 to create Vec3<f64>:
let a = dvec3!(vec2!(1i16, 2 as u8), 3i8);
assert_eq!(a, vek::Vec3::<f64>::new(1.0, 2.0, 3.0));

// Create a Vec2<i32> from two integers:
let b = ivec2!(1, 2);
assert_eq!(b, vek::Vec2::<i32>::new(1, 2));

// Create a vek::Vec4<f64>:
let c = dvec4!(vec3!(1, 2.0, 3 as i8), 4 as f64);
assert_eq!(c, vek::Vec4::<f64>::new(1.0, 2.0, 3.0, 4.0));

Note: at the moment, all casts between types are also GLSL-style - “unsafe” (casted with `as``)

Re-exports§

pub extern crate vek;

Macros§

dvec2
dvec3
dvec4
generate_vec_macros
Macro, that generates vector creation macros for a given scalar type.
i8vec2
i8vec3
i8vec4
i16vec2
i16vec3
i16vec4
i32vec2
i32vec3
i32vec4
i64vec2
i64vec3
i64vec4
ivec2
ivec3
ivec4
u8vec2
u8vec3
u8vec4
u16vec2
u16vec3
u16vec4
u32vec2
u32vec3
u32vec4
u64vec2
u64vec3
u64vec4
uvec2
uvec3
uvec4
vec2
vec3
vec4

Traits§

BuildVec2
Trait to build Vec2 from various inputs.
BuildVec3
Trait to build Vec3 from various inputs.
BuildVec4
Trait to build Vec4 from various inputs.

Functions§

vec2
vec3
vec4