pub trait Light {
// Required methods
fn shader_source(&self, i: u32) -> String;
fn use_uniforms(&self, program: &Program, i: u32);
fn id(&self) -> u8;
}
Expand description
Represents a light source.
Required Methods§
sourcefn shader_source(&self, i: u32) -> String
fn shader_source(&self, i: u32) -> String
The fragment shader source for calculating this lights contribution to the color in a fragment.
It should contain a function with this signature
vec3 calculate_lighting{}(vec3 surface_color, vec3 position, vec3 normal, vec3 view_direction, float metallic, float roughness, float occlusion)
Where {}
is replaced with the number i given as input.
This function should return the color contribution for this light on the surface with the given surface parameters.
sourcefn use_uniforms(&self, program: &Program, i: u32)
fn use_uniforms(&self, program: &Program, i: u32)
Should bind the uniforms that is needed for calculating this lights contribution to the color in Light::shader_source.