Add bounding box calculation to triangle..

Could be helpful XD
This commit is contained in:
Godzil
2020-02-26 02:17:57 +00:00
parent 1c00077949
commit 7a96d42874
3 changed files with 28 additions and 0 deletions

View File

@@ -54,4 +54,18 @@ Intersect Triangle::localIntersect(Ray r)
Tuple Triangle::localNormalAt(Tuple point)
{
return this->normal;
}
BoundingBox Triangle::getBounds()
{
BoundingBox ret;
ret | p1;
ret | p2;
ret | p3;
ret.min = this->objectToWorld(ret.min);
ret.max = this->objectToWorld(ret.max);
return ret;
}