blob: f805860ec8d1063d695c25a8e912c624cfcd2f25 (
plain)
1
2
3
4
5
6
|
fn calculate_lighting(color: vec3f, normal: vec3f, pos: vec3f, shadow: f32) -> vec3f {
let light_dir = normalize(vec3f(1.0, 1.0, 1.0));
let diffuse = max(dot(normal, light_dir), 0.0);
let lighting = diffuse * (0.1 + 0.9 * shadow) + 0.1; // Ambient + Shadowed Diffuse
return color * lighting;
}
|