2022-11-11 14:39:48 +01:00
|
|
|
#include "light/light.h"
|
|
|
|
#include "scene/scene.h"
|
|
|
|
#include "shader/simpleshadowshader.h"
|
|
|
|
|
|
|
|
SimpleShadowShader::SimpleShadowShader(Color const &objectColor) : objectColor(objectColor) {}
|
|
|
|
|
|
|
|
Color SimpleShadowShader::shade(Scene const &scene, Ray const &ray) const {
|
|
|
|
// IMPLEMENT ME
|
|
|
|
// loop over all light sources to check for visibility and multiply "light
|
|
|
|
// strength" with this objects albedo (color)
|
2022-11-17 20:28:23 +01:00
|
|
|
|
|
|
|
Color color = Color(0, 0, 0);
|
|
|
|
for (auto light : scene.lights()) {
|
|
|
|
color += this->objectColor * light->illuminate(scene, ray).color;
|
|
|
|
}
|
|
|
|
|
|
|
|
return color;
|
2022-11-11 14:39:48 +01:00
|
|
|
}
|