cloudy-raytracer/shader/simpleshadowshader.cpp
2022-11-18 11:43:53 +01:00

15 lines
483 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 {
Color fragmentColor;
// Accumulate the light over all light sources
for (const auto &light : scene.lights())
fragmentColor += light->illuminate(scene, ray).color;
return fragmentColor * this->objectColor;
}