Skip to content

enum

Uniform

pub enum Uniform {
    Float(f32),
    Int(i32),
    Bool(bool),
    Vec2([f32; 2]),
    Vec3([f32; 3]),
    Vec4([f32; 4]),
    Mat4([f32; 16]),
    Vec3Array(Vec<[f32; 3]>),
    Texture(TextureRef),
}

A shader uniform's value.

Variants

Float

Float(f32)

float

Int

Int(i32)

int

Bool

Bool(bool)

bool

Vec2

Vec2([f32; 2])

vec2

Vec3

Vec3([f32; 3])

vec3

Vec4

Vec4([f32; 4])

vec4

Mat4

Mat4([f32; 16])

mat4, column by column.

Vec3Array

Vec3Array(Vec<[f32; 3]>)

A vec3 array, such as the preset palette u_color[4].

Texture

Texture(TextureRef)

sampler2D

Methods

parse

pub fn parse(text: &str) -> Option<Uniform>

A value from template text: 0.3 → float, "#22d3ee" → vec3 (vec4 with alpha), "1 2" / "1, 2, 3" → vecN, true → bool.

Trait implementations