Now, we'll use valora's shader API to define some uniforms and load the shader. A shader in valora is made of two parts:
The shader program. This is the GLSL above, which exposes an interface to provide uniforms.
The uniforms bound to the shader.
First let's define the uniforms type in Rust:
#[derive(UniformSet, Copy, Clone, Debug)]structUniforms {/// A solid color overlay on the shader pattern. color: (f32, f32, f32),/// The vector scale of the output. scale:f32,/// Width of the output. width:f32,/// Height of the output. height:f32,}
The derive macro UniformSet will generate mappings from the field types to something we can send to the GPU, should such a mapping exist for the type.