Add bounding box calculation to triangle..
Could be helpful XD
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user