Ocean
DepthAttribute.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_DEPTH_ATTRIBUTE_H
9 #define META_OCEAN_RENDERING_DEPTH_ATTRIBUTE_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 // Forward declaration
21 class DepthAttribute;
22 
23 /**
24  * Definition of a smart object reference holding a depth attribute.
25  * @see SmartObjectRef, DepthAttribute.
26  * @ingroup rendering
27  */
29 
30 /**
31  * This class implements a depth attribute specifying the depth buffer behavior for associated objects.
32  * @ingroup rendering
33  */
34 class OCEAN_RENDERING_EXPORT DepthAttribute : virtual public Attribute
35 {
36  public:
37 
38  /**
39  * Definition of different depth comparison functions.
40  */
42  {
43  /// Always accepted.
45  /// Accepted if the incomming depth value is equal to the stored one.
47  /// Accepted if the incomming depth value is greater than the stored one.
49  /// Accepted if the incomming depth value is greater than or equal to the stored one.
51  /// Accepted if the incomming depth value is less than the stored one.
53  /// Accepted if the incomming depth value is less than or equal to the stored one.
55  /// Never accepted.
57  /// Accepted if the incomming depth value is not equal to the stored one.
58  FUNCTION_NOT_EQUAL
59  };
60 
61  public:
62 
63  /**
64  * Returns whether the depth buffer is used for occlusion tests.
65  * @return True, if so
66  * @exception NotSupportedException Is thrown if this function is not supported
67  */
68  virtual bool testingEnabled() const;
69 
70  /**
71  * Returns whether the depth buffer writing is enabled.
72  * @return True, if so
73  * @exception NotSupportedException Is thrown if this function is not supported
74  */
75  virtual bool writingEnabled() const;
76 
77  /**
78  * Returns the depth function of this attribute.
79  * @return Depth function
80  * @exception NotSupportedException Is thrown if this function is not supported
81  */
82  virtual DepthFunction depthFunction() const;
83 
84  /**
85  * Sets whether the depth buffer is used for occlusion tests.
86  * @param state Depth buffer enable state
87  * @exception NotSupportedException Is thrown if this function is not supported
88  */
89  virtual void setTestingEnabled(const bool state);
90 
91  /**
92  * Sets whether the depth buffer is writable.
93  * @param state Depth buffer writable state
94  * @exception NotSupportedException Is thrown if this function is not supported
95  */
96  virtual void setWritingEnabled(const bool state);
97 
98  /**
99  * Sets the depth function of this attribute.
100  * @param function Depth function to set
101  * @exception NotSupportedException Is thrown if this function is not supported
102  */
103  virtual void setDepthFunction(const DepthFunction function);
104 
105  /**
106  * Returns the type of this object.
107  * @see Object::type().
108  */
109  ObjectType type() const override;
110 
111  protected:
112 
113  /**
114  * Creates a new depth attribute object.
115  */
117 };
118 
119 }
120 
121 }
122 
123 #endif // META_OCEAN_RENDERING_DEPTH_ATTRIBUTE_H
This class is the base class for all rendering attribute objects.
Definition: Attribute.h:39
This class implements a depth attribute specifying the depth buffer behavior for associated objects.
Definition: DepthAttribute.h:35
virtual bool writingEnabled() const
Returns whether the depth buffer writing is enabled.
virtual bool testingEnabled() const
Returns whether the depth buffer is used for occlusion tests.
virtual void setTestingEnabled(const bool state)
Sets whether the depth buffer is used for occlusion tests.
DepthFunction
Definition of different depth comparison functions.
Definition: DepthAttribute.h:42
@ FUNCTION_LESS
Accepted if the incomming depth value is less than the stored one.
Definition: DepthAttribute.h:52
@ FUNCTION_GREATER
Accepted if the incomming depth value is greater than the stored one.
Definition: DepthAttribute.h:48
@ FUNCTION_LESS_EQUAL
Accepted if the incomming depth value is less than or equal to the stored one.
Definition: DepthAttribute.h:54
@ FUNCTION_GREATER_EQUAL
Accepted if the incomming depth value is greater than or equal to the stored one.
Definition: DepthAttribute.h:50
@ FUNCTION_ALWAYS
Always accepted.
Definition: DepthAttribute.h:44
@ FUNCTION_NEVER
Never accepted.
Definition: DepthAttribute.h:56
@ FUNCTION_EQUAL
Accepted if the incomming depth value is equal to the stored one.
Definition: DepthAttribute.h:46
virtual void setDepthFunction(const DepthFunction function)
Sets the depth function of this attribute.
DepthAttribute()
Creates a new depth attribute object.
ObjectType type() const override
Returns the type of this object.
virtual DepthFunction depthFunction() const
Returns the depth function of this attribute.
virtual void setWritingEnabled(const bool state)
Sets whether the depth buffer is writable.
ObjectType
Definition of different object type.
Definition: Object.h:63
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
SmartObjectRef< DepthAttribute > DepthAttributeRef
Definition of a smart object reference holding a depth attribute.
Definition: DepthAttribute.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15