[−][src]Trait luminance::shader::UniformInterface
Uniform
interface.
When a type implements UniformInterface
, it means that it can be used as part of a shader
Program
type. When a Program
is in use in a graphics pipeline, its UniformInterface
is automatically provided to the user, giving them access to all the fields declared in. Then,
they can pass data to shaders before issuing draw commands.
Parametricity
B
is the backend type. It must implementShader
.E
is the environment type. Set by default to()
, it allows to pass a mutable object at construction-site of theUniformInterface
. It can be useful to generate events or customize the way theUniform
are built by doing some lookups in hashmaps, etc.
Notes
Implementing this trait — especially UniformInterface::uniform_interface
can be a bit
overwhelming. It is highly recommended to use luminance-derive’s UniformInterface
proc-macro, which will do that for you by scanning your type declaration.
Required methods
fn uniform_interface<'a>(
builder: &mut UniformBuilder<'a, B>,
env: &mut E
) -> Result<Self, UniformWarning>
builder: &mut UniformBuilder<'a, B>,
env: &mut E
) -> Result<Self, UniformWarning>
Create a UniformInterface
by constructing Uniform
s with a UniformBuilder
and an
optional environment object.
This method is the only place where Self
should be created. In theory, you could create it
the way you want (since the type is provided by you) but not all types make sense. You will
likely want to have some Uniform
objects in your type, and the UniformBuilder
that is
provided as argument is the only way to create them.
Implementations on Foreign Types
impl<B: ?Sized, E> UniformInterface<B, E> for () where
B: Shader,
[src]
B: Shader,
fn uniform_interface<'a>(
_: &mut UniformBuilder<'a, B>,
_: &mut E
) -> Result<Self, UniformWarning>
[src]
_: &mut UniformBuilder<'a, B>,
_: &mut E
) -> Result<Self, UniformWarning>