Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoDepthBufferElement.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (Apr 2009)
22**=======================================================================*/
23
24#ifndef _SO_DEPTH_BUFFER_ELEMENT_
25#define _SO_DEPTH_BUFFER_ELEMENT_
26
27#include <Inventor/SbBasic.h>
28#include <Inventor/SbVec.h>
29#include <Inventor/elements/SoSubElement.h>
30#include <Inventor/SbEnums.h>
31
32class SoDepthBuffer;
33
51{
52 SO_ELEMENT_HEADER(SoDepthBufferElement);
53
54public:
60 NEVER = SbEnums::COMP_FUNC_NEVER,
62 LESS = SbEnums::COMP_FUNC_LESS,
64 EQUAL = SbEnums::COMP_FUNC_EQUAL,
66 LEQUAL = SbEnums::COMP_FUNC_LESS_EQUAL,
68 GREATER = SbEnums::COMP_FUNC_GREATER,
70 NOTEQUAL = SbEnums::COMP_FUNC_NOT_EQUAL,
72 GEQUAL = SbEnums::COMP_FUNC_GREATER_EQUAL,
74 ALWAYS = SbEnums::COMP_FUNC_ALWAYS
75 };
76
82 static void set(SoState* state, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
83
89 static void set(SoState* state, SoDepthBuffer* depthBuffer, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
90
94 static void get(SoState* state, SbBool& test, SbBool& write, DepthWriteFunction& function, SbVec2f& range);
95
99 virtual void print(FILE *fp) const;
100
104 virtual void push(SoState *state);
105
109 virtual void pop(SoState *state, const SoElement *prevTopElement);
110
111private:
112
114 virtual void init(SoState *state);
115
119 virtual SbBool matches(const SoElement* elt) const;
120
124 virtual SoElement* copyMatchInfo() const;
125
126
127private:
128
130 static void initClass();
131
133 static void exitClass();
134
136 static SbBool getWriteMask(SoState * state);
137
138 static void setWriteMask(SoState* state, const SbBool writeMask);
139
141 static DepthWriteFunction getFunction(SoState * state);
142
143 static void setFunction( SoState* state, const DepthWriteFunction function );
144
146 static SbBool getTest( SoState * state );
147
148 static void setTest( SoState* state, const SbBool test );
149
151 static SbVec2f getRange(SoState * state);
152
154 static SoDepthBuffer* getDepthBuffer(SoState * state);
155
157 static DepthWriteFunction getDefaultFunction();
158
160 static bool depthTest(DepthWriteFunction func, double currentDepth, double newDepth);
161
163 static bool depthTest(SoState* state, double currentDepth, double newDepth);
164
165private:
166
168 virtual ~SoDepthBufferElement();
169
175 virtual void setElt(SoDepthBuffer* depthBuffer, const SbBool enable, const SbBool write, const DepthWriteFunction function, const SbVec2f range);
176
177private:
179 SbBool test;
181 SbBool write;
183 DepthWriteFunction function;
185 SbVec2f range;
186
188 SoDepthBuffer* m_depthBuffer;
189};
190
191#endif /* _SO_DEPTH_BUFFER_ELEMENT_ */
192
193
2D vector class.
Definition SbVec.h:76
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Stores the curre...
static void set(SoState *state, SoDepthBuffer *depthBuffer, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range)
Sets the depth buffer parameters.
DepthWriteFunction
Depth function mode as defined by OpenGL.
@ NOTEQUAL
Passes if the incoming depth value is not equal to the stored depth value.
@ EQUAL
Passes if the incoming depth value is equal to the stored depth value.
@ LESS
Passes if the incoming depth value is less than the stored depth value.
@ GREATER
Passes if the incoming depth value is greater than the stored depth value.
@ GEQUAL
Passes if the incoming depth value is greater than or equal to the stored depth value.
@ LEQUAL
Passes if the incoming depth value is less than or equal to the stored depth value.
virtual void print(FILE *fp) const
Prints element (for debugging).
virtual void push(SoState *state)
Override push() method to keep GL up to date.
static void get(SoState *state, SbBool &test, SbBool &write, DepthWriteFunction &function, SbVec2f &range)
Returns current depth buffer parameters.
static void set(SoState *state, const SbBool test, const SbBool write, const DepthWriteFunction function, const SbVec2f range)
Sets the depth buffer parameters.
virtual void pop(SoState *state, const SoElement *prevTopElement)
Override pop() method to keep GL up to date.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Depth buffer par...
Abstract base class for all state elements.
Definition SoElement.h:102
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87