mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
add ambient intensity
This commit is contained in:
parent
ef5df2fa64
commit
641b62ca01
4 changed files with 13 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
|||
#include "Light.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
|
@ -30,7 +32,8 @@ Vector3f PointLight::illumination(const HitRecord &hit,
|
|||
g->type() == Geometry::Type::SPHERE)
|
||||
return Vector3f::Zero();
|
||||
|
||||
Vector3f ambient_ = geometry->ka() * geometry->ca();
|
||||
Vector3f ambient_ =
|
||||
geometry->ka() * geometry->ca().array() * Scene::current->ai().array();
|
||||
|
||||
Vector3f diffuse_ = geometry->kd() * geometry->cd().array() * id_.array() *
|
||||
std::max(0.0f, hit.normal().dot(rayDirection));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue