Ocean
GLESDepthAttribute.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_DEPTH_ATTRIBUTE_H
9 #define META_OCEAN_RENDERING_GLES_DEPTH_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 depth attribute.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESDepthAttribute :
30  virtual public GLESAttribute,
31  virtual public DepthAttribute
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns whether the depth buffer is used for occlusion tests.
39  * @see DepthAttribute::testingEnabled().
40  */
41  bool testingEnabled() const override;
42 
43  /**
44  * Returns whether the depth buffer writing is enabled.
45  * @see DepthAttribute::writingEnabled().
46  */
47  bool writingEnabled() const override;
48 
49  /**
50  * Returns the depth function of this attribute.
51  * @see DepthAttribute::depthFunction().
52  */
53  DepthFunction depthFunction() const override;
54 
55  /**
56  * Sets whether the depth buffer is used for occlusion tests.
57  * @see DepthAttribute::setTestingEnabled().
58  */
59  void setTestingEnabled(const bool state) override;
60 
61  /**
62  * Sets whether the depth buffer is writable.
63  * @see DepthAttribute::setWritingEnabled().
64  */
65  void setWritingEnabled(const bool state) override;
66 
67  /**
68  * Sets the depth function of this attribute.
69  * @see DepthAttribute::setDepthFunction().
70  */
71  void setDepthFunction(const DepthFunction function) override;
72 
73  /**
74  * Binds this attribute.
75  * @see Attribute::bindAttribute().
76  */
77  void bindAttribute(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram) override;
78 
79  /**
80  * Unbindes this attribute.
81  * @see Attribute::unbindAttribute().
82  */
83  void unbindAttribute() override;
84 
85  protected:
86 
87  /**
88  * Creates a new GLESceneGraph depth attribute object.
89  */
91 
92  /**
93  * Destructs a GLESceneGraph depth attribute object.
94  */
95  ~GLESDepthAttribute() override;
96 
97  /**
98  * Translates a depth function to the corresponding OpenGL ES enum value.
99  * @param function Depth function to translate
100  * @return Corresponding OpenGL ES enum value
101  */
102  static GLenum translateDepthFunction(const DepthFunction function);
103 
104  protected:
105 
106  /// True, to enable depth buffer testing.
108 
109  /// True, to enable depth buffer writing.
111 
112  /// Depth function value.
114 
115  /// OpenGL ES depth function value.
117 };
118 
119 }
120 
121 }
122 
123 }
124 
125 #endif // META_OCEAN_RENDERING_GLES_DEPTH_ATTRIBUTE_H
This class implements a depth attribute specifying the depth buffer behavior for associated objects.
Definition: DepthAttribute.h:35
DepthFunction
Definition of different depth comparison functions.
Definition: DepthAttribute.h:42
This class wraps a GLESceneGraph attribute object.
Definition: GLESAttribute.h:36
This class implements a GLESceneGraph depth attribute.
Definition: GLESDepthAttribute.h:32
void setDepthFunction(const DepthFunction function) override
Sets the depth function of this attribute.
bool testingEnabled_
True, to enable depth buffer testing.
Definition: GLESDepthAttribute.h:107
GLESDepthAttribute()
Creates a new GLESceneGraph depth attribute object.
void setWritingEnabled(const bool state) override
Sets whether the depth buffer is writable.
~GLESDepthAttribute() override
Destructs a GLESceneGraph depth attribute object.
void setTestingEnabled(const bool state) override
Sets whether the depth buffer is used for occlusion tests.
bool writingEnabled() const override
Returns whether the depth buffer writing is enabled.
GLenum glesDepthFunction
OpenGL ES depth function value.
Definition: GLESDepthAttribute.h:116
bool testingEnabled() const override
Returns whether the depth buffer is used for occlusion tests.
void bindAttribute(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram) override
Binds this attribute.
bool writingEnabled_
True, to enable depth buffer writing.
Definition: GLESDepthAttribute.h:110
void unbindAttribute() override
Unbindes this attribute.
static GLenum translateDepthFunction(const DepthFunction function)
Translates a depth function to the corresponding OpenGL ES enum value.
DepthFunction depthFunction_
Depth function value.
Definition: GLESDepthAttribute.h:113
DepthFunction depthFunction() const override
Returns the depth function of this attribute.
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