Function lights_shader_source

Source
pub fn lights_shader_source(lights: &[&dyn Light]) -> String
Expand description

Returns shader source code with the function calculate_lighting which calculate the lighting contribution for the given lights and the given LightingModel. Use this if you want to implement a custom Material but use the default lighting calculations.

The shader function has the following signature:

vec3 calculate_lighting(vec3 camera_position, vec3 surface_color, vec3 position, vec3 normal, float metallic, float roughness, float occlusion)