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<'_>>,
) -> EffectMaterialId;
fn use_uniforms(
&self,
program: &Program,
viewer: &dyn Viewer,
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<'_>>,
) -> EffectMaterialId
fn id( &self, color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>>, ) -> EffectMaterialId
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 in the public use range as defined by EffectMaterialId.
Sourcefn use_uniforms(
&self,
program: &Program,
viewer: &dyn Viewer,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>,
)
fn use_uniforms( &self, program: &Program, viewer: &dyn Viewer, 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.