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
|
@ -66,9 +66,12 @@ Sphere::set_radius(float r)
|
|||
*/
|
||||
bool
|
||||
Sphere::DoesIntersect(const Ray& ray,
|
||||
TVector& t)
|
||||
TVector& t,
|
||||
Stats& stats)
|
||||
const
|
||||
{
|
||||
stats.sphereIntersectionTests++;
|
||||
|
||||
/* Origin of the vector in object space. */
|
||||
Vector3 rayOriginObj = ray.origin - GetOrigin();
|
||||
|
||||
|
@ -119,6 +122,7 @@ Sphere::DoesIntersect(const Ray& ray,
|
|||
}
|
||||
}
|
||||
|
||||
stats.sphereIntersections++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue