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     private:
00185 
00186 
00187         // ********************************************* //
00188         // ********************************************* //
00189         //  Internal Camera Parameters
00190         // ********************************************* //
00191         // ********************************************* //
00192 
00194         trackball track;
00196         v3 tr;
00198         double dist;
00199 
00201         double fov;
00203         double znear;
00205         double zfar;
00206 
00207         // ********************************************* //
00208         // ********************************************* //
00209         //  Window and mouse parameters
00210         // ********************************************* //
00211         // ********************************************* //
00212 
00214         unsigned int x_size;
00216         unsigned int y_size;
00217 
00219         int mouse_x_previous;
00221         int mouse_y_previous;
00222 
00223 
00225         bool is_left_button;
00227         bool is_right_button;
00228 
00229         // ********************************************* //
00230         // ********************************************* //
00231         //  Time parameter
00232         // ********************************************* //
00233         // ********************************************* //
00234 
00236         double current_fps;
00238         unsigned int current_time;
00240         unsigned int old_time;
00242         unsigned int frame;
00243 
00244     };
00245 }
00246 
00247 #endif
Generated on Wed Oct 27 16:12:18 2010 by  doxygen 1.6.3