scene.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 
00023 #ifndef _SCENE_HPP_
00024 #define _SCENE_HPP_
00025 
00026 #include <v3.hpp>
00027 #include <mesh.hpp>
00028 #include <grid.hpp>
00029 #include <surface_param_drawable.hpp>
00030 #include <picking_data.hpp>
00031 #include <gui_interface.hpp>
00032 
00033 #include <vector>
00034 
00035 class glwidget;
00036 
00037 class scene
00038 {
00039     private:
00040 
00042         cpe::grid g0;
00044         std::vector<cpe::surface_param_drawable> surf;
00045 
00046     public:
00047 
00048         // ********************************************* //
00049         // ********************************************* //
00050         //  CONSTRUCTORS
00051         // ********************************************* //
00052         // ********************************************* //
00053 
00055         scene();
00056 
00057 
00058         // ********************************************* //
00059         // ********************************************* //
00060         //  Scene construction and drawing
00061         // ********************************************* //
00062         // ********************************************* //
00063 
00065         void load_model();
00067         void draw_scene();
00068 
00069         // ********************************************* //
00070         // ********************************************* //
00071         //  Spline manager
00072         // ********************************************* //
00073         // ********************************************* //
00074 
00076         void build_spline_surface(const unsigned int& N_samples);
00078         void fill_patch(const unsigned int& index_surface,const cpe::patch4& p,const unsigned int& N_samples);
00080         void compute_curve_spline();
00081 
00083         void update_high_res();
00085         void update_low_res();
00086 
00087 
00088 
00089         // ********************************************* //
00090         // ********************************************* //
00091         //  Grid manager
00092         // ********************************************* //
00093         // ********************************************* //
00094 
00096         void picking_grid(const cpe::v3& center_ray,const cpe::v3& direction_ray);
00098         void translate_picking(const cpe::v3 t);
00099 
00101         void add_u_back_line();
00103         void add_v_back_line();
00105         void add_u_front_line();
00107         void add_v_front_line();
00108 
00110         void erase_u_back_line();
00112         void erase_v_back_line();
00114         void erase_u_front_line();
00116         void erase_v_front_line();
00117 
00119         void duplicate_boundary();
00120 
00122         void load_grid();
00124         void save_grid() const;
00125 
00126 
00127         // ********************************************* //
00128         // ********************************************* //
00129         //  Gui Helpers
00130         // ********************************************* //
00131         // ********************************************* //
00132 
00133 
00135         void set_glwidget(glwidget *p_widget);
00136 
00138         cpe::gui_interface& gui_visible_interface();
00139 
00140 
00141 
00142     private:
00143 
00145         std::vector<cpe::v3> color_table;
00146 
00148         std::vector<std::vector<cpe::v3> > curve_spline;
00149 
00151         cpe::mesh sphere;
00153         std::vector<cpe::v3> sphere_normal;
00155         void preload_sphere();
00156 
00158         cpe::picking_data pick;
00159 
00161         std::string filename_grid;
00162 
00164         unsigned int N_sample_high_res;
00166         unsigned int N_sample_low_res;
00167 
00168 
00170         cpe::gui_interface gui_visible;
00171 
00173         unsigned int counter_update;
00174 
00175 
00177         void init_gui_visibility();
00179         void init_color_table();
00180 
00181 };
00182 
00183 #endif
Generated on Mon Feb 27 18:30:05 2012 by  doxygen 1.6.3