Ocean
GLESPoints.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_POINTS_H
9 #define META_OCEAN_RENDERING_GLES_POINTS_H
10 
13 
14 #include "ocean/rendering/Points.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a GLESceneGraph points object.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESPoints :
30  virtual public GLESIndependentPrimitive,
31  virtual public Points
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns the indices of the used vertex points.
39  * @see Points::indices().
40  */
41  VertexIndices indices() const override;
42 
43  /**
44  * Returns the number of point indices defined in this primitive.
45  * @see Points::numberIndices().
46  */
47  unsigned int numberIndices() const override;
48 
49  /**
50  * Returns the size in pixels at which all points will be rendered.
51  * @see Points::pointSize().
52  */
53  Scalar pointSize() const override;
54 
55  /**
56  * Sets the indices of the used vertex points.
57  * @see Points::setIndices().
58  */
59  void setIndices(const VertexIndices& indices) override;
60 
61  /**
62  * Sets the indices of the used vertex points.
63  * @see Points::setIndices().
64  */
65  void setIndices(const unsigned int numberImplicitPoints) override;
66 
67  /**
68  * Sets the size in pixels at which all points will be rendered.
69  * @see Points::setPointSize().
70  */
71  void setPointSize(const Scalar size) override;
72 
73  /**
74  * Renders the points defined by the associated vertex set and the defined indices.
75  * @see GLESRenderable::render().
76  */
77  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;
78 
79  /**
80  * Renders the triangles defined by the associated vertex set and the defined triangle faces.
81  * @see Renderable::render().
82  */
83  void render(const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_object, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, GLESShaderProgram& shaderProgram) override;
84 
85  /**
86  * Draws all points with the currently bound shader program.
87  */
88  void drawPoints();
89 
90  protected:
91 
92  /**
93  * Creates a new GLESceneGraph points object.
94  */
96 
97  /**
98  * Destructs a GLESceneGraph points object.
99  */
100  ~GLESPoints() override;
101 
102  /**
103  * Releases the internal vertex buffer object containing the point indices.
104  */
105  void release();
106 
107  /**
108  * Updates the bounding box of this primitive.
109  * @see GLESPrimitive::updateBoundingBox().
110  */
111  void updateBoundingBox() override;
112 
113  protected:
114 
115  /// Vertex buffer object for point indices.
116  GLuint vboIndices_ = 0u;
117 
118  /// The point indices, in case points are defined via explicit point indices.
120 
121  /// Number of points, in case points are defined implicitly based on points with consecutive indices.
122  unsigned int numberImplicitPoints_ = 0u;
123 
124  /// The size of all points (the diameter), in pixels, with range (0, infinity).
125  Scalar pointSize_ = Scalar(1);
126 };
127 
128 }
129 
130 }
131 
132 }
133 
134 #endif // META_OCEAN_RENDERING_GLES_POINTS_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 points object.
Definition: GLESPoints.h:32
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 points defined by the associated vertex set and the defined indices.
void setIndices(const unsigned int numberImplicitPoints) override
Sets the indices of the used vertex points.
~GLESPoints() override
Destructs a GLESceneGraph points object.
VertexIndices explicitPointIndices_
The point indices, in case points are defined via explicit point indices.
Definition: GLESPoints.h:119
Scalar pointSize() const override
Returns the size in pixels at which all points will be rendered.
VertexIndices indices() const override
Returns the indices of the used vertex points.
GLESPoints()
Creates a new GLESceneGraph points object.
void drawPoints()
Draws all points with the currently bound shader program.
void setIndices(const VertexIndices &indices) override
Sets the indices of the used vertex points.
unsigned int numberIndices() const override
Returns the number of point 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.
void release()
Releases the internal vertex buffer object containing the point indices.
void setPointSize(const Scalar size) override
Sets the size in pixels at which all points will be rendered.
void updateBoundingBox() override
Updates the bounding box of this primitive.
This class implements a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
This class is the base for all points objects.
Definition: Points.h:38
float Scalar
Definition of a scalar type.
Definition: Math.h:128
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