Ocean
GLESLines.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_LINES_H
9 #define META_OCEAN_RENDERING_GLES_LINES_H
10 
13 
14 #include "ocean/rendering/Lines.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a GLESceneGraph lines object.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESLines :
30  virtual public GLESIndependentPrimitive,
31  virtual public Lines
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns the indices of the used vertex lines.
39  * @see Lines::indices().
40  */
41  VertexIndices indices() const override;
42 
43  /**
44  * Returns the number of line indices defined in this primitive.
45  * @see Lines::numberIndices().
46  */
47  unsigned int numberIndices() const override;
48 
49  /**
50  * Sets the indices of the used vertex lines.
51  * @see Lines::setIndices().
52  */
53  void setIndices(const VertexIndices& indices) override;
54 
55  /**
56  * Sets the indices of the used vertex lines.
57  * @see Lines::setIndices().
58  */
59  void setIndices(const unsigned int numberImplicitLines) override;
60 
61  /**
62  * Renders the lines defined by the associated vertex set and the defined indices.
63  * @see GLESRenderable::render().
64  */
65  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) override;
66 
67  /**
68  * Renders the triangles defined by the associated vertex set and the defined triangle faces.
69  * @see Renderable::render().
70  */
71  void render(const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_object, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, GLESShaderProgram& shaderProgram) override;
72 
73  /**
74  * Draws all lines with the currently bound shader program.
75  */
76  void drawLines();
77 
78  protected:
79 
80  /**
81  * Creates a new GLESceneGraph lines object.
82  */
84 
85  /**
86  * Destructs a GLESceneGraph lines object.
87  */
88  ~GLESLines() override;
89 
90  /**
91  * Releases the internal vertex buffer object containing the line indices.
92  */
93  void release();
94 
95  /**
96  * Updates the bounding box of this primitive.
97  * @see GLESPrimitive::updateBoundingBox().
98  */
99  void updateBoundingBox() override;
100 
101  protected:
102 
103  /// Vertex buffer object for line indices.
104  GLuint vboIndices_ = 0u;
105 
106  /// The line indices, in case lines are defined via explicit line indices.
108 
109  /// Number of lines, in case lines are defined implicitly based on lines with consecutive indices.
110  unsigned int numberImplicitLines_ = 0u;
111 };
112 
113 }
114 
115 }
116 
117 }
118 
119 #endif // META_OCEAN_RENDERING_GLES_LINES_H
This class implements a GLESceneGraph attribute set object.
Definition: GLESAttributeSet.h:40
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 the base class for all GLESceneGraph independent primitive.
Definition: GLESIndependentPrimitive.h:32
This class implements a GLESceneGraph lines object.
Definition: GLESLines.h:32
~GLESLines() override
Destructs a GLESceneGraph lines object.
void updateBoundingBox() override
Updates the bounding box of this primitive.
GLESLines()
Creates a new GLESceneGraph lines object.
void setIndices(const VertexIndices &indices) override
Sets the indices of the used vertex lines.
VertexIndices explicitLineIndices_
The line indices, in case lines are defined via explicit line indices.
Definition: GLESLines.h:107
void drawLines()
Draws all lines with the currently bound shader program.
unsigned int numberIndices() const override
Returns the number of line indices defined in this primitive.
void render(const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_object, const HomogenousMatrix4 &camera_T_world, const SquareMatrix3 &normalMatrix, GLESShaderProgram &shaderProgram) override
Renders the triangles defined by the associated vertex set and the defined triangle faces.
VertexIndices indices() const override
Returns the indices of the used vertex lines.
void setIndices(const unsigned int numberImplicitLines) override
Sets the indices of the used vertex lines.
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) override
Renders the lines defined by the associated vertex set and the defined indices.
void release()
Releases the internal vertex buffer object containing the line indices.
This class implements a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
This class is the base for all lines objects.
Definition: Lines.h:39
std::vector< VertexIndex > VertexIndices
Definition of a vector holding vertex indices.
Definition: rendering/Rendering.h:101
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