[][src]Trait luminance::shader::UniformInterface

pub trait UniformInterface<B: ?Sized, E = ()>: Sized where
    B: Shader
{ fn uniform_interface<'a>(
        builder: &mut UniformBuilder<'a, B>,
        env: &mut E
    ) -> Result<Self, UniformWarning>; }

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 implement Shader.
  • E is the environment type. Set by default to (), it allows to pass a mutable object at construction-site of the UniformInterface. It can be useful to generate events or customize the way the Uniform 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>

Create a UniformInterface by constructing Uniforms 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.

Loading content...

Implementations on Foreign Types

impl<B: ?Sized, E> UniformInterface<B, E> for () where
    B: Shader
[src]

Loading content...

Implementors

Loading content...