Ocean
GLESStereoView.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_GLES_STEREO_VIEW_H
9 #define META_OCEAN_RENDERING_GLES_STEREO_VIEW_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a perspective stereo view for GLESceneGraph.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESStereoView :
30  virtual public GLESView,
31  virtual public StereoView
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns the transformation between the center of both views (device) and world.
39  * @see StereoView::transformation().
40  */
42 
43  /**
44  * Returns the position and orientation of the left view in world coordinates (the left extrinsic camera data, the inverse of the known View Matrix).
45  * @see StereoView::leftTransformation().
46  */
48 
49  /**
50  * Returns the position and orientation of the right view in world coordinates (the right extrinsic camera data, the inverse of the known View Matrix).
51  * @see StereoView::rightTransformation().
52  */
54 
55  /**
56  * Returns the left projection matrix.
57  * @see StereoView::leftProjectionMatrix().
58  */
60 
61  /**
62  * Returns the right projection matrix.
63  * @see StereoView::rightProjectionMatrix().
64  */
66 
67  /**
68  * Sets the position and orientation of the center between left and right view (device) in world coordinates.
69  * @see StereoView::setTransformation().
70  */
71  void setTransformation(const HomogenousMatrix4& world_T_device) override;
72 
73  /**
74  * Sets the position and orientation of the left view in world coordinates (the left extrinsic camera data, the inverse of the known View Matrix).
75  * @see StereoView::setLeftTransformation().
76  */
77  void setLeftTransformation(const HomogenousMatrix4& world_T_leftView) override;
78 
79  /**
80  * Sets the position and orientation of the right view in world coordinates (the right extrinsic camera data, the inverse of the known View Matrix).
81  * @see StereoView::setRightTransformation().
82  */
83  void setRightTransformation(const HomogenousMatrix4& world_T_rightView) override;
84 
85  /**
86  * Sets the left projection matrix.
87  * @see StereoView::setLeftProjectionMatrix().
88  */
89  void setLeftProjectionMatrix(const SquareMatrix4& leftClip_T_leftView_) override;
90 
91  /**
92  * Sets the right projection matrix.
93  * @see StereoView::setRightProjectionMatrix().
94  */
95  void setRightProjectionMatrix(const SquareMatrix4& rightClip_T_rightView_) override;
96 
97  protected:
98 
99  /**
100  * Creates a new perspective view.
101  */
103 
104  /**
105  * Destructs a perspective view.
106  */
107  ~GLESStereoView() override;
108 
109  /**
110  * Returns the projection matrix of this view.
111  * Protected function as it has no meaning in stereo views.
112  * @return The invalid 4x4 matrix
113  */
114  SquareMatrix4 projectionMatrix() const override;
115 
116  protected:
117 
118  /// The transformation between device and world.
119  HomogenousMatrix4 world_T_device_ = HomogenousMatrix4(false);
120 
121  /// The transformation between left view and world.
122  HomogenousMatrix4 world_T_leftView_ = HomogenousMatrix4(false);
123 
124  /// The transformation between right view and world.
125  HomogenousMatrix4 world_T_rightView_ = HomogenousMatrix4(false);
126 
127  /// The left projection matrix.
128  SquareMatrix4 rightClip_T_leftView_ = SquareMatrix4(false);
129 
130  /// The right projection matrix.
131  SquareMatrix4 rightClip_T_rightView_ = SquareMatrix4(false);
132 };
133 
134 }
135 
136 }
137 
138 }
139 
140 #endif // META_OCEAN_RENDERING_GLES_STEREO_VIEW_H
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
This class implements a perspective stereo view for GLESceneGraph.
Definition: GLESStereoView.h:32
HomogenousMatrix4 transformation() const override
Returns the transformation between the center of both views (device) and world.
void setRightProjectionMatrix(const SquareMatrix4 &rightClip_T_rightView_) override
Sets the right projection matrix.
~GLESStereoView() override
Destructs a perspective view.
HomogenousMatrix4 rightTransformation() const override
Returns the position and orientation of the right view in world coordinates (the right extrinsic came...
SquareMatrix4 projectionMatrix() const override
Returns the projection matrix of this view.
GLESStereoView()
Creates a new perspective view.
void setRightTransformation(const HomogenousMatrix4 &world_T_rightView) override
Sets the position and orientation of the right view in world coordinates (the right extrinsic camera ...
void setLeftTransformation(const HomogenousMatrix4 &world_T_leftView) override
Sets the position and orientation of the left view in world coordinates (the left extrinsic camera da...
void setLeftProjectionMatrix(const SquareMatrix4 &leftClip_T_leftView_) override
Sets the left projection matrix.
SquareMatrix4 leftProjectionMatrix() const override
Returns the left 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...
HomogenousMatrix4 leftTransformation() const override
Returns the position and orientation of the left view in world coordinates (the left extrinsic camera...
SquareMatrix4 rightProjectionMatrix() const override
Returns the right projection matrix.
This class implements a GLESceneGraph view object.
Definition: GLESView.h:34
This class is the base class for all stereo views.
Definition: StereoView.h:35
SquareMatrixT4< Scalar > SquareMatrix4
Definition of the SquareMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with ...
Definition: SquareMatrix4.h:32
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition: HomogenousMatrix4.h:37
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15