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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
00050 #define OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
00051
00052
00053
00054
00055 #include <OpenMesh/Core/Geometry/VectorT.hh>
00056 #include <OpenMesh/Core/Geometry/Plane3d.hh>
00057
00058
00059
00060
00061
00062
00063
00064 namespace OpenMesh {
00065 namespace VDPM {
00066
00067
00068
00069
00072 class ViewingParameters
00073 {
00074 private:
00075 double modelview_matrix_[16];
00076 float fovy_;
00077 float aspect_;
00078 float tolerance_square_;
00079
00080 Vec3f eye_pos_;
00081 Vec3f right_dir_;
00082 Vec3f up_dir_;
00083 Vec3f view_dir_;
00084
00085 Plane3d frustum_plane_[4];
00086
00087 public:
00088
00089 ViewingParameters();
00090
00091 void increase_tolerance() { tolerance_square_ *= 5.0f; }
00092 void decrease_tolerance() { tolerance_square_ /= 5.0f; }
00093
00094 float fovy() const { return fovy_; }
00095 float aspect() const { return aspect_; }
00096 float tolerance_square() const { return tolerance_square_; }
00097
00098 void set_fovy(float _fovy) { fovy_ = _fovy; }
00099 void set_aspect(float _aspect) { aspect_ = _aspect; }
00100 void set_tolerance_square(float _tolerance_square) { tolerance_square_ = _tolerance_square; }
00101
00102 const Vec3f& eye_pos() const { return eye_pos_; }
00103 const Vec3f& right_dir() const { return right_dir_; }
00104 const Vec3f& up_dir() const { return up_dir_; }
00105 const Vec3f& view_dir() const { return view_dir_; }
00106 Vec3f& eye_pos() { return eye_pos_; }
00107 Vec3f& right_dir() { return right_dir_; }
00108 Vec3f& up_dir() { return up_dir_; }
00109 Vec3f& view_dir() { return view_dir_; }
00110
00111 void frustum_planes( Plane3d _plane[4] )
00112 {
00113 for (unsigned int i=0; i<4; ++i)
00114 _plane[i] = frustum_plane_[i];
00115 }
00116
00117 void get_modelview_matrix(double _modelview_matrix[16])
00118 {
00119 for (unsigned int i=0; i<16; ++i)
00120 _modelview_matrix[i] = modelview_matrix_[i];
00121 }
00122
00123 void set_modelview_matrix(const double _modelview_matrix[16])
00124 {
00125 for (unsigned int i=0; i<16; ++i)
00126 modelview_matrix_[i] = _modelview_matrix[i];
00127 }
00128
00129 void update_viewing_configurations();
00130
00131 void PrintOut();
00132 };
00133
00134
00135
00136 }
00137 }
00138
00139 #endif // OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH defined
00140
00141