scene3d.hpp
Go to the documentation of this file.
00001 /*
00002 **    TP 4ETI CPE Lyon
00003 **    Copyright (C) 2012 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 SCENE3D_HPP
00021 #define SCENE3D_HPP
00022 
00023 #include <vector>
00024 
00025 #include <exception_cpe.hpp>
00026 #include <light.hpp>
00027 #include <object3d.hpp>
00028 #include <color.hpp>
00029 #include <light.hpp>
00030 #include <camera.hpp>
00031 #include <material.hpp>
00032 
00033 
00034 namespace cpe
00035 {
00036 
00037 
00038 
00043     class scene3d
00044     {
00045     public:
00046 
00047         // ********************************************* //
00048         // ********************************************* //
00049         //  CONSTRUCTOR
00050         // ********************************************* //
00051         // ********************************************* //
00052 
00054         scene3d();
00055 
00056         // ********************************************* //
00057         // ********************************************* //
00058         //  ADD/DELETE OBJECTS
00059         // ********************************************* //
00060         // ********************************************* //
00061 
00063         void clean_memory();
00064 
00065 
00066 
00068         void add(const object3d* obj,const material& material);
00070         void add(const light& light_parameter);
00071 
00073         unsigned int N_object() const;
00075         unsigned int N_light() const;
00076 
00077 
00078         // ********************************************* //
00079         // ********************************************* //
00080         //  ADD/DELETE OBJECTS
00081         // ********************************************* //
00082         // ********************************************* //
00083 
00085         const object3d* get_object(const unsigned int k_object) const;
00087         const light& get_light(const unsigned int k_light) const;
00089         const material& get_material(const unsigned int k_material) const;
00090 
00092         void set_camera(const camera& cam);
00094         const camera& get_camera() const;
00095 
00096 
00098         void set_background_color(const color& background_color);
00100         const color& get_background_color() const;
00101 
00102     private:
00103 
00104         // ********************************************* //
00105         // ********************************************* //
00106         //  INTERNAL STORAGE
00107         // ********************************************* //
00108         // ********************************************* //
00109 
00111         std::vector<std::pair<const object3d*,material> > v_object;
00113         std::vector<light> v_light;
00115         camera cam;
00116 
00118         color background_color;
00119 
00120     };
00121 
00122 
00123 
00124 
00125 
00127     class exception_scene3d : public exception_cpe
00128     {
00129     public:
00130 
00132         exception_scene3d():exception_cpe(){}
00134         exception_scene3d(const std::string& msg,const std::string& file,const std::string& caller,const int& line):exception_cpe(msg,file,caller,line){}
00135     };
00136 
00137 }
00138 #endif