finish global illumination

This commit is contained in:
Shuo Feng 2024-03-20 23:37:20 -04:00
parent e59c6dbea4
commit a63aedc323
Signed by: sfeng
GPG key ID: 1E83AE6CD1C037B1
5 changed files with 41 additions and 20 deletions

View file

@ -40,6 +40,8 @@ Vector3f Sphere::normal(const Vector3f &p) const {
return (p - center).normalized();
}
Vector3f Sphere::sample() const { return center + Vector3f(radius, 0, 0); }
bool isInRectangle(const Vector3f &p, const Vector3f &a, const Vector3f &b,
const Vector3f &c, const Vector3f &d, const Vector3f &n) {
float s1 = (b - a).cross(p - a).dot(n);
@ -67,3 +69,5 @@ Optional<float> Rectangle::intersect(const Ray &r) const {
}
Vector3f Rectangle::normal(const Vector3f &p) const { return normal_; }
Vector3f Rectangle::sample() const { return p1; }