cloudy-raytracer/shader/simpleshadowshader.cpp

18 lines
571 B
C++

#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)
Color color = Color(0, 0, 0);
for (auto light : scene.lights()) {
color += this->objectColor * light->illuminate(scene, ray).color;
}
return color;
}