Legacy code clean up for t values
Intersection methods push values into the t vector in ascending order, so no need to check them in TraceRay.
This commit is contained in:
		
							parent
							
								
									2ade996783
								
							
						
					
					
						commit
						4cbe9df324
					
				
					 1 changed files with 2 additions and 9 deletions
				
			
		
							
								
								
									
										11
									
								
								src/scene.cc
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/scene.cc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -228,15 +228,8 @@ Scene::trace_ray(const Ray &ray,
 | 
			
		|||
    for (Object::Ptr s : shapes) {
 | 
			
		||||
        ts.clear();
 | 
			
		||||
        if (s->DoesIntersect(ray, ts, mStats)) {
 | 
			
		||||
            for (Double t : ts) {
 | 
			
		||||
                if (t < 1e-2) {
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                if (t < nearest_t) {
 | 
			
		||||
                    intersected_shape = s;
 | 
			
		||||
                    nearest_t = t;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            intersected_shape = s;
 | 
			
		||||
            nearest_t = ts[0];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue