Ocean
Loading...
Searching...
No Matches
GLESTriangles.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_TRIANGLES_H
9#define META_OCEAN_RENDERING_GLES_TRIANGLES_H
10
13
15
16namespace Ocean
17{
18
19namespace Rendering
20{
21
22namespace GLESceneGraph
23{
24
25/**
26 * This class implements a GLESceneGraph triangles object.
27 * This class holds independent and separated triangles and is able to render them.
28 * @ingroup renderinggles
29 */
30class OCEAN_RENDERING_GLES_EXPORT GLESTriangles :
31 virtual public GLESIndependentPrimitive,
32 virtual public Triangles
33{
34 friend class GLESFactory;
35
36 public:
37
38 /**
39 * Returns the faces of this triangles object.
40 * @see Triangles::faces().
41 */
42 TriangleFaces faces() const override;
43
44 /**
45 * Returns the number of triangle faces defined in this primitive.
46 * @see Triangles::numberFaces().
47 */
48 unsigned int numberFaces() const override;
49
50 /**
51 * Sets the faces of this triangles object.
52 * @see Triangles::setFaces().
53 */
54 void setFaces(const TriangleFaces& faces) override;
55
56 /**
57 * Sets the faces of this triangles object.
58 * @see Triangles::setFaces().
59 */
60 void setFaces(const unsigned int numberImplicitTriangleFaces) override;
61
62 /**
63 * Renders the triangles defined by the associated vertex set and the defined triangle faces.
64 * @see Renderable::render().
65 */
66 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;
67
68 /**
69 * Renders the renderable node.
70 * @see Renderable::render().
71 */
72 void render(const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_object, const HomogenousMatrix4& camera_T_world, const SquareMatrix3& normalMatrix, GLESShaderProgram& shaderProgram) override;
73
74 /**
75 * Draws all triangles with the currently bound shader program.
76 */
78
79 /**
80 * Draws a subset of all triangles with the currently bound shader program.
81 * @param firstTriangle The index of the first triangle to draw, with range [0, numberFaces() - 1]
82 * @param numberTriangles The number of triangles to draw, with range [0, numberFaces() - firstTriangle]
83 */
84 void drawTriangles(const unsigned int firstTriangle, const unsigned int numberTriangles);
85
86 protected:
87
88 /**
89 * Creates a new GLESceneGraph triangles object.
90 */
92
93 /**
94 * Destructs a GLESceneGraph triangles object.
95 */
96 ~GLESTriangles() override;
97
98 /**
99 * Releases the internal vertex buffer object containing the triangle indices.
100 */
101 void release();
102
103 /**
104 * Updates the bounding box of this primitive.
105 * @see GLESPrimitive::updateBoundingBox().
106 */
107 void updateBoundingBox() override;
108
109 protected:
110
111 /// Vertex buffer object for triangle indices.
112 GLuint vboIndices_ = 0u;
113
114 /// The vertex indices, in case triangles are defined via vertex indices, three for each triangle.
116
117 /// Number of triangle faces, in case triangles are defined implicitly based on vertices with consecutive indices.
118 unsigned int numberImplicitTriangleFaces_ = 0u;
119};
120
121}
122
123}
124
125}
126
127#endif // META_OCEAN_RENDERING_GLES_TRIANGLES_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 container for an OpenGL ES shader program.
Definition GLESShaderProgram.h:53
This class implements a GLESceneGraph triangles object.
Definition GLESTriangles.h:33
void drawTriangles(const unsigned int firstTriangle, const unsigned int numberTriangles)
Draws a subset of all triangles with the currently bound shader program.
void updateBoundingBox() override
Updates the bounding box of 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 renderable node.
void setFaces(const unsigned int numberImplicitTriangleFaces) override
Sets the faces of this triangles object.
~GLESTriangles() override
Destructs a GLESceneGraph triangles object.
void release()
Releases the internal vertex buffer object containing the triangle indices.
unsigned int numberFaces() const override
Returns the number of triangle faces defined in this primitive.
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 triangles defined by the associated vertex set and the defined triangle faces.
void setFaces(const TriangleFaces &faces) override
Sets the faces of this triangles object.
TriangleFaces faces() const override
Returns the faces of this triangles object.
TriangleFaces explicitTriangleFaces_
The vertex indices, in case triangles are defined via vertex indices, three for each triangle.
Definition GLESTriangles.h:115
void drawTriangles()
Draws all triangles with the currently bound shader program.
GLESTriangles()
Creates a new GLESceneGraph triangles object.
This class is the base for all triangles objects.
Definition Triangles.h:42
std::vector< TriangleFace > TriangleFaces
Definition of a vector holding triangle faces.
Definition TriangleFace.h:30
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