Move Stats to its own module
Move Stats to its own module and pass it around to the intersection methods to keep track of how many tests and successful intersections there are.
This commit is contained in:
parent
b60e27824b
commit
79c951030d
12 changed files with 166 additions and 62 deletions
|
@ -53,9 +53,12 @@ Box::SetFar(const Vector3& far)
|
|||
|
||||
bool
|
||||
Box::DoesIntersect(const Ray& ray,
|
||||
TVector& t)
|
||||
TVector& t,
|
||||
Stats& stats)
|
||||
const
|
||||
{
|
||||
stats.boxIntersectionTests++;
|
||||
|
||||
/*
|
||||
* XXX: For now, I'm assuming that all boxes are parallel to the coordinate
|
||||
* axes. This is the Kay-Kajiya box intersection algorithm.
|
||||
|
@ -174,8 +177,10 @@ Box::DoesIntersect(const Ray& ray,
|
|||
}
|
||||
|
||||
/* We have an intersection! */
|
||||
stats.boxIntersections++;
|
||||
t.push_back(tNear);
|
||||
t.push_back(tFar);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue