navigator_tool.hpp

Go to the documentation of this file.
00001 /*
00002 **    TP ETI5 CPE Lyon
00003 **    Copyright (C) 2010 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 _NAVIGATOR_TOOL_HPP_
00022 #define _NAVIGATOR_TOOL_HPP_
00023 
00024 #include <trackball.hpp>
00025 #include <v3.hpp>
00026 
00027 #include <vector>
00028 
00029 namespace cpe
00030 {
00031 
00043     class navigator_tool
00044     {
00045     public:
00046 
00047         // ********************************************* //
00048         // ********************************************* //
00049         //  CONSTRUCTORS
00050         // ********************************************* //
00051         // ********************************************* //
00052 
00054         navigator_tool();
00055 
00056 
00057         // ********************************************* //
00058         // ********************************************* //
00059         //  Screen parameters
00060         // ********************************************* //
00061         // ********************************************* //
00062 
00064         unsigned int& screen_size_x();
00066         const unsigned int& screen_size_x() const;
00067 
00069         unsigned int& screen_size_y();
00071         const unsigned int& screen_size_y() const;
00072 
00073 
00074         // ********************************************* //
00075         // ********************************************* //
00076         //  Camera manipulation
00077         // ********************************************* //
00078         // ********************************************* //
00079 
00081         double& dist_cam();
00083         const double& dist_cam() const;
00084 
00086         void go_forward(const double& dL);
00088         void go_right  (const double& dL);
00090         void go_up     (const double& dL);
00091 
00092 
00094         void trackball_rotate(const int& x,const int&y);
00096         void trackball_zoom(const int& y);
00097 
00098 
00099         // ********************************************* //
00100         // ********************************************* //
00101         //  Mouse record
00102         // ********************************************* //
00103         // ********************************************* //
00104 
00106         int& x_previous();
00108         const int& x_previous() const;
00109 
00111         int& y_previous();
00113         const int& y_previous() const;
00114 
00116         bool& left_button();
00118         const bool& left_button() const;
00119 
00121         bool& right_button();
00123         const bool& right_button() const;
00124 
00125 
00126 
00127 
00128         // ********************************************* //
00129         // ********************************************* //
00130         // Projection parameters
00131         // ********************************************* //
00132         // ********************************************* //
00133 
00146         std::vector<double> projection_param() const;
00147 
00148 
00149         // ********************************************* //
00150         // ********************************************* //
00151         //  Camera orientation
00152         // ********************************************* //
00153         // ********************************************* //
00154 
00156         matrix3 camera_orientation();
00158         v3 camera_translation();
00159 
00160 
00161 
00162         // ********************************************* //
00163         // ********************************************* //
00164         //  FPS
00165         // ********************************************* //
00166         // ********************************************* //
00167 
00169         void increase_frame_number();
00170 
00172         const unsigned int& time() const;
00174         unsigned int& time();
00175 
00177         double update_fps();
00179         double delta_time();
00180 
00182         double fps();
00183 
00184 
00185         // ********************************************* //
00186         // ********************************************* //
00187         //  Drawing parameters
00188         // ********************************************* //
00189         // ********************************************* //
00190 
00192         const bool& is_grid() const;
00194         bool& is_grid();
00196         const bool& is_texture() const;
00198         bool& is_texture();
00199 
00200     private:
00201 
00202 
00203         // ********************************************* //
00204         // ********************************************* //
00205         //  Internal Camera Parameters
00206         // ********************************************* //
00207         // ********************************************* //
00208 
00210         trackball track;
00212         v3 tr;
00214         double dist;
00215 
00217         double fov;
00219         double znear;
00221         double zfar;
00222 
00223         // ********************************************* //
00224         // ********************************************* //
00225         //  Window and mouse parameters
00226         // ********************************************* //
00227         // ********************************************* //
00228 
00230         unsigned int x_size;
00232         unsigned int y_size;
00233 
00235         int mouse_x_previous;
00237         int mouse_y_previous;
00238 
00239 
00241         bool is_left_button;
00243         bool is_right_button;
00244 
00245         // ********************************************* //
00246         // ********************************************* //
00247         //  Time parameter
00248         // ********************************************* //
00249         // ********************************************* //
00250 
00252         double current_fps;
00254         unsigned int current_time;
00256         unsigned int old_time;
00258         unsigned int frame;
00259 
00260         // ********************************************* //
00261         // ********************************************* //
00262         //  Drawing parameters
00263         // ********************************************* //
00264         // ********************************************* //
00265 
00267         bool is_grid_draw;
00269         bool is_texture_draw;
00270 
00271     };
00272 }
00273 
00274 #endif
Generated on Tue Dec 28 08:43:38 2010 by  doxygen 1.6.3