mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 07:22:01 +00:00
finish global illumination
This commit is contained in:
parent
e59c6dbea4
commit
a63aedc323
5 changed files with 41 additions and 20 deletions
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue