Ocean
GLESBlendAttribute.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_BLEND_ATTRIBUTE_H
9 #define META_OCEAN_RENDERING_GLES_BLEND_ATTRIBUTE_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a GLESceneGraph blend attribute.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESBlendAttribute :
30  virtual public GLESAttribute,
31  virtual public BlendAttribute
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns the blending function for the source object.
39  * @see BlendAttribute::sourceFunction().
40  */
41  BlendingFunction sourceFunction() const override;
42 
43  /**
44  * Returns the blending function for the destination object.
45  * @see BlendAttribute::destinationFunction().
46  */
48 
49  /**
50  * Sets the blending function for the source object.
51  * @see BlendAttribute::setSourceFunction().
52  */
53  void setSourceFunction(const BlendingFunction function) override;
54 
55  /**
56  * Sets the blending function for the destination object.
57  * @see BlendAttribute::setDestinationFunction().
58  */
59  void setDestinationFunction(const BlendingFunction function) override;
60 
61  /**
62  * Binds this attribute.
63  */
64  void bindAttribute(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram) override;
65 
66  /**
67  * Unbindes this attribute.
68  */
69  void unbindAttribute() override;
70 
71  protected:
72 
73  /**
74  * Creates a new GLESceneGraph blend attribute.
75  */
77 
78  /**
79  * Destructs a GLESceneGraph blend attribute.
80  */
81  ~GLESBlendAttribute() override;
82 
83  /**
84  * Translates a source blending function to the corresponding OpenGL ES enum value.
85  * @param function Source blending function to translate
86  * @return Corresponding OpenGL ES enum value
87  */
88  static GLenum translateSourceBlendingFunction(const BlendingFunction function);
89 
90  /**
91  * Translates a destination blending function to the corresponding OpenGL ES enum value.
92  * @param function Destination blending function to translate
93  * @return Corresponding OpenGL ES enum value
94  */
96 
97  protected:
98 
99  /// Selected source blending function of this blend attribute.
101 
102  /// Selected destination blending function of this blend attribute.
104 
105  /// OpenGL ES source blending value.
107 
108  /// OpenGL ES destination blending value.
110 };
111 
112 }
113 
114 }
115 
116 }
117 
118 #endif // META_OCEAN_RENDERING_GLES_BLEND_ATTRIBUTE_H
This class is the base class for all blend attributes.
Definition: BlendAttribute.h:38
BlendingFunction
Defines several blending functions.
Definition: BlendAttribute.h:45
This class wraps a GLESceneGraph attribute object.
Definition: GLESAttribute.h:36
This class implements a GLESceneGraph blend attribute.
Definition: GLESBlendAttribute.h:32
static GLenum translateDestinationBlendingFunction(const BlendingFunction function)
Translates a destination blending function to the corresponding OpenGL ES enum value.
BlendingFunction destinationFunction() const override
Returns the blending function for the destination object.
GLenum attributeGLESDestinationBlendingFunction
OpenGL ES destination blending value.
Definition: GLESBlendAttribute.h:109
void bindAttribute(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram) override
Binds this attribute.
BlendingFunction sourceFunction() const override
Returns the blending function for the source object.
GLenum attributeGLESSourceBlendingFunction
OpenGL ES source blending value.
Definition: GLESBlendAttribute.h:106
static GLenum translateSourceBlendingFunction(const BlendingFunction function)
Translates a source blending function to the corresponding OpenGL ES enum value.
BlendingFunction attributeDestinationBlendingFunction
Selected destination blending function of this blend attribute.
Definition: GLESBlendAttribute.h:103
void setDestinationFunction(const BlendingFunction function) override
Sets the blending function for the destination object.
GLESBlendAttribute()
Creates a new GLESceneGraph blend attribute.
void unbindAttribute() override
Unbindes this attribute.
BlendingFunction attributeSourceBlendingFunction
Selected source blending function of this blend attribute.
Definition: GLESBlendAttribute.h:100
~GLESBlendAttribute() override
Destructs a GLESceneGraph blend attribute.
void setSourceFunction(const BlendingFunction function) override
Sets the blending function for the source object.
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 a container for an OpenGL ES shader program.
Definition: GLESShaderProgram.h:53
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15