mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
work on direct illumination
This commit is contained in:
parent
184812c533
commit
bb8819013c
8 changed files with 80 additions and 18 deletions
19
src/Light.cc
19
src/Light.cc
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue