00001 #ifndef Pv_Camera_Included 00002 #define Pv_Camera_Included 00003 00004 #include "GL/gl.h" 00005 00006 #include "pv_matrix.h" 00007 #include "pv_gl.h" 00008 #include "pv_point.h" 00009 00010 00011 class Pv_Camera{ 00012 Pv_Matrix init_m; 00013 Pv_Matrix m; 00014 Pv_Matrix saved_m; 00015 00016 /*radius for pitch and yaw*/ 00017 double radius; 00018 00019 public: 00020 /*constructors*/ 00021 Pv_Camera(Pv_Point,Pv_Point);/*point where it is, 00022 *point were it looks 00023 *orientation is vertical*/ 00024 Pv_Camera(Pv_Point position,Pv_Point eye,Pv_Point up); 00025 00026 /*get*/ 00027 Pv_Matrix get_m() const; 00028 00029 /*put*/ 00030 00031 /*operators*/ 00032 friend std::ostream& operator<< (std::ostream& s,Pv_Camera& c); 00033 00034 /*coordinate transformations*/ 00035 double mouse_to_gl_x(int x); 00036 double mouse_to_gl_y(int y); 00037 double mouse_to_gl_angle_x(int x); 00038 double mouse_to_gl_angle_y(int y); 00039 double mouse_to_gl_roll_angle(int x); 00040 00041 /*move*/ 00042 void translate(double x,double y); 00043 void zoom(double x,double y); 00044 void roll(double x,double y); 00045 void rotate(double x,double y); 00046 00047 /*misc*/ 00048 void reset(); 00049 void reshape(); 00050 void save(); 00051 void restore(); 00052 }; 00053 #endif 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067
1.2.18