Add default values for trace_ray depth and weight arguments

This commit is contained in:
Eryn Wells 2013-09-21 16:45:10 -07:00
parent 745aa27447
commit 58f3cdd304
2 changed files with 5 additions and 3 deletions

View file

@ -134,7 +134,7 @@ Scene::render()
d = Vector3(0, 0, 1);
d.normalize();
primary_ray = Ray(o, d);
Color c = trace_ray(primary_ray, 0);
Color c = trace_ray(primary_ray);
pixels[y * width + x] = c;
}
}
@ -177,7 +177,9 @@ Scene::add_light(PointLight *light)
* Trace the given ray through the scene, recursing until depth has been reached.
*/
Color
Scene::trace_ray(const Ray &ray, const int depth)
Scene::trace_ray(const Ray &ray,
const int depth,
const float weight)
{
if (depth >= max_depth) {
return Color::Black;

View file

@ -42,7 +42,7 @@ public:
void add_light(PointLight *light);
private:
Color trace_ray(const Ray &ray, const int depth);
Color trace_ray(const Ray &ray, const int depth = 0, const float weight = 1.0);
// Pixel dimensions of the image.
int width, height;