pub trait Effect {
// Required methods
fn fragment_shader_source(
&self,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
) -> String;
fn id(
&self,
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
) -> u16;
fn fragment_attributes(&self) -> FragmentAttributes;
fn use_uniforms(
&self,
program: &Program,
camera: &Camera,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
);
fn render_states(&self) -> RenderStates;
}
Expand description
Required Methods§
sourcefn fragment_shader_source(
&self,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
) -> String
fn fragment_shader_source( &self, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> String
Returns the fragment shader source for this effect.
sourcefn id(
&self,
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
) -> u16
fn id( &self, color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> ) -> u16
Returns a unique ID for each variation of the shader source returned from Effect::fragment_shader_source.
Note: The first 16 bits are reserved to internally implemented effects, so if implementing the Effect trait
outside of this crate, always return an id that is larger than or equal to 0b1u16 << 16
.
sourcefn fragment_attributes(&self) -> FragmentAttributes
fn fragment_attributes(&self) -> FragmentAttributes
Returns a FragmentAttributes struct that describes which fragment attributes, ie. the input from the vertex shader, are required for rendering with this effect.
sourcefn use_uniforms(
&self,
program: &Program,
camera: &Camera,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
)
fn use_uniforms( &self, program: &Program, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> )
Sends the uniform data needed for this effect to the fragment shader.
sourcefn render_states(&self) -> RenderStates
fn render_states(&self) -> RenderStates
Returns the render states needed to render with this effect.