src/scene.cc
branchpyrit
changeset 8 e6567b740c5e
parent 7 bf17f9f84c91
child 12 f4fcabf05785
equal deleted inserted replaced
7:bf17f9f84c91 8:e6567b740c5e
    69 		}
    69 		}
    70 	}
    70 	}
    71 	return false;
    71 	return false;
    72 }
    72 }
    73 
    73 
       
    74 BBox Sphere::get_bbox()
       
    75 {	
       
    76 	BBox bbox = BBox();
       
    77 	bbox.L.x = center.x - radius;
       
    78 	bbox.L.y = center.y - radius;
       
    79 	bbox.L.z = center.z - radius;
       
    80 	bbox.R.x = center.x + radius;
       
    81 	bbox.R.y = center.y + radius;
       
    82 	bbox.R.z = center.z + radius;
       
    83 	return bbox;
       
    84 }
       
    85 
    74 bool Plane::intersect(const Ray &ray, float &dist)
    86 bool Plane::intersect(const Ray &ray, float &dist)
    75 {
    87 {
    76 	float dir = dot(N, ray.dir);
    88 	float dir = dot(N, ray.dir);
    77 	if (dir != 0)
    89 	if (dir != 0)
    78 	{
    90 	{
    81 			dist = newdist;
    93 			dist = newdist;
    82 			return true;
    94 			return true;
    83 		}
    95 		}
    84 	}
    96 	}
    85 	return false;
    97 	return false;
       
    98 }
       
    99 
       
   100 BBox Plane::get_bbox()
       
   101 {	
       
   102 	return BBox();
    86 }
   103 }
    87 
   104 
    88 // this initialization and following intersection methods implements
   105 // this initialization and following intersection methods implements
    89 // Fast Triangle Intersection algorithm from
   106 // Fast Triangle Intersection algorithm from
    90 // http://www.mpi-inf.mpg.de/~wald/PhD/
   107 // http://www.mpi-inf.mpg.de/~wald/PhD/