- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# Tools/VDPM/ViewingParameters.hh

    00001 /*===========================================================================*\
    00002  *                                                                           *
    00003  *                               OpenMesh                                    *
    00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
    00005  *                           www.openmesh.org                                *
    00006  *                                                                           *
    00007  *---------------------------------------------------------------------------*
    00008  *                                                                           *
    00009  *                                License                                    *
    00010  *                                                                           *
    00011  *  This library is free software; you can redistribute it and/or modify it  *
    00012  *  under the terms of the GNU Library General Public License as published   *
    00013  *  by the Free Software Foundation, version 2.                              *
    00014  *                                                                           *
    00015  *  This library is distributed in the hope that it will be useful, but      *
    00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
    00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
    00018  *  Library General Public License for more details.                         *
    00019  *                                                                           *
    00020  *  You should have received a copy of the GNU Library General Public        *
    00021  *  License along with this library; if not, write to the Free Software      *
    00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
    00023  *                                                                           *
    00024 \*===========================================================================*/
    00025
    00026 //=============================================================================
    00027 //
    00028 //  CLASS newClass
    00029 //
    00030 //=============================================================================
    00031
    00032 #ifndef OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
    00033 #define OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
    00034
    00035
    00036 //== INCLUDES =================================================================
    00037
    00038 #include <OpenMesh/Core/Math/VectorT.hh>
    00039 #include <OpenMesh/Tools/VDPM/Plane3d.hh>
    00040
    00041
    00042 //== FORWARDDECLARATIONS ======================================================
    00043
    00044
    00045 //== NAMESPACES ===============================================================
    00046
    00047 namespace OpenMesh {
    00048 namespace VDPM {
    00049
    00050 //== CLASS DEFINITION =========================================================
    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 } // namespace VDPM
    00120 } // namespace OpenMesh
    00121 //=============================================================================
    00122 #endif // OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH defined
    00123 //=============================================================================
    00124