gVirtualXRay  2.0.10
VirtualX-RayImagingLibraryonGPU
StereoHelper.inl
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2014, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4 http://www.fpvidal.net/
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 3. Neither the name of the Bangor University nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 
63 //******************************************************************************
64 // namespace
65 //******************************************************************************
66 namespace gVirtualXRay {
67 
68 
69 //----------------------------------------------------------------
70 inline void StereoHelper::setIntraocularDistance(double aDistance)
71 //----------------------------------------------------------------
72 {
73  m_intraocular_distance = aDistance;
75 }
76 
77 
78 //--------------------------------------------------------
80 //--------------------------------------------------------
81 {
82  return (m_intraocular_distance);
83 }
84 
85 
86 //-----------------------------------------------------------
87 inline void StereoHelper::setScreenAspectRatio(double aRatio)
88 //-----------------------------------------------------------
89 {
90  m_screen_aspect_ratio = aRatio;
92 }
93 
94 
95 //-----------------------------------------------------
96 inline void StereoHelper::setFieldOfViewY(double aFOVY)
97 //-----------------------------------------------------
98 {
99  m_fovy = aFOVY;
101 }
102 
103 
104 //-------------------------------------------------
105 inline double StereoHelper::getFieldOfViewY() const
106 //-------------------------------------------------
107 {
108  return (m_fovy);
109 }
110 
111 
112 //----------------------------------------------
113 inline void StereoHelper::setNear(double aPlane)
114 //----------------------------------------------
115 {
116  m_near = aPlane;
118 }
119 
120 
121 //-----------------------------------------
122 inline double StereoHelper::getNear() const
123 //-----------------------------------------
124 {
125  return (m_near);
126 }
127 
128 
129 //---------------------------------------------
130 inline void StereoHelper::setFar(double aPlane)
131 //---------------------------------------------
132 {
133  m_far = aPlane;
135 }
136 
137 
138 //----------------------------------------
139 inline double StereoHelper::getFar() const
140 //----------------------------------------
141 {
142  return (m_far);
143 }
144 
145 
146 //---------------------------------------------------------------
147 inline void StereoHelper::setScreenProjectionPlane(double aPlane)
148 //---------------------------------------------------------------
149 {
150  m_screen_projection_plane = aPlane;
152 }
153 
154 
155 //--------------------------------------------------------------
157 //--------------------------------------------------------------
158 {
160  {
161  update();
162  }
163 
165 }
166 
167 
168 //---------------------------------------------------------------
170 //---------------------------------------------------------------
171 {
173  {
174  update();
175  }
176 
178 }
179 
180 
181 //----------------------------------------
182 inline bool StereoHelper::isActive() const
183 //----------------------------------------
184 {
185  return (m_stereo_currently_in_use);
186 }
187 
188 
189 } // namespace gVirtualXRay
void setScreenProjectionPlane(double aPlane)
Set the screen projection plane.
double m_screen_aspect_ratio
Screen aspect ratio.
Definition: StereoHelper.h:298
void setNear(double aPlane)
Set the near clipping plane.
bool m_stereo_currently_in_use
Flag set to true when the stereo is in used.
Definition: StereoHelper.h:314
void setFieldOfViewY(double aFOVY)
Set the field of view along the y-axis.
double getFar() const
Accessor on the far clipping plane.
bool isActive() const
Accessor on the stereo flag.
bool m_matrices_are_up_to_date
Flag set to true when the matrices are up-to-date.
Definition: StereoHelper.h:306
double getFieldOfViewY() const
Accessor on the field of view along the y-axis.
const MATRIX4 & getLeftEyeProjectionMatrix()
Accessor on the projection matrix corresponding to the left eye.
double getNear() const
Accessor on the near clipping plane.
double m_screen_projection_plane
Screen projection plane.
Definition: StereoHelper.h:302
void update()
Compute the projection matrices.
void setIntraocularDistance(double aDistance)
Set the intraocular distance.
MATRIX4 m_left_eye_projection_matrix
The projection matrix corresponding to the left eye.
Definition: StereoHelper.h:262
double m_intraocular_distance
Intraocular distance.
Definition: StereoHelper.h:258
void setFar(double aPlane)
Set the far clipping plane.
MATRIX4 m_right_eye_projection_matrix
The projection matrix corresponding to the right eye.
Definition: StereoHelper.h:266
double m_near
Near clipping plane.
Definition: StereoHelper.h:286
double m_far
Far clipping plane.
Definition: StereoHelper.h:290
double m_fovy
Field of view along the y-axis.
Definition: StereoHelper.h:294
const MATRIX4 & getRightEyeProjectionMatrix()
Accessor on the projection matrix corresponding to the right eye.
void setScreenAspectRatio(double aRatio)
Set the screen aspect ratio.
double getIntraocularDistance() const
Accessor on the intraocular distance.