Ocean
GLESUndistortedBackground.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_UNDISTORTED_BACKGROUND_H
9 #define META_OCEAN_RENDERING_GLES_UNDISTORTED_BACKGROUND_H
10 
13 
19 
20 namespace Ocean
21 {
22 
23 namespace Rendering
24 {
25 
26 namespace GLESceneGraph
27 {
28 
29 /**
30  * This class implements an undistorted background for the GLESceneGraph render engine.
31  * @ingroup renderinggles
32  */
33 class OCEAN_RENDERING_GLES_EXPORT GLESUndistortedBackground :
34  virtual public GLESBackground,
35  virtual public UndistortedBackground
36 {
37  friend class GLESFactory;
38 
39  public:
40 
41  /**
42  * Returns the timestamp of the most recent camera change.
43  * @return The camera type timestamp
44  */
45  const Timestamp& cameraTimestamp() const;
46 
47  /**
48  * Returns the normalized camera frustum matrix of the background.
49  * @return The camera frustum matrix
50  */
52 
53  /**
54  * Returns the background texture.
55  * @return Background texture
56  */
58 
59  /**
60  * Returns the offset texture.
61  * @return Offset texture
62  */
64 
65  /**
66  * Returns the number of horizontal elements.
67  * The default value is 20.
68  * @return Horizontal elements
69  */
70  virtual unsigned int horizontalElements() const;
71 
72  /**
73  * Returns the number of vertical elements.
74  * The default value is 20.
75  * @return Vertical elements
76  */
77  virtual unsigned int verticalElements() const;
78 
79  /**
80  * Sets the number of horizontal elements.
81  * The default value is 20.
82  * @param elements Number of horizontal elements to set
83  */
84  virtual void setHorizontalElements(const unsigned int elements);
85 
86  /**
87  * Sets the number of vertical elements.
88  * The default value is 20.
89  * @param elements Number of vertical elements to set
90  */
91  virtual void setVerticalElements(const unsigned int elements);
92 
93  /**
94  * Sets the display type of this background object.
95  * @see UndistortedBackground::setDisplayType().
96  */
97  bool setDisplayType(const DisplayType type) override;
98 
99  /**
100  * Adds this node and all child node to a traverser.
101  * @see GLESNode::addToTraverser().
102  */
103  void addToTraverser(const GLESFramebuffer& framebuffer, const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_parent, const Lights& lights, GLESTraverser& traverser) const override;
104 
105  protected:
106 
107  /**
108  * Creates a new GLESceneGraph undistorted background object.
109  */
111 
112  /**
113  * Destructs a GLESceneGraph undistorted background object.
114  */
116 
117  /**
118  * Event function if the camera of the used medium has changed.
119  * @see UndistortedBackground::onMediumCameraChanged().
120  */
121  void onMediumCameraChanged(const Timestamp timestamp) override;
122 
123  /**
124  * Rebuilds the primitive vertex, normals and face sets.
125  */
126  virtual void rebuildPrimitive();
127 
128  protected:
129 
130  /// Triangle strips for the background geometry.
132 
133  /// Vertexset for the background geometry.
135 
136  /// Textures object holding the 2D texture.
138 
139  /// Attribute set holding rendering attributes of the background object.
141 
142  /// Number of horizontal elements.
144 
145  /// Number of vertical elements.
147 
148  /// Timestamp of the camera frame type.
150 
153 };
154 
155 }
156 
157 }
158 
159 }
160 
161 #endif // META_OCEAN_RENDERING_GLES_UNDISTORTED_BACKGROUND_H
This class implements the base class for all GLESceneGraph background nodes.
Definition: GLESBackground.h:34
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
This class implements a traverser for renderables.
Definition: GLESTraverser.h:39
This class implements an undistorted background for the GLESceneGraph render engine.
Definition: GLESUndistortedBackground.h:36
void addToTraverser(const GLESFramebuffer &framebuffer, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_parent, const Lights &lights, GLESTraverser &traverser) const override
Adds this node and all child node to a traverser.
Texture2DRef texture() const
Returns the background texture.
virtual void setVerticalElements(const unsigned int elements)
Sets the number of vertical elements.
virtual unsigned int verticalElements() const
Returns the number of vertical elements.
~GLESUndistortedBackground() override
Destructs a GLESceneGraph undistorted background object.
Timestamp backgroundCameraTimestamp
Timestamp of the camera frame type.
Definition: GLESUndistortedBackground.h:149
bool setDisplayType(const DisplayType type) override
Sets the display type of this background object.
Texture2DRef backgroundOffsetTexture
Definition: GLESUndistortedBackground.h:152
unsigned int backgroundVerticalElements
Number of vertical elements.
Definition: GLESUndistortedBackground.h:146
VertexSetRef backgroundVertexSet
Vertexset for the background geometry.
Definition: GLESUndistortedBackground.h:134
void onMediumCameraChanged(const Timestamp timestamp) override
Event function if the camera of the used medium has changed.
unsigned int backgroundHorizontalElements
Number of horizontal elements.
Definition: GLESUndistortedBackground.h:143
SquareMatrix4 backgroundNormalizedCameraFrustumMatrix
Definition: GLESUndistortedBackground.h:151
Texture2DRef offsetTexture() const
Returns the offset texture.
const Timestamp & cameraTimestamp() const
Returns the timestamp of the most recent camera change.
AttributeSetRef backgroundAttributeSet
Attribute set holding rendering attributes of the background object.
Definition: GLESUndistortedBackground.h:140
TriangleStripsRef backgroundTriangleStrips
Triangle strips for the background geometry.
Definition: GLESUndistortedBackground.h:131
TexturesRef backgroundTextures
Textures object holding the 2D texture.
Definition: GLESUndistortedBackground.h:137
virtual void rebuildPrimitive()
Rebuilds the primitive vertex, normals and face sets.
virtual unsigned int horizontalElements() const
Returns the number of horizontal elements.
const SquareMatrix4 & normalizedCameraFrustumMatrix() const
Returns the normalized camera frustum matrix of the background.
virtual void setHorizontalElements(const unsigned int elements)
Sets the number of horizontal elements.
GLESUndistortedBackground()
Creates a new GLESceneGraph undistorted background object.
This class is the base class for all undistorted backgrounds.
Definition: UndistortedBackground.h:46
DisplayType
Definition of different distortion display types.
Definition: UndistortedBackground.h:53
This class implements a timestamp.
Definition: Timestamp.h:36
std::vector< LightPair > Lights
Definition of a set holding light sources.
Definition: GLESLightSource.h:44
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15