Skip to content

struct

ShaderSpec

pub struct ShaderSpec {
    pub preset: Option<String>,
    pub fragment: Option<String>,
    pub colors: Vec<Color>,
    pub speed: f32,
    pub intensity: f32,
    pub texture: Option<TextureRef>,
}

A full-surface animated shader (shader element).

Fields

preset

pub preset: Option<String>

A built-in shader, by name (aurora, plasma…).

fragment

pub fragment: Option<String>

Custom GLSL (see custom_fragment); takes precedence over preset.

colors

pub colors: Vec<Color>

Up to four palette colors (u_color[0..3]).

speed

pub speed: f32

How fast it moves (1 is normal speed).

intensity

pub intensity: f32

How bright it is (u_intensity).

texture

pub texture: Option<TextureRef>

An image it can sample.

Methods

source

pub fn source(&self) -> Option<String>

The fragment source to compile, if the preset exists.

Trait implementations