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:
Eryn Wells 2014-08-02 15:21:14 -07:00
parent b60e27824b
commit 79c951030d
12 changed files with 166 additions and 62 deletions

View file

@ -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;
}