glsl_layout

Trait Uniform

Source
pub trait Uniform: Copy {
    type Align: Copy + Default;
    type Std140: Std140;

    // Required method
    fn std140(&self) -> Self::Std140;
}
Expand description

Structure to transform data from rust’s structure to the raw data ready to upload to UBO. Users should prefer to use derive(Uniform) instead of implementing this manually.

Required Associated Types§

Source

type Align: Copy + Default

ZST that enforces alignment required for this type.

Source

type Std140: Std140

Type that contain same data with memory layout matching glsl’s layout(std140).

Required Methods§

Source

fn std140(&self) -> Self::Std140

Get aligned data from structure.

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.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> Uniform for [T; N]
where T: Uniform,

Source§

type Align = Align16

Source§

type Std140 = Array<<T as Uniform>::Std140, [Element<<T as Uniform>::Std140>; N]>

Source§

fn std140(&self) -> Array<T::Std140, [Element<T::Std140>; N]>

Implementors§

Source§

impl Uniform for boolean

Source§

impl Uniform for bvec2

Source§

type Align = Align8

Source§

type Std140 = bvec2

Source§

impl Uniform for bvec3

Source§

type Align = Align16

Source§

type Std140 = bvec3

Source§

impl Uniform for bvec4

Source§

type Align = Align16

Source§

type Std140 = bvec4

Source§

impl Uniform for dvec2

Source§

type Align = Align16

Source§

type Std140 = dvec2

Source§

impl Uniform for dvec3

Source§

type Align = Align32

Source§

type Std140 = dvec3

Source§

impl Uniform for dvec4

Source§

type Align = Align32

Source§

type Std140 = dvec4

Source§

impl Uniform for ivec2

Source§

type Align = Align8

Source§

type Std140 = ivec2

Source§

impl Uniform for ivec3

Source§

type Align = Align16

Source§

type Std140 = ivec3

Source§

impl Uniform for ivec4

Source§

type Align = Align16

Source§

type Std140 = ivec4

Source§

impl Uniform for uvec2

Source§

type Align = Align8

Source§

type Std140 = uvec2

Source§

impl Uniform for uvec3

Source§

type Align = Align16

Source§

type Std140 = uvec3

Source§

impl Uniform for uvec4

Source§

type Align = Align16

Source§

type Std140 = uvec4

Source§

impl Uniform for vec2

Source§

type Align = Align8

Source§

type Std140 = vec2

Source§

impl Uniform for vec3

Source§

type Align = Align16

Source§

type Std140 = vec3

Source§

impl Uniform for vec4

Source§

type Align = Align16

Source§

type Std140 = vec4

Source§

impl Uniform for double

Source§

type Align = Align8

Source§

type Std140 = f64

Source§

impl Uniform for float

Source§

type Align = Align4

Source§

type Std140 = f32

Source§

impl Uniform for int

Source§

type Align = Align4

Source§

type Std140 = i32

Source§

impl Uniform for uint

Source§

type Align = Align4

Source§

type Std140 = u32

Source§

impl<T, const N: usize> Uniform for Array<T, [Element<T>; N]>
where T: Uniform,

Source§

type Align = Align16

Source§

type Std140 = Array<<T as Uniform>::Std140, [Element<<T as Uniform>::Std140>; N]>