scene3d.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 
00021 #ifndef _SCENE3D_HPP_
00022 #define _SCENE3D_HPP_
00023 
00024 #include <vector>
00025 
00026 #include <exception_cpe.hpp>
00027 #include <object3d.hpp>
00028 #include <color.hpp>
00029 #include <v3_shaded.hpp>
00030 
00031 
00032 namespace cpe
00033 {
00034 
00035 
00036     struct material;
00037 
00042     class scene3d
00043     {
00044     public:
00045 
00046         // ********************************************* //
00047         // ********************************************* //
00048         //  CONSTRUCTOR
00049         // ********************************************* //
00050         // ********************************************* //
00051 
00053         scene3d();
00054 
00055         // ********************************************* //
00056         // ********************************************* //
00057         //  ADD/DELETE OBJECTS
00058         // ********************************************* //
00059         // ********************************************* //
00060 
00062         void clean_memory();
00063 
00065         void add(const object3d* obj,const material& material);
00067         void add(const light_parameters& light);
00068 
00070         unsigned int N_object() const;
00072         unsigned int N_light() const;
00073 
00074 
00075         // ********************************************* //
00076         // ********************************************* //
00077         //  ADD/DELETE OBJECTS
00078         // ********************************************* //
00079         // ********************************************* //
00080 
00082         const object3d* get_object(const unsigned int k_object) const;
00084         const light_parameters& get_light(const unsigned int k_light) const;
00086         const material& get_material(const unsigned int k_material) const;
00087 
00088     private:
00089 
00090         // ********************************************* //
00091         // ********************************************* //
00092         //  INTERNAL STORAGE
00093         // ********************************************* //
00094         // ********************************************* //
00095 
00097         std::vector<std::pair<const object3d*,material> > v_object;
00099         std::vector<light_parameters> v_light;
00100 
00101     };
00102 
00103 
00104 
00106     struct material
00107     {
00109         material(const color& _c,const shading_parameters& _shad):c(_c),shad(_shad){}
00110 
00112         color c;
00114         shading_parameters shad;
00115     };
00116 
00118     class exception_scene3d : public exception_cpe
00119     {
00120     public:
00121 
00123         exception_scene3d():exception_cpe(){}
00125         exception_scene3d(const std::string& msg,const std::string& file,const std::string& caller,const int& line):exception_cpe(msg,file,caller,line){}
00126     };
00127 
00128 }
00129 #endif
Generated on Mon Apr 18 16:13:40 2011 by  doxygen 1.6.3