Ocean
GLESRenderable.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_RENDERABLE_H
9 #define META_OCEAN_RENDERING_GLES_RENDERABLE_H
10 
16 
18 
22 
23 namespace Ocean
24 {
25 
26 namespace Rendering
27 {
28 
29 namespace GLESceneGraph
30 {
31 
32 // Forward declaration.
33 class GLESFramebuffer;
34 
35 /**
36  * This class is the base class for all GLESceneGraph renderable objects.
37  * @ingroup renderinggles
38  */
39 class OCEAN_RENDERING_GLES_EXPORT GLESRenderable :
40  virtual public GLESObject,
41  virtual public Renderable
42 {
43  public:
44 
45  /**
46  * Returns the bounding box of this renderable.
47  * @return The renderable's bounding box, invalid if the renderable does not contain any geometry
48  */
49  inline const BoundingBox& boundingBox() const;
50 
51  /**
52  * Renders the renderable node, the shader program is determined automatically.
53  * @param framebuffer The framebuffer in which the renderable will be rendered
54  * @param projectionMatrix The projection matrix to be applied, must be valid
55  * @param camera_T_object The transformation between object and camera (aka Modelview matrix), must be valid
56  * @param camera_T_world The transformation between world and camera, must be valid
57  * @param normalMatrix The normal transformation matrix with is the transposed inverse of the upper 3x3 model view matrix
58  * @param attributeSet The attributes defining the appearance of this
59  * @param lights The lights used the render this renderable, can be empty
60  */
61  virtual void render(const GLESFramebuffer& framebuffer, const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_object, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, GLESAttributeSet& attributeSet, const Lights& lights) = 0;
62 
63  /**
64  * Renders the renderable node with a given shader program.
65  * @param projectionMatrix The projection matrix to be applied, must be valid
66  * @param camera_T_object The transformation between object and camera (aka Modelview matrix), must be valid
67  * @param camera_T_world The transformation between world and camera, must be valid
68  * @param normalMatrix The normal transformation matrix with is the transposed inverse of the upper 3x3 model view matrix
69  * @param shaderProgram The shader program to be used, must be compiled
70  */
71  virtual void render(const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_object, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, GLESShaderProgram& shaderProgram) = 0;
72 
73  protected:
74 
75  /**
76  * Creates a new GLESceneGraph renderable object.
77  */
79 
80  /**
81  * Destructs a GLESceneGraph renderable object.
82  */
83  ~GLESRenderable() override;
84 
85  protected:
86 
87  /// The renderable's bounding box.
89 };
90 
92 {
93  return boundingBox_;
94 }
95 
96 }
97 
98 }
99 
100 }
101 
102 #endif // META_OCEAN_RENDERING_GLES_RENDERABLE_H
This class implements a 3D bounding box.
Definition: BoundingBox.h:23
This class implements a GLESceneGraph attribute set object.
Definition: GLESAttributeSet.h:40
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
This class is the base class for all GLESceneGraph objects.
Definition: GLESObject.h:57
This class is the base class for all GLESceneGraph renderable objects.
Definition: GLESRenderable.h:42
~GLESRenderable() override
Destructs a GLESceneGraph renderable object.
BoundingBox boundingBox_
The renderable's bounding box.
Definition: GLESRenderable.h:88
virtual void render(const GLESFramebuffer &framebuffer, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_object, const HomogenousMatrix4 &camera_T_world, const SquareMatrix3 &normalMatrix, GLESAttributeSet &attributeSet, const Lights &lights)=0
Renders the renderable node, the shader program is determined automatically.
const BoundingBox & boundingBox() const
Returns the bounding box of this renderable.
Definition: GLESRenderable.h:91
GLESRenderable()
Creates a new GLESceneGraph renderable object.
virtual void render(const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_object, const HomogenousMatrix4 &camera_T_world, const SquareMatrix3 &normalMatrix, GLESShaderProgram &shaderProgram)=0
Renders the renderable node with a given shader program.
This class implements a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
This class is the base class for all renderable objects.
Definition: Renderable.h:38
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