OpenMesh
ViewingParameters.hh
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2025, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44
45//=============================================================================
46//
47// CLASS newClass
48//
49//=============================================================================
50
51#ifndef OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
52#define OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH
53
54
55//== INCLUDES =================================================================
56
57#include <OpenMesh/Core/Geometry/VectorT.hh>
58#include <OpenMesh/Core/Geometry/Plane3d.hh>
59
60
61//== FORWARDDECLARATIONS ======================================================
62
63
64//== NAMESPACES ===============================================================
65
66namespace OpenMesh {
67namespace VDPM {
68
69//== CLASS DEFINITION =========================================================
70
71
74class OPENMESHDLLEXPORT ViewingParameters
75{
76private:
77 double modelview_matrix_[16];
78 float fovy_;
79 float aspect_;
80 float tolerance_square_;
81
82 Vec3f eye_pos_;
83 Vec3f right_dir_;
84 Vec3f up_dir_;
85 Vec3f view_dir_;
86
87 Plane3d frustum_plane_[4];
88
89public:
90
92
93 void increase_tolerance() { tolerance_square_ *= 5.0f; }
94 void decrease_tolerance() { tolerance_square_ /= 5.0f; }
95
96 float fovy() const { return fovy_; }
97 float aspect() const { return aspect_; }
98 float tolerance_square() const { return tolerance_square_; }
99
100 void set_fovy(float _fovy) { fovy_ = _fovy; }
101 void set_aspect(float _aspect) { aspect_ = _aspect; }
102 void set_tolerance_square(float _tolerance_square) { tolerance_square_ = _tolerance_square; }
103
104 const Vec3f& eye_pos() const { return eye_pos_; }
105 const Vec3f& right_dir() const { return right_dir_; }
106 const Vec3f& up_dir() const { return up_dir_; }
107 const Vec3f& view_dir() const { return view_dir_; }
108 Vec3f& eye_pos() { return eye_pos_; }
109 Vec3f& right_dir() { return right_dir_; }
110 Vec3f& up_dir() { return up_dir_; }
111 Vec3f& view_dir() { return view_dir_; }
112
113 void frustum_planes( Plane3d _plane[4] )
114 {
115 for (unsigned int i=0; i<4; ++i)
116 _plane[i] = frustum_plane_[i];
117 }
118
119 void get_modelview_matrix(double _modelview_matrix[16])
120 {
121 for (unsigned int i=0; i<16; ++i)
122 _modelview_matrix[i] = modelview_matrix_[i];
123 }
124
125 void set_modelview_matrix(const double _modelview_matrix[16])
126 {
127 for (unsigned int i=0; i<16; ++i)
128 modelview_matrix_[i] = _modelview_matrix[i];
129 }
130
131 void update_viewing_configurations();
132
133 void PrintOut();
134};
135
136
137//=============================================================================
138} // namespace VDPM
139} // namespace OpenMesh
140//=============================================================================
141#endif // OPENMESH_VDPROGMESH_VIEWINGPARAMETERS_HH defined
142//=============================================================================
143
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
ax + by + cz + d = 0
Definition: Plane3d.hh:79
Definition: ViewingParameters.hh:75

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .