Trait gfx_phase::Technique
[−]
[src]
pub trait Technique<R: Resources, M: Material, V: ToDepth> { type Kernel: Copy + Debug + Eq + Hash; type Params: ShaderParam<Resources = R>; fn test(&self, _: &Mesh<R>, _: &M) -> Option<Self::Kernel>; fn compile<'a>(&'a self, _: Self::Kernel) -> TechResult<'a, R, Self::Params>; fn fix_params(&self, _: &M, _: &V, _: &mut Self::Params); }
Technique is basically a Fn(Entity) -> Option<TechResult>
.
It processes a material, checks for the compatibility, adds a mesh
to produce a shader program with associated data (state, parameters).
Associated Types
type Kernel: Copy + Debug + Eq + Hash
The most important part of the entity, which is enough to decide which program or state to use on it.
type Params: ShaderParam<Resources = R>
Associated shader parameters.
Required Methods
fn test(&self, _: &Mesh<R>, _: &M) -> Option<Self::Kernel>
Test if this mesh/material can be drawn using the technique.
fn compile<'a>(&'a self, _: Self::Kernel) -> TechResult<'a, R, Self::Params>
Compile a given kernel by producing a program, parameter block, a draw state, and optional instancing data.
fn fix_params(&self, _: &M, _: &V, _: &mut Self::Params)
Fix the shader parameters, using an updated material and view info. Called every time before a batch is added to the draw queue.