ray_tracer.hpp

Go to the documentation of this file.
00001 /*
00002 **    TP 4ETI CPE Lyon
00003 **    Copyright (C) 2011 Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef _RAY_TRACER_HPP_
00021 #define _RAY_TRACER_HPP_
00022 
00023 #include <object3d.hpp>
00024 #include <scene3d.hpp>
00025 #include <vector>
00026 
00027 
00028 namespace cpe
00029 {
00030 
00031     struct intersection_object;
00032     class image;
00033     class color;
00034     class ray;
00035 
00036 
00038     class ray_tracer
00039     {
00040     public:
00041 
00042         // ********************************************* //
00043         // ********************************************* //
00044         //  RAY-TRACING
00045         // ********************************************* //
00046         // ********************************************* //
00047 
00049         static void trace(const scene3d& scene,image* pic);
00050 
00051 
00052     private:
00053 
00054         // ********************************************* //
00055         // ********************************************* //
00056         //  HELPER METHODS
00057         // ********************************************* //
00058         // ********************************************* //
00059 
00063         static color throw_ray(const scene3d& scene,const ray& ray_current);
00064 
00066         static std::pair<intersection_object,bool> find_inter(const ray& ray_current,const scene3d& scene);
00068         static color find_intersection_color(const std::pair<intersection_object,bool>& inter,const scene3d& scene);
00069 
00070 
00071     };
00072 
00073 
00074 
00076     struct intersection_object
00077     {
00079         intersection_object(const intersection_data& inter,const material& mat):inter_data(inter),mat_data(mat){}
00080 
00082         intersection_data inter_data;
00084         material mat_data;
00085     };
00086 }
00087 
00088 #endif
Generated on Mon Apr 18 16:13:40 2011 by  doxygen 1.6.3