Ocean
GLESPhantomAttribute.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_PHANTOM_ATTRIBUTE_H
9 #define META_OCEAN_RENDERING_GLES_PHANTOM_ATTRIBUTE_H
10 
13 
16 
17 namespace Ocean
18 {
19 
20 namespace Rendering
21 {
22 
23 namespace GLESceneGraph
24 {
25 
27  virtual public GLESAttribute,
28  virtual public DynamicObject,
29  virtual public PhantomAttribute
30 {
31  friend class GLESFactory;
32 
33  public:
34 
35  /**
36  * Binds this attribute.
37  * @param framebuffer Framebuffer initiated the rendering process
38  * @param shaderProgram Shader program to be applied
39  */
40  void bindAttribute(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram) override;
41 
42  /**
43  * Unbindes this attribute.
44  */
45  void unbindAttribute() override;
46 
47  /**
48  * Update function called by the framebuffer.
49  * @param view Associated view
50  * @param timestamp Update timestamp
51  */
52  void onDynamicUpdate(const ViewRef& view, const Timestamp timestamp) override;
53 
54  /**
55  * Returns the shader type necessary to render an object with this attribute.
56  * @return Shader program type
57  */
59 
60  protected:
61 
62  /**
63  * Constructor
64  */
66 
67  /**
68  * Destructor
69  */
71 
72  /**
73  * Update matrices and texture related to the background image.
74  * @param view Associated view
75  * @param timestamp Update timestamp
76  * @see onDynamicUpdate()
77  */
78  void updateBackgroundInformation(const ViewRef& view, const Timestamp timestamp);
79 
80  protected:
81 
82  /// Timestamp of the last video camera type change.
84 
85  /// Timestamp of the last color change.
87 
88  /// Phantom mode.
89  unsigned int phantomMode;
90 
91  /// Currently set background color; used for PM_COLOR
93 
94  /// Texture transformation matrix (required for moveable object with fixed texture on them)
96 
97  /// Normalized camera frustum matrix (required to convert vertex positions into texture coordinates)
99 
100  /// Reference to the (undistorted) background texture.
102 
103  /// Reference to the (undistorted) background offset texture.
105 };
106 
107 } // namespace GLESceneGraph
108 
109 } // namespace Rendering
110 
111 } // namespace Ocean
112 
113 #endif // META_OCEAN_RENDERING_GLES_PHANTOM_ATTRIBUTE_H
This class implements a color defined by red, green, blue and alpha parameters.
Definition: RGBAColor.h:41
This class is the base class for all dynamic scene graph objects.
Definition: DynamicObject.h:40
This class wraps a GLESceneGraph attribute object.
Definition: GLESAttribute.h:36
ProgramType
Definition of different shader functionalities.
Definition: GLESAttribute.h:43
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
Definition: GLESPhantomAttribute.h:30
Timestamp phantomVideoTimestamp
Timestamp of the last video camera type change.
Definition: GLESPhantomAttribute.h:83
SquareMatrix4 phantomTextureCoordinateTransform
Texture transformation matrix (required for moveable object with fixed texture on them)
Definition: GLESPhantomAttribute.h:95
unsigned int phantomMode
Phantom mode.
Definition: GLESPhantomAttribute.h:89
void onDynamicUpdate(const ViewRef &view, const Timestamp timestamp) override
Update function called by the framebuffer.
SquareMatrix4 phantomNormalizedCameraFrustumMatrix
Normalized camera frustum matrix (required to convert vertex positions into texture coordinates)
Definition: GLESPhantomAttribute.h:98
Timestamp phantomColorTimestamp
Timestamp of the last color change.
Definition: GLESPhantomAttribute.h:86
RGBAColor phantomBackgroundColor
Currently set background color; used for PM_COLOR.
Definition: GLESPhantomAttribute.h:92
Texture2DRef phantomUndistortedBackgroundTexture
Reference to the (undistorted) background texture.
Definition: GLESPhantomAttribute.h:101
void updateBackgroundInformation(const ViewRef &view, const Timestamp timestamp)
Update matrices and texture related to the background image.
GLESAttribute::ProgramType necessaryShader() const override
Returns the shader type necessary to render an object with this attribute.
Texture2DRef phantomUndistortedBackgroundOffsetTexture
Reference to the (undistorted) background offset texture.
Definition: GLESPhantomAttribute.h:104
void bindAttribute(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram) override
Binds this attribute.
void unbindAttribute() override
Unbindes this attribute.
This class implements a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
This class is the base class for all phantom attributes.
Definition: PhantomAttribute.h:36
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15