cloudy-raytracer/shader/simpleshadowshader.cpp

16 lines
483 B
C++
Raw Permalink Normal View History

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 {
2022-11-18 11:43:53 +01:00
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;
2022-11-11 14:39:48 +01:00
}