Ocean
GLESObject.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_OBJECT_H
9 #define META_OCEAN_RENDERING_GLES_OBJECT_H
10 
13 
15 #include "ocean/math/RGBAColor.h"
18 #include "ocean/math/Vector3.h"
19 #include "ocean/math/Vector4.h"
20 
21 #include "ocean/rendering/Object.h"
22 
23 #if defined(OCEAN_PLATFORM_BUILD_APPLE_IOS_ANY)
24  #include <OpenGLES/ES3/gl.h>
25 #elif defined(OCEAN_PLATFORM_BUILD_APPLE_MACOS)
26  #define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
27  #include <OpenGL/OpenGL.h>
28  #include <OpenGL/gl3.h>
29 #elif defined(OCEAN_PLATFORM_BUILD_ANDROID)
30  #include <GLES3/gl32.h>
31 #else
32  #define GL_GLEXT_PROTOTYPES
33 
34  #if defined(OCEAN_PLATFORM_BUILD_LINUX)
35  #include <GL/gl.h>
36  #include <GL/glext.h>
37  #else
38  #include <gl/GL.h>
39  #include <gl/glext.h>
40  #endif
41 #endif
42 
43 namespace Ocean
44 {
45 
46 namespace Rendering
47 {
48 
49 namespace GLESceneGraph
50 {
51 
52 /**
53  * This class is the base class for all GLESceneGraph objects.
54  * @ingroup renderinggles
55  */
56 class OCEAN_RENDERING_GLES_EXPORT GLESObject : virtual public Object
57 {
58  public:
59 
60  /**
61  * Returns the name of the owner engine.
62  * @see Object::engineId().
63  */
64  const std::string& engineName() const override;
65 
66  /**
67  * Sets the value of a uniform variable for the current (currently bound) program object.
68  * @param location The location of the uniform variable to be modified, must be valid
69  * @param value The value to be set
70  */
71  static void setUniform(const GLint location, const int32_t value);
72 
73  /**
74  * Sets the value of a uniform variable for the current (currently bound) program object.
75  * @param location The location of the uniform variable to be modified, must be valid
76  * @param value The value to be set
77  */
78  static void setUniform(const GLint location, const uint32_t value);
79 
80  /**
81  * Sets the value of a uniform variable for the current (currently bound) program object.
82  * @param location The location of the uniform variable to be modified, must be valid
83  * @param value The value to be set
84  */
85  static void setUniform(const GLint location, const float value);
86 
87  /**
88  * Sets the value of a uniform variable for the current (currently bound) program object.
89  * @param location The location of the uniform variable to be modified, must be valid
90  * @param value The value to be set
91  */
92  static void setUniform(const GLint location, const double value);
93 
94  /**
95  * Sets the value of a uniform variable for the current (currently bound) program object.
96  * @param location The location of the uniform variable to be modified, must be valid
97  * @param value The value to be set
98  */
99  static void setUniform(const GLint location, const RGBAColor& value);
100 
101  /**
102  * Sets the value of a uniform variable for the current (currently bound) program object.
103  * @param location The location of the uniform variable to be modified, must be valid
104  * @param value The value to be set
105  */
106  static void setUniform(const GLint location, const SquareMatrixF3& value);
107 
108  /**
109  * Sets the value of a uniform variable for the current (currently bound) program object.
110  * @param location The location of the uniform variable to be modified, must be valid
111  * @param value The value to be set
112  */
113  static void setUniform(const GLint location, const SquareMatrixD3& value);
114 
115  /**
116  * Sets the value of a uniform variable for the current (currently bound) program object.
117  * @param location The location of the uniform variable to be modified, must be valid
118  * @param value The value to be set
119  */
120  static void setUniform(const GLint location, const SquareMatrixF4& value);
121 
122  /**
123  * Sets the value of a uniform variable for the current (currently bound) program object.
124  * @param location The location of the uniform variable to be modified, must be valid
125  * @param value The value to be set
126  */
127  static void setUniform(const GLint location, const SquareMatrixD4& value);
128 
129  /**
130  * Sets the value of a uniform variable for the current (currently bound) program object.
131  * @param location The location of the uniform variable to be modified, must be valid
132  * @param value The value to be set
133  */
134  static void setUniform(const GLint location, const HomogenousMatrixF4& value);
135 
136  /**
137  * Sets the value of a uniform variable for the current (currently bound) program object.
138  * @param location The location of the uniform variable to be modified, must be valid
139  * @param value The value to be set
140  */
141  static void setUniform(const GLint location, const HomogenousMatrixD4& value);
142 
143  /**
144  * Sets the value of a uniform variable for the current (currently bound) program object.
145  * @param location The location of the uniform variable to be modified, must be valid
146  * @param value The value to be set
147  */
148  static void setUniform(const GLint location, const VectorF2& value);
149 
150  /**
151  * Sets the value of a uniform variable for the current (currently bound) program object.
152  * @param location The location of the uniform variable to be modified, must be valid
153  * @param value The value to be set
154  */
155  static void setUniform(const GLint location, const VectorD2& value);
156 
157  /**
158  * Sets the value of a uniform variable for the current (currently bound) program object.
159  * @param location The location of the uniform variable to be modified, must be valid
160  * @param value The value to be set
161  */
162  static void setUniform(const GLint location, const VectorF3& value);
163 
164  /**
165  * Sets the value of a uniform variable for the current (currently bound) program object.
166  * @param location The location of the uniform variable to be modified, must be valid
167  * @param value The value to be set
168  */
169  static void setUniform(const GLint location, const VectorD3& value);
170 
171  /**
172  * Sets the value of a uniform variable for the current (currently bound) program object.
173  * @param location The location of the uniform variable to be modified, must be valid
174  * @param value The value to be set
175  */
176  static void setUniform(const GLint location, const VectorF4& value);
177 
178  /**
179  * Sets the value of a uniform variable for the current (currently bound) program object.
180  * @param location The location of the uniform variable to be modified, must be valid
181  * @param value The value to be set
182  */
183  static void setUniform(const GLint location, const VectorD4& value);
184 
185  /**
186  * Sets the value of a uniform variable for the current (currently bound) program object.
187  * @param location The location of the uniform variable to be modified, must be valid
188  * @param value The value to be set
189  */
190  static void setUniform(const GLint location, const SquareMatricesT3<float>& value);
191 
192  /**
193  * Sets the value of a uniform variable for the current (currently bound) program object.
194  * @param location The location of the uniform variable to be modified, must be valid
195  * @param value The value to be set
196  */
197  static void setUniform(const GLint location, const SquareMatricesT3<double>& value);
198 
199  /**
200  * Sets the value of a uniform variable for the current (currently bound) program object.
201  * @param location The location of the uniform variable to be modified, must be valid
202  * @param value The value to be set
203  */
204  static void setUniform(const GLint location, const SquareMatricesT4<float>& value);
205 
206  /**
207  * Sets the value of a uniform variable for the current (currently bound) program object.
208  * @param location The location of the uniform variable to be modified, must be valid
209  * @param value The value to be set
210  */
211  static void setUniform(const GLint location, const SquareMatricesT4<double>& value);
212 
213  /**
214  * Sets the value of a uniform variable for the current (currently bound) program object.
215  * @param location The location of the uniform variable to be modified, must be valid
216  * @param value The value to be set
217  */
218  static void setUniform(const GLint location, const HomogenousMatricesF4& value);
219 
220  /**
221  * Sets the value of a uniform variable for the current (currently bound) program object.
222  * @param location The location of the uniform variable to be modified, must be valid
223  * @param value The value to be set
224  */
225  static void setUniform(const GLint location, const HomogenousMatricesD4& value);
226 
227  /**
228  * Sets the value of a uniform variable for the current (currently bound) program object.
229  * @param location The location of the uniform variable to be modified, must be valid
230  * @param value The value to be set
231  */
232  static void setUniform(const GLint location, const VectorsF2& value);
233 
234  /**
235  * Sets the value of a uniform variable for the current (currently bound) program object.
236  * @param location The location of the uniform variable to be modified, must be valid
237  * @param value The value to be set
238  */
239  static void setUniform(const GLint location, const VectorsD2& value);
240 
241  /**
242  * Sets the value of a uniform variable for the current (currently bound) program object.
243  * @param location The location of the uniform variable to be modified, must be valid
244  * @param value The value to be set
245  */
246  static void setUniform(const GLint location, const VectorsF3& value);
247 
248  /**
249  * Sets the value of a uniform variable for the current (currently bound) program object.
250  * @param location The location of the uniform variable to be modified, must be valid
251  * @param value The value to be set
252  */
253  static void setUniform(const GLint location, const VectorsD3& value);
254 
255  /**
256  * Sets the value of a uniform variable for the current (currently bound) program object.
257  * @param location The location of the uniform variable to be modified, must be valid
258  * @param value The value to be set
259  */
260  static void setUniform(const GLint location, const VectorsF4& value);
261 
262  /**
263  * Sets the value of a uniform variable for the current (currently bound) program object.
264  * @param location The location of the uniform variable to be modified, must be valid
265  * @param value The value to be set
266  */
267  static void setUniform(const GLint location, const VectorsD4& value);
268 
269  /**
270  * Sets the value of a uniform variable for the current (currently bound) program object.
271  * @param location The location of the uniform variable to be modified, must be valid
272  * @param values The values to be set, must be valid
273  * @param size The number of elements, with range [1, infinity)
274  */
275  static void setUniform(const GLint location, const float* values, const size_t size);
276 
277  protected:
278 
279  /**
280  * Creates a new GLESceneGraph object.
281  */
283 
284  /**
285  * Destructs a GLESceneGraph object.
286  */
287  ~GLESObject() override;
288 
289  private:
290 
291  /**
292  * Sets the value of a uniform variable for the current (currently bound) program object.
293  * @param location The location of the uniform variable to be modified, must be valid
294  * @param value The value to be set
295  */
296  static void setUniform(const GLint location, const bool value) = delete;
297 };
298 
299 }
300 
301 }
302 
303 }
304 
305 #endif // META_OCEAN_RENDERING_GLES_OBJECT_H
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition: HomogenousMatrix4.h:110
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 GLESceneGraph objects.
Definition: GLESObject.h:57
static void setUniform(const GLint location, const VectorsF4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatricesT4< float > &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const HomogenousMatrixD4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
~GLESObject() override
Destructs a GLESceneGraph object.
static void setUniform(const GLint location, const SquareMatricesT3< double > &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorF4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorsF2 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const uint32_t value)
Sets the value of a uniform variable for the current (currently bound) program object.
GLESObject()
Creates a new GLESceneGraph object.
static void setUniform(const GLint location, const VectorD4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatricesT3< float > &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const float *values, const size_t size)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const HomogenousMatrixF4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatrixD4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const HomogenousMatricesD4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorsD3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
const std::string & engineName() const override
Returns the name of the owner engine.
static void setUniform(const GLint location, const VectorsD2 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorD3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorD2 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorsF3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorF2 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatricesT4< double > &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorF3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const RGBAColor &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatrixF4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const double value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const VectorsD4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const int32_t value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const float value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatrixF3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const SquareMatrixD3 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const HomogenousMatricesF4 &value)
Sets the value of a uniform variable for the current (currently bound) program object.
static void setUniform(const GLint location, const bool value)=delete
Sets the value of a uniform variable for the current (currently bound) program object.
This class is the base class for all rendering objects.
Definition: Object.h:54
This class implements a 3x3 square matrix.
Definition: SquareMatrix3.h:88
This class implements a 4x4 square matrix.
Definition: SquareMatrix4.h:85
This class implements a vector with two elements.
Definition: Vector2.h:96
This class implements a vector with three elements.
Definition: Vector3.h:97
This class implements a vector with four elements.
Definition: Vector4.h:97
std::vector< SquareMatrixT3< T > > SquareMatricesT3
Definition of a typename alias for vectors with SquareMatrixT3 objects.
Definition: SquareMatrix3.h:64
std::vector< SquareMatrixT4< T > > SquareMatricesT4
Definition of a typename alias for vectors with SquareMatrixT4 objects.
Definition: SquareMatrix4.h:61
std::vector< VectorF3 > VectorsF3
Definition of a vector holding VectorF3 objects.
Definition: Vector3.h:79
std::vector< VectorD2 > VectorsD2
Definition of a vector holding VectorD2 objects.
Definition: Vector2.h:71
std::vector< VectorD4 > VectorsD4
Definition of a vector holding VectorD4 objects.
Definition: Vector4.h:72
std::vector< VectorF2 > VectorsF2
Definition of a vector holding VectorF2 objects.
Definition: Vector2.h:78
std::vector< HomogenousMatrixD4 > HomogenousMatricesD4
Definition of a vector holding HomogenousMatrixD4 objects.
Definition: HomogenousMatrix4.h:79
std::vector< VectorD3 > VectorsD3
Definition of a vector holding VectorD3 objects.
Definition: Vector3.h:72
std::vector< HomogenousMatrixF4 > HomogenousMatricesF4
Definition of a vector holding HomogenousMatrixF4 objects.
Definition: HomogenousMatrix4.h:85
std::vector< VectorF4 > VectorsF4
Definition of a vector holding VectorF4 objects.
Definition: Vector4.h:79
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15