Add default values for trace_ray depth and weight arguments
This commit is contained in:
		
							parent
							
								
									745aa27447
								
							
						
					
					
						commit
						58f3cdd304
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue