cloudy-raytracer/shader/depthshader.cpp

12 lines
331 B
C++

#include "depthshader.h"
Color DepthShader::shade(const Scene &scene, const Ray &ray) const
{
float brightness = exp(-ray.length * 0.1f);
return brightness * nearColor + (1 - brightness) * farColor;
}
DepthShader::DepthShader(const Color &nearColor, const Color &farColor) : nearColor(nearColor), farColor(farColor)
{
}