Skip to main content

Module shaderprimitive

Module shaderprimitive 

Source
Expand description

Yes, these differ from crate::vertexformats.

Regular bound buffers are packed a lot more loosely, requiring different alignment. The naming convention tries to look like wgsl types for clarity.

All these types are internally represented by arrays. For example Vec3f is just a unit struct over [f32; 3], but a single [F32] is also an array of length 1 ([f32; 1]). Of course you can deref them into regular arrays, but keep in mind that’s not what they directly are.

// There shouldn't be a reason to construct these explicitly, just pass
// arrays into shader struct constructors, but for the sake of the example
let mut vec3f: Vec3f = [1.0, 2.0, 3.0].into();
*vec3f = [3.0, 2.0, 1.0];
vec3f[2] = 0.0;
let bytes: &[u32] = vec3f.as_ref();

Structs§

F32
I32
Mat2x2f
Mat2x2i
Mat2x2u
Mat2x3f
Mat2x3i
Mat2x3u
Mat2x4f
Mat2x4i
Mat2x4u
Mat3x2f
Mat3x2i
Mat3x2u
Mat3x3f
Mat3x3i
Mat3x3u
Mat3x4f
Mat3x4i
Mat3x4u
Mat4x2f
Mat4x2i
Mat4x2u
Mat4x3f
Mat4x3i
Mat4x3u
Mat4x4f
Mat4x4i
Mat4x4u
U32
Vec2f
Vec2i
Vec2u
Vec3f
Vec3i
Vec3u
Vec4f
Vec4i
Vec4u

Traits§

MewShaderPrimitive