00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
00033 #define OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
00034
00035
00036
00037
00038 #include <OpenMesh/Core/Math/VectorT.hh>
00039 #include <OpenMesh/Tools/VDPM/Plane3d.hh>
00040
00041
00042
00043
00044
00045
00046
00047 namespace OpenMesh {
00048 namespace VDPM {
00049
00050
00051
00052
00055 class ViewingParameters
00056 {
00057 private:
00058 double modelview_matrix_[16];
00059 float fovy_;
00060 float aspect_;
00061 float tolerance_square_;
00062
00063 Vec3f eye_pos_;
00064 Vec3f right_dir_;
00065 Vec3f up_dir_;
00066 Vec3f view_dir_;
00067
00068 Plane3d frustum_plane_[4];
00069
00070 public:
00071
00072 ViewingParameters();
00073
00074 void increase_tolerance() { tolerance_square_ *= 5.0f; }
00075 void decrease_tolerance() { tolerance_square_ /= 5.0f; }
00076
00077 float fovy() const { return fovy_; }
00078 float aspect() const { return aspect_; }
00079 float tolerance_square() const { return tolerance_square_; }
00080
00081 void set_fovy(float _fovy) { fovy_ = _fovy; }
00082 void set_aspect(float _aspect) { aspect_ = _aspect; }
00083 void set_tolerance_square(float _tolerance_square) { tolerance_square_ = _tolerance_square; }
00084
00085 const Vec3f& eye_pos() const { return eye_pos_; }
00086 const Vec3f& right_dir() const { return right_dir_; }
00087 const Vec3f& up_dir() const { return up_dir_; }
00088 const Vec3f& view_dir() const { return view_dir_; }
00089 Vec3f& eye_pos() { return eye_pos_; }
00090 Vec3f& right_dir() { return right_dir_; }
00091 Vec3f& up_dir() { return up_dir_; }
00092 Vec3f& view_dir() { return view_dir_; }
00093
00094 void frustum_planes( Plane3d _plane[4] )
00095 {
00096 for (unsigned int i=0; i<4; ++i)
00097 _plane[i] = frustum_plane_[i];
00098 }
00099
00100 void get_modelview_matrix(double _modelview_matrix[16])
00101 {
00102 for (unsigned int i=0; i<16; ++i)
00103 _modelview_matrix[i] = modelview_matrix_[i];
00104 }
00105
00106 void set_modelview_matrix(const double _modelview_matrix[16])
00107 {
00108 for (unsigned int i=0; i<16; ++i)
00109 modelview_matrix_[i] = _modelview_matrix[i];
00110 }
00111
00112 void update_viewing_configurations();
00113
00114 void PrintOut();
00115 };
00116
00117
00118
00119 }
00120 }
00121
00122 #endif // OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH defined
00123
00124