work on direct illumination

This commit is contained in:
Shuo Feng 2024-02-29 00:15:00 -05:00
parent 184812c533
commit bb8819013c
Signed by: sfeng
GPG key ID: 1E83AE6CD1C037B1
8 changed files with 80 additions and 18 deletions

View file

@ -8,6 +8,21 @@ void Light::setGridSize(unsigned int gridSize) { this->gridSize = gridSize; }
void Light::setUseCenter(bool useCenter) { this->useCenter = useCenter; }
void PointLight::illumination() const {}
Vector3f PointLight::illumination(const HitRecord &hit,
const vector<Geometry *> &geometries) const {
Vector3f shadingPoint = hit.getPoint();
Vector3f rayDirection = (center - shadingPoint).normalized();
Geometry *geometry = hit.geometry();
Ray shadowRay(shadingPoint, rayDirection);
void AreaLight::illumination() const {}
for (auto g : geometries)
if (g != geometry && g->intersect(shadowRay).hasValue())
return Vector3f::Zero();
return Vector3f::Zero();
}
Vector3f AreaLight::illumination(const HitRecord &hit,
const vector<Geometry *> &geometries) const {
return Vector3f::Zero();
}