Ocean
StereoView.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_STEREO_VIEW_H
9 #define META_OCEAN_RENDERING_STEREO_VIEW_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 // Forward declaration
21 class StereoView;
22 
23 /**
24  * Definition of a smart object reference holding a stereo view node.
25  * @see SmartObjectRef, StereoView.
26  * @ingroup rendering
27  */
29 
30 /**
31  * This class is the base class for all stereo views.
32  * @ingroup rendering
33  */
34 class OCEAN_RENDERING_EXPORT StereoView : virtual public PerspectiveView
35 {
36  public:
37 
38  /**
39  * Definition of different stereo visualization types.
40  */
42  {
43  /// Invalid stereo type.
45  /// Quadbuffered stereo visualization type.
47  /// Anaglyph stereo visualization type.
49  };
50 
51  public:
52 
53  /**
54  * Returns the focus distance of this view.
55  * @return View focus distance
56  * @exception NotSupportedException Is thrown if this function is not supported
57  */
58  virtual Scalar focusDistance() const;
59 
60  /**
61  * Returns whether left and right image is reversed.
62  * @return True, if so
63  * @exception NotSupportedException Is thrown if this function is not supported
64  */
65  virtual bool eyesReversed() const;
66 
67  /**
68  * Returns the stereo visualization type of this stereo view.
69  * @return Stereo visualization type
70  * @exception NotSupportedException Is thrown if this function is not supported
71  */
72  virtual StereoType stereoType() const;
73 
74  /**
75  * Returns the transformation between the center of both views (device) and world.
76  * @return The device's transformation, which is world_T_device
77  * @exception NotSupportedException Is thrown if this function is not supported
78  * @see setTransformation().
79  */
81 
82  /**
83  * Returns the position and orientation of the left view in world coordinates (the left extrinsic camera data, the inverse of the known View Matrix).
84  * @return The transformation converting the left view to world, which is world_T_leftView
85  * @exception NotSupportedException Is thrown if this function is not supported
86  * @see rightTransformation().
87  */
89 
90  /**
91  * Returns the position and orientation of the right view in world coordinates (the right extrinsic camera data, the inverse of the known View Matrix).
92  * @return The transformation converting the right view to world, which is world_T_rightView
93  * @exception NotSupportedException Is thrown if this function is not supported
94  * @see leftTransformation().
95  */
97 
98  /**
99  * Returns the left projection matrix.
100  * @return The left projection matrix
101  * @exception NotSupportedException Is thrown if this function is not supported
102  * @see rightProjectionMatrix().
103  */
105 
106  /**
107  * Returns the right projection matrix.
108  * @return The right projection matrix
109  * @exception NotSupportedException Is thrown if this function is not supported
110  * @see leftProjectionMatrix().
111  */
113 
114  /**
115  * Sets the focus distance of this view.
116  * @param focus View focus distance to set
117  * @exception NotSupportedException Is thrown if this function is not supported
118  */
119  virtual void setFocusDistance(const Scalar focus);
120 
121  /**
122  * Sets whether left and right image will be reversed.
123  * @param reverse True, if the left image will be displayed for the right eye and vice versa
124  * @exception NotSupportedException Is thrown if this function is not supported
125  */
126  virtual void setEyesReversed(const bool reverse);
127 
128  /**
129  * Sets the stereo visualization type of this stereo view.
130  * @param type Stereo visualization type to set
131  * @return True, if succeeded
132  * @exception NotSupportedException Is thrown if this function is not supported
133  */
134  virtual bool setStereoType(const StereoType type);
135 
136  /**
137  * Sets the position and orientation of the center between left and right view (device) in world coordinates.
138  * @param world_T_device The transformation converting the device to world, must be valid
139  * @exception NotSupportedException Is thrown if this function is not supported
140  * @see transformation().
141  */
142  void setTransformation(const HomogenousMatrix4& world_T_device) override;
143 
144  /**
145  * Sets the position and orientation of the left view in world coordinates (the left extrinsic camera data, the inverse of the known View Matrix).
146  * @param world_T_leftView The transformation converting the left view to world, must be valid
147  * @exception NotSupportedException Is thrown if this function is not supported
148  * @see setRightTransformation().
149  */
150  virtual void setLeftTransformation(const HomogenousMatrix4& world_T_leftView);
151 
152  /**
153  * Sets the position and orientation of the right view in world coordinates (the right extrinsic camera data, the inverse of the known View Matrix).
154  * @param world_T_rightView The transformation converting the right view to world, must be valid
155  * @exception NotSupportedException Is thrown if this function is not supported
156  * @see setLeftTransformation().
157  */
158  virtual void setRightTransformation(const HomogenousMatrix4& world_T_rightView);
159 
160  /**
161  * Sets the left projection matrix.
162  * @param leftClip_T_leftView_ Left projection matrix to set
163  * @exception NotSupportedException Is thrown if this function is not supported
164  * @see setRightProjectionMatrix().
165  */
166  virtual void setLeftProjectionMatrix(const SquareMatrix4& leftClip_T_leftView_);
167 
168  /**
169  * Sets the right projection matrix.
170  * @param rightClip_T_rightView_ Right projection matrix to set
171  * @exception NotSupportedException Is thrown if this function is not supported
172  * @see setLeftProjectionMatrix().
173  */
174  virtual void setRightProjectionMatrix(const SquareMatrix4& rightClip_T_rightView_);
175 
176  /**
177  * Returns the type of this object.
178  * @see Object::type().
179  */
180  ObjectType type() const override;
181 
182  protected:
183 
184  /**
185  * Creates a new stereo view object.
186  */
188 
189  /**
190  * Destructs a stereo view object.
191  */
192  ~StereoView() override;
193 
194  /**
195  * Returns the projection matrix of this view.
196  * Protected function as it has no meaning in stereo views.
197  * @return The invalid 4x4 matrix
198  */
199  SquareMatrix4 projectionMatrix() const override;
200 };
201 
202 }
203 
204 }
205 
206 #endif // META_OCEAN_RENDERING_STEREO_VIEW_H
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all perspective views.
Definition: PerspectiveView.h:37
This class is the base class for all stereo views.
Definition: StereoView.h:35
~StereoView() override
Destructs a stereo view object.
virtual void setRightTransformation(const HomogenousMatrix4 &world_T_rightView)
Sets the position and orientation of the right view in world coordinates (the right extrinsic camera ...
virtual HomogenousMatrix4 rightTransformation() const
Returns the position and orientation of the right view in world coordinates (the right extrinsic came...
virtual void setRightProjectionMatrix(const SquareMatrix4 &rightClip_T_rightView_)
Sets the right projection matrix.
void setTransformation(const HomogenousMatrix4 &world_T_device) override
Sets the position and orientation of the center between left and right view (device) in world coordin...
virtual Scalar focusDistance() const
Returns the focus distance of this view.
virtual bool setStereoType(const StereoType type)
Sets the stereo visualization type of this stereo view.
ObjectType type() const override
Returns the type of this object.
virtual void setFocusDistance(const Scalar focus)
Sets the focus distance of this view.
StereoView()
Creates a new stereo view object.
virtual void setEyesReversed(const bool reverse)
Sets whether left and right image will be reversed.
StereoType
Definition of different stereo visualization types.
Definition: StereoView.h:42
@ STEREO_TYPE_ANAGLYPH
Anaglyph stereo visualization type.
Definition: StereoView.h:48
@ STEREO_TYPE_INVALID
Invalid stereo type.
Definition: StereoView.h:44
@ STEREO_TYPE_QUADBUFFERED
Quadbuffered stereo visualization type.
Definition: StereoView.h:46
virtual void setLeftTransformation(const HomogenousMatrix4 &world_T_leftView)
Sets the position and orientation of the left view in world coordinates (the left extrinsic camera da...
virtual bool eyesReversed() const
Returns whether left and right image is reversed.
SquareMatrix4 projectionMatrix() const override
Returns the projection matrix of this view.
virtual SquareMatrix4 leftProjectionMatrix() const
Returns the left projection matrix.
virtual StereoType stereoType() const
Returns the stereo visualization type of this stereo view.
virtual void setLeftProjectionMatrix(const SquareMatrix4 &leftClip_T_leftView_)
Sets the left projection matrix.
HomogenousMatrix4 transformation() const override
Returns the transformation between the center of both views (device) and world.
virtual HomogenousMatrix4 leftTransformation() const
Returns the position and orientation of the left view in world coordinates (the left extrinsic camera...
virtual SquareMatrix4 rightProjectionMatrix() const
Returns the right projection matrix.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
SmartObjectRef< StereoView > StereoViewRef
Definition of a smart object reference holding a stereo view node.
Definition: StereoView.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15