mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
fix area light illumination
This commit is contained in:
parent
ebae7ccfaf
commit
87d3c2788e
1 changed files with 3 additions and 5 deletions
|
@ -57,11 +57,10 @@ Vector3f AreaLight::illumination(const HitRecord &hit,
|
||||||
Vector3f u = p4 - p1;
|
Vector3f u = p4 - p1;
|
||||||
Vector3f v = p2 - p1;
|
Vector3f v = p2 - p1;
|
||||||
|
|
||||||
Vector3f color = Vector3f::Zero();
|
|
||||||
|
|
||||||
if (useCenter) {
|
if (useCenter) {
|
||||||
color += PointLight(*this, getCenter()).illumination(hit, geometries);
|
return PointLight(*this, getCenter()).illumination(hit, geometries);
|
||||||
} else {
|
} else {
|
||||||
|
Vector3f color = Vector3f::Zero();
|
||||||
for (int y = 0; y < gridSize; ++y)
|
for (int y = 0; y < gridSize; ++y)
|
||||||
for (int x = 0; x < gridSize; ++x) {
|
for (int x = 0; x < gridSize; ++x) {
|
||||||
Vector3f contribution =
|
Vector3f contribution =
|
||||||
|
@ -69,7 +68,6 @@ Vector3f AreaLight::illumination(const HitRecord &hit,
|
||||||
.illumination(hit, geometries);
|
.illumination(hit, geometries);
|
||||||
color += contribution;
|
color += contribution;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return color / gridSize / gridSize;
|
return color / gridSize / gridSize;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue