Fixed only phong merge

This commit is contained in:
arvid schröder 2022-12-12 20:24:08 +01:00
parent 63a0ec8f28
commit 9121a3281a

View file

@ -31,16 +31,5 @@ Color PhongShader::shade(Scene const &scene, Ray const &ray) const {
fragmentColor += specular * illum.color; fragmentColor += specular * illum.color;
} }
} }
for (auto &light: scene.lights()) {
auto illum = light->illuminate(scene, ray);
Vector3d reflection = 2 * dotProduct(illum.direction, ray.normal) * ray.normal - illum.direction;
Color diffuse = diffuseCoefficient * dotProduct(illum.direction, -ray.normal) * diffuseColor;
Color specular = specularCoefficient * specularColor
* std::pow(dotProduct(ray.direction, reflection), shininessExponent);
fragmentColor += illum.color * diffuse + illum.color * specular;
}
return fragmentColor; return fragmentColor;
} }