Added simplistic lambert implementation

This commit is contained in:
arvid schröder 2022-11-28 19:15:34 +01:00
parent d00599ced6
commit 9dcbefe5a5

View file

@ -8,6 +8,10 @@ Color LambertShader::shade(Scene const &scene, Ray const &ray) const {
Color fragmentColor;
// IMPLEMENT ME
return fragmentColor;
for (auto& light : scene.lights()) {
auto illum = light->illuminate(scene, ray);
auto lightAngle = dotProduct(ray.normal, normalized(illum.direction));
fragmentColor += illum.color * std::abs(lightAngle);
}
return fragmentColor * diffuseColor;
}